:root {
  --page: #ebebee;
  --bg: #ffffff;
  --side: #fafafa;
  --line: #ececee;
  --line-strong: #e2e2e6;
  --text: #18181b;
  --muted: #6b6b73;
  --faint: #a1a1aa;
  --accent: #f26522;
  --accent-soft: #fdeee6;
  --accent-ink: #e2550f;
  --hover: #f4f4f5;
  --chip: #ffffff;
  --code-bg: #ffffff;
  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --bad: #dc2626;
  --bad-soft: #fdecec;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 30px rgba(0,0,0,.06);
  /* syntax (one-light-ish) */
  --s-kw: #a626a4; --s-str: #50a14f; --s-fn: #4078f2; --s-num: #986801;
  --s-com: #a0a1a7; --s-dec: #c18401; --s-const: #986801; --s-builtin: #0184bc; --s-key: #e45649;
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --page: #0c0c0e;
  --bg: #17171a;
  --side: #131316;
  --line: #26262b;
  --line-strong: #303036;
  --text: #ececef;
  --muted: #9b9ba4;
  --faint: #63636b;
  --accent-soft: #3a2116;
  --accent-ink: #ff8a50;
  --hover: #222227;
  --chip: #1c1c20;
  --code-bg: #17171a;
  --ok-soft: #12291b;
  --bad-soft: #2e1515;
  --shadow: 0 8px 30px rgba(0,0,0,.4);
  --s-kw: #c678dd; --s-str: #98c379; --s-fn: #61afef; --s-num: #d19a66;
  --s-com: #5c6370; --s-dec: #e5c07b; --s-const: #d19a66; --s-builtin: #56b6c2; --s-key: #e06c75;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--page); color: var(--text); font: 15px/1.5 var(--sans); padding: 18px; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { display: block; }

/* ---------- window ---------- */
.window {
  height: calc(100vh - 36px); min-height: 560px;
  display: grid; grid-template-columns: 206px 1fr;
  background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; border: 1px solid var(--line);
}

/* ---------- sidebar ---------- */
.sidebar { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px 14px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 11px; margin: 30px 0 26px 12px; }
.logo { width: 36px; height: 36px; flex: none; color: var(--accent); filter: drop-shadow(0 4px 10px rgba(242,101,34,.28)); }
.brand-name { font-size: 20px; font-weight: 750; letter-spacing: -.03em; line-height: 1; display: flex; flex-direction: column; }
.brand-name small { font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; margin-bottom: 3px; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 10px; color: var(--text); font-size: 16px; text-align: left; transition: background .12s; }
.nav-item i { width: 22px; height: 22px; color: var(--muted); }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }
.nav-item.active i { color: var(--accent); }
.sidebar .user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--line); margin-inline: -14px; padding-inline: 20px; text-align: left; }
.avatar { position: relative; width: 36px; height: 36px; border-radius: 50%; background: #1f2937; color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.avatar::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid var(--side); }
.user-name { font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.muted-icon { width: 16px; height: 16px; color: var(--muted); flex: none; }

/* ---------- main area ---------- */
.main-area { display: grid; grid-template-rows: 62px 1fr; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--line); }
.project-picker { position: relative; }
.project-btn { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 8px; font-size: 15px; font-weight: 500; }
.project-btn:hover { background: var(--hover); }
.project-btn > i:first-child { width: 18px; height: 18px; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: 260px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; text-align: left; font-size: 14px; }
.menu button:hover { background: var(--hover); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 0; }
.menu .tag { margin-left: auto; font-size: 11px; color: var(--muted); }
.menu i { width: 16px; height: 16px; color: var(--muted); }
.menu .label { font-size: 12px; color: var(--muted); padding: 6px 10px 4px; }
.top-actions { display: flex; gap: 12px; align-items: center; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; color: var(--text); }
.icon-btn i { width: 21px; height: 21px; }
.icon-btn:hover { background: var(--hover); }
.icon-btn.boxed { background: var(--hover); }
.icon-btn.small { width: 26px; height: 26px; }
.icon-btn.small i { width: 16px; height: 16px; color: var(--muted); }

.body { display: grid; grid-template-columns: minmax(0, 1fr) clamp(380px, 38%, 620px); min-height: 0; }
.body.no-assistant { grid-template-columns: minmax(0, 1fr); }
.body.no-assistant .assistant { display: none; }

/* ---------- center ---------- */
.center { min-width: 0; min-height: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tabs { height: 62px; flex: none; display: flex; align-items: stretch; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { display: flex; align-items: center; gap: 10px; padding: 0 16px 0 20px; border-right: 1px solid var(--line); font-size: 16px; font-weight: 500; white-space: nowrap; color: var(--muted); cursor: pointer; position: relative; }
.tab.active { color: var(--text); background: var(--bg); }
.tab.active::after { content: ""; position: absolute; inset: auto 0 -1px 0; height: 1px; background: var(--bg); }
.tab .close { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; color: var(--faint); }
.tab .close:hover { background: var(--hover); color: var(--text); }
.tab .close i { width: 15px; height: 15px; }
.tab-add { width: 54px; display: grid; place-items: center; color: var(--muted); }
.tab-add i { width: 20px; height: 20px; }
.tab-add:hover { color: var(--text); }
.badge { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 5px; font: 700 10.5px/1 var(--sans); color: #fff; background: #3572a5; letter-spacing: .02em; }
.badge.json { background: #c98a12; }
.badge.md { background: #6b7280; }
.badge.sm { min-width: 18px; height: 18px; font-size: 9px; border-radius: 4px; }

.editor { flex: 1; min-height: 0; overflow: auto; background: var(--code-bg); }
.code { display: grid; grid-template-columns: auto 1fr; font: 15px/1.86 var(--mono); padding: 14px 0 40px; min-width: max-content; }
.gutter { text-align: right; color: var(--faint); padding: 0 22px 0 26px; user-select: none; }
.gutter div { cursor: pointer; }
.lines { padding-right: 40px; white-space: pre; tab-size: 4; }
.lines div { min-height: 1.86em; }
.lines div.hl, .gutter div.hl { background: var(--accent-soft); }
.tok-kw { color: var(--s-kw); } .tok-str { color: var(--s-str); } .tok-fn { color: var(--s-fn); }
.tok-num { color: var(--s-num); } .tok-com { color: var(--s-com); font-style: italic; } .tok-dec { color: var(--s-dec); }
.tok-const { color: var(--s-const); } .tok-builtin { color: var(--s-builtin); } .tok-key { color: var(--s-key); }

.statusbar { height: 42px; flex: none; display: flex; align-items: center; gap: 22px; padding: 0 22px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.statusbar .lang { display: flex; align-items: center; gap: 8px; margin-right: auto; }

.empty-editor { height: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 30px; }
.empty-editor .ghost-logo { width: 64px; height: 64px; margin: 0 auto 18px; color: var(--line-strong); --logo-ink: var(--bg); }
.empty-editor h3 { margin: 0 0 6px; color: var(--text); font-size: 18px; font-weight: 600; }
.empty-editor p { margin: 0; max-width: 380px; }

/* panels (files, search, activity, run, settings) */
.panel-head { height: 62px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 600; }
.panel-head .sub { font-weight: 400; color: var(--muted); font-size: 14px; }
.panel-head .right { margin-left: auto; display: flex; gap: 8px; }
.panel-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 24px 30px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

.file-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 9px; text-align: left; font: 14px var(--mono); }
.file-row:hover { background: var(--hover); }
.file-row .size { margin-left: auto; color: var(--faint); font: 12px var(--sans); }
.file-row i { width: 18px; height: 18px; color: var(--muted); }
.dir { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 14px 12px 6px; }

.search-box { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 12px; margin-bottom: 16px; background: var(--bg); }
.search-box i { width: 18px; height: 18px; color: var(--muted); }
.search-box input { flex: 1; border: 0; outline: 0; background: none; padding: 11px 0; }
.search-box:focus-within { border-color: var(--accent); }
.result-file { font: 600 13px var(--mono); padding: 12px 4px 6px; display: flex; gap: 8px; align-items: center; }
.result { display: flex; gap: 12px; width: 100%; padding: 6px 10px; border-radius: 7px; text-align: left; font: 13px/1.6 var(--mono); }
.result:hover { background: var(--hover); }
.result .ln { color: var(--faint); min-width: 32px; text-align: right; }
.result mark { background: var(--accent-soft); color: var(--accent-ink); border-radius: 3px; padding: 0 1px; }

.timeline { display: flex; flex-direction: column; }
.event { display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); align-items: start; font-size: 14px; }
.agent { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 6px; text-transform: capitalize; text-align: center; }
.agent.requirements { background: #eef2ff; color: #4f46e5; }
.agent.architect { background: #ecfdf5; color: #059669; }
.agent.coder { background: var(--accent-soft); color: var(--accent-ink); }
.agent.tester { background: #f5edff; color: #9333ea; }
.agent.orchestrator { background: var(--hover); color: var(--muted); }
[data-theme="dark"] .agent.tester { background: #2a1640; color: #d8b4fe; }
[data-theme="dark"] .agent.requirements { background: #1e1b4b; color: #a5b4fc; }
[data-theme="dark"] .agent.architect { background: #052e1f; color: #6ee7b7; }
.event .what b { font-weight: 600; }
.event .what div { color: var(--muted); margin-top: 2px; word-break: break-word; }
.event .meta { color: var(--faint); font-size: 12px; text-align: right; white-space: nowrap; }

.card { border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: var(--bg); }
.card + .card { margin-top: 16px; }
.card h4 { margin: 0 0 4px; font-size: 15px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px; font-weight: 500; font-size: 14px; border: 1px solid var(--line-strong); background: var(--bg); }
.btn:hover { background: var(--hover); }
.btn i { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.15); }
a { color: var(--accent-ink); }

.try { display: grid; grid-template-columns: 260px 1fr; gap: 16px; margin-top: 16px; min-height: 380px; }
.ep-list { border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: 520px; }
.ep { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 12px; text-align: left; font: 12.5px var(--mono); border-bottom: 1px solid var(--line); }
.ep:last-child { border-bottom: 0; }
.ep:hover { background: var(--hover); }
.ep.sel { background: var(--accent-soft); }
.method { font: 700 10.5px var(--sans); padding: 3px 0; border-radius: 5px; min-width: 52px; text-align: center; color: #fff; }
.m-GET { background: #2563eb; } .m-POST { background: #16a34a; } .m-PUT { background: #d97706; }
.m-PATCH { background: #9333ea; } .m-DELETE { background: #dc2626; }
.form { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 11px; background: var(--bg); outline: 0; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { font: 13px/1.5 var(--mono); min-height: 120px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.response { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.response .head { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.status { font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.status.ok { background: var(--ok-soft); color: var(--ok); } .status.bad { background: var(--bad-soft); color: var(--bad); }
.response pre { margin: 0; padding: 12px; font: 12.5px/1.6 var(--mono); max-height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.settings { max-width: 560px; display: flex; flex-direction: column; gap: 16px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ---------- assistant ---------- */
.assistant { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.assistant-head { height: 62px; flex: none; display: flex; align-items: stretch; padding-left: 16px; border-bottom: 1px solid var(--line); }
.assistant-tab { display: flex; align-items: center; gap: 12px; padding: 0 10px 0 6px; font-weight: 600; font-size: 16px; border-bottom: 2px solid var(--accent); margin-bottom: -1px; }
.tab-logo { width: 22px; height: 22px; color: var(--accent); }
.assistant-tab .icon-btn { margin-left: 14px; }

.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 22px 12px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.welcome { margin: auto; text-align: center; padding: 20px 0; }
.welcome .big-logo { width: 76px; height: 76px; margin: 0 auto 18px; color: var(--accent); }
.welcome h2 { margin: 0 0 8px; font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.welcome p { margin: 0 auto 30px; color: var(--muted); font-size: 16.5px; max-width: 400px; }
.chips { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 14px; padding: 11px 20px; border: 1px solid var(--line-strong); background: var(--chip); border-radius: 999px; font-size: 15px; transition: border-color .12s, transform .12s; }
.chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.chip i { width: 19px; height: 19px; color: var(--accent); }
.chip i.plain { color: var(--text); }

.msg { max-width: 88%; padding: 11px 15px; border-radius: 16px; font-size: 14.5px; line-height: 1.55; word-wrap: break-word; animation: in .18s ease-out; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.msg.assistant { align-self: flex-start; background: var(--hover); border-bottom-left-radius: 5px; }
.msg.error { align-self: stretch; max-width: none; background: var(--bad-soft); color: var(--bad); display: flex; gap: 10px; }
.msg.error i { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.msg ul { margin: 6px 0 0; padding-left: 18px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin: 6px 0 -8px 2px; }
.who i { width: 14px; height: 14px; color: var(--accent); }
@keyframes in { from { opacity: 0; transform: translateY(4px); } }

.typing { align-self: flex-start; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; padding: 8px 4px; }
.typing .dots { display: flex; gap: 4px; }
.typing .dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.typing .dots span:nth-child(2) { animation-delay: .2s; } .typing .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.elapsed { color: var(--faint); font-variant-numeric: tabular-nums; }

.acard { align-self: stretch; border: 1px solid var(--line-strong); border-radius: 14px; overflow: hidden; animation: in .18s ease-out; background: var(--bg); }
.acard-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14.5px; }
.acard-head i { width: 18px; height: 18px; color: var(--accent); }
.acard-head .pill { margin-left: auto; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--hover); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.run { background: var(--accent-soft); color: var(--accent-ink); }
.acard-body { padding: 14px 16px; font-size: 14px; }
.acard-body h5 { margin: 12px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; }
.acard-body h5:first-child { margin-top: 0; }
.acard-body .desc { color: var(--muted); margin: 0 0 4px; }
.entity { margin-bottom: 6px; }
.entity b { font-weight: 600; }
.entity span { color: var(--muted); font-size: 13px; }
.eps { display: flex; flex-direction: column; gap: 5px; }
.eps .e { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.eps .e code { font: 12.5px var(--mono); }
.eps .e .s { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.eps .acc { font-size: 11px; color: var(--faint); }
.rules { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; }
.acard-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.steps { display: flex; flex-direction: column; gap: 8px; }
.step { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.step .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--ok-soft); color: var(--ok); margin-top: 1px; }
.step .ic i { width: 12px; height: 12px; }
.step.warn .ic { background: var(--bad-soft); color: var(--bad); }
.step.live .ic { background: var(--accent-soft); color: var(--accent); }
.step b { font-weight: 600; }
.step div span { color: var(--muted); display: block; font-size: 12.5px; }
.spin { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

.composer { margin: 8px 18px 18px; border: 1px solid var(--line-strong); border-radius: 16px; padding: 14px 14px 10px 16px; background: var(--bg); transition: border-color .12s, box-shadow .12s; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(242,101,34,.08); }
.composer textarea { width: 100%; border: 0; outline: 0; resize: none; background: none; font-size: 15.5px; line-height: 1.5; max-height: 180px; padding: 0; }
.composer textarea::placeholder { color: var(--muted); }
.composer-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.composer-row .icon-btn i { color: var(--muted); }
.send { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; transition: background .12s, transform .12s; }
.send i { width: 20px; height: 20px; }
.send:hover { background: var(--accent-ink); transform: scale(1.04); }
.send:disabled { background: var(--line-strong); cursor: not-allowed; transform: none; }

.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: #18181b; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); z-index: 50; max-width: 80vw; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 1000px) {
  body { padding: 0; }
  .window { height: 100vh; border-radius: 0; grid-template-columns: 64px 1fr; }
  .nav-item span, .user-name, .sidebar .user .muted-icon { display: none; }
  .brand { margin: 8px auto 20px; } .brand-name { display: none; }
  .logo { width: 34px; height: 34px; }
  .nav-item { justify-content: center; padding: 11px; }
  .sidebar .user { justify-content: center; padding-inline: 0; }
  .body { grid-template-columns: minmax(0, 1fr) minmax(320px, 46%); }
  .try { grid-template-columns: 1fr; }
}

/* the app fills the browser tab */
body { padding: 0; }
.window { height: 100vh; border-radius: 0; border: 0; box-shadow: none; }
.brand { margin-top: 16px; }

/* items in the scrolling chat column must keep their height */
.messages > * { flex-shrink: 0; }
.code { font-variant-ligatures: none; }

.export-btn { text-decoration: none; color: var(--text); padding: 7px 13px; }
.acard-foot a.btn, .panel-head a.btn { text-decoration: none; color: var(--text); }
.tab-dir { font-size: 12.5px; color: var(--faint); font-weight: 400; margin-left: -4px; }

/* ---------- map ---------- */
.l-client { --lc: #71717a; } .l-entry { --lc: var(--accent); } .l-routers { --lc: #3b82f6; }
.l-services { --lc: #a855f7; } .l-schemas { --lc: #16a34a; } .l-core { --lc: #64748b; }
.map-stats { gap: 18px !important; font-size: 13px; font-weight: 400; color: var(--muted); }
.map-stats b { color: var(--text); font-weight: 600; }
.map-body { padding: 0; background-color: var(--side);
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1px); background-size: 20px 20px; }
.map { position: relative; display: flex; gap: 36px; align-items: flex-start; padding: 26px 54px 40px 26px; min-width: max-content; }
.map-edges { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.map-col { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; width: 196px; }
.map-col:first-of-type { width: 160px; }
.map-col:has(.l-routers) { width: 240px; }
.map-col-head { white-space: nowrap; display: flex; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 0 2px 4px; }
.map-col-head small { font-size: 12px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--faint); }
.ldot { width: 8px; height: 8px; border-radius: 3px; background: var(--lc); align-self: center; flex: none; }
.mnode { background: var(--bg); border: 1px solid var(--line-strong); border-left: 3px solid var(--lc); border-radius: 11px; padding: 11px 13px 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: opacity .15s, box-shadow .15s, transform .15s; }
.mnode:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.mnode-name { display: block; font: 600 14.5px/1.3 var(--mono); text-align: left; padding: 0; }
.mnode-name span { color: var(--faint); font-weight: 400; }
button.mnode-name:hover { color: var(--lc); }
.mnode-doc { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.mnode-routes { display: flex; flex-direction: column; gap: 3px; margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line-strong); }
.route { display: flex; align-items: center; gap: 7px; font: 12px/1.5 var(--mono); color: var(--text); text-align: left; padding: 2px 4px; margin: 0 -4px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route:hover { background: var(--hover); }
.route b { flex: none; width: 42px; font: 700 9.5px/1.7 var(--sans); text-align: center; border-radius: 4px; color: #fff; letter-spacing: .03em; }
.m-get { background: #16a34a; } .m-post { background: #3b82f6; } .m-put, .m-patch { background: #d97706; } .m-delete { background: #dc2626; }
.edge { fill: none; stroke: var(--lc); stroke-width: 1.6; opacity: .35; transition: opacity .15s, stroke-width .15s; }
.edge-end { fill: var(--lc); opacity: .5; }
.map.focus .mnode:not(.on) { opacity: .3; }
.map.focus .edge:not(.on), .map.focus .edge-end:not(.on) { opacity: .06; }
.edge.on { opacity: 1; stroke-width: 2.2; stroke-dasharray: 6 5; animation: flow .6s linear infinite; }
.edge-end.on { opacity: 1; }
@keyframes flow { to { stroke-dashoffset: -11; } }
@media (prefers-reduced-motion: reduce) { .edge.on { animation: none; } }

/* tester */
.agent-tag { font-style: normal; font-size: 10.5px; font-weight: 600; color: #a855f7; background: color-mix(in srgb, #a855f7 12%, transparent);
  padding: 1px 6px; border-radius: 5px; margin-right: 7px; letter-spacing: .02em; }
.known-issues { display: flex; gap: 10px; background: var(--bad-soft); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; font-size: 13.5px; }
.known-issues > i { width: 18px; height: 18px; color: var(--bad); flex: none; margin-top: 1px; }
.known-issues p { margin: 2px 0 8px; color: var(--muted); }
.known-issues pre { margin: 0; white-space: pre-wrap; font: 12px/1.5 var(--mono); max-height: 220px; overflow: auto; }

.test-strip { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 14px; border-radius: 11px; background: var(--ok-soft); }
.test-strip.bad { background: var(--bad-soft); }
.test-strip > i { width: 20px; height: 20px; color: var(--ok); flex: none; }
.test-strip.bad > i { color: var(--bad); }
.test-strip > div { flex: 1; display: flex; flex-direction: column; }
.test-strip span { font-size: 12.5px; color: var(--muted); }
.test-group { border: 1px solid var(--line-strong); border-radius: 12px; margin-bottom: 16px; overflow: hidden; }
.test-group-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--side); border-bottom: 1px solid var(--line); }
.test-group-head > div { flex: 1; display: flex; flex-direction: column; }
.test-group-head span { font-size: 12.5px; color: var(--muted); }
.test-group-head .count { font: 600 13px var(--mono); color: var(--ok); }
.test-group-head .count.bad { color: var(--bad); }
.test-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 16px; text-align: left; font-size: 14px; border-top: 1px solid var(--line); }
.test-row:first-of-type { border-top: 0; }
.test-row:hover { background: var(--hover); }
.tname::first-letter { text-transform: uppercase; }
.test-row code { font: 12px var(--mono); color: var(--muted); background: var(--hover); padding: 1px 6px; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tdot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.tdot.passed { background: var(--ok); } .tdot.failed, .tdot.error { background: var(--bad); }
.toutcome { margin-left: auto; font-size: 11.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; flex: none; }
.toutcome.failed, .toutcome.error { color: var(--bad); font-weight: 600; }

/* publish */
.sub-input { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--bg); overflow: hidden; font: 13.5px var(--mono); }
.sub-input:focus-within { border-color: var(--accent); }
.sub-input span { padding: 9px 0; color: var(--muted); white-space: nowrap; }
.sub-input span:first-child { padding-left: 11px; }
.sub-input span:last-child { padding-right: 11px; }
.field .sub-input input { border: 0; border-radius: 0; padding: 9px 2px; min-width: 60px; flex: 1; font: inherit; color: var(--text); }
.ok-text { color: var(--ok); display: inline-flex; gap: 4px; align-items: center; }
.ok-text i svg { width: 14px; height: 14px; }
.bad-text { color: var(--bad); }

/* try it (Run view): plain-language actions, forms and results */
.btn.ghost { border-color: transparent; }
.btn.big { padding: 11px 20px; font-size: 15px; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--muted); padding: 0 6px; }
.empty-run { max-width: 420px; margin: 80px auto; text-align: center; color: var(--muted); }
.empty-run i svg { width: 34px; height: 34px; color: var(--faint); }
.empty-run h3 { color: var(--text); margin: 10px 0 6px; }
.try { grid-template-columns: 280px minmax(0, 1fr); margin-top: 0; }
.actions { border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: calc(100vh - 170px); padding: 6px; align-self: start; }
.act-group { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); padding: 12px 10px 6px; }
.act { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 10px; border-radius: 9px; text-align: left; font-size: 14px; }
.act:hover { background: var(--hover); }
.act.sel { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }
.verb { font-size: 11px; font-weight: 600; padding: 2px 0; width: 50px; text-align: center; border-radius: 6px; flex: none; }
.v-View { background: #e7f0ff; color: #2357c6; } .v-Create { background: var(--ok-soft); color: var(--ok); }
.v-Edit { background: #fff4e0; color: #b25e00; } .v-Delete { background: var(--bad-soft); color: var(--bad); }
.v-Action { background: #f1ebff; color: #6d3fd1; }
[data-theme="dark"] .v-View { background: #18263f; color: #8fb4ff; } [data-theme="dark"] .v-Edit { background: #33240f; color: #ffb35c; }
[data-theme="dark"] .v-Action { background: #261d3d; color: #b99bff; }
.form { max-width: 560px; gap: 14px; }
.form-head h3 { margin: 0; font-size: 19px; }
.who-needs { font-size: 13px; color: var(--muted); }
.field.narrow { max-width: 200px; }
.opt { font-weight: 400; color: var(--faint); font-size: 12px; margin-left: 4px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { padding: 6px 12px; border-radius: 7px; font-size: 13.5px; color: var(--muted); }
.seg button.on { background: var(--accent); color: #fff; }
.try-result { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.try-result.ok { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.try-result.bad { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: color-mix(in srgb, var(--bad-soft) 50%, transparent); }
.result-head { display: flex; gap: 8px; align-items: center; font-size: 15px; }
.try-result.ok .result-head i { color: var(--ok); } .try-result.bad .result-head i { color: var(--bad); }
.result-head i svg { width: 18px; height: 18px; }
.problems { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 12px 0 0; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.table-wrap { overflow: auto; margin-top: 12px; border: 1px solid var(--line); border-radius: 9px; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.table-wrap th, .table-wrap td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-wrap th { color: var(--muted); font-weight: 500; background: var(--side); }
.table-wrap tr:last-child td { border-bottom: 0; }
.count, .nothing { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.raw { margin-top: 12px; font-size: 13px; }
.raw summary { cursor: pointer; color: var(--muted); }
.raw-meta { color: var(--faint); margin: 8px 0 4px; font: 12px var(--mono); }
.raw pre { margin: 0; padding: 10px; background: var(--side); border-radius: 8px; font: 12.5px/1.6 var(--mono); max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.modal-back { position: fixed; inset: 0; background: rgba(15, 15, 20, .38); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: min(520px, 100%); background: var(--bg); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; display: flex; gap: 8px; align-items: center; font-size: 17px; }
.modal .desc { color: var(--muted); font-size: 14px; margin: 8px 0 14px; }
.modal-head h3 i svg { width: 18px; height: 18px; color: var(--accent); }
@media (max-width: 800px) {
  .try { grid-template-columns: 1fr; }
  .actions { max-height: 240px; }
  #view-run .panel-head { height: auto; padding: 12px 16px; flex-wrap: wrap; }
  #view-run .panel-head .sub { display: none; }
  #view-run .panel-body { padding: 14px 16px 24px; }
}

/* ---------- phones: one screen at a time, floating tab bar ---------- */
.tabbar, .top-logo, .act-picker { display: none; }
.sheet-back[hidden] { display: none !important; }

@media (max-width: 760px) {
  :root { --bar-h: 64px; --bar-gap: 12px; --safe-b: env(safe-area-inset-bottom, 0px); }
  html, body { height: 100%; overflow: hidden; }
  body { font-size: 15px; -webkit-tap-highlight-color: transparent; }
  .window { height: 100dvh; min-height: 0; grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-area { grid-template-rows: auto 1fr; }

  /* top bar: logo, project, nothing else (the rest lives in More) */
  .topbar { padding: calc(env(safe-area-inset-top, 0px) + 8px) 14px 8px; gap: 10px; justify-content: flex-start; min-height: 56px; }
  .top-logo { display: block; width: 30px; height: 30px; filter: none; }
  .project-picker { flex: 1; min-width: 0; }
  .project-btn { max-width: 100%; font-size: 16px; font-weight: 600; padding: 8px 10px; }
  .project-btn #project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menu { position: fixed; left: 12px; right: 12px; top: calc(env(safe-area-inset-top, 0px) + 60px); min-width: 0; border-radius: 16px; padding: 8px; }
  .menu button { padding: 13px 12px; font-size: 15.5px; }
  .top-actions { display: none; }

  /* content stops above the floating bar; one pane shows at a time */
  .body, .body.no-assistant { grid-template-columns: 1fr; padding-bottom: calc(var(--bar-h) + var(--bar-gap) * 2 + var(--safe-b)); }
  .center { border-right: 0; }
  .assistant, .body.no-assistant .assistant { display: none; }
  body.chat-open .center { display: none; }
  body.chat-open .assistant { display: flex; }
  .assistant-head { display: none; }

  /* floating tab bar */
  .tabbar {
    display: flex; position: fixed; z-index: 40; left: 12px; right: 12px; bottom: calc(var(--bar-gap) + var(--safe-b));
    height: var(--bar-h); padding: 6px; gap: 2px; border-radius: 22px;
    background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(18px) saturate(1.6); -webkit-backdrop-filter: blur(18px) saturate(1.6);
    border: 1px solid var(--line-strong); box-shadow: 0 10px 30px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.06);
  }
  .tabbar button { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border-radius: 16px; font-size: 11px; font-weight: 500; color: var(--muted); transition: background .15s, color .15s; }
  .tabbar button i { width: 22px; height: 22px; }
  .tabbar button.on { color: var(--accent-ink); background: var(--accent-soft); }
  .tabbar button:active { transform: scale(.96); }
  .busy-dot { position: absolute; top: 8px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
    border: 2px solid var(--bg); animation: blink 1.2s infinite; }
  /* typing: give the keyboard the room */
  body:has(textarea:focus, input:not([type=checkbox]):focus) .tabbar { display: none; }
  body.chat-open:has(#input:focus) .body { padding-bottom: 0; }   /* send keeps focus, so no jump on tap */

  /* More sheet */
  .sheet-back { position: fixed; inset: 0; z-index: 45; background: rgba(15,15,20,.35); display: flex; align-items: flex-end; animation: fade .15s; }
  .sheet { width: 100%; background: var(--bg); border-radius: 22px 22px 0 0; padding: 8px 10px calc(14px + var(--safe-b)); box-shadow: 0 -10px 40px rgba(0,0,0,.18); animation: up .2s ease-out; }
  .sheet-grip { width: 38px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 4px auto 10px; }
  .sheet-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 14px; border-radius: 12px; font-size: 16px; color: var(--text); text-decoration: none; text-align: left; }
  .sheet-item i { width: 22px; height: 22px; color: var(--muted); }
  .sheet-item:active { background: var(--hover); }
  .sheet-sep { height: 1px; background: var(--line); margin: 6px 8px; }

  /* chat */
  .messages { padding: 16px 14px 10px; gap: 12px; }
  .welcome { padding: 8px 4px; }
  .welcome .big-logo { width: 60px; height: 60px; margin-bottom: 14px; }
  .welcome h2 { font-size: 25px; }
  .welcome p { font-size: 15.5px; margin-bottom: 22px; }
  .chips { align-items: stretch; }
  .chip { justify-content: flex-start; padding: 13px 16px; border-radius: 14px; text-align: left; }
  .msg { max-width: 85%; font-size: 15px; padding: 10px 14px; border-radius: 18px; }
  .msg.user { border-bottom-right-radius: 6px; }
  .msg.assistant { border-bottom-left-radius: 6px; }
  .acard-foot { flex-wrap: wrap; }
  .eps .e { flex-wrap: wrap; row-gap: 2px; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .eps .e:last-child { border-bottom: 0; }
  .eps .e code { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .eps .e .s { flex-basis: 100%; white-space: normal; order: 3; }
  .acard-foot .btn { flex: 1 1 calc(50% - 8px); justify-content: center; min-height: 44px; white-space: nowrap; font-size: 14.5px; padding-inline: 10px; }
  .composer { margin: 0 12px 10px; border-radius: 22px; padding: 6px 6px 6px 6px; display: flex; align-items: flex-end; gap: 4px; }
  .composer textarea { order: 2; flex: 1; padding: 9px 4px; max-height: 140px; }
  .composer-row { display: contents; }
  .composer-row #attach-btn { order: 1; width: 40px; height: 40px; }
  .composer-row .send { order: 3; width: 40px; height: 40px; flex: none; }
  .composer textarea, input, select, textarea { font-size: 16px !important; }   /* stops iOS zooming in */

  /* panels */
  .panel-head { height: auto; min-height: 54px; padding: 10px 16px; flex-wrap: wrap; row-gap: 8px; font-size: 17px; }
  .panel-head .sub { display: none; }
  .panel-head .right { margin-left: auto; flex-wrap: wrap; gap: 6px; }
  .panel-body { padding: 14px 14px 24px; }
  .btn { min-height: 40px; }

  /* code */
  .tabs { height: 48px; }
  .tab { font-size: 14px; padding: 0 10px 0 14px; }
  .code { font-size: 13px; line-height: 1.75; padding-top: 10px; }
  .gutter { padding: 0 12px 0 12px; }
  .lines { padding-right: 20px; }
  .statusbar { display: none; }

  /* try it: pick an action from a list that opens in place */
  .try { display: flex; flex-direction: column; gap: 12px; }
  .act-picker { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 14px; border: 1px solid var(--line-strong); border-radius: 14px;
    background: var(--bg); font-size: 15.5px; font-weight: 500; text-align: left; }
  .act-picker-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .act-picker i { width: 18px; height: 18px; color: var(--muted); transition: transform .15s; }
  .try.list-open .act-picker i { transform: rotate(180deg); }
  .try .actions { display: none; max-height: none; }
  .try.list-open .actions { display: block; }
  .try.list-open .form { display: none; }
  .act { padding: 12px 10px; font-size: 15px; }
  .form { max-width: none; }
  .form-head h3 { display: none; }   /* the picker above already names the action */
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1; padding: 10px 6px; }
  .field.narrow { max-width: none; }
  .btn.big { width: 100%; justify-content: center; min-height: 50px; font-size: 16px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .live-pill { padding: 0; }

  /* dialogs become bottom sheets */
  .modal-back { align-items: end; padding: 0; }
  .modal { width: 100%; border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + var(--safe-b)); animation: up .2s ease-out; }
  .sub-input { font-size: 14px; }
  .modal .row > .btn { flex: 1; justify-content: center; min-height: 46px; }
  .sub-input span:first-child { display: none; }

  .toast { bottom: calc(var(--bar-h) + var(--bar-gap) * 2 + var(--safe-b)); max-width: calc(100vw - 32px); }
  .settings { max-width: none; }
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }

/* install (PWA) */
.install-btn { padding: 7px 13px; }
.install-steps { margin: 12px 0 4px; padding-left: 22px; display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.share-glyph { display: inline-flex; vertical-align: -4px; color: #0a84ff; }
.share-glyph i svg { width: 18px; height: 18px; }
/* installed app on a phone: no browser bar, so respect the notch */
@media (display-mode: standalone) and (max-width: 760px) {
  .topbar { padding-top: calc(env(safe-area-inset-top, 0px) + 10px); }
}
