:root {
  /* layout: left session bar, large board, thin live strip at the bottom */
  --bg: #f4f5f8; --surface: #ffffff; --ink: #151922; --muted: #5a6372; --line: #dde1e8;
  --accent: #1f6feb; --voice: #c2255c; --org: #7048e8; --lay: #0b7285; --res: #2b8a3e; --l3: #d9480f;
  --fresh: #fff4d6; --danger: #c92a2a;
  --display: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --body: "IBM Plex Sans", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1117; --surface: #161a22; --ink: #e6e9ef; --muted: #98a1b0; --line: #2a303b;
    --accent: #5b9cff; --voice: #f06595; --org: #9775fa; --lay: #3bc9db; --res: #51cf66; --l3: #ff8c42;
    --fresh: #3a3216; --danger: #ff6b6b; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14.5px/1.5 var(--body); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 6px 12px; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { border-color: transparent; background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; height: 100%; }
.side { grid-row: 1 / span 2; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; padding: 14px 10px; min-height: 0; }
.brand { font: 800 17px var(--display); padding: 0 6px; display: flex; align-items: center; gap: 8px; }
.brand .logo { width: 18px; height: 18px; border-radius: 5px; background: linear-gradient(135deg, var(--accent), var(--voice)); }
.sess-list { display: grid; gap: 2px; overflow-y: auto; min-height: 0; flex: 1; align-content: start; }
.sess { text-align: left; border: 0; background: transparent; padding: 8px; border-radius: 7px; display: grid; gap: 1px; width: 100%; }
.sess:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.sess.active { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.sess .t { font-weight: 500; display: flex; gap: 6px; align-items: center; overflow: hidden; }
.sess .t span.n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess .m { font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--voice); flex: none; display: inline-block; }
.side-foot { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 13px; }
.side-foot a { color: var(--muted); text-decoration: none; padding: 4px 6px; border-radius: 6px; }
.side-foot a:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.engines { display: flex; gap: 10px; padding: 0 6px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.engines .ok::before, .engines .bad::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; }
.engines .ok::before { background: var(--res); } .engines .bad::before { background: var(--danger); }

.main { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; }
.head { display: flex; align-items: center; gap: 10px; padding: 14px 20px 10px; flex-wrap: wrap; }
.title { font: 800 24px/1.2 var(--display); letter-spacing: -.01em; margin: 0; padding: 2px 6px; border-radius: 6px; min-width: 120px; flex: 1 1 280px; border: 1px solid transparent; }
.title:hover { border-color: var(--line); }
.title[contenteditable="true"] { border-color: var(--accent); outline: none; background: var(--surface); }
.tools { display: flex; gap: 6px; flex-wrap: wrap; }
.stage { display: flex; min-height: 0; min-width: 0; }
.boardwrap { overflow: auto; padding: 4px 20px 24px; min-height: 0; flex: 1; min-width: 0; }
.transcript { width: 320px; flex: none; border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.transcript[hidden] { display: none; }
.transcript h2 { margin: 0; padding: 10px 14px; font: 600 12px var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.transcript h2 button { border: 0; background: none; font-size: 18px; padding: 0 4px; }
.tlist { flex: 1; overflow: auto; padding: 8px 14px; display: grid; gap: 8px; align-content: start; font-size: 14px; line-height: 1.45; }
.tlist p { margin: 0; }
.tlist time { font: 11px var(--mono); color: var(--muted); margin-right: 6px; }
.tlist .model { color: var(--voice); }
.tlist .act { font-size: 12px; color: var(--muted); padding-left: 10px; border-left: 2px solid var(--line); }
.tlist .act .who { font: 600 10px var(--mono); text-transform: uppercase; margin-right: 6px; color: var(--accent); }
.tlist .act.tool .who, .tlist .act.cmd .who { color: var(--voice); }
.tlist .run { font-size: 11px; color: var(--muted); text-align: center; }
.tacts { margin-left: auto; margin-right: 8px; font: 500 11px var(--body); text-transform: none; letter-spacing: 0; display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.tlive { margin: 0; padding: 8px 14px 12px; font-size: 14px; color: var(--muted); font-style: italic; min-height: 1.4em; border-top: 1px dashed var(--line); }
#tBtn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
@media (max-width: 900px) { .transcript { position: fixed; right: 0; top: 0; bottom: 58px; z-index: 20; box-shadow: -8px 0 24px rgb(0 0 0 / .25); max-width: 90vw; } }
.free { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.free > .card { flex: 1 1 320px; }
.free > .card.sized { flex: none; }
.card { resize: both; overflow: auto; position: relative; }
.card.dragging { opacity: .4; }
.card.drop-before { box-shadow: -4px 0 0 var(--accent); }
.card.drop-after { box-shadow: 4px 0 0 var(--accent); }
.cardctl { margin-left: auto; display: inline-flex; gap: 2px; }
.cardctl button { border: 0; background: none; padding: 0 5px; font-size: 14px; color: var(--muted); line-height: 1.4; border-radius: 4px; }
.cardctl button:hover { color: var(--ink); background: var(--line); }
.cardctl .grip { cursor: grab; }
.card.max { position: fixed; inset: 20px; z-index: 30; resize: none; width: auto !important; height: auto !important; box-shadow: 0 20px 60px rgb(0 0 0 / .4); }
.card.max .vis svg, .free > .card.sized .vis svg { width: 100%; max-width: none !important; height: auto; }
.card.max .vis svg { max-height: calc(100vh - 110px); }
.vis svg.mindmap { display: block; margin: 0 auto; }
.card.max .vis svg.mindmap { width: 100%; min-width: 0 !important; }
.card.max .vis:has(svg.mindmap) { display: flex; align-items: center; min-height: calc(100vh - 110px); }
.card.max .vis .chartbox { height: calc(100vh - 120px); }
.free > .card.sized .vis .chartbox { height: auto; min-height: 200px; }
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .45); z-index: 29; }
.board { display: grid; gap: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.row { display: grid; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .row { grid-template-columns: 1fr !important; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 8px; align-content: start; min-width: 0; transition: background-color .8s; }
.card.wide { grid-column: span 2; }
@media (max-width: 760px) { .card.wide { grid-column: auto; } }
.card.flash { background: var(--fresh); }
.card.temp { border: 1.5px dashed var(--org); grid-column: 1 / -1; }
.card h3 { margin: 0; font: 600 12px var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card h3 .cnt { font-weight: 500; color: var(--muted); opacity: .8; }
.badge { font: 500 11px var(--mono); text-transform: none; letter-spacing: 0; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.badge.pin { color: var(--org); border-color: var(--org); }
.badge.tmp { background: var(--org); border-color: var(--org); color: #fff; }
.badge.stale { color: var(--l3); border-color: var(--l3); }
ul.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
li.item { display: flex; gap: 8px; align-items: flex-start; padding: 4px 4px; border-radius: 6px; position: relative; }
li.item:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
li.item.done .txt { text-decoration: line-through; color: var(--muted); }
.check { width: 16px; height: 16px; margin-top: 3px; flex: none; accent-color: var(--res); cursor: pointer; }
.bullet { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); margin: 9px 5px 0 6px; flex: none; }
.body { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; }
.txt { border-radius: 4px; padding: 0 2px; cursor: text; }
.txt[contenteditable="true"] { outline: 1px solid var(--accent); background: var(--surface); }
.chip { font: 500 11.5px var(--mono); padding: 0 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); background: transparent; line-height: 1.6; }
button.chip { cursor: pointer; }
.chip.owner { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.chip.owner.unk { color: var(--l3); border-color: color-mix(in srgb, var(--l3) 50%, transparent); border-style: dashed; }
.chip.source { color: var(--res); border-color: var(--res); }
.chip.checking { color: var(--l3); border-color: var(--l3); }
.chip.edited { border: 0; padding: 0; opacity: .6; }
.srcs { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; width: 100%; }
.srcs a { color: var(--muted); }
.del { visibility: hidden; border: 0; background: transparent; color: var(--muted); padding: 0 4px; font-size: 16px; line-height: 1; }
li.item:hover .del, li.item:focus-within .del { visibility: visible; }
.add { display: flex; gap: 6px; }
.add input { flex: 1; border: 1px dashed var(--line); background: transparent; border-radius: 6px; padding: 4px 8px; }
.add input:focus { border-style: solid; border-color: var(--accent); outline: none; }
.vis { overflow: auto; min-height: 60px; }
.vis svg:not(.mindmap) { display: block; margin: 0 auto; }
.vis svg { max-width: 100%; height: auto; }
.vis .chartbox { position: relative; height: 240px; }
.vis .err { color: var(--l3); font-size: 13px; }
.vis details { font-size: 12px; color: var(--muted); }
.vis pre { white-space: pre-wrap; font: 12px var(--mono); }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.opt { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 8px; align-content: start; }
.opt .oh { display: flex; justify-content: space-between; align-items: center; gap: 8px; font: 600 13px var(--mono); }
.empty { border: 1px dashed var(--line); border-radius: 12px; padding: 28px; display: grid; gap: 10px; justify-items: start; max-width: 640px; }
.empty h2 { margin: 0; font: 800 20px var(--display); }
.empty ul { margin: 0; padding-left: 18px; color: var(--muted); display: grid; gap: 4px; }

.strip { grid-column: 2; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; min-height: 58px; }
.startbtn { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; padding: 8px 16px; border-radius: 999px; }
.startbtn.live { background: var(--voice); border-color: var(--voice); color: #fff; }
.startbtn .dot { background: currentColor; }
.startbtn.live .dot { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 5px 12px; font-size: 13px; }
.seg button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 600; }
.meter { position: relative; width: 70px; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--muted); transition: width .08s; }
.meter.open i { background: var(--res); }
.meter b { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); opacity: .6; }
.meter.novad b { display: none; }
.gate { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.gate label { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.gate input[type=range] { width: 80px; accent-color: var(--accent); }
.gate input[type=range]:disabled { opacity: .4; }
#muteBtn[aria-pressed="true"] { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.caption { flex: 1 1 280px; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.caption .u { color: var(--ink); }
.caption .v { color: var(--voice); }
.layers { display: flex; gap: 4px; flex-wrap: wrap; }
.lchip { font: 500 11px var(--mono); padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); display: inline-flex; gap: 5px; align-items: center; }
.lchip.running { color: var(--ink); border-color: var(--accent); }
.lchip.running::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
.lchip.error { color: var(--danger); border-color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }
.typed { display: flex; gap: 6px; flex: 0 1 280px; }
.typed input { flex: 1; min-width: 120px; border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; background: var(--bg); }
.consent { font-size: 12px; color: var(--voice); font-weight: 500; }

.toasts { position: fixed; top: 14px; right: 14px; display: grid; gap: 8px; z-index: 50; max-width: min(420px, calc(100vw - 28px)); }
.toast { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 12px; box-shadow: 0 8px 24px rgb(0 0 0 / .12); font-size: 14px; display: grid; gap: 4px; }
.toast.source { border-left-color: var(--res); } .toast.error { border-left-color: var(--danger); }
.toast a { color: var(--muted); font-size: 12px; }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 18px; max-width: 420px; box-shadow: 0 20px 50px rgb(0 0 0 / .25); }
dialog::backdrop { background: rgb(0 0 0 / .35); }
dialog h2 { margin: 0 0 6px; font: 700 18px var(--display); }
dialog .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; }
  .side { grid-row: auto; border-right: 0; border-bottom: 1px solid var(--line); max-height: 30vh; }
  .strip { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) { .card { transition: none; } .startbtn.live .dot, .lchip.running::before { animation: none; } }
.who { color: var(--muted); font-size: 12px; padding: 0 6px; overflow-wrap: anywhere; }
.who a { padding: 0; }
.inline { display: inline; margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

/* ---- live windows (lenses) ---- */
.ldot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--accent); }
.ldot.paused { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.ldot.pending { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent); }
.ldot.busy { animation: lpulse 1s ease-in-out infinite; }
@keyframes lpulse { 50% { transform: scale(1.5); opacity: .5; } }
.card.lens.paused > :not(h3) { opacity: .85; }
.card.pending { border-style: dashed; border-color: var(--accent); }
.card .drawing { color: var(--muted); font-size: 13px; padding: 10px 2px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 10%, transparent), transparent) 0 0 / 200% 100%; animation: shimmer 1.6s linear infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.lnote { margin: 0; font-size: 12px; color: var(--muted); white-space: pre-line; }
.ghost { margin: 0; font-size: 13px; color: var(--muted); font-style: italic; border-left: 2px solid var(--accent); padding-left: 8px; }
.ghost.failed { border-color: var(--l3); font-style: normal; }
.ghost button { border: 1px solid var(--line); background: none; border-radius: 5px; padding: 0 6px; font-size: 12px; }
.card.fading { animation: wfade .9s ease forwards; pointer-events: none; }
@keyframes wfade { 60% { opacity: 0; transform: scale(.98); } 100% { opacity: 0; transform: scale(.98); max-height: 0; padding-top: 0; padding-bottom: 0; margin: 0; } }
@media (prefers-reduced-motion: reduce) { .card.fading, .ldot.busy, .card .drawing { animation: none; } .card.fading { opacity: .3; } }
.vis g.node.glow rect, .vis g.node.glow polygon, .vis g.node.glow path, .vis g.node.glow circle { stroke: var(--accent) !important; stroke-width: 3px !important; animation: nglow 3.5s ease-out forwards; }
@keyframes nglow { from { filter: drop-shadow(0 0 6px var(--accent)); } to { filter: none; stroke-width: 1px; } }
.compose { display: flex; gap: 6px; }
.compose input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); }
.compose .ptt { white-space: nowrap; touch-action: none; user-select: none; }
.compose .ptt.rec { background: var(--l3); color: #fff; border-color: var(--l3); }
.cardctl .undochip { border: 1px solid var(--accent); color: var(--accent); font-size: 12px; }
body.solo .side, body.solo .tools { display: none; }
body.solo .card.max { position: static; inset: auto; box-shadow: none; resize: both; }
.tomb { display: grid; gap: 12px; padding: 12px; }
.card.closed { opacity: .8; }
body.solo .app { grid-template-columns: minmax(0, 1fr); }
body.solo .strip { grid-column: 1; }
/* ---- shared window page ---- */
body.sharepage { min-height: 100vh; background: var(--bg); }
.sharewrap { max-width: 1100px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-left)); display: grid; gap: 12px; }
.sharehead { display: flex; align-items: center; gap: 10px; }
.sharehead h1 { margin: 0; font-size: 22px; }
.sharewrap .vis svg { max-width: 100%; height: auto; }
.sharefoot { color: var(--muted); font-size: 12px; margin: 0; }
.sharelist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; } .sharelist button { margin-left: 6px; font-size: 12px; }
[hidden] { display: none !important; }
