/* Jarvis side panel. Narrow-first (320–480 px), light and dark. */
:root {
  color-scheme: light;
  --bg:#fff; --surface:#f6f7f9; --surface-2:#eceff3; --border:#e3e6eb; --border-strong:#cdd2dc;
  --text:#1f2742; --muted:#5f6779; --faint:#868d9d; --user:#eef1f6;
  --accent:#c83e00; --accent-hover:#a93400; --accent-soft:#fdf1ea; --accent-fill:#c83e00; --on-accent:#fff;
  --ok:#21784a; --ok-soft:#e7f4ec; --bad:#b42318; --bad-soft:#fdeceb;
  --warn:#9a5b00; --warn-soft:#fff7e8; --warn-border:#efc56f; --warn-bar:#d98a00;
  --code:#f2f4f7; --logo-ink:#202945; --logo-mark:#ff4d00;
  --shadow:0 10px 30px rgba(20,26,45,.14),0 2px 6px rgba(20,26,45,.06);
  --mono:ui-monospace,SFMono-Regular,Menlo,monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg:#15171c; --surface:#1d2027; --surface-2:#262a33; --border:#2c3039; --border-strong:#3c414d;
    --text:#e7e9ef; --muted:#a3a9b7; --faint:#7f8595; --user:#252a34;
    --accent:#ff7a3d; --accent-hover:#ff935f; --accent-soft:#33211a; --accent-fill:#ff7433; --on-accent:#1b0f08;
    --ok:#5cc98f; --ok-soft:#16291f; --bad:#f2786f; --bad-soft:#35191a;
    --warn:#f2c470; --warn-soft:#2b2312; --warn-border:#6a5222; --warn-bar:#e0a63c;
    --code:#1f232b; --logo-ink:#e7e9ef;
    --shadow:0 12px 32px rgba(0,0,0,.45),0 2px 6px rgba(0,0,0,.3);
  }
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
html,body { height:100%; margin:0; }
body { display:flex; flex-direction:column; background:var(--bg); color:var(--text); font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; -webkit-font-smoothing:antialiased; overflow:hidden; }
button,input,textarea,select { font:inherit; color:inherit; }
button { cursor:pointer; transition:background-color .15s,color .15s,border-color .15s,opacity .15s; }
button:disabled { opacity:.45; cursor:default; }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
svg { flex:none; }
button svg, .project-picker svg, .empty-tip svg, .hero-mark svg, .starter-icon svg, .file-icon svg { fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }

/* ---------- top bar ---------- */
.topbar { height:48px; flex:none; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:0 8px 0 14px; border-bottom:1px solid var(--border); }
.brand { display:flex; align-items:center; gap:9px; min-width:0; }
.brand-logo { width:92px; height:auto; display:block; }
.logo-ink { fill:var(--logo-ink); } .logo-mark { fill:var(--logo-mark); }
.brand-divider { width:1px; height:16px; background:var(--border-strong); }
.product-name { font-size:15px; font-weight:680; letter-spacing:-.01em; white-space:nowrap; }
.conn { width:7px; height:7px; border-radius:50%; background:var(--faint); flex:none; }
.conn.on { background:var(--ok); } .conn.off { background:var(--faint); }
.actions { display:flex; align-items:center; gap:2px; }
button.icon { width:32px; height:32px; display:grid; place-items:center; padding:0; border:0; border-radius:8px; background:transparent; color:var(--muted); }
button.icon:hover:not(:disabled), button.icon[aria-expanded="true"] { background:var(--surface-2); color:var(--text); }
button.icon svg { width:18px; height:18px; }
#menuToggle svg { fill:currentColor; stroke:none; }
.menu-wrap { position:relative; }
.menu { position:absolute; right:0; top:38px; z-index:30; width:min(260px,calc(100vw - 16px)); padding:6px; background:var(--bg); border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow); }
.menu button { display:flex; align-items:center; gap:10px; width:100%; padding:8px 10px; border:0; border-radius:8px; background:transparent; text-align:left; font-size:13px; }
.menu button:hover:not(:disabled), .menu button:focus-visible { background:var(--surface-2); outline:none; }
.menu button svg { width:16px; height:16px; color:var(--muted); }
.menu-sep { height:1px; background:var(--border); margin:6px 4px; }
.menu-label { margin:2px 10px 4px; font-size:11px; color:var(--faint); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.menu-label::before { content:'This chat · '; }
button.menu-account { padding:8px; }
.avatar { width:30px; height:30px; flex:none; border-radius:50%; display:grid; place-items:center; background:var(--accent-soft); color:var(--accent); font-size:12px; font-weight:700; }
.menu-account-text { min-width:0; display:flex; flex-direction:column; }
.menu-account-text strong { font-size:13px; font-weight:600; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.menu-account-text small { font-size:11px; color:var(--muted); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.offline { flex:none; display:flex; align-items:center; gap:8px; padding:7px 14px; font-size:12px; color:var(--warn); background:var(--warn-soft); border-bottom:1px solid var(--warn-border); }

/* ---------- context bar ---------- */
.workspace { flex:1; display:flex; min-height:0; position:relative; }
.chat-shell { display:flex; flex-direction:column; flex:1; min-width:0; }
.context-bar { flex:none; display:flex; align-items:center; gap:8px; padding:8px 12px; border-bottom:1px solid var(--border); }
.project-picker { position:relative; flex:1; min-width:0; display:flex; align-items:center; gap:7px; height:32px; padding:0 8px 0 9px; border:1px solid var(--border); border-radius:8px; background:var(--surface); color:var(--muted); cursor:pointer; }
.project-picker:hover { border-color:var(--border-strong); }
.project-picker:focus-within { border-color:var(--accent); }
.project-picker svg { width:16px; height:16px; }
.project-picker::after { content:''; position:absolute; right:11px; top:12px; width:6px; height:6px; border-right:1.6px solid var(--muted); border-bottom:1.6px solid var(--muted); transform:rotate(45deg); pointer-events:none; }
#project { flex:1; min-width:0; height:100%; padding:0 18px 0 0; border:0; background:transparent; color:var(--text); font-size:13px; font-weight:560; appearance:none; -webkit-appearance:none; text-overflow:ellipsis; cursor:pointer; }
#project:focus-visible { outline:none; }
#project:disabled { cursor:default; opacity:.7; }
.project-picker.unset { border-style:dashed; border-color:var(--accent); background:var(--accent-soft); color:var(--accent); }
.project-picker.unset #project { color:var(--accent); }
.plan-chip { flex:none; display:inline-flex; align-items:center; gap:6px; height:26px; padding:0 9px; border-radius:999px; background:var(--surface); color:var(--muted); font-size:11.5px; font-weight:550; white-space:nowrap; }
.plan-chip .dot { width:7px; height:7px; border-radius:50%; background:var(--faint); }
.plan-chip[data-state="ok"] { color:var(--ok); background:var(--ok-soft); } .plan-chip[data-state="ok"] .dot { background:var(--ok); }
.plan-chip[data-state="checking"] .dot { background:var(--accent); animation:pulse 1.2s ease-in-out infinite; }
.plan-chip[data-state="error"] { color:var(--bad); background:var(--bad-soft); } .plan-chip[data-state="error"] .dot { background:var(--bad); }
.plan-chip[data-state="none"] { display:none; }
#planChipText { max-width:180px; overflow:hidden; text-overflow:ellipsis; }
.plan-status { flex:none; padding:8px 14px; font-size:12px; color:var(--bad); background:var(--bad-soft); border-bottom:1px solid var(--border); overflow-wrap:anywhere; }

/* ---------- conversation ---------- */
main { flex:1; min-height:0; overflow-y:auto; overflow-x:hidden; padding:16px max(14px,calc((100% - 720px)/2)) 20px; display:flex; flex-direction:column; gap:14px; scroll-behavior:smooth; }
.empty { width:100%; max-width:560px; margin:auto; padding:8px 0 12px; }
.hero-mark { width:40px; height:40px; border-radius:12px; display:grid; place-items:center; background:var(--accent-soft); color:var(--accent); margin-bottom:14px; }
.hero-mark svg { width:22px; height:22px; }
.empty h1 { font-size:22px; line-height:1.25; letter-spacing:-.02em; font-weight:680; margin:0 0 6px; text-wrap:balance; }
.empty>p { margin:0 0 18px; color:var(--muted); font-size:13px; line-height:1.55; max-width:42ch; }
.starters { display:grid; grid-template-columns:1fr; gap:8px; }
.starter { display:flex; align-items:center; gap:12px; width:100%; padding:11px 12px; text-align:left; border:1px solid var(--border); border-radius:10px; background:var(--bg); }
.starter:hover { border-color:var(--accent); background:var(--accent-soft); }
.starter-icon { width:32px; height:32px; flex:none; display:grid; place-items:center; border-radius:8px; background:var(--surface); color:var(--accent); }
.starter:hover .starter-icon { background:var(--bg); }
.starter-icon svg { width:18px; height:18px; }
.starter-text { min-width:0; display:flex; flex-direction:column; }
.starter-text strong { font-size:13px; font-weight:600; }
.starter-text small { font-size:11.5px; color:var(--muted); }
.empty>.empty-tip { display:flex; align-items:flex-start; gap:7px; margin:16px 0 0; font-size:12px; color:var(--muted); }
.empty-tip svg { width:16px; height:16px; margin-top:1px; color:var(--faint); }

.msg { max-width:100%; overflow-wrap:anywhere; }
.msg.user { align-self:flex-end; max-width:86%; background:var(--user); border-radius:14px 14px 4px 14px; padding:8px 12px; white-space:pre-wrap; }
.msg.user>.attachment-card { margin-top:8px; }
.bot-head { display:flex; align-items:center; gap:7px; margin-bottom:6px; font-size:12px; font-weight:650; color:var(--text); }
.bot-mark { width:20px; height:20px; border-radius:6px; display:grid; place-items:center; background:var(--accent-fill); color:var(--on-accent); font-size:11px; font-weight:750; }
.msg.bot { align-self:stretch; }
.msg.bot.streaming { white-space:pre-wrap; color:var(--muted); }
.msg h1,.msg h2,.msg h3,.msg h4 { font-size:14.5px; line-height:1.35; margin:14px 0 6px; }
.msg-body>:first-child { margin-top:0; }
.msg p { margin:7px 0; } .msg ul,.msg ol { margin:7px 0; padding-left:20px; } .msg li { margin:3px 0; }
.msg code { background:var(--code); padding:1px 5px; border-radius:4px; font:12px var(--mono); }
.msg pre { background:var(--code); padding:10px 12px; border-radius:8px; overflow-x:auto; white-space:pre; font-size:12px; }
.msg pre code { padding:0; background:none; }
.msg a { color:var(--accent); text-underline-offset:2px; }
.table-wrap { margin:10px 0; overflow-x:auto; border:1px solid var(--border); border-radius:8px; }
.msg table { border-collapse:collapse; width:100%; font-size:12px; font-variant-numeric:tabular-nums; }
.msg th,.msg td { padding:6px 10px; text-align:left; border-bottom:1px solid var(--border); white-space:nowrap; }
.msg td { white-space:normal; min-width:72px; }
.msg th { background:var(--surface); font-weight:600; color:var(--muted); font-size:11.5px; }
.msg tbody tr:last-child td { border-bottom:0; }
.badge { display:inline-block; white-space:nowrap; padding:1px 7px; border-radius:999px; font-size:11px; font-weight:700; letter-spacing:.03em; background:var(--surface-2); color:var(--muted); }
.badge.pass { background:var(--ok-soft); color:var(--ok); } .badge.fail { background:var(--bad-soft); color:var(--bad); } .badge.neutral { background:var(--warn-soft); color:var(--warn); }
.answer-actions { display:flex; align-items:center; gap:2px; margin-top:6px; }
.answer-actions button { width:28px; height:28px; display:grid; place-items:center; padding:0; border:0; border-radius:7px; background:transparent; color:var(--faint); }
.answer-actions button:hover { background:var(--surface-2); color:var(--text); }
.answer-actions button[aria-pressed="true"] { color:var(--accent); background:var(--accent-soft); }
.answer-actions button svg { width:15px; height:15px; }
.answer-actions .copied { color:var(--ok); }
.answer-meta { margin-left:auto; font-size:11px; color:var(--faint); font-variant-numeric:tabular-nums; }

/* ---------- work timeline ---------- */
.run { border:1px solid var(--border); border-radius:10px; background:var(--bg); overflow:hidden; }
.run-head { display:grid; grid-template-columns:20px minmax(0,1fr) auto 14px; align-items:center; gap:10px; width:100%; padding:9px 12px; border:0; background:transparent; text-align:left; }
.run-head:hover { background:var(--surface); }
.run-icon { width:20px; height:20px; display:grid; place-items:center; }
.run-text { min-width:0; display:flex; flex-direction:column; }
.run-title { font-size:13px; font-weight:600; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.run-now { font-size:12px; color:var(--muted); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.run-time { font-size:11.5px; color:var(--faint); font-variant-numeric:tabular-nums; }
.chev { width:14px; height:14px; color:var(--faint); fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; transition:transform .15s; }
.run-head[aria-expanded="true"] .chev { transform:rotate(180deg); }
.run-steps { list-style:none; margin:0; padding:6px 12px 8px; border-top:1px solid var(--border); }
.step { position:relative; display:grid; grid-template-columns:16px minmax(0,1fr) auto; column-gap:10px; align-items:start; padding:4px 0; font-size:12.5px; }
.step::before { content:''; position:absolute; left:7.5px; top:21px; bottom:-5px; width:1px; background:var(--border); }
.step:last-child::before { display:none; }
.step-icon { width:16px; height:16px; margin-top:1px; border-radius:50%; display:grid; place-items:center; background:var(--bg); position:relative; z-index:1; }
.step-icon svg { width:12px; height:12px; fill:none; stroke:currentColor; stroke-width:2.4; stroke-linecap:round; stroke-linejoin:round; }
.step.ok .step-icon { background:var(--ok-soft); color:var(--ok); }
.step.fail .step-icon { background:var(--bad-soft); color:var(--bad); }
.step.note .step-icon::after { content:''; width:5px; height:5px; border-radius:50%; background:var(--faint); }
.step-label { min-width:0; overflow-wrap:anywhere; }
.step.note .step-label { color:var(--muted); }
.step-sub { display:block; font-size:11.5px; color:var(--muted); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.step.fail .step-sub { color:var(--bad); }
.step-meta { font-size:11px; color:var(--faint); font-variant-numeric:tabular-nums; white-space:nowrap; }
.step-tech { grid-column:2 / -1; margin-top:4px; font-size:11px; }
.step-tech summary { cursor:pointer; color:var(--faint); width:max-content; }
.step-tech .tech-label { font-family:var(--mono); color:var(--muted); margin:4px 0; overflow-wrap:anywhere; }
.step-tech pre { margin:4px 0 0; padding:8px 10px; max-height:220px; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; background:var(--code); border-radius:6px; font:11px/1.45 var(--mono); }
.step-tech .text-button { margin-top:4px; }
.spinner { width:14px; height:14px; flex:none; border-radius:50%; border:2px solid var(--accent-soft); border-top-color:var(--accent); animation:spin .8s linear infinite; }
.step-icon .spinner { width:12px; height:12px; }
.run-icon svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.run[data-state="done"] .run-icon { color:var(--ok); }
.run[data-state="stopped"] .run-icon, .run[data-state="failed"] .run-icon { color:var(--bad); }
@keyframes spin { to { transform:rotate(360deg); } }
@keyframes pulse { 50% { opacity:.35; } }

/* ---------- cards: approval, files, errors, workstreams ---------- */
.confirm { border:1px solid var(--warn-border); border-left:4px solid var(--warn-bar); background:var(--warn-soft); border-radius:10px; padding:12px 14px; scroll-margin:16px; }
.confirm-eyebrow { display:flex; align-items:center; gap:6px; font-size:11px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; color:var(--warn); }
.confirm-eyebrow svg { width:15px; height:15px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.confirm-title { display:block; margin:6px 0 4px; font-size:14px; font-weight:650; }
.confirm-detail { font-size:13px; overflow-wrap:anywhere; }
.confirm code { display:block; margin:8px 0 0; padding:8px; border-radius:6px; background:var(--bg); font:11px var(--mono); overflow-wrap:anywhere; }
.confirm .row { display:flex; gap:8px; margin-top:12px; }
.confirm .row button { flex:1; min-height:36px; font-weight:600; }
.confirm .verdict { margin-top:10px; }
.confirm.answered { background:var(--surface); border-color:var(--border); border-left-color:var(--faint); }
.confirm.answered .confirm-eyebrow { color:var(--muted); }
.file-card { display:flex; align-items:center; gap:10px; padding:9px 10px; border:1px solid var(--border); border-radius:10px; background:var(--bg); }
.file-icon { width:32px; height:32px; flex:none; display:grid; place-items:center; border-radius:8px; background:var(--accent-soft); color:var(--accent); }
.file-icon svg { width:17px; height:17px; }
.file-info { flex:1; min-width:0; display:flex; flex-direction:column; }
.file-info strong { font-size:13px; font-weight:600; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.file-info small { font-size:11px; color:var(--faint); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.error-card { display:flex; gap:8px; padding:10px 12px; border-radius:10px; background:var(--bad-soft); color:var(--bad); font-size:13px; overflow-wrap:anywhere; }
.error-card svg { width:16px; height:16px; margin-top:2px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
.error-card .text-button { color:inherit; text-decoration:underline; padding:0; margin-top:4px; display:block; }
.error { color:var(--bad); font-size:13px; }
.workstream-card { border:1px solid var(--border); border-radius:10px; padding:12px; background:var(--bg); margin:8px 0; font-size:12px; }
.workstream-card>small { color:var(--muted); font-size:11px; }
.job-state { color:var(--accent); font-size:11px; font-weight:600; }
.workstream-row { display:grid; grid-template-columns:76px minmax(0,1fr); gap:2px 10px; border-top:1px solid var(--border); margin-top:8px; padding-top:8px; }
.workstream-row strong { font-weight:550; } .workstream-row small { grid-column:2; color:var(--muted); font-size:11px; }
.task-state { font-size:11px; color:var(--muted); } .task-state.prepared { color:var(--ok); } .task-state.failed,.task-state.blocked,.task-state.interrupted { color:var(--bad); } .task-state.running { color:var(--accent); }
.workstream-note { font-size:11px; color:var(--muted); margin-bottom:0; }

/* ---------- composer ---------- */
.composer-area { flex:none; padding:8px max(12px,calc((100% - 720px)/2)) 12px; }
.live { display:flex; align-items:center; gap:8px; padding:0 4px 8px; font-size:12px; color:var(--muted); min-width:0; }
#activityText { min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.live.waiting { color:var(--warn); font-weight:600; }
#elapsed { margin-left:auto; font-variant-numeric:tabular-nums; color:var(--faint); }
#composer { display:flex; flex-direction:column; gap:2px; padding:8px 8px 6px 12px; border:1px solid var(--border-strong); border-radius:14px; background:var(--bg); box-shadow:0 1px 2px rgba(20,26,45,.04); }
#composer:focus-within { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
#composer.file-drop { outline:2px dashed var(--accent); outline-offset:3px; background:var(--accent-soft); }
#input { width:100%; min-height:24px; max-height:160px; padding:3px 0; border:0; outline:0; resize:none; background:transparent; color:var(--text); line-height:1.45; }
#input::placeholder { color:var(--faint); }
.composer-row { display:flex; align-items:center; gap:6px; margin-left:-6px; }
#attach { width:30px; height:30px; }
.composer-hint { flex:1; min-width:0; font-size:10.5px; color:var(--faint); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
#send { flex:none; height:32px; min-width:32px; display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:0 7px; border:0; border-radius:9px; background:var(--accent-fill); color:var(--on-accent); font-size:12.5px; font-weight:650; }
#send:hover:not(:disabled) { background:var(--accent-hover); }
#send svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
#send .i-stop, #send .send-label { display:none; }
#send.stop { background:var(--text); color:var(--bg); padding:0 12px 0 9px; }
#send.stop .i-send { display:none; } #send.stop .i-stop, #send.stop .send-label { display:inline; }
#send.stop .i-stop { width:14px; height:14px; fill:currentColor; stroke:none; }
.attachment-list { display:flex; flex-direction:column; gap:6px; margin-bottom:8px; max-height:200px; overflow:auto; }
.attachment-card { display:flex; align-items:center; gap:10px; padding:8px 10px; border:1px solid var(--border); border-radius:10px; background:var(--bg); color:var(--text); font-size:12px; white-space:normal; }
.attachment-info { flex:1; min-width:0; }
.attachment-info strong { display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:12px; font-weight:600; }
.attachment-info small { color:var(--faint); font-size:11px; }
.attachment-preview { width:44px; height:44px; object-fit:cover; border-radius:6px; background:var(--surface); }
.attachment-warnings { font-size:11px; color:var(--muted); margin-top:4px; }
.attachment-warnings summary { cursor:pointer; }
.attachment-warnings>div { white-space:pre-wrap; margin-top:4px; }
.file-status { font-size:11.5px; color:var(--muted); margin:0 2px 6px; }
.file-status:empty { display:none; }
.page-source { display:block; color:var(--muted); margin-top:6px; font-size:11px; }

/* ---------- history drawer ---------- */
.history-panel { position:absolute; z-index:20; inset:0 auto 0 0; width:min(320px,100%); display:flex; flex-direction:column; gap:8px; padding:12px; background:var(--bg); border-right:1px solid var(--border); box-shadow:var(--shadow); }
.history-heading { display:flex; justify-content:space-between; align-items:center; }
.history-heading h2 { font-size:14px; margin:0; font-weight:650; }
#historySearch { width:100%; height:34px; padding:0 10px; border:1px solid var(--border); border-radius:8px; background:var(--surface); color:var(--text); font-size:13px; }
.history-filters { display:flex; align-items:center; gap:10px; }
#historyProject { flex:1; min-width:0; height:30px; padding:0 6px; border:1px solid var(--border); border-radius:7px; background:var(--bg); color:var(--muted); font-size:12px; }
.archive-filter { display:flex; align-items:center; gap:5px; color:var(--muted); font-size:12px; white-space:nowrap; }
#historyList { overflow-y:auto; flex:1; margin:0 -4px; padding:0 4px; }
.history-item { width:100%; display:block; border:0; background:transparent; text-align:left; padding:9px 10px; border-radius:8px; margin-bottom:2px; }
.history-item:hover { background:var(--surface); }
.history-item.active { background:var(--accent-soft); box-shadow:inset 3px 0 0 var(--accent); }
.history-item strong { display:block; font-size:13px; font-weight:550; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.history-item small { color:var(--faint); font-size:11px; display:block; margin-top:2px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.history-item .running { color:var(--accent); font-weight:600; }
.history-empty { color:var(--muted); font-size:12px; padding:12px 6px; }

/* ---------- dialogs and shared buttons ---------- */
dialog { border:1px solid var(--border); border-radius:14px; background:var(--bg); color:var(--text); width:min(92vw,400px); max-height:90dvh; overflow:auto; padding:20px; box-shadow:var(--shadow); }
dialog::backdrop { background:rgba(20,26,45,.45); }
dialog h2 { margin:0 0 8px; font-size:17px; letter-spacing:-.01em; }
dialog h3 { font-size:14px; }
dialog label { display:block; margin:14px 0 0; font-size:12px; color:var(--muted); }
dialog input { width:100%; display:block; margin-top:6px; padding:9px 11px; border:1px solid var(--border); border-radius:8px; background:var(--surface); color:var(--text); }
dialog .row { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; margin-top:20px; }
.hint { color:var(--muted); font-size:12px; margin:0; }
.text-button { color:var(--muted); background:none; border:0; border-radius:6px; padding:4px 8px; font-size:12px; }
.text-button:hover:not(:disabled) { background:var(--surface-2); color:var(--text); }
button.primary,button.ghost,button.danger { padding:7px 14px; border-radius:8px; border:1px solid transparent; font-size:13px; }
button.primary { background:var(--accent-fill); color:var(--on-accent); font-weight:600; } button.primary:hover:not(:disabled) { background:var(--accent-hover); }
button.ghost { background:var(--bg); border-color:var(--border-strong); color:var(--text); } button.ghost:hover:not(:disabled) { background:var(--surface); }
button.danger { background:var(--bg); border-color:var(--bad); color:var(--bad); }
.dialog-heading,.workstream-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.activity-dialog { width:min(94vw,820px); }
.connections-dialog { width:min(94vw,530px); }
.activity-metrics { display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); margin:18px 0; border-top:1px solid var(--border); border-left:1px solid var(--border); }
.activity-stat { display:flex; flex-direction:column; padding:12px; border-right:1px solid var(--border); border-bottom:1px solid var(--border); }
.activity-stat strong { font-size:20px; line-height:1.2; font-variant-numeric:tabular-nums; font-weight:600; }
.activity-stat small { color:var(--muted); font-size:11px; }
.connection-card { border:1px solid var(--border); border-radius:10px; padding:16px; margin:16px 0; }
.connection-card h3 { margin:0; font-size:15px; }
.connection-card a, dialog a { color:var(--accent); overflow-wrap:anywhere; }
.connection-buttons { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:14px; }
#atlassianContinue { display:block; margin-top:12px; }
.access-pill { flex:none; white-space:nowrap; padding:2px 9px; border-radius:999px; font-size:11px; font-weight:650; background:var(--surface-2); color:var(--muted); }
.access-pill[data-access="read"] { background:var(--ok-soft); color:var(--ok); } .access-pill[data-access="post"] { background:var(--accent-soft); color:var(--accent); } .access-pill[data-access="attention"] { background:var(--warn-soft); color:var(--warn); }
.posting-step { margin-top:16px; padding-top:14px; border-top:1px solid var(--border); }
.posting-step p { margin:0; }
.token-form label { margin-top:4px; } .token-form input + label { margin-top:12px; } .token-form .hint { margin-top:8px; }
.confirm-preview { margin:8px 0 0; padding:8px 10px; max-height:240px; overflow:auto; border:1px solid var(--border); border-radius:6px; background:var(--bg); font:12px/1.45 var(--mono); white-space:pre-wrap; overflow-wrap:anywhere; }
.provider-list { display:grid; gap:10px; margin:20px 0 12px; }
.provider-button { width:100%; background:var(--bg); color:var(--text); border:1px solid var(--border-strong); border-radius:8px; padding:10px 14px; font-size:13px; text-align:center; }
.provider-button:hover:not(:disabled) { border-color:var(--accent); background:var(--accent-soft); }
#accountName { font-size:13px; overflow-wrap:anywhere; }
#accountId { font:11px var(--mono); }
#authStatus { margin-top:12px; }
#pageAccessSettings { margin:18px 0; padding:14px; border:1px solid var(--border); border-radius:10px; }
#pageAccessSettings legend { font-size:13px; font-weight:600; padding:0 5px; }
#pageAccessSite { width:100%; padding:8px; background:var(--bg); color:var(--text); border:1px solid var(--border); border-radius:7px; }
#pageAccessOrigin { overflow-wrap:anywhere; }
.app-version { margin-top:12px; text-align:right; }

/* ---------- wider panels ---------- */
@media (min-width:440px) {
  .brand-logo { width:104px; }
  .starters { grid-template-columns:1fr 1fr; }
  .starter { flex-direction:column; align-items:flex-start; gap:10px; padding:12px; }
  .empty h1 { font-size:24px; }
}
@media (min-width:860px) {
  .history-panel { position:static; box-shadow:none; width:280px; background:var(--surface); }
}
@media (max-width:340px) {
  .brand-logo { width:78px; }
  .composer-hint { display:none; }
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
  .spinner { border-color:var(--accent); }
}

.offline.unreachable { background:var(--warn-bg); border-color:var(--warn-border); color:var(--text); }
.offline.unreachable .text-button { margin-left:4px; font-weight:600; }

/* Files saved in a turn, shown under the answer */
.answer-files { display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.image-card { margin:0; border:1px solid var(--border); border-radius:10px; overflow:hidden; background:var(--bg); }
.image-preview { display:block; width:100%; max-height:420px; object-fit:contain; object-position:top; background:var(--bg); cursor:zoom-in; border-bottom:1px solid var(--border); }
.image-card figcaption { display:flex; align-items:center; gap:10px; padding:8px 10px; }
.image-missing { display:block; padding:10px; color:var(--faint); font-size:12px; }
.answer-evidence summary { cursor:pointer; font-size:12px; color:var(--faint); padding:2px 0; }
.answer-evidence .file-card { margin-top:6px; }
.msg-body a { color:var(--accent); text-decoration:underline; text-underline-offset:2px; overflow-wrap:anywhere; }
.msg-body a.file-link { font-weight:600; }
