/* aicp web UI. No external fonts or code; light/dark follow the system. */
:root {
  --bg: #faf9f5; --bg-side: #f3f1ea; --panel: #ffffff; --text: #1f1e1d; --muted: #6f6d66; --faint: #a3a198;
  --border: #e6e3da; --border-strong: #d6d2c6; --hover: rgba(31, 30, 29, .055); --active: rgba(31, 30, 29, .09);
  --accent: #c96442; --accent-hover: #b4563a; --accent-soft: rgba(201, 100, 66, .12);
  --user-bubble: #efebe2; --code-bg: #f2f0e9; --inline-code: rgba(31, 30, 29, .07);
  --ok: #3f8f5a; --warn: #c58a1b; --bad: #c2453a; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.06);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, Cambria, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --content-w: 768px; --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #262624; --bg-side: #1f1e1d; --panel: #30302e; --text: #ecebe6; --muted: #a3a198; --faint: #75736c;
    --border: #3a3936; --border-strong: #4a4945; --hover: rgba(255,255,255,.055); --active: rgba(255,255,255,.09);
    --accent: #d97757; --accent-hover: #e48a6c; --accent-soft: rgba(217, 119, 87, .16);
    --user-bubble: #1c1c1a; --code-bg: #1d1d1b; --inline-code: rgba(255,255,255,.08);
    --shadow: 0 1px 2px rgba(0,0,0,.2), 0 8px 28px rgba(0,0,0,.28);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%; overflow: hidden; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
  stroke-linejoin: round; flex: none; }
code, pre, kbd { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--bad); font-size: 14px; margin: 8px 0 0; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px;
  border-radius: 10px; font-weight: 500; border: 1px solid var(--border-strong); background: var(--panel);
  transition: background .15s, border-color .15s; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.small { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn.small svg { width: 16px; height: 16px; }

/* ---- boot / login ---- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.spinner { width: 26px; height: 26px; border: 2.5px solid var(--border-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-card h1 { font: 500 30px/1.2 var(--serif); margin: 0; }
.login-card p { margin: 0 0 8px; }
.login-logo { width: 48px; height: 48px; margin: 0 auto 4px; }
.login-card input { height: 44px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--panel);
  padding: 0 14px; outline: none; }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-card .btn { height: 44px; }

/* ---- layout ---- */
.app { display: flex; height: 100%; height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative;
  padding-top: env(safe-area-inset-top); }

.agent-avatar { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; flex: none;
  font-size: 12px; font-weight: 600; color: #fff; text-transform: uppercase; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 500;
  background: var(--hover); color: var(--muted); white-space: nowrap; }
.badge.infra { background: rgba(194, 69, 58, .12); color: var(--bad); }
.badge.developer { background: rgba(63, 143, 90, .13); color: var(--ok); }
.badge.aicp-dev { background: var(--accent-soft); color: var(--accent); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: transparent; }
.status-dot.running, .status-dot.queued { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.status-dot.failed { background: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }

/* topbar */
.topbar { display: flex; align-items: center; gap: 8px; height: 54px; padding: 0 14px; flex: none; }
.title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.title .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 6px; position: relative; }
.menu { position: absolute; top: 42px; right: 0; z-index: 30; min-width: 220px; padding: 6px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); }
.menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.menu button:hover { background: var(--hover); }

/* welcome (new chat) */
.welcome { display: none; flex-direction: column; align-items: center; justify-content: flex-end; text-align: center;
  padding: 0 20px 26px; }
.main.is-new .welcome { display: flex; flex: 1; }
.main.is-new .spacer { flex: 1.15; }
.welcome-logo { width: 40px; height: 40px; margin-bottom: 10px; }
.welcome h1 { font: 400 clamp(28px, 4.2vw, 40px)/1.15 var(--serif); margin: 0 0 8px; letter-spacing: -.2px; }
.welcome p { margin: 0; max-width: 560px; }

/* thread */
.thread { flex: 1; overflow-y: auto; overscroll-behavior: contain; scroll-padding-bottom: 24px; }
.messages, .older { max-width: var(--content-w); margin: 0 auto; padding: 8px 24px 24px; }
.older { text-align: center; padding-bottom: 0; }
.msg { margin: 20px 0; }
.msg.user { display: flex; flex-direction: column; align-items: flex-end; }
.bubble { max-width: min(85%, 640px); background: var(--user-bubble); border-radius: 18px; padding: 10px 16px;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user .meta, .msg.inbound .meta { margin-top: 4px; }
.msg.inbound .bubble { max-width: 100%; background: transparent; border: 1px dashed var(--border-strong); }
.msg .from { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.files-chip { display: inline-flex; gap: 4px; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.files-chip svg { width: 14px; height: 14px; }
.meta { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12.5px; min-height: 26px; }
.meta .act { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 6px; color: var(--muted); }
.meta .act:hover { background: var(--hover); color: var(--text); }
.meta .act svg { width: 15px; height: 15px; }
.msg.assistant .meta { opacity: 0; transition: opacity .15s; }
.msg.assistant:hover .meta, .msg.assistant:last-child .meta, .msg.assistant .meta:focus-within { opacity: 1; }
@media (hover: none) { .msg.assistant .meta { opacity: 1; } }

/* assistant content (markdown) */
.md { font: 16.5px/1.65 var(--serif); overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md table, .md .table-wrap { margin: 0 0 14px; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--sans); line-height: 1.3; margin: 22px 0 10px; font-weight: 600; }
.md h1 { font-size: 1.35em; } .md h2 { font-size: 1.2em; } .md h3 { font-size: 1.07em; } .md h4 { font-size: 1em; }
.md ul, .md ol { padding-left: 1.5em; } .md li { margin: 4px 0; } .md li > ul, .md li > ol { margin: 4px 0; }
.md a { color: var(--accent); text-underline-offset: 2px; }
.md strong { font-weight: 650; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.md blockquote { border-left: 3px solid var(--border-strong); padding-left: 14px; color: var(--muted); }
.md code { font-size: .84em; background: var(--inline-code); padding: .12em .38em; border-radius: 5px; }
.md pre { position: relative; background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 0; font-size: 13.5px; line-height: 1.55; }
.md pre .code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 14px;
  font: 12px var(--sans); color: var(--muted); border-bottom: 1px solid var(--border); }
.md pre code { display: block; background: none; padding: 12px 14px; overflow-x: auto; font-size: inherit; border-radius: 0; white-space: pre; }
.md .table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.md table { border-collapse: collapse; width: 100%; font: 14px/1.45 var(--sans); margin: 0; }
.md th, .md td { padding: 7px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.md tr:last-child td { border-bottom: 0; }
.md th { font-weight: 600; background: var(--hover); }
.copy-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 6px; color: var(--muted); font-size: 12px; }
.copy-btn:hover { background: var(--hover); color: var(--text); }
.copy-btn svg { width: 14px; height: 14px; }

/* steps (tool calls) */
.steps { margin: 0 0 12px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--panel); }
.steps-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 14px; font-size: 13.5px; color: var(--muted); text-align: left; }
.steps-head:hover { color: var(--text); }
.steps-head .chev { margin-left: auto; transition: transform .15s; width: 16px; height: 16px; }
.steps.open .steps-head .chev { transform: rotate(180deg); }
.steps-body { display: none; border-top: 1px solid var(--border); padding: 4px 0; max-height: 60vh; overflow-y: auto; }
.steps.open .steps-body { display: block; }
.step { padding: 0 6px; }
.step-row { display: flex; align-items: flex-start; gap: 9px; width: 100%; padding: 6px 8px; border-radius: 8px; text-align: left; font-size: 13.5px; }
.step-row:hover { background: var(--hover); }
.step-row svg { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); }
.step-name { font-weight: 600; flex: none; }
.step-sum { color: var(--muted); font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; min-width: 0; flex: 1; padding-top: 1px; }
.step-state { flex: none; font-size: 12px; color: var(--faint); padding-top: 1px; }
.step-state.err { color: var(--bad); }
.step-detail { display: none; margin: 2px 8px 8px 33px; }
.step.open .step-detail { display: block; }
.step-detail pre { margin: 0 0 6px; padding: 8px 10px; background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 8px; font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow-y: auto; }
.step-detail .lbl { font-size: 11.5px; color: var(--faint); margin: 4px 0 3px; text-transform: uppercase; letter-spacing: .4px; }
.step-text { padding: 6px 14px 6px 39px; color: var(--muted); }
.step-text.md { font-size: 14.5px; line-height: 1.55; }
.step-text.md table { font-size: 13px; }
.step-note { padding: 5px 14px 5px 39px; font-size: 13px; color: var(--warn); }
.step-note.err { color: var(--bad); }

.working { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; margin: 4px 0 10px; }
.working .spark { width: 18px; height: 18px; color: var(--accent); animation: spin 2.4s linear infinite; }
.working .spark svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.err-box { border: 1px solid rgba(194,69,58,.35); background: rgba(194,69,58,.07); color: var(--bad); border-radius: 10px;
  padding: 10px 14px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 14px; color: var(--muted); }

/* composer */
.composer-wrap { flex: none; width: 100%; max-width: calc(var(--content-w) + 32px); margin: 0 auto; padding: 0 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom)); position: relative; }
.composer { background: var(--panel); border: 1px solid var(--border-strong); border-radius: 20px; box-shadow: var(--shadow);
  padding: 12px 12px 10px 16px; transition: border-color .15s; }
.composer:focus-within { border-color: var(--faint); }
.composer textarea { display: block; width: 100%; border: 0; outline: 0; resize: none; background: transparent; padding: 2px 0 6px;
  font-size: 16px; line-height: 1.5; max-height: 40vh; min-height: 28px; }
.composer textarea::placeholder { color: var(--faint); }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.agent-pick { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 9px;
  border: 1px solid var(--border); color: var(--muted); font-size: 13.5px; position: relative; max-width: 260px; }
.agent-pick:hover { background: var(--hover); color: var(--text); }
.agent-pick svg { width: 16px; height: 16px; }
.agent-pick select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; outline: 0; cursor: pointer;
  font-size: 13.5px; color: inherit; padding-right: 2px; max-width: 210px; text-overflow: ellipsis; }
.model-chip { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border-radius: 9px;
  font-size: 13px; color: var(--muted); max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-chip:hover { background: var(--hover); color: var(--text); }
.model-chip.synthetic::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #5b7fd6; flex: none; }
.agent-fixed { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); padding: 0 6px; }
.send { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; }
.send svg { width: 18px; height: 18px; stroke-width: 2.2; }
.send:hover { background: var(--accent-hover); }
.send:disabled { opacity: .4; cursor: default; background: var(--accent); }
.send.stop { background: var(--text); color: var(--bg); }
.send.stop svg { fill: currentColor; stroke: none; }
.attached { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 8px; background: var(--hover);
  font: 12.5px var(--mono); max-width: 100%; }
.chip button { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; color: var(--muted); }
.chip button:hover { background: var(--active); }
.chip svg { width: 13px; height: 13px; }
.hint { text-align: center; padding: 8px 0 0; }
.main:not(.is-new) .hint { display: none; }
.jump { position: absolute; top: -50px; left: 50%; transform: translateX(-50%); width: 36px; height: 36px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--border-strong); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--muted); }
.jump svg { width: 18px; height: 18px; }

/* dialogs */
.dialog { border: 1px solid var(--border); border-radius: 16px; background: var(--panel); color: var(--text); padding: 22px;
  width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.dialog.wide { width: min(640px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog h2 { font: 500 21px/1.3 var(--serif); margin: 0 0 14px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dialog-head h2 { margin: 0; }
.dialog label { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 500; margin: 0 0 12px; }
.dialog input, .dialog textarea, .dialog select { border: 1px solid var(--border-strong); background: var(--bg); border-radius: 9px;
  padding: 9px 11px; font-size: 15px; font-weight: 400; outline: none; }
.dialog input:focus, .dialog textarea:focus, .dialog select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dialog .row2 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.dialog .row2 label { min-width: 0; }
.dialog .row2 select { width: 100%; }
.dialog details { margin: 0 0 12px; } .dialog summary { cursor: pointer; font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 10px 0 16px; }
.hcard { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; }
.hcard .k { display: flex; align-items: center; gap: 7px; font-weight: 500; }
.hcard .v { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }
.files-list { list-style: none; padding: 0; margin: 8px 0 12px; max-height: 260px; overflow-y: auto; }
.files-list li label { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; margin: 0; padding: 7px 6px; border-radius: 8px; cursor: pointer; }
.files-list li label:hover { background: var(--hover); }
.files-list .fp { font: 13px var(--mono); flex: 1; min-width: 0; overflow-wrap: anywhere; }
.files-list input { accent-color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 100; background: var(--text); color: var(--bg);
  padding: 9px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); width: max-content; max-width: calc(100vw - 32px); }
body:has(.main.is-home) .toast { bottom: 128px; }  /* above the home's dock */
.toast:not([hidden]):has(.toast-act) { display: flex; align-items: center; gap: 14px; }
.toast-act { flex: none; padding: 0; border: 0; background: none; color: var(--accent); font: 600 14px var(--sans); white-space: nowrap; cursor: pointer; }

/* ---- small screens ---- */
@media (max-width: 860px) {
  .topbar { padding: 0 8px; }
  .messages, .older { padding-left: 16px; padding-right: 16px; }
  .composer-wrap { padding: 0 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .md { font-size: 16px; }
  .bubble { max-width: 90%; }
  #session-meta { display: none; }
}

.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }
.md th.al-center, .md td.al-center { text-align: center; } .md th.al-right, .md td.al-right { text-align: right; }
.turn { display: block; }
@media (max-width: 480px) { .dialog .row2 { grid-template-columns: 1fr; gap: 0; } }

/* ---- files from a turn: images, live HTML, downloads ---- */
.turn-files { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 0; }
.turn-files:empty { display: none; }
.att-imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.att-img { margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--code-bg);
  max-width: 100%; }
.att-img button { display: block; }
.att-img img { display: block; max-width: 100%; max-height: 420px; object-fit: contain; background:
  repeating-conic-gradient(var(--hover) 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.att-imgs.many .att-img img { width: 180px; height: 140px; object-fit: cover; }
.att-img figcaption { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; font: 12px var(--sans);
  color: var(--muted); border-top: 1px solid var(--border); }
.att-img figcaption span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); overflow: hidden; }
.att-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; font: 14px var(--sans); }
.att-icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent); font: 600 10px var(--sans); text-transform: uppercase; }
.att-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.att-name b { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-name span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-acts { display: flex; gap: 2px; flex: none; }
.att-acts .icon-btn svg, .att-img .icon-btn svg { width: 17px; height: 17px; }
.att-acts .btn.small { height: 30px; padding: 0 9px; }
@media (max-width: 520px) { .att-acts .btn span { display: none; } .att-head { gap: 8px; padding-left: 10px; } }
.att-acts .btn.on { background: var(--active); }
.att-frame { border-top: 1px solid var(--border); resize: vertical; overflow: hidden; height: 440px; min-height: 160px;
  max-height: 85vh; background: #fff; }
.att-frame iframe, .code-frame iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.att video { display: block; width: 100%; max-height: 420px; background: #000; border-top: 1px solid var(--border); }
.att audio { display: block; width: calc(100% - 20px); margin: 0 10px 10px; }
.code-frame { border-top: 1px solid var(--border); resize: vertical; overflow: hidden; height: 360px; min-height: 120px;
  max-height: 85vh; background: #fff; }
.md pre .code-head .acts { display: flex; gap: 2px; }

.viewer { border: 0; padding: 0; margin: auto; width: 100vw; height: 100dvh; max-width: none; max-height: none;
  background: var(--bg); color: var(--text); display: none; flex-direction: column; }
.viewer[open] { display: flex; }
.viewer::backdrop { background: rgba(0,0,0,.6); }
.viewer-head { display: flex; align-items: center; gap: 4px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--border);
  padding-top: max(8px, env(safe-area-inset-top)); }
.viewer-title { flex: 1; min-width: 0; font: 500 15px var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-body { flex: 1; min-height: 0; display: grid; place-items: center; overflow: auto; }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; align-self: stretch; justify-self: stretch; }

/* ---- pages: skills, board ---- */
.badge.new { background: var(--accent); color: #fff; }
.main.is-page .welcome, .main.is-page .thread, .main.is-page .composer-wrap, .main.is-page .spacer { display: none !important; }
.page { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.page-inner { max-width: calc(var(--content-w) + 32px); margin: 0 auto; padding: 4px 16px 40px; }
.page-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; }
.page-head h1 { font: 400 28px/1.2 var(--serif); margin: 0 0 4px; }
.page-head .grow { flex: 1; min-width: 220px; }
.page-head .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.grow { flex: 1; }
.mono { font-family: var(--mono) !important; font-size: 13.5px !important; }
.btn.danger { color: var(--bad); }

.skill-card { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); padding: 14px 14px 12px; margin-bottom: 10px; }
.skill-top { display: flex; align-items: flex-start; gap: 12px; }
.skill-main { flex: 1; min-width: 0; cursor: pointer; }
.skill-main b { font: 600 15px var(--sans); }
.skill-main p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.skill-agents { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ag-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 4px; border-radius: 999px; font-size: 12.5px;
  border: 1px solid var(--border); color: var(--muted); }
.ag-chip .agent-avatar { width: 18px; height: 18px; font-size: 10px; border-radius: 5px; }
.ag-chip.on { color: var(--text); border-color: var(--border-strong); }
.ag-chip.off { text-decoration: line-through; opacity: .55; }
.ag-chip.ovr { border-style: solid; border-color: var(--accent); }
.ag-chip.ovr::after { content: "•"; color: var(--accent); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--border-strong); transition: background .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%;
  background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:disabled + span { opacity: .5; cursor: default; }
.skill-view { max-height: 50vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; font-size: 15px; }
.legend { font-size: 12.5px; color: var(--muted); margin: -8px 0 14px; }

.board-topics { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 14px; }
.topic-chip { padding: 4px 11px; border-radius: 99px; border: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.topic-chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.post { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.post .agent-avatar { width: 30px; height: 30px; font-size: 13px; border-radius: 9px; }
.post-body { flex: 1; min-width: 0; }
.post-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.post-meta b { color: var(--text); font-weight: 600; }
.post-meta .tag { color: var(--accent); }
.post-reply { font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--border-strong); padding-left: 8px; margin: 4px 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post .md { font-size: 15.5px; margin-top: 3px; }
.post .act { font-size: 12.5px; color: var(--muted); padding: 2px 6px; border-radius: 6px; margin-left: -6px; }
.post .act { display: inline-flex; align-items: center; gap: 4px; }
.post .act svg { width: 13px; height: 13px; }
.post .act:hover { background: var(--hover); color: var(--text); }
.post.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { background: var(--accent-soft); } }
.board-compose { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0 max(10px, env(safe-area-inset-bottom)); }
.board-compose .box { border: 1px solid var(--border-strong); border-radius: 16px; background: var(--panel); padding: 10px 12px; box-shadow: var(--shadow); }
.board-compose textarea { width: 100%; border: 0; outline: none; resize: none; background: none; font: 15.5px/1.5 var(--sans); min-height: 44px; max-height: 30vh; }
.board-compose .row { display: flex; align-items: center; gap: 8px; }
.board-compose input { border: 1px solid var(--border); border-radius: 8px; padding: 5px 9px; background: var(--bg); font-size: 13.5px; width: 130px; outline: none; }
.board-compose .reply-to { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.empty-note { text-align: center; color: var(--muted); padding: 40px 10px; }

.tools-set { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px 4px; margin: 0 0 12px; }
.tools-set legend { font-size: 13.5px; font-weight: 500; padding: 0 4px; }
.dialog label.check { flex-direction: row; align-items: flex-start; gap: 9px; font-weight: 400; margin: 0 0 8px; cursor: pointer; }
.dialog label.check input { margin-top: 3px; accent-color: var(--accent); padding: 0; }
.dialog label.check b { font-weight: 550; }

/* ---- pages: vault, files ---- */
:root { --c0: #d19a2a; --c1: #c96442; --c2: #3f8f5a; --c3: #3b7dd8; --c4: #8a8780; --c5: #8e5bd8; --cx: #b5b2a8; }
@media (prefers-color-scheme: dark) { :root { --c0: #e0ad45; --c1: #d97757; --c2: #55a872; --c3: #5b97e6; --c4: #9a978f; --c5: #a47ce3; --cx: #6f6d66; } }
.page-inner.wide { max-width: 1180px; }
.fc { display: inline-block; width: 9px; height: 9px; border-radius: 3px; flex: none; background: var(--cx); }
.fc-0, .stack-bar .fc-0 { background: var(--c0); } .fc-1, .stack-bar .fc-1 { background: var(--c1); }
.fc-2, .stack-bar .fc-2 { background: var(--c2); } .fc-3, .stack-bar .fc-3 { background: var(--c3); }
.fc-4, .stack-bar .fc-4 { background: var(--c4); } .fc-5, .stack-bar .fc-5 { background: var(--c5); }
.k-ui { background: var(--c1); } .k-image { background: var(--c3); } .k-doc { background: var(--c2); }
.k-media { background: var(--c5); } .k-other { background: var(--c4); }
.att-icon.k-ui, .att-icon.k-image, .att-icon.k-doc, .att-icon.k-media, .att-icon.k-other { color: #fff; }

.viz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-bottom: 14px; }
.viz-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); padding: 14px 16px; min-width: 0; }
.viz-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.viz-stats { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 12px; }
.viz-stats div { display: flex; flex-direction: column; }
.viz-stats b { font: 400 26px/1.1 var(--serif); }
.viz-stats span { font-size: 12.5px; color: var(--muted); }
.stack-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--border); margin-bottom: 12px; }
.stack-bar span { min-width: 3px; flex-basis: 0; width: auto; height: auto; border-radius: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .topic-chip { display: inline-flex; align-items: center; gap: 6px; }
.chips .topic-chip .agent-avatar { width: 18px; height: 18px; font-size: 10px; border-radius: 5px; }
.topic-chip:hover { border-color: var(--border-strong); color: var(--text); }
.topic-chip.active:hover { color: var(--bg); }

.heat-wrap { overflow-x: auto; padding-bottom: 2px; }
.heat-months { display: flex; gap: 3px; font-size: 11px; color: var(--muted); height: 15px; }
.heat-months span { width: 14px; flex: none; white-space: nowrap; }
.heat { display: flex; gap: 3px; }
.heat-col { display: flex; flex-direction: column; gap: 3px; }
.heat-cell { display: block; width: 14px; height: 14px; border-radius: 3px; background: var(--border); flex: none; }
.heat-cell.void { background: none; }
.heat-cell.l1 { background: color-mix(in srgb, var(--accent) 28%, var(--border)); }
.heat-cell.l2 { background: color-mix(in srgb, var(--accent) 52%, var(--border)); }
.heat-cell.l3 { background: color-mix(in srgb, var(--accent) 76%, var(--border)); }
.heat-cell.l4 { background: var(--accent); }
button.heat-cell:hover { outline: 2px solid var(--border-strong); }
.heat-cell.sel { outline: 2px solid var(--text); outline-offset: 1px; }
.heat-legend { display: flex; align-items: center; gap: 3px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.heat-legend .heat-cell { width: 11px; height: 11px; }
.heat-legend span:first-child { margin-right: 3px; } .heat-legend span:last-child { margin-left: 3px; }

.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.search-wrap { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--panel); padding: 0 12px; height: 40px; color: var(--muted); margin-bottom: 12px; }
.filter-bar .search-wrap { margin-bottom: 0; }
.search-wrap svg { width: 17px; height: 17px; }
.page-search { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 15px; color: var(--text); }
.search-wrap:focus-within { border-color: var(--accent); }
.note-warn { font-size: 13.5px; color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); padding: 8px 12px;
  border-radius: 10px; margin: 0 0 12px; }
.filter-note { display: flex; align-items: center; gap: 8px; font-size: 14px; background: var(--accent-soft); padding: 4px 6px 4px 12px;
  border-radius: 10px; margin-bottom: 8px; }
.filter-note span { flex: 1; }
.count-note { margin: 2px 2px 4px; }
.day-head { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 16px 4px 6px; }
.list-box .day-head:first-child { padding-top: 6px; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; text-decoration: none; min-width: 0; }
a.row-item:hover, .row-item.file:hover { background: var(--hover); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main b { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.row-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-time { font-size: 12.5px; color: var(--faint); flex: none; font-variant-numeric: tabular-nums; }
.row-item .att-icon { width: 34px; height: 34px; border-radius: 8px; font: 600 10.5px var(--mono); text-transform: uppercase; }
.hit-lines { display: flex; flex-direction: column; margin-top: 3px; }
.hit-lines span { font: 12.5px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hits { border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 6px 6px; margin-bottom: 10px; background: var(--panel); }
.more-row { display: flex; justify-content: center; padding: 12px; }
.spinner.small { width: 18px; height: 18px; margin: 8px auto; }

.crumbs { font-size: 13.5px; color: var(--muted); margin: 6px 0 14px; display: flex; flex-wrap: wrap; align-items: center; }
.crumbs a { color: var(--accent); text-decoration: none; margin-right: 4px; }
.crumb { color: var(--muted); padding: 1px 4px; border-radius: 6px; }
.crumb:hover { background: var(--hover); color: var(--text); }
.note-head h1 { font: 400 30px/1.2 var(--serif); margin: 0 0 6px; display: flex; align-items: center; gap: 10px; overflow-wrap: anywhere; }
.note-head h1 .fc { width: 12px; height: 12px; border-radius: 4px; }
.note-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.note-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tag-chip { font-size: 12.5px; color: var(--accent); background: var(--accent-soft); padding: 2px 9px; border-radius: 99px; }
.props { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13.5px; margin: 0 0 14px;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; }
.props dt { color: var(--muted); } .props dd { margin: 0; overflow-wrap: anywhere; }
.note-md { font-size: 16px; border-top: 1px solid var(--border); padding-top: 8px; }
.md a.wikilink { color: var(--accent); text-decoration: none; border-bottom: 1px dashed currentColor; }
.siblings { margin-top: 28px; border-top: 1px solid var(--border); padding-top: 4px; }

.cv { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.cv-tools { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.cv-tools .icon-btn { font-size: 18px; }
.cv-wrap { height: 70vh; overflow: auto; background-color: var(--bg);
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px); background-size: 22px 22px; }
.cv-sizer { position: relative; }
.cv-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cv-edges { position: absolute; left: 0; top: 0; width: auto; height: auto; overflow: visible; pointer-events: none; }
.cv-edges path { stroke: var(--faint); stroke-width: 2.5; fill: none; }
.cv-edges marker path { fill: var(--faint); stroke: none; }
.cv-edges text { fill: var(--muted); font: 13px var(--sans); text-anchor: middle; stroke: var(--bg); stroke-width: 4px; paint-order: stroke; }
.cv-node { position: absolute; --cv: var(--border-strong); border: 2px solid var(--cv); border-radius: 10px; background: var(--panel);
  overflow: auto; padding: 8px 12px; font-size: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.cv-node .md { font-size: 14px; }
.cv-node .md > :first-child { margin-top: 0; } .cv-node .md > :last-child { margin-bottom: 0; }
.cv-group { background: color-mix(in srgb, var(--cv) 7%, transparent); box-shadow: none; overflow: visible; }
.cv-label { position: absolute; top: -26px; left: 0; font-size: 15px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.cv-file { color: var(--accent); font-weight: 550; text-decoration: none; }

/* ---- vault graph (#/vault/graph) and the home screen's Hafıza card ---- */
.gv-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; min-height: 30px; }
.gv-stats { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; flex: 1; }
.gv-pending { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); }
.spinner.tiny { width: 12px; height: 12px; border-width: 1.6px; }
.gv-legend { display: inline-flex; gap: 12px; flex-wrap: wrap; }
.gv-key { display: inline-flex; align-items: center; gap: 5px; }
.gv-key .fc { width: 8px; height: 8px; }
.gv-wrap { aspect-ratio: 5 / 3; max-height: 72vh; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background-color: var(--bg); background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 26px 26px; }
.gv-svg { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.gv-svg:active { cursor: grabbing; }
.gv-e { stroke: var(--muted); stroke-opacity: .22; stroke-width: 1; }
.gv-node { cursor: pointer; }
.gv-node circle { fill: var(--cx); stroke: var(--bg); stroke-width: 1.2; }
.gv-node.fc-0 circle { fill: var(--c0); } .gv-node.fc-1 circle { fill: var(--c1); }
.gv-node.fc-2 circle { fill: var(--c2); } .gv-node.fc-3 circle { fill: var(--c3); }
.gv-node.fc-4 circle { fill: var(--c4); } .gv-node.fc-5 circle { fill: var(--c5); }
.gv-node circle.undated { fill-opacity: .55; }
.gv-node text { font: 11px var(--sans); fill: var(--muted); opacity: 0; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; pointer-events: none; }
.gv-node.gv-lab text, .gv-node:hover text, .gv-hot .gv-node.on text { opacity: 1; }
.gv-node:hover circle { stroke: var(--text); }
.gv-hot .gv-node { opacity: .16; transition: opacity .12s; }
.gv-hot .gv-node.on { opacity: 1; }
.gv-hot .gv-e { stroke-opacity: .08; }

.mem-card { display: flex; align-items: stretch; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; background: var(--panel);
  background-image: radial-gradient(90% 150% at 100% 100%, var(--accent-soft), transparent 60%); }
.mem-text { flex: 1 1 48%; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 14px 4px 14px 16px; }
.mem-head { display: flex; align-items: baseline; gap: 9px; }
.mem-head b { font: 400 19px/1.2 var(--serif); }
.mem-count { display: flex; align-items: baseline; gap: 7px; }
.mem-count b { font: 400 30px/1.1 var(--serif); color: var(--accent); }
.mem-count span { font-size: 13px; color: var(--muted); }
.mem-list { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
.mem-note { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); min-width: 0; }
.mem-note .fc { width: 8px; height: 8px; }
.mem-note span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-more { font-size: 12.5px; color: var(--accent); text-decoration: none; margin-top: auto; }
.mem-graph { flex: 1 1 52%; min-width: 0; display: flex; align-items: center; }
.mem-graph .gv-svg { max-height: 210px; }
.mem-graph .gv-e { stroke-opacity: .14; }
.mem-graph .gv-node text { font-size: 10px; }
@media (max-width: 600px) {
  .mem-card { flex-direction: column; }
  .mem-graph { flex: none; max-width: none; }
  .mem-graph .gv-svg { height: 170px; }
}

.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--hover); margin: 0 0 12px; }
.seg a { padding: 6px 14px; border-radius: 9px; font-size: 14px; text-decoration: none; color: var(--muted); }
.seg a.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.f-sec h2 { font: 600 14px var(--sans); color: var(--muted); margin: 22px 2px 10px; }
.ui-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ui-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; min-width: 0;
  transition: box-shadow .15s, transform .15s; }
.ui-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.ui-thumb { display: block; width: 100%; aspect-ratio: 16 / 10; position: relative; overflow: hidden; background: #fff;
  border-bottom: 1px solid var(--border); }
.ui-thumb iframe { position: absolute; left: 0; top: 0; width: 1280px; height: 800px; border: 0; transform-origin: 0 0; pointer-events: none; }
.ui-foot { display: flex; align-items: center; gap: 8px; padding: 8px 6px 8px 10px; }
.ui-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ui-name b { font-weight: 550; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-name span { font-size: 12px; color: var(--muted); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.img-card { margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--code-bg); min-width: 0; }
.img-card button { display: block; width: 100%; aspect-ratio: 1; }
.img-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-card figcaption { display: flex; justify-content: space-between; gap: 6px; padding: 5px 8px; font-size: 12px; }
.img-card figcaption span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owner-bars { display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow-y: auto; }
.ob { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; font-size: 13.5px; text-align: left; }
.ob:hover { background: var(--hover); } .ob.active { background: var(--active); }
.ob .agent-avatar { width: 20px; height: 20px; font-size: 11px; border-radius: 6px; }
.ob svg { width: 18px; height: 18px; color: var(--muted); }
.ob-name { width: 110px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-track { flex: 1; height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.ob-fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.ob-n { width: 34px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.viewer-body video { max-width: 100%; max-height: 100%; }
@media (max-width: 600px) {
  .viz-grid { grid-template-columns: 1fr; gap: 10px; }
  .viz-card { padding: 12px 14px; }
  .viz-stats { gap: 16px; }
  .viz-stats b { font-size: 22px; }
  .page-head h1 { font-size: 26px; }
  .ui-grid { grid-template-columns: 1fr; }
  .img-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .img-card figcaption { display: none; }
  .row-item { padding: 8px 4px; gap: 10px; }
  .row-item.file .att-acts .icon-btn:not(:last-child) { display: none; }
}

/* ---- page: system ---- */
.sys-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; margin-bottom: 8px; }
.sys-tile { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); padding: 11px 13px; display: flex;
  flex-direction: column; gap: 3px; min-width: 0; }
.sys-tile .k { font-size: 12.5px; color: var(--muted); }
.sys-tile b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sys-tile .sub { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { height: 5px; border-radius: 99px; overflow: hidden; margin: 2px 0 1px; background: color-mix(in srgb, var(--ok) 18%, transparent); }
.meter span { display: block; height: 100%; border-radius: 99px; background: var(--ok); }
.meter.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); } .meter.warn span { background: var(--warn); }
.meter.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); } .meter.bad span { background: var(--bad); }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 22px 0 10px; }
.sec-head h2, .sec-title { font: 400 20px/1.2 var(--serif); margin: 0; }
.sec-title { margin: 26px 0 8px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.chart-card { padding: 12px 14px 8px; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.chart-head .viz-title { margin-bottom: 6px; }
.chart-head b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-plot { position: relative; height: 120px; margin-left: 38px; touch-action: pan-y; cursor: crosshair; }
.chart-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-svg .grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-svg .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-svg .area { fill: var(--accent); opacity: .1; stroke: none; }
.chart-y { position: absolute; right: calc(100% + 6px); font-size: 11px; color: var(--faint); line-height: 1; transform: translateY(-50%);
  pointer-events: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-y.top { top: 0; } .chart-y.mid { top: 50%; }
.chart-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin: 4px 0 0 38px; }
.xhair { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-strong); pointer-events: none; }
.xdot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 2px var(--panel); pointer-events: none; }
.chart-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center;
  background: var(--text); color: var(--bg); border-radius: 8px; padding: 4px 9px; font-size: 12px; white-space: nowrap; pointer-events: none; z-index: 2; }
.chart-tip b { font-size: 13px; font-variant-numeric: tabular-nums; }
.chart-card .empty-note { margin: 18px 0 22px; }
.ct-row { align-items: flex-start; }
.ct-row > .dot { margin-top: 6px; }
.ct-name { overflow: hidden; text-overflow: ellipsis; }
.ct-ports { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: 46%; }
.port-chip { font: 11.5px var(--mono); padding: 1px 7px; border-radius: 6px; background: var(--hover); color: var(--muted); white-space: nowrap; }
.port-chip.pub { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--text); }
.state-tag { font-size: 11px; font-weight: 500; padding: 0 7px; border-radius: 99px; border: 1px solid var(--border-strong); color: var(--muted); flex: none; }
.state-tag.bad { border-color: var(--bad); color: var(--bad); } .state-tag.warn { border-color: var(--warn); color: var(--warn); }
.port-group { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); margin: 0 0 8px; }
.port-group > summary { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 10px 14px; cursor: pointer; font-weight: 550; }
.port-group.public > summary { color: var(--warn); }
.port-group.public > summary .muted { color: var(--muted); }
.port-list { padding: 0 8px 8px; }
.port-row { display: grid; grid-template-columns: 58px 34px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: baseline;
  padding: 5px 6px; border-radius: 8px; font-size: 13.5px; }
.port-row:hover { background: var(--hover); }
.port-row b { font-variant-numeric: tabular-nums; }
.port-owner { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.port-addr { font: 12px var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.svc-chips { padding: 0 12px 12px; }
.svc-chips .topic-chip { font-size: 12.5px; }
.sys-foot { margin-top: 24px; }
.usage-card { margin-bottom: 8px; }
.usage-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 24px; margin: 6px 0 4px; }
.usage-meter { display: flex; flex-direction: column; gap: 4px; }
.usage-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13.5px; }
.usage-top b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.usage-meter .meter { height: 7px; }
.usage-meter .sub { font-size: 12px; color: var(--faint); min-height: 15px; }
.usage-note { margin: 10px 2px 6px; }
.usage-table { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.usage-table table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.usage-table th, .usage-table td { padding: 7px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.usage-table th { font-size: 12px; font-weight: 600; color: var(--muted); }
.usage-table tbody tr:last-child td, .usage-table tfoot td { border-bottom: 0; }
.usage-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.usage-table tfoot td { font-weight: 600; }
.usage-agent { display: inline-flex; align-items: center; gap: 7px; }
.usage-agent .agent-avatar { width: 20px; height: 20px; font-size: 10.5px; border-radius: 6px; }
@media (max-width: 600px) {
  .ct-row { flex-wrap: wrap; }
  .ct-ports { max-width: none; flex-basis: 100%; justify-content: flex-start; padding-left: 21px; }
  .chart-plot { height: 84px; }
  .port-row { grid-template-columns: 46px minmax(0, 1fr) auto; }
  .port-row .muted { display: none; }
  .sys-tile b { font-size: 20px; }
}

/* ---- page: schedules ---- */
.sched-row { align-items: flex-start; border-bottom: 1px solid var(--border); border-radius: 0; padding: 12px 6px; }
.sched-row:last-of-type { border-bottom: 0; }
.sched-row > .agent-avatar { margin-top: 2px; }
.sched-row.off .row-main b { color: var(--muted); }
.sched-row .row-sub a { color: inherit; }
.sched-row .row-main .row-sub { white-space: normal; }
.sched-acts { display: flex; align-items: center; gap: 4px; flex: none; }
.sched-templates { margin-top: 18px; }
.sched-days { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.dialog label.day-chip { flex-direction: row; align-items: center; gap: 0; margin: 0; font-weight: 500; cursor: pointer; }
.day-chip input { position: absolute; opacity: 0; pointer-events: none; }
.day-chip span { padding: 5px 11px; border-radius: 99px; border: 1px solid var(--border-strong); font-size: 13px; color: var(--muted); }
.day-chip input:checked + span { background: var(--text); color: var(--bg); border-color: var(--text); }
.day-chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.sched-preview { margin: 0 0 12px; min-height: 18px; }
.sched-preview.error { color: var(--bad); }
@media (max-width: 600px) {
  .sched-row { flex-wrap: wrap; }
  .sched-acts { flex-basis: 100%; padding-left: 36px; }
}

/* ---- page: inbox ---- */
.push-card { margin-bottom: 14px; }
.push-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.push-row .viz-title { margin-bottom: 2px; }
.push-row p { margin: 0; }
.push-row .acts { display: flex; gap: 8px; }
.inbox-row { align-items: flex-start; }
.inbox-row > .dot { margin-top: 6px; }
.inbox-row .row-main b { font-weight: 450; }
.inbox-row.unread .row-main b { font-weight: 650; }
.inbox-row .row-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dot.acc { background: var(--accent); }

/* ---- page: triggers ---- */
.trig-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; flex: none; margin-top: 2px;
  background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.trig-icon svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.trig-icon.off { background: var(--hover); color: var(--faint); }
.dialog .row3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; }
.dialog .row3 label { min-width: 0; }
.dialog .tools-set label:not(.check) { margin: 6px 0 10px; }
@media (max-width: 480px) { .dialog .row3 { grid-template-columns: 1fr 1fr; } .dialog .row3 label:first-child { grid-column: 1 / -1; } }

/* ---- actions and approvals ---- */
button.row-item { width: 100%; text-align: left; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button.row-item:hover { background: var(--hover); }
button.topic-chip { cursor: pointer; font: inherit; font-size: 12.5px; background: none; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.action-out { min-height: 20px; }
.log-view { max-height: 46vh; overflow: auto; font: 12px/1.45 var(--mono); background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ok-note { color: var(--ok); font-size: 14px; }
.tier-badge { flex: none; font: 600 11px/1 var(--mono); padding: 4px 6px; border-radius: 6px; background: var(--hover); color: var(--muted); }
.tier-badge.t1 { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.tier-badge.t2 { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.tier-badge.t3 { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.apv-row > .tier-badge { margin-top: 3px; }
.apv-section { margin-bottom: 10px; }
.apv-past { margin-top: 8px; }
.apv-tier { display: inline-block; font-weight: 600; font-size: 13px; padding: 4px 10px; border-radius: 8px; margin-bottom: 6px; }
.apv-tier.t2 { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.apv-tier.t3 { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.apv-tier.t0, .apv-tier.t1 { background: var(--hover); color: var(--muted); }
.apv-diag { font-size: 14px; border-left: 3px solid var(--border-strong); padding-left: 12px; margin: 8px 0; }
.apv-steps { padding-left: 20px; margin: 8px 0 12px; }
.apv-step { margin: 0 0 12px; }
.apv-step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.apv-args { display: block; font: 12px var(--mono); background: var(--inline-code); padding: 4px 8px; border-radius: 6px; overflow-wrap: anywhere; }
.apv-script { max-height: 30vh; margin-top: 6px; }
.apv-decide { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; }
.apv-code-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dialog .totp-input { width: 9.5em; font: 600 20px/1 var(--mono); letter-spacing: .18em; text-align: center; padding: 9px 10px; }
.apv-status { font-weight: 600; }
.apv-status.s-done { color: var(--ok); } .apv-status.s-failed, .apv-status.s-expired { color: var(--bad); }
.apv-status.s-rejected { color: var(--muted); }

/* ---- page: apps ---- */
.app-row { align-items: flex-start; border-bottom: 1px solid var(--border); border-radius: 0; padding: 12px 6px; }
.app-row:last-of-type { border-bottom: 0; }
.app-row > .dot { margin-top: 6px; }
.app-row.off .row-main b { color: var(--muted); }
.app-row .row-main .row-sub { white-space: normal; }
.app-link { color: inherit; text-decoration: none; } .app-link:hover { text-decoration: underline; }
.app-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.app-tags:empty { display: none; }
.app-links { display: flex; flex-direction: column; gap: 6px; padding: 4px 6px 8px; font-size: 14px; min-width: 0; }
.app-links a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-domains { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.app-domains a { color: var(--accent); text-decoration: none; }
.app-domains a:hover { text-decoration: underline; }
.apps-h { margin: 22px 0 6px; font-size: 18px; }
.app-sugg { align-self: flex-start; margin-top: 6px; }
.proj-row { color: inherit; }
.proj-row:hover { background: var(--hover); }
.proj-chev { flex: none; color: var(--muted); align-self: center; }
.proj-chev svg { width: 18px; height: 18px; transform: rotate(-90deg); }
.back-link { display: inline-block; margin-bottom: 8px; text-decoration: none; }
.proj-sec { margin-bottom: 4px; }
.proj-kv { display: flex; gap: 12px; padding: 6px 6px; border-bottom: 1px solid var(--border); font-size: 13.5px; min-width: 0; }
.proj-kv:last-child { border-bottom: 0; }
.proj-kv .muted { flex: none; min-width: 110px; }
.proj-kv .mono { overflow: hidden; text-overflow: ellipsis; word-break: break-all; }
.proj-tiles { margin: 4px 0 6px; }
.proj-tile b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-tile.ok b { color: var(--ok); } .proj-tile.warn b { color: var(--warn); } .proj-tile.bad b { color: var(--bad); }
.proj-sec-head { display: flex; align-items: center; gap: 8px; }
.proj-sec-head .sec-title { flex: 1; min-width: 0; }
.proj-card { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); padding: 2px 14px 10px; margin: 14px 0; }
.proj-card.stale { border-color: var(--warn); }
.proj-card .apps-h { margin-top: 12px; }
.proj-card .md { font-size: 14.5px; }
.proj-meta { margin: 6px 0 0; }
.proj-kv .dot { margin-top: 5px; }
.proj-kv .grow-r { margin-left: auto; text-align: right; flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; }
.proj-log { display: flex; flex-direction: column; gap: 1px; padding: 7px 6px; border-bottom: 1px solid var(--border); font-size: 14px; }
.proj-log:last-child { border-bottom: 0; }
.proj-log-form { display: flex; gap: 8px; margin: 2px 0 8px; }
.proj-log-form input { flex: 1; min-width: 0; border: 1px solid var(--border-strong); background: var(--bg); border-radius: 9px;
  padding: 7px 10px; font: inherit; color: inherit; outline: none; }
.proj-log-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- app tiles (home screen, apps page) ---- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 18px 8px; padding: 6px 0 4px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; padding: 6px 2px;
  border-radius: 14px; text-decoration: none; color: var(--text); -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none; user-select: none; }
.tile-wrap { position: relative; display: block; transition: transform .14s cubic-bezier(.3, .7, .4, 1); }
.tile:active .tile-wrap { transform: scale(.9); }
@media (hover: hover) { .tile:hover .tile-wrap { transform: translateY(-2px); } .tile:hover .tile-icon { box-shadow: 0 6px 18px rgba(0,0,0,.18); } }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-icon { width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center; overflow: hidden; flex: none;
  color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 3px 10px rgba(0,0,0,.10); transition: box-shadow .14s;
  background: var(--accent); }
.tile-icon img { width: 100%; height: 100%; object-fit: cover; }
.tile-icon .tile-emoji { font-size: 32px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.18)); }
.tile-icon .tile-mono { font: 600 27px/1 var(--sans); letter-spacing: -.02em; text-shadow: 0 1px 2px rgba(0,0,0,.2); }
.tile-icon.glyph svg { width: 30px; height: 30px; stroke-width: 1.9; }
.tile-icon.lg { width: 84px; height: 84px; border-radius: 22px; } .tile-icon.lg .tile-emoji { font-size: 46px; } .tile-icon.lg .tile-mono { font-size: 38px; }
.tile-icon.sm { width: 40px; height: 40px; border-radius: 11px; } .tile-icon.sm .tile-emoji { font-size: 22px; } .tile-icon.sm .tile-mono { font-size: 18px; }
.tile-icon.xs { width: 24px; height: 24px; border-radius: 7px; box-shadow: none; } .tile-icon.xs .tile-emoji { font-size: 14px; } .tile-icon.xs .tile-mono { font-size: 12px; }
.tile-icon.xs.glyph svg, .tile-icon.sm.glyph svg { width: 60%; height: 60%; }
.tile-label { font-size: 12.5px; line-height: 1.25; text-align: center; max-width: 100%; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.tile-dot { position: absolute; right: -3px; top: -3px; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--bg); background: var(--faint); }
.tile-dot.ok { background: var(--ok); } .tile-dot.warn { background: var(--warn); } .tile-dot.bad { background: var(--bad); }
.tile-badge { position: absolute; right: -6px; top: -6px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--bad); color: #fff; font: 600 11.5px/20px var(--sans); text-align: center; border: 2px solid var(--bg); }
@media (prefers-reduced-motion: reduce) { .tile-wrap, .tile-icon { transition: none; } }

/* ---- a mini app's window ---- */
.main.is-app .page { overflow: hidden; display: flex; }
.top-extra { display: flex; align-items: center; gap: 2px; }
.top-extra:empty { display: none; }
.appwin { flex: 1; position: relative; min-height: 0; border-top: 1px solid var(--border); }
.appwin-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--panel); }
.appwin-load { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; background: var(--bg); transition: opacity .25s ease; }
.appwin-load.gone { opacity: 0; pointer-events: none; }
.appwin-empty { margin: 60px auto; max-width: 420px; padding: 0 20px; text-align: center; }
.appwin-back { margin-right: 2px; }
.title .tile-icon.xs { margin-right: 2px; }
.pad { padding: 16px; }
.dialog-head .tile-icon.sm { margin-right: 4px; }
.mini-info { margin: -4px 0 10px; }
.mini-info .proj-kv a { color: var(--accent); text-decoration: none; }
.addr-row { display: flex; align-items: center; gap: 4px; }
.addr-row input { flex: 1; min-width: 0; }
#mini-scopes .check .state-tag { margin-left: 6px; }
.dialog input[type=color] { height: 40px; padding: 4px; }
.dialog-head .tile-icon.sm + h2 { flex: 1; min-width: 0; }

/* ---- home screen ---- */
.main.is-home .topbar .title:empty + .icon-btn { margin-left: auto; }
.main.is-home .topbar .home-btn { display: none; }
.home { max-width: 1080px; margin: 0 auto; padding: 8px 20px 120px; }
.home.enter { animation: home-in .28s ease both; }  /* only on coming to the home, not on every repaint */
@keyframes home-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.home-hero { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin: 6px 0 22px; }
.home-when { display: flex; align-items: flex-end; gap: 16px; }
.home-clock { font: 300 56px/0.95 var(--sans); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.home-date { display: flex; flex-direction: column; padding-bottom: 3px; }
.home-date b { font: 400 20px/1.2 var(--serif); }
.home-search { flex: 1; min-width: 260px; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); box-shadow: var(--shadow);
  font-size: 15px; transition: border-color .15s, box-shadow .15s; text-align: left; }
.home-search:hover { border-color: var(--border-strong); }
.home-search .grow { flex: 1; }
.home-search kbd, .pal-foot kbd { font: 500 11.5px var(--mono); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border-strong); color: var(--muted); }

.home-widgets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 26px; }
.widget { display: flex; flex-direction: column; gap: 7px; min-width: 0; padding: 14px 16px; border-radius: 18px; text-decoration: none;
  color: inherit; background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); transition: transform .14s, border-color .15s; }
a.widget:hover { border-color: var(--border-strong); }
a.widget:active { transform: scale(.985); }
.widget.sk { height: 168px; background: linear-gradient(100deg, var(--panel) 30%, var(--hover) 50%, var(--panel) 70%) 0 0 / 300% 100%;
  animation: sk 1.2s linear infinite; box-shadow: none; }
@keyframes sk { to { background-position: -150% 0; } }
.w-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.w-head b { font-weight: 600; }
.w-head .grow-r { margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-count { margin-left: auto; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; background: var(--accent); color: #fff;
  font: 600 13px/26px var(--sans); text-align: center; }
.w-alert { font-size: 13px; font-weight: 600; color: var(--warn); }
.w-meter { display: grid; grid-template-columns: 52px 1fr 40px; align-items: center; gap: 8px; font-size: 12.5px; }
.w-meter b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.w-meter .meter { height: 6px; margin: 0; }
.w-note { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-note.bad { color: var(--bad); } .w-note.warn { color: var(--warn); } .w-note.ok { color: var(--ok); }
.w-spark { height: 30px; margin: -2px 0 2px; }
.spark { width: 100%; height: 30px; display: block; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spark-area { fill: var(--accent-soft); stroke: none; }
.w-line { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; text-decoration: none; color: inherit; }
.w-line-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-line:not(.unread) .w-line-t { color: var(--muted); }
.w-line .agent-avatar { width: 20px; height: 20px; font-size: 11px; border-radius: 6px; }
.w-agents { display: flex; flex-wrap: wrap; gap: 6px; }
.w-agent { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px 3px 3px; border-radius: 99px; background: var(--hover);
  font-size: 12.5px; text-decoration: none; color: inherit; }
.w-agent .agent-avatar { width: 20px; height: 20px; font-size: 11px; border-radius: 50%; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

.home-sec { margin-bottom: 26px; }
.home-frequent .frequent-grid { padding-top: 2px; }
.home-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.home-sec-head h2 { flex: 1; margin: 0; font: 400 20px/1.2 var(--serif); }
.home-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 20px 6px; }
.home-recent { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.recent-card { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 11px 13px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--panel); text-decoration: none; color: inherit; transition: border-color .15s, transform .12s; }
.recent-card:hover { border-color: var(--border-strong); }
.recent-card:active { transform: scale(.985); }
.recent-card .row-sub { white-space: nowrap; }
.home-hidden { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.chip-btn { padding: 4px 10px; border-radius: 99px; border: 1px dashed var(--border-strong); font-size: 12.5px; color: var(--muted); }
.chip-btn:hover { color: var(--text); border-style: solid; }
.home-hint { margin: 10px 0 0; }

.home-dock-wrap { position: sticky; bottom: 12px; display: flex; justify-content: center; margin-top: 10px; pointer-events: none; z-index: 2; }
.home-dock { pointer-events: auto; display: flex; gap: 6px; padding: 8px 12px; border-radius: 26px; min-height: 90px; min-width: 120px;
  background: color-mix(in srgb, var(--panel) 86%, transparent); border: 1px solid var(--border);
  box-shadow: 0 10px 34px rgba(0,0,0,.14); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); }
.home-dock .tile { width: 76px; padding: 4px 2px; }
.home-dock .tile-label { font-size: 11.5px; }
.home.editing .home-dock { border-style: dashed; border-color: var(--accent); }

/* edit mode: tiles jiggle, show ×, and can be dragged (on the home and in an open folder's window) */
.tile-x { display: none; }
.home.editing .tile, .home-folder.editing .tile { touch-action: none; cursor: grab; }
.home.editing .tile .tile-wrap, .home-folder.editing .tile .tile-wrap { animation: jiggle .32s ease-in-out infinite alternate; }
.home.editing .tile:nth-child(2n) .tile-wrap, .home-folder.editing .tile:nth-child(2n) .tile-wrap { animation-delay: -.16s; }
.home.editing .tile-x, .home-folder.editing .tile-x { display: grid; place-items: center; position: absolute; left: calc(50% - 38px); top: 0;
  width: 22px; height: 22px; border-radius: 50%; background: var(--text); color: var(--bg); z-index: 1; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.home.editing .tile-x::before, .home-folder.editing .tile-x::before { content: ''; width: 9px; height: 2px; border-radius: 1px; background: currentColor; }
.home .tile, .home-folder .tile { position: relative; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* a tile resting on the middle of another: letting go makes a folder */
.tile.merge-target .tile-wrap { transform: scale(1.16); animation: none !important; }
.tile.merge-target .tile-wrap > .tile-icon { box-shadow: 0 0 0 4px var(--accent), 0 8px 24px rgba(0,0,0,.22); }

/* folders: a 3×3 preview as the icon, a window in the middle of the screen */
.tile-icon.folder-icon { display: grid; grid-template-columns: repeat(3, 15px); grid-auto-rows: 15px; gap: 3px; place-content: center;
  background: color-mix(in srgb, var(--text) 11%, var(--panel)); box-shadow: inset 0 0 0 1px var(--border), 0 2px 6px rgba(0,0,0,.1); }
.tile-icon.folder-icon > .tile-icon { width: 15px; height: 15px; border-radius: 4px; box-shadow: none; }
.folder-icon .tile-mono { font-size: 8px; text-shadow: none; }
.folder-icon .tile-emoji { font-size: 9px; filter: none; }
.folder-icon .glyph svg, .folder-icon > .tile-icon.glyph svg { width: 70%; height: 70%; stroke-width: 2.4; }
.home-folder { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(0, 0, 0, .3); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: folder-fade .18s ease-out; }
.folder-panel { width: min(420px, 100%); max-height: 80vh; overflow-y: auto; border-radius: 28px; padding: 14px 14px 20px;
  background: color-mix(in srgb, var(--panel) 90%, transparent); border: 1px solid var(--border); box-shadow: 0 24px 60px rgba(0,0,0,.3);
  animation: folder-in .22s cubic-bezier(.2, .8, .3, 1); }
.folder-name { display: block; width: 100%; border: 0; background: transparent; color: var(--text); text-align: center;
  font: 600 20px/1.3 var(--sans); padding: 4px 8px 12px; outline: none; }
.folder-name:focus { text-decoration: underline 2px var(--accent); text-underline-offset: 6px; }
.folder-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 6px; }
@keyframes folder-fade { from { opacity: 0; } }
@keyframes folder-in { from { transform: scale(.7); opacity: 0; } }
.home-suggest { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 0 10px; padding: 9px 12px; border-radius: 12px;
  border: 1px dashed var(--accent); background: var(--accent-soft); font-size: 13.5px; }
.home-suggest .grow { flex: 1; min-width: 180px; }
@keyframes jiggle { from { transform: rotate(-1.6deg); } to { transform: rotate(1.6deg); } }
.tile.drag-src { opacity: .25; }
.tile-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; margin: 0; transition: none;
  filter: drop-shadow(0 12px 22px rgba(0,0,0,.25)); }
.tile-ghost .tile-wrap { animation: none !important; }
.tile-ghost .tile-x { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .home.enter, .home.editing .tile .tile-wrap, .home-folder.editing .tile .tile-wrap, .home-folder, .folder-panel, .pulse, .widget.sk { animation: none; }
}

@media (max-width: 1240px) { .home-widgets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .home { padding: 2px 14px 120px; }
  .home-hero { gap: 14px; margin-bottom: 16px; }
  .home-clock { font-size: 44px; }
  .home-search { min-width: 0; flex-basis: 100%; }
  .home-widgets { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .widget { padding: 12px; border-radius: 16px; }
  .w-meter { grid-template-columns: 42px 1fr 34px; }
  .home-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 2px; }
  .home-grid .tile-icon { width: 56px; height: 56px; border-radius: 15px; }
  .home-recent { grid-template-columns: 1fr; }
  .home-dock { gap: 2px; padding: 6px 8px; border-radius: 24px; }
  .home-dock .tile { width: 68px; }
  .home-dock .tile-icon { width: 52px; height: 52px; border-radius: 14px; }
}

/* ---- command palette ---- */
.palette { padding: 0; border: 0; background: transparent; max-width: none; max-height: none; width: 100%; height: 100%;
  margin: 0; inset: 0; color: var(--text); }
.palette::backdrop { background: rgba(0,0,0,.32); backdrop-filter: blur(2px); }
.palette[open] .pal-box { animation: pal-in .16s cubic-bezier(.2,.7,.3,1) both; }
@keyframes pal-in { from { opacity: 0; transform: translateY(-8px) scale(.985); } to { opacity: 1; transform: none; } }
.pal-box { width: min(680px, calc(100vw - 24px)); margin: 12vh auto 0; background: var(--panel); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: 0 24px 70px rgba(0,0,0,.3); overflow: hidden; display: flex; flex-direction: column;
  max-height: min(70vh, 640px); }
.pal-head { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--border); color: var(--muted); }
.pal-head input { flex: 1; min-width: 0; height: 58px; border: 0; outline: none; background: none; font-size: 17px; color: var(--text); }
.pal-head input::-webkit-search-cancel-button { display: none; }
.pal-esc { font: 500 12px var(--mono); padding: 3px 7px; border-radius: 6px; border: 1px solid var(--border-strong); color: var(--muted); }
.pal-results { overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.pal-group { padding: 10px 10px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.pal-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 10px; text-align: left; min-height: 44px; }
.pal-item.sel { background: var(--active); }
.pal-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--hover); color: var(--muted); flex: none; }
.pal-ic svg { width: 17px; height: 17px; }
.pal-item .agent-avatar { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }
.pal-item .tile-icon.xs { width: 28px; height: 28px; border-radius: 8px; }
.pal-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pal-txt b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-txt .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-empty { padding: 22px; text-align: center; margin: 0; }
.pal-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--border); }
.pal-foot kbd { margin-right: 3px; }
@media (max-width: 600px) {
  .pal-box { width: 100%; margin: 0; border-radius: 0 0 18px 18px; max-height: 88vh; border-top: 0; }
  .pal-foot { display: none; }
}
@media (min-width: 861px) { .main.is-home .topbar { display: none; } .main.is-home .home { padding-top: 26px; } }

/* ---- page: nodes ---- */
.node-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.node-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 18px; background: var(--panel);
  border: 1px solid var(--border); box-shadow: var(--shadow); min-width: 0; }
.node-card.s-unreachable { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.node-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.node-head .row-main b { font-size: 16px; }
.node-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); flex: none; }
.node-state.ok { color: var(--ok); } .node-state.bad { color: var(--bad); }
.node-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.node-stat { display: flex; flex-direction: column; min-width: 0; }
.node-stat b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-disk { display: flex; flex-direction: column; gap: 3px; }
.node-err { margin: 0; font-size: 13.5px; color: var(--bad); }
.node-key { border: 1px dashed var(--border-strong); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.node-key p { margin: 0; }
.node-cmd { width: 100%; white-space: pre-wrap; word-break: break-all; margin: 0; font-size: 12px; max-height: 140px; }
.node-foot { display: flex; align-items: center; gap: 8px; }
@media (max-width: 600px) { .node-grid { grid-template-columns: 1fr; } .node-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- page: backups ---- */
.bk-banner { border: 1px solid color-mix(in srgb, var(--warn) 50%, var(--border)); background: color-mix(in srgb, var(--warn) 9%, var(--panel));
  border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; font-size: 14px; }
.bk-card.s-warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); }
.bk-card.s-bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.node-state.warn { color: var(--warn); }
.warn-text { color: var(--warn) !important; }
.mono-s { font-family: var(--mono); font-size: 13px !important; font-weight: 500 !important; }
.bk-runs summary { cursor: pointer; padding: 2px 0; }
.bk-run { display: grid; grid-template-columns: 12px auto 1fr; gap: 4px 10px; align-items: center; padding: 6px 0;
  border-bottom: 1px solid var(--border); font-size: 13px; }
.bk-run:last-child { border-bottom: 0; }
.bk-file { grid-column: 2 / -1; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) {
  .node-head { flex-wrap: wrap; row-gap: 4px; }
  .node-head .row-main { flex-basis: calc(100% - 56px); }
  .node-state { flex-basis: 100%; padding-left: 52px; }
}

/* ---- page: keys ---- */
.key-row { align-items: flex-start; border-bottom: 1px solid var(--border); border-radius: 0; padding: 11px 6px; }
.key-row > .dot { margin-top: 6px; }
.key-row .row-main .row-sub { white-space: normal; }
.key-row.off .row-main b { color: var(--muted); }
.state-tag.acc { border-color: var(--accent); color: var(--accent); }
/* ---- page: accounts ---- */
.acc-card { border: 1px solid var(--border); border-radius: 14px; padding: 4px 14px 12px; background: var(--panel); }
.acc-card > .key-row:first-child { border-bottom: 0; }
.acc-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 4px 6px 10px; }
.acc-h { font-size: 13.5px; font-weight: 600; margin: 14px 6px 4px; }
.acc-repos { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 6px 6px; }
.acc-repos a, .acc-acts a { text-decoration: none; }
.acc-card .key-row select { border: 1px solid var(--border-strong); background: var(--bg); border-radius: 9px; padding: 6px 9px;
  font-size: 14px; flex: none; max-width: 46%; }
.acc-card details { padding: 8px 6px 0; }
.tok-new { display: flex; flex-direction: column; gap: 10px; }
.tok-new label { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; font-weight: 500; }
.tok-new label.check { flex-direction: row; }
.tok-new input:not([type=checkbox]), .tok-new select { border: 1px solid var(--border-strong); background: var(--bg); border-radius: 9px; padding: 9px 11px; font-size: 15px; }

/* ---- page: agent health ---- */
.ah-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 16px; }
.ah-count { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; background: var(--hover); font-size: 13.5px; }
.ah-count.bad { color: var(--bad); } .ah-count.warn { color: var(--warn); }
.ah-card { cursor: pointer; }
.ah-top .ah-card { cursor: default; }
.ah-card.s-warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); }
.ah-card.s-bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.ah-card.s-off { opacity: .65; }
.ah-reasons { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; }
.ah-reasons li::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 99px; margin-right: 8px; vertical-align: 1px; background: var(--muted); }
.ah-reasons li.bad { color: var(--bad); } .ah-reasons li.bad::before { background: var(--bad); }
.ah-reasons li.warn { color: var(--warn); } .ah-reasons li.warn::before { background: var(--warn); }
.ah-reasons li.run { color: var(--accent); } .ah-reasons li.run::before { background: var(--accent); }
.ah-back { display: inline-block; margin: 0 0 6px; text-decoration: none; }
.ah-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; margin-bottom: 18px; }
.ah-stack { position: relative; display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--hover); }
.ah-stack span { height: 100%; min-width: 2px; }
.ah-mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); opacity: .55; }
.ah-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.ah-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.ah-legend b { color: var(--text); font-weight: 550; font-variant-numeric: tabular-nums; }
.ah-break { display: flex; flex-direction: column; gap: 8px; }
.ah-break p { margin: 0; }
.ah-trend-box { position: relative; margin-top: 4px; }
.ah-trend svg { display: block; width: 100%; height: 70px; }
.ah-trend polyline { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.ah-trend line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.ah-trend-box i { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 99px; background: var(--warn); border: 2px solid var(--panel); }
.ah-pane { display: flex; flex-direction: column; gap: 8px; }
.ah-item { display: flex; flex-direction: column; gap: 5px; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); text-decoration: none; color: inherit; min-width: 0; }
a.ah-item:hover { border-color: var(--border-strong); }
.ah-item.bad { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.ah-item-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ah-item-head .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ah-item-text { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ah-item-text.mono { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.ah-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.ah-h3 { font-size: 14px; margin: 14px 0 2px; }
.ah-sess { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); text-decoration: none; color: inherit; }
.ah-sess:hover { border-color: var(--border-strong); }
.ah-sess.off { opacity: .6; }
.ah-sess-ctx { display: flex; flex-direction: column; gap: 3px; }
.ah-sess-ctx .meter { height: 6px; margin: 0; }
@media (max-width: 860px) { .ah-top { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .ah-sess { grid-template-columns: 1fr; gap: 6px; } .ah-top .node-head { flex-wrap: nowrap; } .ah-top .node-state { flex-basis: auto; padding-left: 0; } }
/* agent health, batch 2: charts (reference categorical palette, validated on --panel in both modes), schedules, traffic */
:root { --viz-1: #2a78d6; --viz-2: #eb6834; --viz-3: #1baf7a; --viz-4: #eda100; --viz-5: #e87ba4; --viz-6: #008300;
  --viz-7: #4a3aa7; --viz-other: #a3a198; }
@media (prefers-color-scheme: dark) {
  :root { --viz-1: #3987e5; --viz-2: #d95926; --viz-3: #199e70; --viz-4: #c98500; --viz-5: #d55181; --viz-6: #008300;
    --viz-7: #9085e9; --viz-other: #75736c; }
}
.ah-reasons li.info { color: var(--muted); }
.ah-stack { gap: 2px; background: var(--hover); }
.ah-stack span:first-child { border-radius: 99px 0 0 99px; }
.ah-tip { position: fixed; z-index: 1000; pointer-events: none; white-space: pre-line; max-width: 280px; padding: 7px 10px;
  border-radius: 9px; background: var(--text); color: var(--bg); font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow); }
.ah-viz { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ah-viz p { margin: 0; }
.ah-axis-max { font-variant-numeric: tabular-nums; border-bottom: 1px dashed var(--border); padding-bottom: 2px; }
.ah-bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; height: 130px; }
.ah-bar-col { display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; cursor: default; }
.ah-bar-col:hover .ah-bar-stack { opacity: .82; }
.ah-bar-stack { flex: 1; display: flex; flex-direction: column-reverse; justify-content: flex-start; gap: 2px; border-bottom: 1px solid var(--border-strong); }
.ah-bar-stack span { width: 100%; min-height: 2px; }
.ah-bar-stack span:last-child { border-radius: 4px 4px 0 0; }
.ah-bar-x { height: 16px; font-size: 11px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.ah-line { position: relative; height: 120px; margin-left: 34px; touch-action: pan-y; }
.ah-line svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ah-line polyline { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.ah-line .s1 { stroke: var(--viz-1); } .ah-line .s2 { stroke: var(--viz-2); }
.ah-line line.g { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ah-y { position: absolute; left: -34px; font-size: 11px; color: var(--muted); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.ah-y.y0 { top: 2.5%; } .ah-y.y1 { top: 50%; } .ah-y.y2 { top: 97.5%; }
.ah-cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); opacity: .6; pointer-events: none; }
.ah-dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 99px; border: 2px solid var(--panel); pointer-events: none; }
.ah-dot.s1 { background: var(--viz-1); } .ah-dot.s2 { background: var(--viz-2); }
.ah-x { display: flex; justify-content: space-between; margin-left: 34px; }
.ah-usage { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ah-usage .ah-wide { grid-column: 1 / -1; }
.ah-hbars { display: flex; flex-direction: column; gap: 6px; }
.ah-hbar { display: grid; grid-template-columns: 130px minmax(0, 1fr) 56px; gap: 10px; align-items: center; text-decoration: none; color: inherit; font-size: 13.5px; }
.ah-hbar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ah-hbar-t { height: 10px; display: block; }
.ah-hbar-t span { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.ah-hbar b { text-align: right; font-weight: 550; font-variant-numeric: tabular-nums; }
.ah-pills { display: inline-flex; gap: 3px; flex: none; }
.ah-pills i { width: 9px; height: 14px; border-radius: 3px; background: var(--ok); }
.ah-pills i.bad { background: var(--bad); } .ah-pills i.run { background: var(--accent); }
.ah-sched.off { opacity: .6; }
.ah-sched .ah-item-head b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ah-inline { margin-left: 10px; color: var(--muted); }
.ah-pair { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; min-width: 0; }
.ah-pair:last-child { border-bottom: 0; }
.ah-pair a { color: inherit; text-decoration: none; font-weight: 550; } .ah-pair a.me { color: var(--accent); }
.ah-mem { margin: 0; }
@media (max-width: 860px) { .ah-usage { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .ah-hbar { grid-template-columns: 96px minmax(0, 1fr) 48px; }
  .ah-sched .ah-item-head { flex-wrap: wrap; }
  .ah-pair { flex-wrap: wrap; }
}
.ah-seg { display: flex; width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ah-seg a { white-space: nowrap; flex: none; }
.ah-big { margin-top: -6px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ah-compact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.ah-compact-row span { flex-basis: 100%; }
.ah-compact { border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); border-radius: 8px; padding: 5px 8px; font-size: 13.5px; }
.ah-sess-ctx { position: relative; }
.ah-sess-btn { align-self: flex-end; margin-bottom: 4px; }

/* approval queue: agents' questions as cards (page, under a chat answer, on the home screen) */
.ask-page .day-head { margin-top: 18px; }
.ask-list { display: flex; flex-direction: column; gap: 14px; }
.ask-card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); min-width: 0; }
.ask-card.focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.ask-card.closed { box-shadow: none; opacity: .85; }
.ask-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ask-head .row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ask-head .row-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.ask-kind { padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ask-kind.k-BINARY_YES_NO { background: rgba(91, 110, 225, .14); color: #5b6ee1; }
.ask-kind.k-TEXT_FEEDBACK { background: rgba(63, 143, 90, .14); color: var(--ok); }
.ask-tag { padding: 1px 7px; border-radius: 99px; border: 1px solid var(--border); }
.ask-q { margin: 0; font: 500 17px/1.4 var(--serif); }
.ask-ctx { font-size: 14px; color: var(--text); }
.ask-ctx > :first-child { margin-top: 0; } .ask-ctx > :last-child { margin-bottom: 0; }
.ask-atts { margin: 0; }
.ask-caps { margin: 4px 0 0; padding-left: 18px; }
.ask-link { text-decoration: none; color: inherit; }
.ask-note { width: 100%; resize: vertical; min-height: 44px; padding: 9px 12px; border: 1px solid var(--border-strong);
  border-radius: 10px; background: var(--bg); }
.ask-note:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ask-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-opts .btn { min-height: 40px; padding-inline: 16px; }
.ask-foot { display: flex; gap: 8px; align-items: center; }
.ask-foot > :last-child:not(:first-child) { margin-left: auto; }
.ask-done { margin: 0; font-size: 14px; }
.ask-done.s-answered b, .ask-done.s-chat b { color: var(--ok); }
.ask-done.s-dismissed b, .ask-done.s-expired b, .ask-done.s-withdrawn b { color: var(--muted); }
.ask-empty { padding: 28px 16px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.ask-empty p { margin: 6px 0 0; }
.turn-asks { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.turn-asks:empty { display: none; }
.ask-chat { box-shadow: none; border-color: var(--accent); background: linear-gradient(var(--accent-soft), transparent 60px), var(--panel); }
/* home: a horizontal strip of compact cards */
.home-asks .w-count { margin-left: 0; }
.ask-strip { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
.ask-home { flex: 0 0 270px; scroll-snap-align: start; gap: 8px; padding: 12px 14px; text-decoration: none; color: inherit; }
.ask-home .ask-body { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; }
.ask-home .ask-q { font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ask-thumb img { display: block; width: 100%; height: 130px; object-fit: cover; border-radius: 10px; background: var(--code-bg); }
.ask-home .ask-opts .btn { min-height: 34px; padding-inline: 12px; }
.ask-apv, .ask-more { justify-content: flex-start; align-items: flex-start; }
.ask-more { flex-basis: 120px; align-items: center; font-weight: 600; color: var(--accent); }
@media (max-width: 640px) { .ask-card { padding: 12px; } .ask-q { font-size: 16px; } .ask-home { flex-basis: 78vw; } }

/* ---- chats page ---- */
.chat-closed { display: inline-flex; align-items: center; gap: 4px; margin: 2px 0 10px; color: var(--muted); font-size: 13px; cursor: pointer; }
.chat-closed input { margin: 0; accent-color: var(--accent); }
.chat-row .row-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row .row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row.closed .row-main b { color: var(--muted); font-weight: 500; }
.chat-row .pulse, .chat-row .badge { flex: none; }
.chat-agents { margin-bottom: 8px; }
.chat-agents .agent-avatar { width: 18px; height: 18px; font-size: 10px; border-radius: 5px; }


/* ---- videos (#/videos): folder cards and the player ---- */
.vid-chips { margin: 6px 0 4px; }
.vid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.vid-card { display: flex; flex-direction: column; gap: 8px; text-align: left; border: 1px solid var(--border);
  border-radius: 14px; background: var(--panel); overflow: hidden; padding: 0 0 10px; transition: border-color .15s, transform .15s; }
.vid-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.vid-thumb { position: relative; display: block; aspect-ratio: 16/9; background: #000; }
.vid-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vid-noimg { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: #fff; opacity: .5; }
.vid-noimg svg { width: 44px; height: 44px; }
.vid-badge { position: absolute; font-size: 11px; line-height: 1; padding: 4px 6px; border-radius: 6px;
  background: rgba(0, 0, 0, .72); color: #fff; }
.vid-badge.dur { right: 8px; bottom: 8px; }
.vid-badge.chap { left: 8px; bottom: 8px; }
.vid-meta { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; min-width: 0; }
.vid-meta b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vid-player { border: 1px solid var(--border-strong); border-radius: 16px; background: var(--panel); margin: 0 0 18px;
  overflow: hidden; box-shadow: var(--shadow); }
.vid-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; flex-wrap: wrap; }
.vid-bar .grow { flex: 1; min-width: 160px; overflow: hidden; }
.vid-bar b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vid-stage { background: #000; }
.vid-el { display: block; width: 100%; max-height: min(70vh, 640px); background: #000; }
.vid-note { margin: 0; padding: 8px 12px; background: var(--bg-side); }
.vid-chapters { padding: 10px 12px 14px; border-top: 1px solid var(--border); }
.vid-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.vid-ch { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; padding: 5px 9px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-side); }
.vid-ch:hover { border-color: var(--border-strong); }
.vid-ch.active { border-color: var(--accent); background: var(--accent-soft); }
.vid-ch-t { font-family: var(--mono); font-size: 12px; color: var(--muted); }
@media (max-width: 640px) {
  .vid-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .vid-meta { padding: 0 8px; }
  .vid-meta b { font-size: 12.5px; }
  .vid-badge { font-size: 10px; padding: 3px 5px; }
  .vid-bar { padding: 8px; }
  .vid-el { max-height: 56vh; }
}

/* ---- SQ Sayfaları (#/sq) ---- */
.sq-keys { margin-bottom: 6px; }
.sq-key, .sq-screen { display: flex; align-items: center; gap: 10px; font-size: 14px; min-width: 0; }
.sq-key .muted, .sq-screen .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sq-screens { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--bg-side); }
.sq-desc { margin: -4px 0 0; }
.sq-access { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.sq-access-priv { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.sq-access select { max-width: 50%; }
.sq-last { margin: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; }
.node-card.s-off { opacity: .72; }
.sq-enroll { border: 1px solid var(--border); border-radius: 18px; background: var(--panel); color: var(--text);
  padding: 22px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.sq-enroll::backdrop { background: rgba(0,0,0,.35); }
.sq-enroll h2 { font: 400 22px/1.2 var(--serif); margin: 0 0 6px; }
.sq-enroll textarea { width: 100%; margin: 6px 0 4px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--bg); resize: vertical; }
.sq-enroll-qr { display: block; width: 240px; height: 240px; margin: 14px auto; background: #fff; border-radius: 14px; padding: 6px;
  border: 1px solid var(--border); image-rendering: pixelated; }
.sq-enroll-acts { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.sq-enroll-acts .grow { flex: 1; }
.sq-temp { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 10px); transform: translateX(-50%); z-index: 60; padding: 6px 14px; border-radius: 99px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 500; text-decoration: none; box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums; }
.sq-page .node-grid { grid-template-columns: repeat(auto-fill, minmax(min(440px, 100%), 1fr)); }
.sq-page .node-foot { flex-wrap: wrap; }
.sq-page .node-foot .btn { white-space: nowrap; }
