/* Jarvis Mirror — dark-first, one amber accent, SF text + mono operational layer.
   Spacing scale: 2 4 6 8 12 16 24. Type scale: 11 12 13 15 17 22. */
:root {
  --bg0: #0a0c10; --bg1: #10131a; --bg2: #161a22; --bg3: #1e232d; --line: #262c37; --line2: #303745;
  --fg: #e7e9ee; --fg2: #aab1bc; --muted: #737c8b;
  --accent: #f5b83d; --accent-ink: #1a1200; --accent-dim: rgba(245,184,61,.14);
  --ok: #3ddc84; --err: #ff6b6b; --info: #7aa2f7; --agent: #7fd1a8; --peer: #b48cf2; --think: #c9a0ff;
  --you-bg: #1c2434; --you-line: #2a3650;
  --shadow: 0 8px 32px rgba(0,0,0,.55);
  --sat: env(safe-area-inset-top); --sab: env(safe-area-inset-bottom); --sal: env(safe-area-inset-left); --sar: env(safe-area-inset-right);
  --fs: 15px; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg0: #f4f5f7; --bg1: #ffffff; --bg2: #eceef2; --bg3: #e2e5eb; --line: #d8dce3; --line2: #c6ccd6;
  --fg: #14171c; --fg2: #454c57; --muted: #6b7380;
  --accent: #b8800a; --accent-ink: #ffffff; --accent-dim: rgba(184,128,10,.12);
  --ok: #1f9d55; --err: #d13b3b; --info: #3a63d6; --agent: #1f8a5a; --peer: #7a42d6; --think: #7c4bd1;
  --you-bg: #e3ebf8; --you-line: #c8d6f0;
  --shadow: 0 8px 32px rgba(20,23,28,.18);
  color-scheme: light;
}
html { font-size: var(--fs); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg0); color: var(--fg); font: 1rem/1.45 var(--sans); overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { position: fixed; inset: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .8rem; letter-spacing: .01em; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
code, pre { font-family: var(--mono); }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.mark { width: 64px; height: 64px; border-radius: 18px; background: var(--accent); color: #0a0c10; font: 700 38px/64px var(--mono); text-align: center; }
.mark.sm { width: 24px; height: 24px; border-radius: 7px; font: 700 15px/24px var(--mono); }

/* ---------- login ---------- */
#login { align-items: center; justify-content: center; padding: 24px; }
#loginForm { display: flex; flex-direction: column; gap: 12px; width: min(340px, 100%); align-items: stretch; text-align: center; }
#loginForm .mark { margin: 0 auto 4px; }
#loginForm h1 { margin: 0; font-size: 1.45rem; font-weight: 600; letter-spacing: -.01em; }
#loginForm .lede { margin: 0 0 8px; color: var(--fg2); font-size: .87rem; }
#loginForm input { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg1); color: var(--fg); font-size: 16px; min-height: 48px; }
.primary { min-height: 48px; padding: 0 16px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 1rem; }
.primary:disabled { opacity: .5; }
.err { color: var(--err); min-height: 1.2em; font-size: .87rem; }

/* ---------- shell ---------- */
#app { flex-direction: row; }
.view { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.side { display: none; }
.bar { padding: calc(var(--sat) + 8px) 12px 8px calc(var(--sal) + 14px); display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--bg1); border-bottom: 1px solid var(--line); min-height: calc(var(--sat) + 52px); }
.status { display: flex; align-items: center; gap: 8px; min-width: 0; }
.status .who { font-weight: 600; font-size: 1.07rem; }
.ticker { color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; box-shadow: 0 0 0 3px transparent; transition: background .18s, box-shadow .18s; }
.dot.idle { background: var(--ok); }
.dot.working { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.dot.needs_approval { background: var(--err); box-shadow: 0 0 0 3px rgba(255,107,107,.25); }
.dot.offline { background: var(--muted); }
@keyframes pulse { 50% { opacity: .3; } }
.bar-actions { display: flex; gap: 4px; flex: none; }
.icon { position: relative; width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--fg2); }
.icon:active { background: var(--bg3); }
.icon.on { color: var(--accent); }
.icon.round { border-radius: 50%; width: 40px; height: 40px; background: var(--bg3); color: var(--fg); }
.icon.send { background: var(--accent); color: var(--accent-ink); }
.icon.send:disabled { background: var(--bg3); color: var(--muted); }
.ghost { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); color: var(--fg2); font-size: .87rem; min-height: 40px; background: var(--bg1); }
.ghost:active { background: var(--bg3); }
.link { color: var(--accent); text-decoration: underline; font-size: inherit; }

/* banners */
.banner { padding: 10px 14px; font-size: .87rem; border-bottom: 1px solid var(--line); line-height: 1.4; }
.banner.warn { background: var(--accent-dim); color: var(--fg); border-left: 3px solid var(--accent); }
.banner.err { background: rgba(255,107,107,.1); border-left: 3px solid var(--err); }
.banner.info { background: rgba(122,162,247,.1); border-left: 3px solid var(--info); }

/* ---------- log ---------- */
main { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#log { padding: 8px calc(var(--sar) + 12px) 12px calc(var(--sal) + 12px); }
#msgs { display: flex; flex-direction: column; gap: 4px; }
.loadmore { text-align: center; padding: 6px 0 10px; }
.day { align-self: center; color: var(--muted); font-family: var(--mono); font-size: .73rem; letter-spacing: .04em; text-transform: uppercase; margin: 14px 0 6px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; }

.msg { position: relative; max-width: 100%; }
.msg .from { font-family: var(--mono); font-size: .73rem; color: var(--muted); letter-spacing: .02em; display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.msg .from .tag { padding: 0 6px; border-radius: 6px; border: 1px solid currentColor; line-height: 1.5; }
.msg .time { font-family: var(--mono); font-size: .73rem; color: var(--muted); margin-top: 3px; display: none; }
.msg.showtime .time { display: block; }
.body { white-space: normal; word-wrap: break-word; overflow-wrap: anywhere; }

/* you (terminal / remote control) and you·phone: right-aligned bubbles */
.msg.user, .msg.phone { align-self: flex-end; max-width: 86%; margin: 6px 0 4px; }
.msg.user .body, .msg.phone .body { background: var(--you-bg); border: 1px solid var(--you-line); border-radius: 18px 18px 4px 18px; padding: 8px 13px; }
.msg.phone .body { border-color: var(--accent); border-style: solid; box-shadow: inset 0 0 0 0 transparent; }
.msg.phone .from { color: var(--accent); justify-content: flex-end; }
.msg.user .from { justify-content: flex-end; }
.msg.user .time, .msg.phone .time { text-align: right; }
.msg.user.command .body { font-family: var(--mono); font-size: .87rem; }
.msg.pending .body { opacity: .55; }
.msg.failed .body { border-color: var(--err); }
.msg.failed .from { color: var(--err); }

/* jarvis: flat ledger text with an amber cap, no bubble */
.msg.jarvis { align-self: stretch; padding: 6px 0 6px 14px; border-left: 2px solid var(--accent); margin: 8px 0 4px; }
.msg.jarvis .from { display: none; }
.msg.jarvis .body { max-width: 72ch; }
/* peer sessions */
.msg.peer { align-self: stretch; padding: 6px 0 6px 14px; border-left: 2px solid var(--peer); margin: 6px 0 4px; }
.msg.peer .from { color: var(--peer); }
/* agent report card */
.msg.agent { align-self: stretch; margin: 6px 0 4px; }
.msg.agent .card { background: var(--bg2); border: 1px solid var(--line); border-left: 3px solid var(--agent); border-radius: 12px; padding: 8px 12px; }
.msg.agent .from { color: var(--agent); cursor: pointer; min-height: 28px; margin: 0; }
.msg.agent .from .chev { margin-left: auto; transition: transform .15s; }
.msg.agent.open .from .chev { transform: rotate(90deg); }
.msg.agent .body { display: none; margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 6px; }
.msg.agent.open .body { display: block; }
.msg.agent .preview { color: var(--fg2); font-size: .87rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.agent.open .preview { display: none; }
.msg.agent .actions { margin-top: 6px; display: none; gap: 8px; }
.msg.agent.open .actions { display: flex; }
/* system */
.msg.system { align-self: center; max-width: 92%; text-align: center; color: var(--err); font-family: var(--mono); font-size: .8rem; padding: 4px 8px; }
.msg.system.warning { color: var(--muted); }
.msg.system.compact { color: var(--fg2); text-align: left; background: var(--bg2); border-radius: 10px; padding: 8px 12px; font-family: var(--sans); font-size: .87rem; }
.msg.system.compact .body { max-height: 6em; overflow: hidden; }
.msg.system.compact.open .body { max-height: none; }

/* photos */
.photos { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.photos img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; background: var(--bg3); }

/* ---------- tool clusters ---------- */
.cluster { align-self: stretch; margin: 2px 0; font-family: var(--mono); font-size: .8rem; }
.cluster .chead { display: flex; align-items: center; gap: 8px; color: var(--muted); min-height: 32px; padding: 0 2px; cursor: pointer; }
.cluster .chead .n { color: var(--fg2); }
.cluster .chead .live { color: var(--accent); }
.cluster .chead .chev { transition: transform .15s; }
.cluster.open .chead .chev { transform: rotate(90deg); }
.cluster .steps { display: none; border-left: 1px solid var(--line2); margin-left: 5px; padding-left: 10px; }
.cluster.open .steps { display: block; }
.step { display: flex; align-items: flex-start; gap: 8px; min-height: 28px; padding: 3px 0; color: var(--fg2); }
.step .st { width: 7px; height: 7px; min-height: 7px; max-height: 7px; border-radius: 50%; margin-top: 6px; flex: none; align-self: flex-start; background: var(--muted); }
.step .st.ok { background: var(--ok); }
.step .st.err { background: var(--err); }
.step .st.run { background: var(--accent); animation: pulse 1.2s infinite; }
.step .name { color: var(--fg); font-weight: 600; flex: none; }
.step .desc { color: var(--fg2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.step.open .desc { white-space: pre-wrap; }
.step .dur { color: var(--muted); flex: none; }
.step .detail { display: none; grid-column: 1 / -1; width: 100%; }
.step.open { flex-wrap: wrap; }
.step.open .detail { display: block; margin: 4px 0 4px 15px; }
.detail pre { margin: 4px 0; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; overflow-x: auto; max-height: 40vh; white-space: pre-wrap; font-size: .77rem; color: var(--fg2); }
.detail .k { color: var(--muted); font-size: .73rem; text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.detail pre.res.err { border-color: var(--err); }
.tools-hidden .cluster { display: none; }
.tools-full .cluster .steps { display: block; }
.tools-full .cluster .chead .chev { transform: rotate(90deg); }

/* live agent card inside chat */
.agentcard { align-self: stretch; margin: 4px 0; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; cursor: pointer; font-family: var(--sans); }
.agentcard .ico { width: 28px; height: 28px; border-radius: 8px; background: var(--bg3); display: flex; align-items: center; justify-content: center; color: var(--agent); grid-row: span 2; }
.agentcard .nm { font-weight: 600; font-size: .93rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agentcard .last { color: var(--muted); font-family: var(--mono); font-size: .77rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { font-family: var(--mono); font-size: .73rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line2); color: var(--fg2); white-space: nowrap; }
.chip.running { color: var(--accent); border-color: var(--accent); }
.chip.done { color: var(--ok); border-color: var(--ok); }
.chip.failed, .chip.blocked, .chip.needs-input { color: var(--err); border-color: var(--err); }
.chip.stopped, .chip.ended { color: var(--muted); }
.agentcard .meta { grid-column: 3; font-family: var(--mono); font-size: .73rem; color: var(--muted); text-align: right; }

/* ---------- markdown ---------- */
.body p { margin: 0 0 .55em; } .body p:last-child { margin: 0; }
.body code { background: var(--bg3); padding: 1px 5px; border-radius: 5px; font-size: .87em; }
.body pre { position: relative; background: var(--bg1); border: 1px solid var(--line); padding: 8px 10px; border-radius: 10px; overflow-x: auto; font-size: .8rem; line-height: 1.45; margin: .4em 0; }
.msg.user .body pre, .msg.phone .body pre { background: rgba(0,0,0,.25); }
.body pre code { background: none; padding: 0; font-size: inherit; }
.body pre .copy { position: absolute; top: 4px; right: 4px; font: .7rem var(--mono); color: var(--muted); background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; min-height: 26px; }
.body ul, .body ol { margin: .2em 0 .5em; padding-left: 1.4em; }
.body li { margin: .12em 0; }
.body h1, .body h2, .body h3 { font-size: 1em; margin: .7em 0 .25em; font-weight: 700; }
.body h1 { font-size: 1.1em; }
.body .tbl { overflow-x: auto; margin: .4em 0; -webkit-overflow-scrolling: touch; }
.body table { border-collapse: collapse; font-size: .87rem; min-width: 100%; }
.body td, .body th { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; white-space: nowrap; }
.body th { background: var(--bg2); font-weight: 600; }
.body blockquote { margin: .3em 0; padding: 2px 0 2px .8em; border-left: 3px solid var(--line2); color: var(--fg2); }
.body hr { border: 0; border-top: 1px solid var(--line); margin: .6em 0; }
.body input[type=checkbox] { margin-right: 6px; }
.body .hl { background: var(--accent-dim); color: var(--accent); border-radius: 3px; }

/* ---------- pill / composer ---------- */
.pill { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--comp-h, 96px) + 12px); background: var(--accent); color: var(--accent-ink);
  padding: 0 16px; min-height: 36px; border-radius: 999px; font-size: .87rem; font-weight: 600; box-shadow: var(--shadow); z-index: 5; }
.composer { background: var(--bg1); border-top: 1px solid var(--line); padding: 6px calc(var(--sar) + 10px) 8px calc(var(--sal) + 10px); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }
.chips button { flex: none; padding: 0 12px; min-height: 32px; border-radius: 999px; border: 1px solid var(--line2); color: var(--fg2); font-size: .8rem; background: var(--bg2); }
.chips button:active { border-color: var(--accent); color: var(--accent); }
.composer .row { display: flex; gap: 8px; align-items: flex-end; }
.composer .box { flex: 1; background: var(--bg0); border: 1px solid var(--line2); border-radius: 20px; padding: 0; min-width: 0; }
.composer textarea { display: block; width: 100%; resize: none; max-height: 40vh; padding: 9px 14px; border: 0; background: transparent; color: var(--fg); font: inherit; font-size: 16px; line-height: 1.35; }
.composer textarea:focus { outline: none; }
.attachments { display: flex; gap: 6px; padding: 8px 8px 0; }
.attachments .att { position: relative; }
.attachments img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.attachments .rm { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--fg); color: var(--bg0); font-size: 13px; line-height: 22px; text-align: center; }
.attachments .prog { position: absolute; inset: 0; border-radius: 8px; background: rgba(0,0,0,.5); color: #fff; font: .7rem var(--mono); display: flex; align-items: center; justify-content: center; }

/* ---------- tabs ---------- */
.tabs { position: absolute; left: 0; right: 0; bottom: 0; display: flex; background: var(--bg1); border-top: 1px solid var(--line); padding: 4px 0 var(--sab); z-index: 6; }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 48px; color: var(--muted); font-size: .67rem; font-family: var(--mono); letter-spacing: .03em; position: relative; }
.tabs button.on { color: var(--accent); }
.icon .badge { top: 6px; right: 4px; }
.badge { position: absolute; top: 4px; right: calc(50% - 22px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: 600 .67rem/16px var(--mono); padding: 0 4px; font-style: normal; }
#app.has-tabs .view { padding-bottom: calc(52px + var(--sab)); }

/* ---------- lists (agents / settings) ---------- */
.list { padding: 8px calc(var(--sar) + 12px) 16px calc(var(--sal) + 12px); display: flex; flex-direction: column; gap: 8px; }
.list > * { flex: none; }
.sect { font-family: var(--mono); font-size: .73rem; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; margin: 10px 2px 0; }
.acard { background: var(--bg1); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; cursor: pointer; }
.acard:active { background: var(--bg2); }
.acard.running { border-color: var(--accent); }
.acard .nm { font-weight: 600; font-size: .97rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acard .desc { grid-column: 1 / -1; color: var(--fg2); font-size: .87rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acard .kv { grid-column: 1 / -1; display: flex; gap: 12px; flex-wrap: wrap; font-family: var(--mono); font-size: .73rem; color: var(--muted); }
.acard .kv b { color: var(--fg2); font-weight: 500; }
.acard .last { grid-column: 1 / -1; font-family: var(--mono); font-size: .77rem; color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 4px; border-top: 1px dashed var(--line); margin-top: 2px; }
.acard.running .last::before { content: "▸ "; color: var(--accent); }
.empty { color: var(--muted); text-align: center; padding: 40px 16px; font-size: .93rem; }
.empty b { display: block; color: var(--fg2); margin-bottom: 4px; }

/* settings */
.group { background: var(--bg1); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; min-height: 48px; border-bottom: 1px solid var(--line); }
.setrow:last-child { border-bottom: 0; }
.setrow .lbl { font-size: .97rem; } .setrow .lbl small { display: block; color: var(--muted); font-size: .77rem; margin-top: 1px; }
.seg { display: flex; background: var(--bg3); border-radius: 9px; padding: 2px; flex: none; }
.seg button { padding: 0 12px; min-height: 32px; border-radius: 7px; font-size: .8rem; color: var(--fg2); font-family: var(--mono); }
.seg button.on { background: var(--bg1); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch { width: 50px; height: 30px; border-radius: 15px; background: var(--bg3); position: relative; flex: none; transition: background .18s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch.on { background: var(--ok); } .switch.on::after { transform: translateX(20px); }
.setrow input[type=text] { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg0); color: var(--fg); font-size: 16px; }
.setrow .danger { color: var(--err); }
.kvs { font-family: var(--mono); font-size: .77rem; color: var(--fg2); padding: 10px 14px; line-height: 1.7; }
.kvs span { color: var(--muted); display: inline-block; width: 9em; }

/* ---------- sheets ---------- */
.scrim { position: absolute; inset: 0; background: rgba(0,0,0,.5); z-index: 20; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92%; background: var(--bg1); border-radius: 18px 18px 0 0; box-shadow: var(--shadow); z-index: 21; display: flex; flex-direction: column; animation: up .18s ease-out; padding-bottom: var(--sab); }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.sheet.full { top: calc(var(--sat) + 8px); max-height: none; }
.sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line2); margin: 8px auto 4px; flex: none; }
.sheet .shead { display: flex; align-items: center; gap: 8px; padding: 4px 8px 8px 16px; border-bottom: 1px solid var(--line); flex: none; }
.sheet .shead .t { font-weight: 600; font-size: 1.05rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet .sbody { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 16px 16px; flex: 1; position: relative; }
.sheet .sbody.tight { padding: 4px 0 8px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 0 20px; min-height: 50px; font-size: 1rem; border-bottom: 1px solid var(--line); }
.menu button:last-child { border-bottom: 0; }
.menu button.danger { color: var(--err); }
.menu .quote { padding: 10px 20px; color: var(--muted); font-size: .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lightbox { position: absolute; inset: 0; background: #000; z-index: 30; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .x { position: absolute; top: calc(var(--sat) + 8px); right: 12px; color: #fff; width: 44px; height: 44px; font-size: 26px; }

/* agent detail timeline */
.tl { display: flex; flex-direction: column; gap: 6px; }
.tl .think { border-left: 2px dotted var(--think); padding: 4px 0 4px 12px; color: var(--fg2); font-style: italic; font-size: .93rem; }
.tl .think .lbl { font-style: normal; font-family: var(--mono); font-size: .73rem; color: var(--think); display: block; margin-bottom: 2px; }
.tl .think.unrec { color: var(--muted); font-size: .8rem; padding: 2px 0 2px 12px; }
.tl .msg.jarvis { border-left-color: var(--agent); }
.tl .msg.user .body { background: var(--bg2); border-color: var(--line); }
.tl .prompt { max-height: 7em; overflow: hidden; position: relative; }
.tl .prompt.open { max-height: none; }
.agent-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-family: var(--mono); font-size: .77rem; color: var(--fg2); padding: 8px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.agent-summary span { color: var(--muted); }
.timeline-states { font-family: var(--mono); font-size: .77rem; color: var(--fg2); border-left: 1px solid var(--line2); margin: 6px 0 10px 4px; padding-left: 10px; }
.timeline-states div { padding: 2px 0; }
.timeline-states b { color: var(--fg); font-weight: 600; }
.searchin { position: sticky; top: 0; background: var(--bg1); padding: 4px 0 8px; z-index: 2; }
.searchin input, .search-input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg0); color: var(--fg); font-size: 16px; }
.hit { padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; display: grid; gap: 2px; }
.hit .h { font-family: var(--mono); font-size: .73rem; color: var(--muted); display: flex; justify-content: space-between; }
.hit .x { font-size: .9rem; color: var(--fg2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.flash { animation: flash 1.2s; }
@keyframes flash { 0%, 60% { background: var(--accent-dim); } }

/* toast */
.toast { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--sat) + 60px); background: var(--fg); color: var(--bg0); padding: 8px 14px; border-radius: 10px; font-size: .87rem; z-index: 40; box-shadow: var(--shadow); }

/* ---------- desktop two-pane ---------- */
@media (min-width: 900px) {
  .side { display: flex; flex-direction: column; width: 340px; flex: none; background: var(--bg1); border-right: 1px solid var(--line); }
  .side-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px; }
  .side-search { padding: 0 12px 8px; }
  .side-search input { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg0); color: var(--fg); font-size: 14px; }
  .side-results { overflow-y: auto; max-height: 45%; padding: 0 12px; border-bottom: 1px solid var(--line); }
  .side-title { display: flex; justify-content: space-between; padding: 10px 16px 4px; font-family: var(--mono); font-size: .73rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
  .side-agents { flex: 1; overflow-y: auto; padding: 4px 12px; display: flex; flex-direction: column; gap: 6px; }
  .side-foot { padding: 10px 12px; border-top: 1px solid var(--line); }
  .tabs { display: none; }
  #app.has-tabs .view { padding-bottom: 0; }
  #agentsView, #settingsView { display: none !important; }
  #chatView { display: flex !important; }
  .bar { padding-top: calc(var(--sat) + 10px); }
  .msg.jarvis .body { max-width: 78ch; }
  .sheet { left: 50%; right: auto; transform: translateX(-50%); width: min(760px, 92%); bottom: 24px; border-radius: 18px; }
  .sheet.full { top: 24px; }
  @keyframes up { from { transform: translate(-50%, 16px); opacity: 0; } }
  .pill { bottom: calc(var(--comp-h, 96px) + 14px); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* overview strip + sessions */
.overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.overview .cell { background: var(--bg1); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; display: grid; gap: 2px; }
.overview .cell b { font-size: 1.2rem; font-weight: 600; line-height: 1.1; }
.overview .cell b.on { color: var(--accent); }
.overview .cell span { font-family: var(--mono); font-size: .7rem; color: var(--muted); letter-spacing: .03em; text-transform: uppercase; }
.overview .cell .dot { display: inline-block; margin-right: 6px; vertical-align: middle; }
.acard.session .nm::before { content: "⌘ "; color: var(--muted); font-weight: 400; }
.chip.idle { color: var(--ok); border-color: var(--ok); }
.acard .new { font-family: var(--mono); font-size: .7rem; color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: middle; }
.note { font-family: var(--mono); font-size: .73rem; color: var(--muted); padding: 6px 0 8px; }
/* notification center */
.ncard { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.ncard.unread .t::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; }
.ncard .t { font-weight: 600; font-size: .95rem; }
.ncard .b { grid-column: 1 / -1; color: var(--fg2); font-size: .87rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.ncard .m { font-family: var(--mono); font-size: .7rem; color: var(--muted); white-space: nowrap; }
.ncard .m .chip { margin-right: 6px; }
.ncard.high .t { color: var(--err); }
.toast.click { cursor: pointer; max-width: 88%; text-align: left; }
.toast b { display: block; }
.setrow input[type=time] { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg0); color: var(--fg); font: inherit; font-size: 15px; }
