:root {
  --bg: #f4f5f8; --panel: #ffffff; --panel2: #eceef4; --ink: #1b2130; --muted: #667089; --line: #d6dae5;
  --accent: #3b6df0; --ok: #2e9e6b; --warn: #c97a12; --bad: #d03f3f; --cell-a: #eef0f6; --cell-b: #f8f9fc;
  --shadow: 0 8px 28px rgba(20, 30, 60, .16); --r: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f121a; --panel: #181c27; --panel2: #222836; --ink: #e5e8f1; --muted: #8b95ad; --line: #2c3345;
    --accent: #7ba0ff; --ok: #4cc38a; --warn: #e5a244; --bad: #ef6b6b; --cell-a: #151925; --cell-b: #1b2030; --shadow: 0 8px 28px rgba(0, 0, 0, .5); }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { display: flex; flex-direction: column; background: var(--bg); color: var(--ink); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sr, .sr-focus { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 99; background: var(--panel); padding: 6px 10px; }

#bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; z-index: 5; }
.brand { font-weight: 800; letter-spacing: .14em; color: var(--accent); margin-right: 4px; }
#bar button, #bar select { background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 4px 10px; min-height: 30px; }
#bar button:hover:not(:disabled) { border-color: var(--accent); }
#bar button:disabled { opacity: .4; cursor: default; }
#bar button[aria-pressed=true], #bar button[aria-expanded=true] { background: var(--accent); color: #fff; border-color: var(--accent); }
.nav { display: flex; gap: 4px; }
.crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; }
#bar .crumb { background: none; border: 0; padding: 2px 6px; color: var(--muted); white-space: nowrap; }
#bar .crumb[aria-current] { color: var(--ink); font-weight: 600; }
.sep { color: var(--muted); }
.spacer { flex: 1; }
.slider { display: flex; align-items: center; gap: 6px; color: var(--muted); } .slider input { width: 110px; accent-color: var(--accent); }
.slider output { min-width: 34px; font-variant-numeric: tabular-nums; }
.net { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--panel2); } .net.on { color: var(--ok); } .net.off { color: var(--bad); }
.count { background: var(--accent); color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; margin-left: 2px; }
#bar button[aria-expanded=true] .count { background: #fff; color: var(--accent); }
kbd { font: inherit; font-size: 11px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted); }
#banner { padding: 5px 14px; background: color-mix(in srgb, var(--accent) 16%, var(--panel)); font-size: 13px; text-align: center; }
#banner.warn { background: color-mix(in srgb, var(--warn) 22%, var(--panel)); }

#stage { position: relative; flex: 1; min-height: 0; }
#field { position: absolute; inset: 0; touch-action: none; display: block; }
#overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#a11y { top: 0; left: 0; } #a11y ul { list-style: none; margin: 0; padding: 0; }
.surface { position: absolute; pointer-events: auto; background: var(--panel); border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.surface-body { height: 100%; overflow: auto; padding: 16px 22px 28px; }

/* Lens view-model rendering */
.stack { display: flex; flex-direction: column; gap: 14px; max-width: 980px; margin: 0 auto; }
.hdr { display: flex; align-items: center; gap: 10px; }
.hdr h2 { margin: 0; font-size: 22px; font-weight: 650; flex: 1; }
.chip-type { background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--c); border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.state, .badge { background: var(--panel2); border-radius: 99px; padding: 2px 10px; font-size: 12px; color: var(--muted); }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 18px; }
.field { display: flex; flex-direction: column; gap: 3px; padding: 4px 6px; border-radius: 8px; border: 1px solid transparent; position: relative; }
.flabel { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.field input[type=text], .field input[type=number], .field input[type=date], .field input[type=datetime-local], .field select, .field textarea, .sec input[type=text] {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; }
.field textarea { resize: vertical; }
.field input:disabled, .field select:disabled, .field textarea:disabled { opacity: .7; }
.field input.invalid { border-color: var(--bad); }
.field input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.row { display: flex; gap: 8px; align-items: center; } .unit { color: var(--muted); font-size: 12px; }
.sealed { color: var(--muted); font-style: italic; padding: 6px 0; } .sealed.open { color: var(--ok); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; gap: 4px; align-items: center; background: var(--panel2); border-radius: 99px; padding: 2px 4px 2px 10px; }
.chip .x { border: 0; background: none; color: var(--muted); padding: 0 6px; }
.link { background: none; border: 0; color: var(--accent); padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.field[data-mark=pending] { border: 1px dashed var(--warn); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.field[data-mark=pending]::after, .field[data-mark=held]::after, .field[data-mark=rejected]::after { position: absolute; right: 8px; top: 4px; font-size: 11px; }
.field[data-mark=pending]::after { content: "pending"; color: var(--warn); }
.field[data-mark=held] { border: 1px dashed var(--accent); } .field[data-mark=held]::after { content: "awaiting"; color: var(--accent); }
.field[data-mark=rejected] { border: 1px solid var(--bad); } .field[data-mark=rejected]::after { content: "rejected"; color: var(--bad); }
.sec h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sec summary { cursor: pointer; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.thread, .hist, ul.plain { list-style: none; margin: 0 0 8px; padding: 0; }
.thread li { padding: 6px 0; border-bottom: 1px solid var(--line); } .thread time, .hist .by { color: var(--muted); font-size: 11px; margin-left: 8px; }
.hist li { padding: 3px 0; font-size: 13px; } code { background: var(--panel2); padding: 0 4px; border-radius: 4px; }
progress { width: 100%; height: 8px; accent-color: var(--accent); }
table { border-collapse: collapse; width: 100%; } th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
tbody tr { cursor: pointer; } tbody tr:hover { background: var(--panel2); }

.columns { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.col { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; min-height: 140px; }
.col.over { outline: 2px dashed var(--accent); }
.col h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; }
.col .n { background: var(--panel2); border-radius: 99px; padding: 0 7px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; }
.card:hover { border-color: var(--accent); } .card[draggable=true] { cursor: grab; }
.card .ct { font-weight: 600; } .card .cs { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card[data-mark=pending] { border-style: dashed; border-color: var(--warn); } .card[data-mark=rejected] { border-color: var(--bad); }

#queues { position: fixed; right: 12px; top: 56px; bottom: 12px; width: min(340px, calc(100vw - 24px)); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px; z-index: 6; }
#queues h2 { margin: 0 0 8px; font-size: 16px; } #queues h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; display: flex; justify-content: space-between; }
#queues .n { background: var(--panel2); border-radius: 99px; padding: 0 7px; }
.qitem { display: flex; flex-direction: column; text-align: left; width: 100%; background: none; border: 0; border-radius: 8px; padding: 6px 8px; } .qitem:hover { background: var(--panel2); }
.qitem small, .empty { color: var(--muted); font-size: 12px; } li.empty { padding: 4px 8px; }

#ask { position: fixed; inset: 0; background: rgba(10, 14, 24, .45); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; z-index: 20; }
#ask[hidden] { display: none; }
.askbox { width: min(620px, calc(100vw - 24px)); background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.askbox input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 14px 16px; font-size: 16px; outline: none; }
#ask-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
#ask-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
#ask-list li.sel { background: var(--accent); color: #fff; } #ask-list li small { opacity: .75; } #ask-list li.empty { cursor: default; }

#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 30; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 9px; box-shadow: var(--shadow); max-width: 90vw; }
.toast.bad { background: var(--bad); color: #fff; } .toast.warn { background: var(--warn); color: #fff; }
.pop { position: fixed; z-index: 25; width: 290px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); font-size: 13px; }
.pop ul { margin: 6px 0 0; padding-left: 16px; } .pop small { color: var(--muted); display: block; }

/* Linear mode */
#linear { position: absolute; inset: 0; overflow: auto; padding: 10px 14px 40px; background: var(--bg); }
#linear ul { list-style: none; margin: 0; padding: 0; } #linear ul ul { margin-left: 18px; border-left: 1px solid var(--line); padding-left: 8px; }
#linear [role=treeitem] { outline: none; } #linear [role=treeitem]:focus > .orow { outline: 2px solid var(--accent); }
.orow { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; cursor: pointer; min-height: 38px; }
.orow:hover { background: var(--panel2); } .orow.cell { font-weight: 650; font-size: 15px; }
.twist { width: 14px; color: var(--muted); } .dotc { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.oname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .otype { color: var(--muted); font-size: 12px; }
.orow .show { font-size: 12px; } .detail { margin: 4px 0 10px 24px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.detail .form { grid-template-columns: 1fr; } .detail .columns { grid-auto-flow: row; grid-auto-columns: auto; }

@media (max-width: 700px) {
  #bar { gap: 5px; padding: 6px 8px; } .slider input { width: 70px; } .net, #asof-label { display: none; }
  .surface-body { padding: 12px; } .crumbs { order: 9; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
.chip-type, .otype { text-transform: capitalize; }

/* Onboarding, dialogs, join screen */
.screen { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); color: var(--ink); z-index: 100; padding: 16px; }
.card-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 20px 22px; max-width: 30rem; width: 100%; display: grid; gap: 10px; }
.card-box h1, .card-box h2 { margin: 0; font-size: 20px; } .card-box p { margin: 0; }
.card-box input[type=text], .stackv input[type=text] { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.stackv { display: grid; gap: 6px; } .err { color: var(--bad); min-height: 1em; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .row > input { flex: 1; min-width: 8rem; } .row.end { justify-content: flex-end; }
.muted { color: var(--muted); }
button.act { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; min-height: 32px; }
button.act:hover:not(:disabled) { border-color: var(--accent); } button.act:disabled { opacity: .5; }
button.act.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.modal { position: fixed; inset: 0; background: rgba(10, 14, 24, .45); display: grid; place-items: center; z-index: 40; padding: 16px; }
#welcome { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; overflow: auto; pointer-events: none; z-index: 4; }
#welcome[hidden] { display: none; } .welcome-box { pointer-events: auto; max-width: 34rem; max-height: 100%; overflow: auto; }
.wsteps { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 12px; }
.wstep { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.wstep.done { opacity: .75; } .wh { display: flex; gap: 8px; align-items: center; }
.tick { width: 22px; height: 22px; border-radius: 50%; background: var(--panel2); display: grid; place-items: center; font-size: 12px; flex: none; }
.wstep.done .tick { background: var(--ok); color: #fff; }
.invite-url { font-family: ui-monospace, monospace; font-size: 12px; }
#hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px; box-shadow: var(--shadow); font-size: 13px; color: var(--muted); z-index: 3; max-width: 92%; text-align: center; pointer-events: none; }
#hint[hidden] { display: none; }

/* Commitment state pill and actions */
.statepill { background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--c); border-radius: 99px; padding: 3px 12px; font-weight: 600; text-transform: capitalize; }
.actions { gap: 6px; }

/* Queues */
#queues li.proposal { display: grid; gap: 4px; padding-bottom: 6px; } .verdicts { display: flex; gap: 6px; }
.due.late { color: var(--bad); font-weight: 600; }
.qview { margin: 0 0 14px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.qview:empty { display: none; } .qview h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 8px 0 4px; display: flex; justify-content: space-between; }
.qview ul { list-style: none; margin: 0; padding: 0; }

/* Top bar: who, history popover */
.who { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 10rem; }
.histwrap { position: relative; }
.popover { position: absolute; right: 0; top: calc(100% + 6px); z-index: 12; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 12px; display: grid; gap: 10px; min-width: 15rem; }
.popover[hidden] { display: none; } .popover .slider input { flex: 1; }

/* List (linear) mode */
.detail .columns { display: none; }
@media (max-width: 700px) {
  #bar { flex-wrap: nowrap; overflow: visible; } #bar .brand, #bar .crumbs, #bar #who, #bar #back, #bar #fwd { display: none; }
  #bar .spacer { flex: 1; min-width: 0; } #bar button { padding: 4px 8px; } #askbtn kbd { display: none; }
  .histwrap .popover { position: fixed; left: 8px; right: 8px; top: 48px; }
}
#welcome.docked { place-items: end end; padding: 14px; } #welcome.docked .welcome-box { max-width: 24rem; box-shadow: var(--shadow); }

.ai-box { display: block !important; cursor: default !important; }
.ai-answer { white-space: pre-wrap; line-height: 1.45; padding: 4px 2px; } .ai-answer.failed { color: var(--bad); } .ai-answer.unconfigured { font-weight: 600; }
.ai-wait { color: var(--muted); padding: 4px 2px; }
.ai-cites { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.ai-cite { border: 1px solid var(--line); background: var(--panel2); border-radius: 99px; padding: 2px 10px; font-size: 12px; }
.ai-review { margin-top: 10px; }

/* presence cursors, calls */
#cursors { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.peer-cursor { position: absolute; left: 0; top: 0; will-change: transform; transition: transform 90ms linear; --c: hsl(var(--hue) 70% 48%); }
.peer-cursor[hidden] { display: none; }
.peer-cursor .dot { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px #fff8; }
.peer-name { position: absolute; left: 8px; top: 6px; pointer-events: auto; font: 11px/1.4 system-ui, sans-serif; background: var(--c); color: #fff; border: 0; border-radius: 4px; padding: 1px 6px; white-space: nowrap; cursor: pointer; }
body.following #stage { outline: 2px solid #3b6df0; outline-offset: -2px; }
#calldock { position: fixed; top: 56px; left: 12px; z-index: 25; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.callbadge { background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 4px 6px 4px 12px; box-shadow: var(--shadow); font-size: 13px; display: flex; align-items: center; }
.callbadge .live { color: #d33; }
#callpanel { position: fixed; right: 12px; bottom: 12px; z-index: 26; width: min(420px, 94vw); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; }
#callpanel[hidden] { display: none; }
.ctiles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ctile { margin: 0; position: relative; background: #111; border-radius: 8px; overflow: hidden; aspect-ratio: 4/3; }
.ctile-v { width: 100%; height: 100%; object-fit: cover; }
.ctile figcaption { position: absolute; left: 4px; bottom: 4px; font-size: 11px; color: #fff; background: #0008; border-radius: 4px; padding: 0 5px; }
.ccontrols { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.ccontrols .ctitle { flex: 1 1 100%; font-size: 12px; }
.cbtn { font: inherit; font-size: 12px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); color: inherit; cursor: pointer; }
.cbtn[aria-pressed=true] { background: #3b6df022; border-color: #3b6df0; }
.cbtn.danger { background: #d33; color: #fff; border-color: #d33; }
.surface .callbtn { position: absolute; top: 4px; right: 8px; z-index: 2; font: inherit; font-size: 12px; padding: 2px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); color: inherit; cursor: pointer; }
.surface .callbtn[data-live]:not([data-live="0"]) { border-color: #d33; color: #d33; }

/* Design Kit: Frame editor */
.surface-body.editor-body { padding: 0; overflow: hidden; }
.fed { display: flex; flex-direction: column; height: 100%; min-height: 0; font-size: 12px; }
.fed-bar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px 70px 6px 8px; border-bottom: 1px solid var(--line); background: var(--panel); }
.fed-bar button { font: inherit; min-width: 28px; height: 26px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: inherit; cursor: pointer; }
.fed-bar button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.fed-bar input[type=color] { width: 26px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; }
.fed-bar .sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.fed-count { margin-left: auto; color: var(--muted); }
.fed-main { display: flex; flex: 1; min-height: 0; }
.fed-stage { position: relative; flex: 1; min-width: 0; overflow: hidden; background: #e9ebf0; }
.fed-canvas { position: absolute; inset: 0; touch-action: none; outline: none; }
.fed-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.fed-text { position: absolute; z-index: 3; font-family: system-ui, sans-serif; line-height: 1.25; background: rgba(255,255,255,.85); border: 1px dashed var(--accent); outline: none; resize: none; padding: 0; margin: 0; }
.fed-side { width: 210px; flex: none; border-left: 1px solid var(--line); background: var(--panel); overflow: auto; }
.fed-tabs { display: flex; border-bottom: 1px solid var(--line); }
.fed-tabs button { flex: 1; font: inherit; padding: 6px 2px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.fed-tabs button[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -2px var(--accent); }
.fed-pbody { padding: 8px; display: grid; gap: 6px; align-content: start; }
.fed-f { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 6px; }
.fed-f input[type=number], .fed-f input[type=text], .fed-f textarea { width: 100%; box-sizing: border-box; font: inherit; }
.fed-c { display: flex; align-items: center; gap: 4px; }
.fed-kind { margin: 0; font-weight: 600; text-transform: capitalize; }
.fed-btn { font: inherit; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: inherit; cursor: pointer; }
.fed-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.fed-list li { display: flex; align-items: center; gap: 6px; }
.fed-list li span { flex: 1; }
.fed-sw { width: 22px; height: 22px; border-radius: 5px; border: 2px solid; cursor: pointer; padding: 0; }
.fed-sw[aria-pressed="true"] { outline: 2px solid var(--accent); }
.fed-ov { display: flex; align-items: center; gap: 4px; }
.fed-ov span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fed-ov input[type=text] { width: 70px; }
.fed.narrow .fed-side { display: none; }
.surface.expanded { inset: 0 !important; left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; z-index: 5; display: flex; flex-direction: column; }
.surface.expanded > .surface-body { flex: 1; height: auto; min-height: 0; }
.surface.expanded > .callbtn, .surface.expanded .hdr h2, .surface.expanded .hdr .callbtn { display: none; }

/* UX review 2: list mode at narrow widths, outline measure line, held files */
.omeasure { display: block; color: var(--muted); font-size: 12px; font-weight: 400; white-space: normal; }
#cursors[hidden] { display: none; }
.held-file { color: var(--muted); }
.invite-made { margin-bottom: 6px; }
@media (max-width: 600px) {
  #linear ul ul { margin-left: 6px; padding-left: 0; }
  #linear .detail { margin-left: 0; min-width: 0; max-width: 100%; box-sizing: border-box; }
  #linear .detail input, #linear .detail select, #linear .detail textarea { max-width: 100%; min-width: 0; box-sizing: border-box; }
  #linear .detail .row, #linear .detail .form > * { min-width: 0; }
}
textarea.collab { width: 100%; box-sizing: border-box; resize: none; overflow: hidden; min-height: 40px; }
.add-paragraph { align-self: flex-start; }
.hdr .callbtn { font: inherit; font-size: 12px; padding: 2px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); color: inherit; cursor: pointer; }
.hdr .callbtn[data-live]:not([data-live="0"]) { border-color: #d33; color: #d33; }
.surface:has(.hdr .callbtn) > .callbtn { display: none; }      /* the header carries it; Frame editors have no header and keep the corner one */
.field .row .link[aria-label^="Go to"] { padding: 0 6px; font-size: 16px; }
.fed-thumb { max-width: 100%; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; }

/* Apps: launcher, app bar, help */
#bar button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.newwrap .popover { right: auto; left: 0; min-width: 21rem; gap: 2px; padding: 8px; }
.newwhere { font-size: 12px; color: var(--muted); padding: 2px 8px 6px; }
.newitem { display: grid; grid-template-columns: 20px auto 1fr; gap: 8px; align-items: center; text-align: left; background: none; border: 0; border-radius: 7px; padding: 6px 8px; }
#bar .newitem { background: none; border: 0; min-height: 0; }
.newitem small { color: var(--muted); font-size: 12px; } .newitem:hover, .newitem:focus-visible { background: var(--panel2); }
.newmenu hr, #newmenu hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.appicon { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; }
@media (max-width: 700px) { .newwrap .popover { position: fixed; left: 8px; right: 8px; top: 48px; min-width: 0; } #bar .newwrap { display: block; } }
.appbar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--panel); flex: none; }
.appbar .appback, .appbar .appclose { background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 4px 10px; min-height: 30px; }
.appbar .appclose { padding: 4px 9px; }
.appbar .apptitle { font-size: 16px; font-weight: 600; background: transparent; border: 1px solid transparent; border-radius: 7px; padding: 4px 8px; min-width: 8rem; max-width: 40vw; }
.appbar .apptitle:hover, .appbar .apptitle:focus { border-color: var(--line); background: var(--bg); }
.appbar .spacer { flex: 1; }
.appbar .act { min-height: 30px; }
.help-box { max-width: 40rem; max-height: calc(100vh - 32px); overflow: auto; }
.help-apps { display: grid; gap: 4px; padding-left: 8px; }
#helpbtn { min-width: 30px; }
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-log { flex: 1; overflow: auto; padding: 14px 20px; display: flex; flex-direction: column; gap: 2px; max-width: 820px; width: 100%; margin: 0 auto; }
.chat-day { align-self: center; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
.chat-msg.head { margin-top: 10px; } .chat-who time { color: var(--muted); font-size: 11px; margin-left: 8px; }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; } .chat-empty { color: var(--muted); margin: auto; }
.chat-compose { padding: 8px 20px 14px; max-width: 820px; width: 100%; margin: 0 auto; }
.chat-input { width: 100%; resize: none; min-height: 40px; max-height: 8em; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.chat-input:disabled { opacity: .7; }
.grid-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.grid-scroll { flex: 1; overflow: auto; }
.grid-bar { padding: 8px 12px; border-top: 1px solid var(--line); }
table.grid { border-collapse: separate; border-spacing: 0; width: auto; min-width: 100%; }
table.grid th, table.grid td { padding: 0; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; }
table.grid thead th { position: sticky; top: 0; background: var(--panel2); z-index: 1; min-width: 9rem; }
table.grid tbody tr { cursor: default; } table.grid tbody tr:hover { background: transparent; }
.gcorner, .gnum { width: 44px; min-width: 44px !important; background: var(--panel2); text-align: center !important; position: sticky; left: 0; z-index: 2; }
.gcell, .gcol { width: 100%; min-width: 9rem; border: 0; background: transparent; padding: 7px 10px; border-radius: 0; }
.gcell:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--panel); }
.gcell.num { text-align: right; font-variant-numeric: tabular-nums; }
.gcell[data-mark=pending] { background: color-mix(in srgb, var(--warn) 12%, transparent); }
.gcell[data-mark=held] { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.gcell[data-mark=rejected] { background: color-mix(in srgb, var(--bad) 18%, transparent); }
.gcol { font-weight: 600; } .ghead { display: flex; align-items: center; } .gx { display: none; border: 0; background: none; color: var(--muted); padding: 0 8px; }
.ghead:focus-within .gx, th:hover .gx { display: block; }
.gadd { border: 0; background: none; color: var(--accent); font-size: 18px; padding: 2px 12px; }
.gsum td, .gsum th { background: var(--panel2); font-weight: 600; } .gsumc { padding: 7px 10px !important; text-align: right !important; font-variant-numeric: tabular-nums; }
.rowmenu summary { cursor: pointer; padding: 7px 0; color: var(--muted); list-style: none; } .rowmenu[open] { position: relative; }
.rowmenu .gdel { position: absolute; left: 36px; top: 2px; z-index: 5; white-space: nowrap; box-shadow: var(--shadow); }
.deck { display: flex; height: 100%; min-height: 0; }
.deck-side { width: 184px; flex: none; display: flex; flex-direction: column; gap: 8px; padding: 8px; border-right: 1px solid var(--line); background: var(--panel2); }
.deck-strip { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.sthumb { position: relative; background: #fff; border: 2px solid var(--line); border-radius: 6px; padding: 0; cursor: pointer; flex: none; }
.sthumb[aria-selected=true] { border-color: var(--accent); }
.sthumb-c { display: block; width: 154px; height: 87px; margin: 0 auto; background: #fff; }
.sthumb .n { position: absolute; left: 4px; top: 2px; font-size: 11px; color: #555; background: #fffc; border-radius: 4px; padding: 0 4px; }
.sthumb .smove { position: absolute; right: 2px; bottom: 2px; display: flex; gap: 2px; }
.smove button { font-size: 11px; padding: 0 5px; border: 1px solid var(--line); background: var(--panel); border-radius: 4px; }
.deck-main { flex: 1; min-width: 0; } .deck-empty { padding: 20px; }
#present { position: fixed; inset: 0; background: #000; z-index: 1000; outline: none; cursor: none; }
#present canvas { display: block; } #present .pcount { position: absolute; right: 12px; bottom: 8px; color: #fff8; font-size: 13px; }
.vb-box { max-width: 44rem; max-height: calc(100vh - 32px); overflow: auto; }
.vb-form { display: grid; gap: 10px; } .vb-row { display: grid; grid-template-columns: 5.5rem 1fr; gap: 8px; align-items: start; }
.vb-row select, .vb-row input[type=text] { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }
.vb-fields { display: flex; flex-wrap: wrap; gap: 4px 14px; } .vb-filters { display: grid; gap: 6px; } .vb-h { margin: 4px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.vb-preview { border: 1px solid var(--line); border-radius: 8px; padding: 8px; max-height: 14rem; overflow: auto; background: var(--bg); }
.surface.expanded .stack.page { max-width: 720px; }
textarea.collab.md-h1 { font-size: 26px; font-weight: 700; } textarea.collab.md-h2 { font-size: 20px; font-weight: 650; }
textarea.collab.md-li { padding-left: 22px; background: radial-gradient(circle at 11px 50%, var(--ink) 0 2.5px, transparent 3px) no-repeat; }
