@font-face { font-family: "Instrument Sans"; src: url(fonts/instrument-sans.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(fonts/jetbrains-mono.woff2) format("woff2"); font-weight: 400 600; font-display: swap; }

/* ---------- tokens ---------- */
:root {
  --bg: #0d0d0c; --bg-2: #151513; --bg-3: #1c1c1a;
  --line: #252421; --line-2: #34332f;
  --ink: #ecebe5; --ink-2: #a5a39a; --ink-3: #6f6d66;
  --signal: #8fe388; --signal-dim: rgba(143, 227, 136, .14);
  --warn: #f2b13b; --warn-dim: rgba(242, 177, 59, .14);
  --crit: #ff6450; --crit-dim: rgba(255, 100, 80, .15);
  --led-off: #22211e; --led-zw: #2c2618; --led-zc: #2f1c18;
  --scrim: rgba(0, 0, 0, .55);
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.18, .9, .22, 1.04);
  --bar-h: 52px; --tabs-h: 60px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f1ec; --bg-2: #fbfaf7; --bg-3: #ebe8e1;
    --line: #e0ddd5; --line-2: #cfcbc1;
    --ink: #181816; --ink-2: #57554e; --ink-3: #8a877e;
    --signal: #1e8a3c; --signal-dim: rgba(30, 138, 60, .12);
    --warn: #a86400; --warn-dim: rgba(168, 100, 0, .12);
    --crit: #c42f1c; --crit-dim: rgba(196, 47, 28, .1);
    --led-off: #e2dfd7; --led-zw: #eadcc0; --led-zc: #ecd3cc;
    --scrim: rgba(20, 20, 18, .35);
    color-scheme: light;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.45 var(--sans); letter-spacing: .005em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 8px);
  overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dim { color: var(--ink-2); }
.ic { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
p { margin: 0; }
h1, h2 { margin: 0; font-weight: 600; letter-spacing: -.01em; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: calc(var(--bar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid transparent; transition: border-color .25s;
  max-width: 600px; margin: 0 auto;
}
body.scrolled .bar { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.wordmark { font-weight: 600; font-size: 18px; letter-spacing: -.02em; }
.host { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mock { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--warn); border: 1px solid currentColor; border-radius: 4px; padding: 1px 5px; }
.brand:has(.mock:not([hidden])) .host { display: none; }
.mark { display: grid; grid-template-columns: repeat(3, 5px); gap: 2px; }
.mark i { width: 5px; height: 5px; border-radius: 1px; background: var(--line-2); transition: background .5s var(--ease); }
.mark i.on { background: var(--signal); }
.bar-right { display: flex; align-items: center; gap: 6px; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); padding: 0 6px; height: 28px; }
.conn i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); position: relative; }
.conn[data-state="live"] { color: var(--ink-2); }
.conn[data-state="live"] i { background: var(--signal); }
.conn[data-state="live"] i::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 1px solid var(--signal); animation: breathe 2.4s var(--ease) infinite; }
.conn[data-state="stale"] i { background: var(--warn); }
.conn[data-state="stale"] { color: var(--warn); }
.conn[data-state="offline"] i { background: var(--crit); }
.conn[data-state="offline"] { color: var(--crit); }
@keyframes breathe { 0% { transform: scale(.6); opacity: .9; } 70%, 100% { transform: scale(1.9); opacity: 0; } }
.iconbtn { position: relative; width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px; color: var(--ink); transition: background .2s; }
.iconbtn:active { background: var(--bg-3); }
.count { position: absolute; top: 5px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--crit); color: #fff; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; font-style: normal; box-shadow: 0 0 0 2px var(--bg); }

/* ---------- layout ---------- */
#views { max-width: 600px; margin: 0 auto; }
.sec { padding: 22px 16px 2px; }
.sec.flush-top { padding-top: 4px; }
.sec-h { display: flex; align-items: center; gap: 12px; height: 28px; margin-bottom: 10px; font: 500 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.sec-h > span:first-child { flex: none; }
.sec-h::after { content: ""; flex: 1; height: 1px; background: var(--line); order: 1; }
.sec-h > :not(:first-child) { order: 2; }
.hint { font-size: 10px; letter-spacing: .04em; text-transform: none; color: var(--ink-3); }
.link { font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); padding: 8px 0 8px 4px; }
.link:active { color: var(--ink); }
.view { animation: none; }

/* ---------- hero readout ---------- */
.hero { padding-top: 14px; }
.readout { display: flex; align-items: baseline; gap: 6px; }
.big { font-size: 68px; line-height: .95; font-weight: 400; letter-spacing: -.055em; font-feature-settings: "zero" 0; }
.unit { font-size: 17px; color: var(--ink-2); margin-right: 8px; }
.word { font: 500 12px/1 var(--mono); padding: 5px 8px; border-radius: 6px; align-self: center; margin-top: 10px; letter-spacing: .02em; }
.word[data-tone="ok"] { color: var(--signal); background: var(--signal-dim); }
.word[data-tone="warn"] { color: var(--warn); background: var(--warn-dim); }
.word[data-tone="crit"] { color: var(--crit); background: var(--crit-dim); }
.word[data-tone="mute"] { color: var(--ink-3); background: var(--bg-3); }
.readout-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 8px; min-height: 16px; }

/* segmented control with a sliding thumb */
.seg { position: relative; display: inline-flex; padding: 2px; border-radius: 8px; background: var(--bg-3); }
.seg button { position: relative; z-index: 1; height: 26px; min-width: 34px; padding: 0 9px; font: 500 11px/1 var(--mono); color: var(--ink-3); letter-spacing: .02em; text-transform: none; transition: color .25s; }
.seg button[aria-pressed="true"] { color: var(--ink); }
.seg-thumb { position: absolute; top: 2px; left: 2px; height: 26px; border-radius: 6px; background: var(--bg); box-shadow: 0 1px 0 var(--line-2), 0 1px 3px rgba(0,0,0,.25); transition: transform .38s var(--spring), width .38s var(--spring); }

/* ---------- spark ---------- */
.spark { position: relative; height: 148px; margin: 14px -16px 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.spark.empty::after { content: "Collecting samples"; position: absolute; inset: 0; display: grid; place-items: center; font: 11px var(--mono); color: var(--ink-3); border-block: 1px dashed var(--line); margin: 20px 16px; }
.spark-svg { display: block; overflow: visible; cursor: crosshair; }
.sp-line { fill: none; stroke: var(--signal); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.sp-fill-a { stop-color: var(--signal); stop-opacity: .16; }
.sp-fill-b { stop-color: var(--signal); stop-opacity: 0; }
.sp-grid line { stroke: var(--line); stroke-width: 1; }
.sp-grid text, .sp-axis text, .sp-thr text { font: 10px var(--mono); fill: var(--ink-3); }
.sp-axis text { font-size: 9.5px; }
.sp-thr line { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 2 4; opacity: .8; }
.sp-thr text { fill: var(--warn); opacity: .9; }
.sp-head { fill: var(--signal); }
.sp-halo { fill: none; stroke: var(--signal); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: halo 2.4s var(--ease) infinite; }
@keyframes halo { 0% { transform: scale(1); opacity: .8; } 80%, 100% { transform: scale(3.4); opacity: 0; } }
.sp-cline { stroke: var(--ink-2); stroke-width: 1; }
.sp-cdot { fill: var(--bg); stroke: var(--ink); stroke-width: 2; }
.sp-cursor { transition: opacity .15s; }
.spark-svg.scrubbing .sp-head, .spark-svg.scrubbing .sp-halo { opacity: 0; }

/* ---------- LED meters ---------- */
.meter { display: grid; grid-template-columns: 70px 1fr 44px; align-items: center; gap: 14px; height: 38px; }
.mlab { font-size: 13.5px; color: var(--ink-2); }
.leds { display: grid; grid-template-columns: repeat(28, 1fr); gap: 2.5px; height: 13px; }
.leds i { background: var(--led-off); border-radius: 1.5px; transition: background .35s var(--ease), box-shadow .35s; }
.leds i.zw { background: var(--led-zw); }
.leds i.zc { background: var(--led-zc); }
.leds i.on { background: var(--signal); }
.leds i.on.zw { background: var(--warn); }
.leds i.on.zc { background: var(--crit); }
.mval { font-size: 13px; text-align: right; color: var(--ink); }

/* ---------- strips (stat rows with hairline dividers) ---------- */
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin-top: 10px; border-block: 1px solid var(--line); }
.strip > div { display: flex; flex-direction: column; gap: 5px; padding: 12px 0 12px 12px; border-left: 1px solid var(--line); min-width: 0; }
.strip > div:first-child { border-left: 0; padding-left: 0; }
.slab { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.sval { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sval[data-tone="warn"] { color: var(--warn); }
.sval[data-tone="crit"] { color: var(--crit); }

/* ---------- rows (agents, accounts) ---------- */
.rows { border-top: 1px solid var(--line); }
.row { width: 100%; display: grid; grid-template-columns: 10px 1fr auto 16px; align-items: center; gap: 14px; min-height: 62px; padding: 10px 0; border-bottom: 1px solid var(--line); text-align: left; position: relative; overflow: hidden; }
.row.static { grid-template-columns: 10px 1fr auto; }
.row .ic { color: var(--ink-3); transition: transform .25s var(--ease); }
button.row:active { background: linear-gradient(90deg, transparent, var(--bg-2) 20%, var(--bg-2) 80%, transparent); }
button.row:active .ic { transform: translateX(2px); }
.rmain { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rname { display: flex; align-items: center; gap: 8px; font-size: 15.5px; font-weight: 500; }
.rsub { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: 10px; font-weight: 500; color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; letter-spacing: .03em; }
.rside { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.rside[data-tone="run"] { color: var(--signal); }
.rside[data-tone="fail"] { color: var(--crit); }
.rside[data-tone="wait"] { color: var(--warn); }
.rside[data-tone="off"] { color: var(--ink-3); }
.glyph { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink-3); position: relative; }
.glyph[data-tone="idle"], .glyph[data-tone="ok"] { border-color: var(--ink-2); }
.glyph[data-tone="ok"] { background: var(--signal); border-color: var(--signal); }
.glyph[data-tone="run"] { background: var(--signal); border-color: var(--signal); }
.glyph[data-tone="run"]::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--signal); animation: breathe 1.6s var(--ease) infinite; }
.glyph[data-tone="fail"] { background: var(--crit); border-color: var(--crit); }
.glyph[data-tone="wait"] { border-color: var(--warn); border-style: dashed; }
.glyph[data-tone="off"] { border-style: dashed; }
.row.running::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--signal), transparent); background-size: 40% 100%; background-repeat: no-repeat; animation: scan 1.8s linear infinite; }
@keyframes scan { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* ---------- timeline ---------- */
.tl { list-style: none; margin: 0; padding: 0; }
.tl-day { position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top)); z-index: 2; padding: 14px 0 10px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); background: var(--bg); }
.tl-item { position: relative; padding: 0 0 18px 22px; }
.tl-item::before { content: ""; position: absolute; left: 3.5px; top: 15px; bottom: 1px; width: 1px; background: var(--line); }
.tl-item:last-child::before, .tl-item:has(+ .tl-day)::before { display: none; }
.tl-node { position: absolute; left: 0; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--ink-3); }
.tl-item[data-kind="job.finish"] .tl-node, .tl-item[data-sev="resolved"] .tl-node, .tl-item[data-kind="health.resolved"] .tl-node { border-color: var(--signal); background: var(--signal); }
.tl-item[data-kind="job.start"] .tl-node { border-color: var(--ink-2); }
.tl-item[data-sev="warn"] .tl-node { border-color: var(--warn); background: var(--warn); }
.tl-item[data-sev="critical"] .tl-node { border-color: var(--crit); background: var(--crit); box-shadow: 0 0 0 4px var(--crit-dim); }
.tl-msg { font-size: 14.5px; line-height: 1.4; overflow-wrap: anywhere; }
.tl-item[data-sev="critical"] .tl-msg { color: var(--crit); }
.tl-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 11px; color: var(--ink-3); }
.tl-item[data-unread="true"] .tl-msg { font-weight: 600; }
.tl.compact .tl-item { padding-bottom: 14px; }
.tl-item.fresh { animation: enter .55s var(--ease) both; }
.tl-item.fresh .tl-body { animation: flash 2.4s var(--ease) both; border-radius: 6px; }
@keyframes enter { from { opacity: 0; transform: translateY(-8px); } }
@keyframes flash { 0% { background: var(--signal-dim); box-shadow: 0 0 0 6px var(--signal-dim); } 100% { background: transparent; box-shadow: 0 0 0 6px transparent; } }
.empty { list-style: none; color: var(--ink-3); font-size: 14px; padding: 18px 0; }

/* ---------- chips ---------- */
.feed-top { position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top)); z-index: 3; background: var(--bg); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 32px; padding: 0 13px; border-radius: 16px; border: 1px solid var(--line-2); font-size: 13.5px; color: var(--ink-2); transition: background .2s, color .2s, border-color .2s, transform .15s; }
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
body[data-tab="feed"] .tl-day { top: calc(var(--bar-h) + env(safe-area-inset-top) + 52px); }

/* ---------- alerts ---------- */
.alist { display: flex; flex-direction: column; gap: 10px; }
.alert { position: relative; overflow: hidden; border-radius: 12px; border: 1px solid var(--line); background: var(--warn-dim); transition: opacity .3s; }
.a-under { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding-right: 22px; color: var(--warn); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.alert.armed .a-under { color: var(--ink); }
.a-body { position: relative; background: var(--bg-2); padding: 14px 16px 12px 18px; touch-action: pan-y; transition: transform .35s var(--spring); }
.a-body::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--warn); }
.alert[data-sev="critical"] .a-body::before { background: var(--crit); }
.alert[data-status="acked"] .a-body::before { background: var(--line-2); }
.a-top { display: flex; justify-content: space-between; align-items: center; }
.a-sev { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--warn); }
.a-sev[data-sev="critical"] { color: var(--crit); }
.a-age { font-size: 11px; color: var(--ink-3); }
.a-title { margin-top: 6px; font-size: 15.5px; font-weight: 500; line-height: 1.35; }
.a-detail { margin-top: 4px; font-size: 13.5px; color: var(--ink-2); }
.a-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 11px; }
.a-acked { display: none; font-size: 11px; color: var(--ink-3); }
.alert[data-status="acked"] .a-ack { display: none; }
.alert[data-status="acked"] .a-acked { display: inline; }
.alert[data-status="acked"] .a-title, .alert[data-status="acked"] .a-sev { color: var(--ink-2); }
.allclear { display: flex; align-items: center; gap: 16px; padding: 18px 0 8px; }
.allclear-mark { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--signal); position: relative; flex: none; }
.allclear-mark::before { content: ""; position: absolute; left: 14px; top: 11px; width: 8px; height: 15px; border: solid var(--signal); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.allclear-mark::after { content: ""; position: absolute; inset: -1.5px; border-radius: 50%; border: 1.5px solid var(--signal); animation: breathe 3s var(--ease) infinite; }
.allclear-t { font-size: 17px; font-weight: 600; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px; border-radius: 12px; background: var(--bg-3); font-weight: 500; font-size: 15px; transition: transform .15s var(--ease), background .2s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.ghost { background: transparent; border: 1px solid var(--line-2); color: var(--ink-2); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.wide { width: 100%; }
.sec > .btn.wide { margin: 8px 0 12px; }

/* ---------- usage ---------- */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 150px; margin-top: 18px; }
.bcol { display: grid; grid-template-rows: 18px 1fr 20px; align-items: end; justify-items: center; gap: 4px; height: 100%; min-width: 0; }
.bval { font-size: 9.5px; color: var(--ink-3); opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; white-space: nowrap; }
.bcol.sel .bval, .bcol.today .bval { opacity: 1; transform: none; }
.bcol.today .bval { color: var(--ink); }
.btrack { width: 100%; height: 100%; display: flex; align-items: flex-end; border-radius: 4px; }
.bfill { width: 100%; height: 0; border-radius: 4px 4px 2px 2px; background: var(--line-2); transition: height .8s var(--spring), background .2s; }
.bcol.today .bfill { background: var(--signal); }
.bcol.sel .bfill { background: var(--ink-2); }
.bcol.today.sel .bfill { background: var(--signal); }
.blab { font-size: 10px; color: var(--ink-3); text-transform: lowercase; }
.bcol.today .blab { color: var(--ink); }
.mrow { display: grid; grid-template-columns: 96px 1fr 64px; align-items: center; gap: 12px; height: 36px; }
.mname { font-size: 12.5px; }
.mbar { height: 4px; border-radius: 2px; background: var(--led-off); overflow: hidden; }
.mbar i { display: block; height: 100%; background: var(--ink-2); border-radius: 2px; animation: grow .9s var(--ease) both; transform-origin: left; }
.mrow:first-child .mbar i { background: var(--signal); }
@keyframes grow { from { transform: scaleX(0); } }
.mcost { font-size: 12.5px; text-align: right; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.tile { display: flex; flex-direction: column; gap: 5px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.tile:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--line); }
.tile .sval { font-size: 19px; }
.lcard { padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.lhead { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.lname { font-size: 15px; color: var(--ink); }
.ltag { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; }
.ltag[data-tone="ok"] { color: var(--signal); background: var(--signal-dim); }
.ltag[data-tone="mute"] { color: var(--ink-3); background: var(--bg-3); }
.lupd { margin-left: auto; font-size: 11px; color: var(--ink-3); }
.lnote { font-size: 11.5px; margin: 2px 0 4px; }
.lnote[data-tone="wait"] { color: var(--warn); }
.lnote[data-tone="fail"] { color: var(--crit); }
.lrow { padding-bottom: 6px; }
.lrow .meter { grid-template-columns: 96px 1fr 44px; height: 30px; }
.lsub { display: block; font-size: 11.5px; color: var(--ink-3); }
.mval[data-tone="warn"] { color: var(--warn); }
.mval[data-tone="crit"] { color: var(--crit); }
.lcard .tiles { border-top: 0; }
.lfine { font-size: 11px; line-height: 1.5; color: var(--ink-3); margin: 8px 0 0; }
.acct-info { border-top: 1px solid var(--line); }
.fine { font-size: 12px; color: var(--ink-3); padding: 18px 16px 8px; line-height: 1.5; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; min-height: calc(100dvh - var(--bar-h) - var(--tabs-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 8px); }
.msgs { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 12px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; animation: pop .32s var(--spring) both; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.msg.me { align-self: flex-end; background: var(--ink); color: var(--bg); border-bottom-right-radius: 6px; transform-origin: right bottom; }
.msg.bot { align-self: flex-start; background: var(--bg-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; transform-origin: left bottom; }
.msg.err { color: var(--crit); }
.msg.note { align-self: center; max-width: 92%; background: none; border: 0; padding: 2px 8px; font-size: 12px; color: var(--dim, #888); text-align: center; }
.chatbar { display: flex; align-items: center; gap: 6px; padding: 8px 0 0; }
.chatbar .chips { flex: 1; min-width: 0; padding: 4px 0 4px 16px; }
.chatbar .newconv { margin-right: 16px; border-style: dashed; }
.chatbar .newconv:disabled { opacity: .35; }
.chatbar .newconv { display: inline-flex; align-items: center; padding: 6px 9px; }
.chatbar .clearconv { margin-right: 0; }
.chatbar .clearconv:disabled { opacity: .35; }
.chatmeter { min-height: 16px; padding: 4px 16px 10px; font-size: 12px; color: var(--dim, #888); }
/* markdown inside bot bubbles and task text (.md) */
.md { white-space: normal; min-width: 0; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 8px; }
.md .md-h { margin: 10px 0 4px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 20px; }
.md li { margin: 2px 0; }
.md a { color: var(--signal); text-decoration: underline; text-underline-offset: 2px; }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.md pre { margin: 0 0 8px; padding: 10px 12px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.md pre code { display: block; background: none; border: 0; padding: 0; white-space: pre; overflow-wrap: normal; }
.md .md-table { margin: 0 0 8px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.md table { border-collapse: collapse; font-size: 13px; width: max-content; min-width: 100%; }
.md th, .md td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.md th { background: var(--bg-3); font-weight: 600; color: var(--ink-2); }
.md tr:last-child td { border-bottom: 0; }
.report-md { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); overflow-wrap: anywhere; margin: 0; }
.report-md.plan { color: var(--ink); }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: dot 1.2s var(--ease) infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.chat-empty { margin: auto 0 0; padding: 24px 0 8px; display: flex; flex-direction: column; gap: 10px; }
.chat-hello { font-size: 22px; font-weight: 500; letter-spacing: -.015em; line-height: 1.25; max-width: 18em; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.suggest .chip { height: auto; padding: 8px 13px; text-align: left; }
.composer { position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 10px 16px 12px; background: linear-gradient(transparent, var(--bg) 14px); }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; padding: 11px 15px; border-radius: 22px; border: 1px solid var(--line-2); background: var(--bg-2); line-height: 1.4; outline: none; transition: border-color .2s; }
.composer textarea:focus { border-color: var(--ink-3); }
.composer input[type=file] { display: none; }
.clipbtn { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); border: 1px solid var(--line-2); background: var(--bg-2); }
.clipbtn .ic { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tray { flex: 1 1 100%; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.tray[hidden] { display: none; }
.pend { position: relative; flex: none; display: flex; align-items: center; gap: 8px; max-width: 220px; min-height: 52px; padding: 4px 4px 4px 4px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg-2); overflow: hidden; }
.pend img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; }
.pend.bad { border-color: var(--crit, #d33); }
.pend-meta { display: flex; flex-direction: column; min-width: 0; font-size: 12px; padding-left: 6px; }
.pend img + .pend-meta { padding-left: 0; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pend .prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line); }
.pend .prog i { display: block; height: 100%; background: var(--signal); transition: width .15s linear; }
.att-x { flex: none; width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink-2); }
.att-x .ic { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.atts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.msg .atts:last-child { margin-bottom: 0; }
.att-img img { display: block; max-width: min(220px, 60vw); max-height: 200px; border-radius: 10px; object-fit: cover; }
.att-chip { display: flex; flex-direction: column; max-width: 220px; padding: 8px 10px; border-radius: 10px; background: var(--bg-3); border: 1px solid var(--line); font-size: 13px; color: inherit; text-decoration: none; }
.sendbtn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--bg); transition: transform .2s var(--spring), opacity .2s; }
.sendbtn .ic { stroke-width: 2; }
.sendbtn:disabled { opacity: .25; transform: scale(.92); }
.note { font-size: 13px; color: var(--warn); background: var(--warn-dim); border-radius: 10px; padding: 10px 12px; margin-top: 12px; }

/* ---------- tasks ---------- */
.chatseg { position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top)); z-index: 3; display: flex; flex-wrap: wrap; justify-content: center; padding: 12px 16px 10px; background: var(--bg); }
.chatseg .seg { width: 100%; max-width: 240px; }
.chatseg .seg button { flex: 1; }
.tasksv[hidden], .chat[hidden] { display: none; }
.flab { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin: 14px 0 0; }
.chips.flat { padding: 8px 0 2px; flex-wrap: wrap; overflow: visible; }
.taskin { display: block; width: 100%; margin-top: 12px; resize: vertical; min-height: 104px; max-height: 280px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink); line-height: 1.45; outline: none; transition: border-color .2s; }
.taskin:focus { border-color: var(--ink-3); }
.tfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 11.5px; }
.tnote { font-size: 12.5px; margin: 12px 0 0; color: var(--ink-3); }
.rtitle { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow { display: flex; align-items: center; gap: 8px; }
.trow .tag { flex: none; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.trow .mono { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rside[data-tone="ok"] { color: var(--ink-2); }
.task-prompt { font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 0; }
.report { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.stat { margin: 0; font-size: 11.5px; line-height: 1.55; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.stat + .btn { margin-top: 14px; }
.diff { display: block; margin-top: 14px; max-height: 46dvh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); padding: 8px 0; font-size: 11.5px; line-height: 1.5; -webkit-overflow-scrolling: touch; }
.diff[hidden] { display: none; }
.dl { display: block; padding: 0 10px; white-space: pre; color: var(--ink-2); width: max-content; min-width: 100%; }
.dl.add { background: var(--signal-dim); color: var(--signal); }
.dl.del { background: var(--crit-dim); color: var(--crit); }
.dl.hunk { color: var(--warn); }
.dl.meta { color: var(--ink-3); }
.cmd { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); }
.cmd code { flex: 1; min-width: 0; font-size: 11.5px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; user-select: all; }
.cmd .btn { flex: none; }
.btn[data-armed] { color: var(--crit); border-color: var(--crit); }

/* ---------- tab bar ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  max-width: 600px; margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
  border-top: 1px solid var(--line);
}
.tabs button { position: relative; height: var(--tabs-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--ink-3); font-size: 10.5px; font-weight: 500; letter-spacing: .01em; transition: color .25s; }
.tabs button .ic { width: 23px; height: 23px; transition: transform .3s var(--spring); }
.tabs button:active .ic { transform: scale(.88); }
.tabs button[aria-current="page"] { color: var(--ink); }
.tabs .count { top: 6px; right: calc(50% - 22px); }
.tab-ind { position: absolute; top: -1px; left: 0; width: 20%; height: 2px; display: flex; justify-content: center; transition: transform .45s var(--spring); pointer-events: none; }
.tab-ind i { width: 22px; height: 2px; border-radius: 0 0 2px 2px; background: var(--ink); }

/* ---------- sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); opacity: 0; transition: opacity .3s var(--ease); }
.scrim.open { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 600px; margin: 0 auto; max-height: 88dvh; overflow: auto; overscroll-behavior: contain;
  background: var(--bg-2); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0;
  padding-bottom: calc(env(safe-area-inset-bottom) + 16px);
  transform: translateY(102%); transition: transform .42s var(--spring); box-shadow: 0 -20px 60px rgba(0,0,0,.35); }
.sheet.open { transform: none; }
.grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 8px auto 0; touch-action: none; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 18px; touch-action: none; }
.sheet-h h2 { font-size: 19px; }
.sheet-b { padding: 4px 18px 0; }
.lede { font-size: 15px; color: var(--ink-2); }
.facts { margin: 14px 0 0; border-top: 1px solid var(--line); }
.facts > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--ink-3); font-size: 13.5px; }
.facts dd { margin: 0; font-size: 12.5px; text-align: right; }
.facts dd[data-tone="run"] { color: var(--signal); }
.facts dd[data-tone="fail"] { color: var(--crit); }
.facts dd[data-tone="wait"] { color: var(--warn); }
.sub-h { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin: 20px 0 8px; }
.kv { display: flex; justify-content: space-between; padding: 7px 0; font-size: 12.5px; }
.run { padding: 10px 0; border-bottom: 1px solid var(--line); }
.run-top { display: flex; align-items: center; gap: 12px; font-size: 12px; }
.run-sum { font-size: 13.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.45; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.dot[data-tone="ok"] { background: var(--signal); }
.dot[data-tone="crit"] { background: var(--crit); }
.dot[data-tone="run"] { background: var(--signal); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.taskcard { margin-top: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--bg); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.tc-title { font-size: 14px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.report.plan { color: var(--ink); }
.plan-old { margin-top: 8px; }
.plan-old summary { cursor: pointer; font-size: 12px; color: var(--ink-3); padding: 4px 0; }
.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.pad { padding: 12px 0; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 12px); z-index: 30; max-width: 520px; margin: 0 auto; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.3); transform: translateY(16px); opacity: 0; transition: transform .35s var(--spring), opacity .25s; }
.toast.show { transform: none; opacity: 1; }
.toast[data-kind="crit"] { background: var(--crit); color: #fff; }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px 20px; background: var(--bg); }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
.big-mark { grid-template-columns: repeat(3, 9px); gap: 3px; margin-bottom: 14px; }
.big-mark i { width: 9px; height: 9px; border-radius: 2px; }
.login h1 { font-size: 26px; letter-spacing: -.02em; }
.login input { width: 100%; height: 50px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); font-size: 16px; outline: none; }
.login input:focus { border-color: var(--ink-3); }
.login .field { display: flex; flex-direction: column; gap: 6px; }
.login .flab { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding-left: 2px; }
.login input.code { letter-spacing: .5em; text-indent: .25em; }
.login input.code::placeholder { letter-spacing: .5em; color: var(--ink-3); opacity: .6; }
.login .btn { margin-top: 6px; }
.login #loginMsg[data-tone="crit"] { color: var(--crit); }
.login .fine { padding: 2px 0 0; }

/* ---------- skeleton ---------- */
.sk { display: inline-block; border-radius: 4px; background: linear-gradient(90deg, var(--line) 0 40%, var(--line-2) 50%, var(--line) 60% 100%); background-size: 300% 100%; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- wider screens ---------- */
@media (min-width: 700px) {
  .bar, .tabs, #views { max-width: 640px; }
  .big { font-size: 80px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

.apply-note { padding: 0 2px; margin-top: -2px; }
.apply-note[data-tone="crit"] { color: var(--crit); }

/* ---------- needs-you banner, AWS request, issues ---------- */
.needbar { width: 100%; margin-top: 10px; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px 0 14px; border: 1px solid var(--line-2); border-left: 3px solid var(--warn); border-radius: 10px; background: var(--bg-2); text-align: left; font-size: 13.5px; }
.needbar[hidden] { display: none; }
.needbar { padding-top: 8px; padding-bottom: 8px; line-height: 1.35; }
.needbar .nb-t { flex: 1; min-width: 0; }
.needbar .nb-t b { font-weight: 600; }
.needbar .ic { flex: none; color: var(--ink-3); }
.awsreq { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--warn); border-radius: 12px; background: var(--warn-dim); }
.awsreq .ar-h { font: 500 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--warn); }
.awsreq p { margin: 8px 0 0; font-size: 14px; line-height: 1.45; }
.awsreq p.dim { font-size: 12.5px; color: var(--ink-2); }
.sheet-actions .btn + .btn { margin-top: 8px; }
.a-actions { display: flex; gap: 8px; margin-top: 12px; }
.alert.issue .a-body { touch-action: auto; }
.alert.issue .a-sev { color: var(--warn); }

/* run now + quick actions */
.arow { display: flex; align-items: center; gap: 8px; }
.arow .row { flex: 1; min-width: 0; }
.runbtn { flex: none; }
.chips.quick { flex-wrap: wrap; }
.chip.qa { display: inline-flex; align-items: center; gap: 6px; }
.chip.qa[data-tone="run"] { border-color: var(--ink-3); }
.runtask { width: 100%; box-sizing: border-box; margin-top: 6px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; resize: vertical; }
.runcard { margin-top: 10px; }

/* AWS cost cards */
.aws-cards { display: grid; gap: 14px; }
.aws-card .rname { display: flex; gap: 8px; align-items: center; }
.aws-spark { width: 100%; height: 28px; color: var(--ink-2); margin: 8px 0 4px; }
.tag[data-tone="warn"] { color: var(--warn); border-color: var(--warn); }

/* task report cards in the chat */
.report-msg { max-width: 100%; }
.taskcard.report { width: 100%; align-items: stretch; }
.rpt-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; }
.rpt-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* merge badges (ready, rebasing, resolving, resolved, conflict) and the Apply all panel */
.word.mbadge { margin-top: 0; padding: 2px 6px; font-size: 10px; flex: none; }
.aa-box { margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); display: flex; flex-direction: column; gap: 8px; }
.aa-box[hidden] { display: none; }
.aa-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.aa-log { margin: 0; padding-left: 18px; font-size: 11px; line-height: 1.5; color: var(--ink-2); max-height: 30dvh; overflow: auto; }
.aa-log li[data-step="landed"] { color: var(--signal); }
.aa-log li[data-step="stopped"] { color: var(--crit); }
.aa-wait { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.45; }

/* several task cards in one Handler reply */
.tc-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.tc-list .taskcard { margin-top: 0; }
.tc-all { align-self: flex-start; }
.tc-after { color: var(--warn); }
.tc-bad { color: var(--warn); margin: 0; }

/* self-repair: fix-task line on issue cards, Doctor report card */
.fixline { margin-top: 8px; }
.linkbtn { font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; padding: 0; border: 0; background: none; cursor: pointer; }
.a-actions { flex-wrap: wrap; }
.taskcard.doctor .tc-title { display: flex; align-items: center; gap: 8px; }
.taskcard.doctor .tc-list { width: 100%; }
#v-alerts .sec-h .btn { white-space: nowrap; flex: none; }

/* ---------- lite AI (Gemma) ---------- */
.modebar { padding: 6px 16px 0; }
.modeseg { width: 100%; max-width: 260px; }
.modeseg button { flex: 1; }
.engtag { display: inline-block; margin-top: 6px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); background: var(--bg-3); padding: 1px 5px; border-radius: 3px; }
.engtag[data-e="gemma"] { color: var(--signal); background: var(--signal-dim); }
.msg.md { display: flex; flex-direction: column; align-items: flex-start; }
.gemma-card { padding: 4px 16px 8px; }
.gemma-card .grow { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 0; }
.gsel { width: 100%; min-height: 40px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink); font-size: 13px; }
.tfoot .btn.small { margin-left: auto; }
