:root {
  --ink: #1b1f30;
  --panel: #252a3f;
  --panel-2: #2e3450;
  --line: #3a4163;
  --cyan: #9cc6ff;
  --paper: #eef1f8;
  --dim: #9aa3c0;
  --serif: "Fraunces", Georgia, serif;
  --radius: 12px;
  --redline: #ff6f5e;
  --ok: #7fe3a6;
  --warn: #ffc864;
  --display: "Silkscreen", "Courier New", monospace;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ink);
  color: var(--paper);
  font: 14px/1.55 var(--mono);
  background-image: radial-gradient(1200px 700px at 50% -10%, #2c3354 0%, transparent 70%);
  min-height: 100vh;
}
a { color: var(--cyan); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
[hidden] { display: none !important; }

/* top bar */
header.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--ink) 92%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
header.top .bar { display: flex; align-items: center; gap: 20px; height: 56px; padding: 0 16px; max-width: 1400px; margin: 0 auto; }
.brand { font-family: var(--display); font-size: 18px; color: var(--cyan); text-decoration: none; letter-spacing: .04em; white-space: nowrap; }
.brand span { color: var(--redline); }
.tabs { display: flex; gap: 4px; }
.tabs button { background: none; border: 1px solid transparent; color: var(--dim); padding: 6px 12px; cursor: pointer; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.tabs button[aria-selected="true"] { color: var(--cyan); border-color: var(--line); background: var(--panel); }
.tabs button:hover { color: var(--paper); }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--dim); }
@media (max-width: 640px) {
  header.top .bar { gap: 10px; }
  .brand { font-size: 14px; }
  .tabs button { padding: 6px 8px; letter-spacing: .04em; font-size: 11px; }
  .who .label { display: none; }
}

/* buttons, fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--cyan); background: transparent; color: var(--cyan); cursor: pointer; letter-spacing: .1em; text-transform: uppercase; font-size: 12px; font-weight: 600; text-decoration: none; }
.btn:hover { background: color-mix(in srgb, var(--cyan) 12%, transparent); }
.btn.solid { background: var(--cyan); color: var(--ink); }
.btn.solid:hover { background: #b5e4ff; }
.btn.ghost { border-color: var(--line); color: var(--dim); }
.btn.danger { border-color: var(--redline); color: var(--redline); }
.btn.small { padding: 4px 10px; font-size: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
label.field { display: grid; gap: 4px; font-size: 11px; color: var(--dim); letter-spacing: .1em; text-transform: uppercase; }
input[type=text], input[type=number], select, textarea {
  width: 100%; background: var(--ink); border: 1px solid var(--line); color: var(--paper); padding: 8px 10px; font-size: 13px; letter-spacing: 0; text-transform: none;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); outline: none; }
.label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.muted { color: var(--dim); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; padding: 1px 8px; border: 1px solid currentColor; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.pill.queued { color: var(--dim); }
.pill.running { color: var(--redline); }
.pill.running::before { content: ""; width: 6px; height: 6px; background: currentColor; animation: blink 1s steps(2) infinite; }
.pill.done { color: var(--ok); }
.pill.failed { color: var(--warn); }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pill.running::before { animation: none; } }

/* layout */
main { max-width: 1400px; margin: 0 auto; padding: 20px 16px 48px; }
.panel { background: var(--panel); border: 1px solid var(--line); }
.panel > .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel > .body { padding: 14px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--warn); color: var(--paper); padding: 10px 16px; z-index: 50; max-width: calc(100% - 32px); font-size: 13px; }
.toast.ok { border-color: var(--ok); }

/* projects view */
.projects { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .projects { grid-template-columns: 1fr; } }
.plist { list-style: none; margin: 0; padding: 0; }
.plist button { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; cursor: pointer; color: var(--paper); }
.plist button:hover { background: var(--panel-2); }
.plist button[aria-current="true"] { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--cyan); }
.plist .name { font-weight: 600; }
.plist .meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--dim); margin-top: 2px; }
.phase { font-size: 11px; color: var(--cyan); border: 1px solid var(--cyan); padding: 0 5px; }
.empty { padding: 20px 14px; color: var(--dim); font-size: 13px; }

.detail { display: grid; gap: 16px; }
.specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px 20px; }
.specs div { display: grid; }
.specs b { font-weight: 500; }
.notes { margin-top: 12px; color: var(--dim); font-size: 13px; white-space: pre-wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: none; border: 1px dashed var(--line); color: var(--paper); padding: 6px 10px; cursor: pointer; font-size: 12px; }
.chip:hover { border-color: var(--cyan); color: var(--cyan); }
.chip.crew { border-color: var(--warn); color: var(--warn); }
.composer { display: grid; gap: 10px; }
.composer .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.composer .row > label { flex: 1 1 240px; }
.runs { list-style: none; margin: 0; padding: 0; }
.runs li + li { border-top: 1px solid var(--line); }
.runs button { display: grid; gap: 4px; width: 100%; text-align: left; background: none; border: 0; padding: 12px 14px; cursor: pointer; color: var(--paper); }
.runs button:hover { background: var(--panel-2); }
.runs .top { display: flex; gap: 10px; align-items: center; }
.runs .agent { font-weight: 600; }
.runs .crewtag { color: var(--warn); font-size: 11px; letter-spacing: .1em; }
.runs .brief { color: var(--dim); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.runs .when { color: var(--dim); font-size: 11px; }
.dot { width: 10px; height: 10px; flex: none; }
.spacer { flex: 1; }

/* crew view */
.crew { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); padding: 14px; display: grid; gap: 8px; text-align: left; color: var(--paper); cursor: pointer; }
.card:hover { border-color: var(--cyan); }
.card .top { display: flex; gap: 10px; align-items: center; }
.card .nm { font-weight: 700; letter-spacing: .06em; }
.lead { font-size: 10px; font-weight: 700; background: var(--warn); color: var(--ink); padding: 0 5px; letter-spacing: .1em; }
.skills { color: var(--cyan); font-size: 12px; }
.portrait { width: 34px; height: 34px; image-rendering: pixelated; border: 1px solid var(--line); flex: none; }

/* floor view */
.floor { display: grid; gap: 12px; max-width: 980px; }
.floor canvas { width: 100%; height: auto; image-rendering: pixelated; border: 1px solid var(--line); background: #0d1d30; display: block; }

/* dialogs */
dialog { background: var(--panel); color: var(--paper); border: 1px solid var(--line); padding: 0; width: min(640px, calc(100% - 32px)); max-height: calc(100% - 48px); }
dialog.wide { width: min(920px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(4, 10, 20, .72); }
dialog form, dialog .dlg { display: grid; gap: 14px; padding: 18px; }
dialog h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 18px; color: var(--cyan); }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
dialog .actions .left { margin-right: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 26px; height: 26px; border: 2px solid transparent; cursor: pointer; }
.swatches button[aria-pressed="true"] { border-color: var(--paper); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 12px; font-size: 13px; }
.checks label, .toggle { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.output { white-space: pre-wrap; background: var(--ink); border: 1px solid var(--line); padding: 14px; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
details.child { border: 1px solid var(--line); background: var(--ink); }
details.child summary { display: flex; gap: 10px; align-items: center; padding: 8px 12px; cursor: pointer; }
details.child .output { border: 0; border-top: 1px solid var(--line); }
.err { color: var(--warn); }

/* sign-in */
.gate { max-width: 520px; margin: 10vh auto 0; padding: 0 16px; }
.gate .panel .body { display: grid; gap: 14px; padding: 24px; }
.gate h1 { margin: 0; font-family: var(--display); font-weight: 400; color: var(--cyan); font-size: 26px; }
.apple { background: var(--paper); color: #000; border: 0; padding: 12px 16px; font-weight: 600; cursor: pointer; display: inline-flex; gap: 10px; align-items: center; justify-content: center; font-size: 15px; }
.apple:hover { background: #fff; }
.apple:disabled { opacity: .6; cursor: progress; }

/* ---------- wide views ---------- */
body.wide main { max-width: none; padding: 12px; }
body.wide header.top .bar { max-width: none; }
.pill.review { color: var(--warn); }
.pill.clickable { background: none; cursor: pointer; font: inherit; font-size: 11px; }
.review-box { display: grid; gap: 8px; border: 1px solid var(--warn); padding: 12px; background: color-mix(in srgb, var(--warn) 6%, var(--ink)); }
.sources { margin: 0; padding: 8px 12px 10px 28px; font-size: 12px; display: grid; gap: 4px; }

/* ---------- office ---------- */
.office { display: grid; grid-template-columns: 1fr 330px; grid-template-areas: "stage tasks"; gap: 12px; height: calc(100vh - 56px - 24px); min-height: 560px; }
.office:has(#oLeft:not([hidden])) { grid-template-columns: 320px 1fr 330px; grid-template-areas: "lead stage tasks"; }
.o-left { grid-area: lead; } .o-stage { grid-area: stage; } .o-right { grid-area: tasks; }
.o-left { overflow-y: auto; overflow-x: hidden; padding: 14px; display: grid; gap: 12px; align-content: start; }
.o-right { overflow: hidden; display: grid; grid-template-rows: auto auto auto 1fr; }
.o-right #oTasks { display: contents; }
.o-stage { position: relative; border: 1px solid var(--line); overflow: hidden; background: #070d18; min-height: 0; }
.o-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.o-bar { position: absolute; top: 10px; left: 10px; display: flex; gap: 10px; align-items: center; z-index: 2; }
.o-title { font-family: var(--display); color: var(--paper); font-size: 15px; text-shadow: 0 1px 6px #000; }
.o-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.o-legend { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 14px; font-size: 11px; color: var(--dim); background: rgba(7,13,24,.75); padding: 4px 10px; flex-wrap: wrap; }
.o-legend i { display: inline-block; width: 9px; height: 9px; margin-right: 5px; vertical-align: -1px; }
.o-legend .lit { background: #bfe9ff; box-shadow: 0 0 6px #8fd6ff; }
.o-legend .amber { background: var(--warn); }
.o-legend .red { background: var(--redline); }

.fcard { position: absolute; pointer-events: auto; width: 172px; text-align: left; cursor: pointer; padding: 9px 11px; color: var(--paper);
  background: rgba(11, 22, 38, .9); border: 1px solid color-mix(in srgb, var(--fc) 70%, #fff 0%); box-shadow: 0 8px 24px rgba(0,0,0,.45), inset 3px 0 0 var(--fc);
  backdrop-filter: blur(4px); display: grid; gap: 3px; font-size: 11px; transition: box-shadow .15s, transform .15s; }
.fcard:hover, .fcard:focus-visible { box-shadow: 0 0 0 1px var(--fc), 0 0 22px color-mix(in srgb, var(--fc) 70%, transparent), inset 3px 0 0 var(--fc); }
.fc-top { display: flex; gap: 6px; align-items: center; }
.fc-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-big { color: var(--dim); }
.fc-big b { font-family: var(--display); font-size: 20px; color: var(--paper); font-weight: 400; margin-right: 2px; }
.fc-row { display: flex; justify-content: space-between; color: var(--dim); }
.fc-row b { color: var(--paper); }
.fc-flag { margin-top: 3px; background: var(--warn); color: #1a1200; font-weight: 700; padding: 2px 6px; letter-spacing: .04em; }
.fc-flag.bad { background: var(--redline); color: #200; }

.o-tabs { display: flex; border-bottom: 1px solid var(--line); }
.o-tabs button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--dim); padding: 9px 4px; cursor: pointer; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.o-tabs button[aria-selected="true"] { color: var(--paper); border-bottom-color: var(--cyan); }
.o-tabs .n { margin-left: 6px; color: var(--cyan); }
.o-list { list-style: none; margin: 0; padding: 0; overflow: auto; }
.o-right .o-list, .o-right > p { overflow: auto; min-height: 0; }
.o-list li + li { border-top: 1px solid var(--line); }
.o-list button { width: 100%; background: none; border: 0; color: var(--paper); text-align: left; padding: 10px 12px; cursor: pointer; display: grid; gap: 4px; }
.o-list button:hover { background: var(--panel-2); }
.o-list .top { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.o-list .proj { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.o-list .brief { color: var(--dim); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.o-head { border-left: 3px solid var(--fc); padding-left: 10px; display: grid; gap: 2px; }
.o-pname { font-family: var(--display); font-size: 17px; color: var(--paper); }
.o-stats { display: flex; gap: 12px; font-size: 12px; color: var(--dim); }
.o-stats b { color: var(--paper); }
.o-lead { display: flex; gap: 10px; align-items: center; padding: 8px; background: var(--ink); border: 1px solid var(--line); }
.o-convo { display: grid; gap: 8px; }
.bubble { font-size: 12px; line-height: 1.5; padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 92%; }
.bubble.me { justify-self: end; background: color-mix(in srgb, var(--cyan) 16%, var(--ink)); border: 1px solid color-mix(in srgb, var(--cyan) 40%, transparent); }
.bubble.them { justify-self: start; text-align: left; background: var(--ink); border: 1px solid var(--line); color: var(--paper); cursor: pointer; display: grid; font: inherit; font-size: 12px; }
.bubble.them:hover { border-color: var(--cyan); }
.o-msg { display: grid; gap: 8px; }
.o-msg-row { display: flex; justify-content: space-between; align-items: center; }
.o-left .chips .chip { font-size: 11px; padding: 5px 8px; text-align: left; }

@media (max-width: 1100px) {
  .office, .office:has(#oLeft:not([hidden])) { grid-template-columns: 1fr; grid-template-areas: "stage" "lead" "tasks"; height: auto; }
  .o-stage { height: 62vh; min-height: 380px; }
  .o-right { max-height: 60vh; }
}

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; padding-bottom: 8px; }
.col { background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.col-head .n { color: var(--cyan); font-size: 12px; }
.col-review .col-head { box-shadow: inset 0 2px 0 var(--warn); }
.col-running .col-head { box-shadow: inset 0 2px 0 var(--redline); }
.col-approved .col-head { box-shadow: inset 0 2px 0 var(--ok); }
.col-body { display: grid; gap: 8px; padding: 8px; max-height: calc(100vh - 150px); overflow: auto; }
.bcard { text-align: left; background: var(--ink); border: 1px solid var(--line); color: var(--paper); padding: 9px 10px; cursor: pointer; display: grid; gap: 5px; font-size: 12px; }
.bcard:hover { border-color: var(--cyan); }
.bcard .top { display: flex; gap: 8px; align-items: center; }
.bcard .brief { color: var(--dim); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bcard .when { color: var(--dim); font-size: 11px; }
.bcard .crewtag { color: var(--warn); font-size: 10px; letter-spacing: .1em; }
.bproj { justify-self: start; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; padding: 1px 6px; background: color-mix(in srgb, var(--fc) 30%, transparent); border: 1px solid var(--fc); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .who #connect { display: none; } }
@media (max-width: 640px) {
  header.top .bar { flex-wrap: wrap; height: auto; padding: 8px 12px; row-gap: 8px; }
  .tabs { order: 3; width: 100%; }
  .tabs button { flex: 1; }
  .who { gap: 8px; }
}

/* ---------- connectors ---------- */
.connectors { display: grid; gap: 16px; max-width: 1400px; margin: 0 auto; }
.ctools, .cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.ccat { display: grid; gap: 8px; margin-top: 14px; }
.ccard { background: var(--ink); border: 1px solid var(--line); padding: 12px; display: grid; gap: 6px; align-content: start; }
.ccard.on { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); }
.ccard .top { display: flex; gap: 8px; justify-content: space-between; align-items: start; }
.ccard .btn { justify-self: start; }
.tools-list { display: grid; gap: 4px; max-height: 240px; overflow: auto; font-size: 12px; }
.tools-list label { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: baseline; cursor: pointer; }
.tools-list code { color: var(--paper); }
.tools-list .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { border: 1px dashed var(--line); padding: 16px; text-align: center; color: var(--dim); font-size: 13px; cursor: pointer; }
.dropzone:hover, .dropzone.over, .dropzone:focus-visible { border-color: var(--cyan); color: var(--paper); }
.doclist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.doclist li { display: flex; gap: 10px; align-items: center; }
.doclist li .toggle { flex: 1; min-width: 0; }
.doclist li .toggle span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#connBody .dlg { max-height: calc(100vh - 80px); overflow: auto; }

/* ---------- crew grouped by department ---------- */
.dept-head { grid-column: 1 / -1; margin: 14px 0 0; font: 700 11px/1.2 "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--paper); display: flex; align-items: center; gap: 8px; }
.dept-head::before { content: ""; width: 10px; height: 10px; background: var(--fc); border-radius: 2px; }
.dept-head:first-child { margin-top: 0; }
.o-left .field select { width: 100%; }

/* =================== prefabmars Studio theme (slate, rounded) =================== */
.panel, .card, .ccard, .col, dialog, .bcard, .o-lead, .output, .review-box, .toast, details.child { border-radius: var(--radius); }
.panel > .head { border-radius: var(--radius) var(--radius) 0 0; }
.btn, .chip, input[type=text], input[type=number], select, textarea, .pill, .phase, .dropzone { border-radius: 8px; }
.pill { border-radius: 999px; }
.panel { background: linear-gradient(180deg, var(--panel) 0%, #22263a 100%); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
input[type=text], input[type=number], select, textarea { background: #1f2336; }
.btn.solid { color: #121626; }

/* top bar */
header.top { background: rgba(27,31,48,.88); }
header.top .bar { height: 54px; gap: 18px; }
.brand { font-family: var(--serif); font-size: 19px; font-weight: 700; color: var(--paper); letter-spacing: .01em; display: inline-flex; align-items: baseline; gap: 6px; }
.brand b { color: var(--warn); font-weight: 700; }
.brand small { font-family: var(--mono); font-size: 10px; color: var(--dim); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }
.tabs button { border-radius: 8px; letter-spacing: .1em; }
.tabs button[aria-selected="true"] { background: var(--panel-2); border-color: var(--line); color: var(--paper); }
.conn-strip { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--dim); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.conn-strip .ic { width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 10px; font-weight: 700; color: #121626; letter-spacing: 0; cursor: pointer; border: 0; }
.conn-strip .more { color: var(--dim); }
.clock { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
@media (max-width: 1200px) { .conn-strip { display: none; } }

/* office stage */
.o-stage { background: #22273b; border-color: var(--line); border-radius: var(--radius); }
.o-title { font-family: var(--serif); font-size: 18px; font-weight: 700; text-shadow: none; }
.o-legend { background: rgba(27,31,48,.8); border-radius: 999px; }
.o-zoom { position: absolute; right: 12px; bottom: 12px; display: grid; gap: 6px; z-index: 2; }
.o-zoom button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: rgba(37,42,63,.9); color: var(--paper); cursor: pointer; font-size: 16px; line-height: 1; }
.o-zoom button:hover { border-color: var(--cyan); }
.o-stage canvas.grab { cursor: grabbing !important; }

/* floor cards: float above each floor */
.fcard { width: 150px; padding: 9px 11px 10px; gap: 4px; border-radius: 12px; background: rgba(30,34,52,.92);
  border: 1px solid color-mix(in srgb, var(--fc) 55%, #3a4163); box-shadow: 0 10px 28px rgba(0,0,0,.4); }
.fcard:hover, .fcard:focus-visible, .fcard.open { z-index: 3; box-shadow: 0 0 0 1px var(--fc), 0 0 26px color-mix(in srgb, var(--fc) 65%, transparent); }
.fc-name { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.fc-name::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--fc); flex: none; }
.fc-big { display: flex; align-items: baseline; gap: 6px; color: var(--dim); font-size: 11px; }
.fc-big b { font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--paper); line-height: 1; }
.fc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 2px; }
.fc-stats span { display: grid; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.fc-stats b { font-size: 13px; color: var(--paper); letter-spacing: 0; }
.fc-flag { margin-top: 4px; border-radius: 999px; padding: 2px 8px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; text-align: center; }
.o-overlay.tiny .fcard { width: 118px; padding: 6px 8px; }
.o-overlay.tiny .fc-stats { display: none; }
.o-overlay.tiny .fc-big b { font-size: 18px; }

/* task panel */
.o-quick { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.o-quick input { flex: 1; min-width: 0; border-radius: 999px; padding: 7px 12px; }
.o-quick .btn { border-radius: 999px; }
.o-tabs button { font-size: 10px; letter-spacing: .1em; padding: 10px 2px; }
.o-list button { padding: 11px 14px; }

/* department panel (left) */
.o-head { border-left: 0; padding-left: 0; gap: 6px; }
.o-pname { font-family: var(--serif); font-weight: 700; font-size: 20px; }
.o-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.o-kpis div { background: #1f2336; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; }
.o-kpis b { font-family: var(--serif); font-size: 24px; line-height: 1.1; }
.o-kpis span { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.o-approval { background: var(--warn); color: #1a1200; border-radius: 999px; padding: 4px 10px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; text-align: center; }
.bubble { border-radius: 12px; }
.bubble.me { border-bottom-right-radius: 4px; }
.bubble.them { border-bottom-left-radius: 4px; }

/* board: rows by department */
.board2 { display: grid; gap: 10px; }
.board2 .bhead { display: flex; align-items: baseline; gap: 12px; }
.board2 .bhead h2 { margin: 0; font-family: var(--serif); font-size: 22px; }
.bgrid { display: grid; grid-template-columns: 190px repeat(5, minmax(200px, 1fr)); gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.bgrid .ch { position: sticky; top: 0; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); padding: 6px 8px; border-bottom: 2px solid var(--line); }
.bgrid .ch.review { border-color: var(--warn); } .bgrid .ch.running { border-color: var(--cyan); } .bgrid .ch.done { border-color: var(--ok); }
.bgrid .dname { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--fc); border-radius: 10px; padding: 10px; display: grid; gap: 2px; align-content: start; }
.bgrid .dname b { font-size: 13px; }
.bgrid .dname span { font-size: 11px; color: var(--dim); }
.bgrid .cell { background: rgba(37,42,63,.55); border: 1px dashed var(--line); border-radius: 10px; padding: 6px; display: grid; gap: 6px; align-content: start; min-height: 54px; }
.bgrid .bcard { background: var(--panel-2); }
.fcard .fc-name { white-space: normal; overflow: visible; letter-spacing: .1em; line-height: 1.25; }
.fc-stats { gap: 8px; }
.fc-stats span { font-size: 8px; letter-spacing: .06em; }

/* read-only preview inside the home page */
body.demo header.top { display: none; }
body.demo main { padding: 10px; }
body.demo .office { height: calc(100vh - 20px); min-height: 0; }
body.demo .o-quick { display: none; }

/* full screen office */
#view-office:fullscreen { background: var(--ink); padding: 12px; height: 100vh; }
#view-office:fullscreen .office, #view-office.office:fullscreen { height: 100vh; }

/* guided tour */
.tour { position: fixed; inset: 0; z-index: 100; }
.tour-spot { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(12,14,24,.72), 0 0 0 2px var(--warn); transition: all .35s ease; pointer-events: none; }
.tour-card { position: fixed; width: 420px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 18px 14px; box-shadow: 0 24px 60px rgba(0,0,0,.5); display: grid; gap: 8px; transition: left .35s ease, top .35s ease; }
.tour-card h3 { margin: 0; font-family: var(--serif); font-size: 22px; }
.tour-card p { margin: 0; color: var(--paper); opacity: .9; font-size: 13px; line-height: 1.6; }
.tour-step { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--warn); }
.tour-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-card { transition: none; } }

/* ---------- studio guide (bottom right) ---------- */
.g-fab { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 999px; border: 1px solid #c3dcff;
  background: linear-gradient(135deg, #9cc6ff, #c7a6ff); color: #121626; font: 700 13px var(--mono); letter-spacing: .06em; cursor: pointer; box-shadow: 0 12px 30px rgba(0,0,0,.45); }
.g-fab:hover { filter: brightness(1.06); }
.g-spark { font-size: 15px; }
.g-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px #121626; }
.g-panel { position: fixed; right: 20px; bottom: 76px; z-index: 60; width: min(400px, calc(100vw - 24px)); height: min(600px, calc(100vh - 110px)); display: grid; grid-template-rows: auto 1fr auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.55); overflow: hidden; }
.g-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.g-head b { font-family: var(--serif); font-size: 17px; }
.g-sub { font-size: 11px; color: var(--dim); }
.g-icon { background: none; border: 1px solid var(--line); color: var(--paper); border-radius: 8px; width: 28px; height: 28px; cursor: pointer; font-size: 15px; line-height: 1; }
.g-icon:hover { border-color: var(--cyan); }
.g-msgs { overflow: auto; padding: 12px; display: grid; gap: 10px; align-content: start; }
.g-msg { font-size: 13px; line-height: 1.55; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 92%; }
.g-msg.me { justify-self: end; background: color-mix(in srgb, var(--cyan) 18%, var(--ink)); border-bottom-right-radius: 4px; }
.g-msg.them { justify-self: start; background: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.g-msg.wait { color: var(--dim); display: grid; gap: 6px; }
.g-ctx { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin-bottom: 3px; }
.g-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; white-space: normal; }
.g-typing { display: inline-flex; gap: 4px; }
.g-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: gblink 1.2s infinite; }
.g-typing i:nth-child(2) { animation-delay: .2s; } .g-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes gblink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .g-typing i { animation: none; } }
.g-form { display: grid; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.g-form textarea { min-height: 54px; resize: none; }
.g-row { display: flex; align-items: center; gap: 8px; }
.g-shot { position: relative; justify-self: start; }
.g-shot img { max-height: 90px; max-width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; }
.g-shot .g-icon { position: absolute; top: -8px; right: -8px; background: var(--panel-2); width: 22px; height: 22px; font-size: 13px; }
.g-snap { position: fixed; inset: 0; z-index: 200; cursor: crosshair; background: rgba(12,14,24,.35); outline: none; touch-action: none; }
.g-snap-hint { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 12px; color: var(--paper); pointer-events: none; }
.g-snap-box { position: fixed; display: none; border: 2px dashed var(--warn); background: rgba(255,200,100,.08); box-shadow: 0 0 0 9999px rgba(12,14,24,.35); pointer-events: none; }
body.demo .g-fab { bottom: 14px; right: 14px; }

/* ---------- calendar ---------- */
.calendar { display: grid; gap: 10px; }
.k-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.k-bar h2 { margin: 0; font-family: var(--serif); font-size: 24px; min-width: 220px; }
.k-nav { display: flex; gap: 4px; }
.k-mode { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.k-mode button { background: none; border: 0; color: var(--dim); padding: 5px 14px; cursor: pointer; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.k-mode button[aria-selected="true"] { background: var(--panel-2); color: var(--paper); }
.k-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.k-filter { border: 1px solid var(--line); background: none; color: var(--dim); border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.k-filter::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--dc); opacity: .35; }
.k-filter[aria-pressed="true"] { color: var(--paper); border-color: color-mix(in srgb, var(--dc) 60%, var(--line)); }
.k-filter[aria-pressed="true"]::before { opacity: 1; }
.k-legend { margin-left: auto; font-size: 11px; color: var(--dim); white-space: pre; }
.k-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.k-head div { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); padding: 0 6px; }
.k-head { display: contents; }
.k-day { background: rgba(37,42,63,.6); border: 1px solid var(--line); border-radius: 10px; padding: 6px; min-height: 118px; display: grid; gap: 3px; align-content: start; cursor: pointer; min-width: 0; }
.k-grid.week .k-day { min-height: calc(100vh - 230px); }
.k-day:hover { border-color: color-mix(in srgb, var(--cyan) 50%, var(--line)); }
.k-day.out { opacity: .45; }
.k-day.today { border-color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
.k-date { font-size: 12px; color: var(--dim); margin-bottom: 2px; }
.k-day.today .k-date { color: var(--warn); font-weight: 700; }
.k-chip { display: flex; align-items: center; gap: 5px; min-width: 0; text-align: left; border: 0; border-left: 3px solid var(--dc); border-radius: 6px; padding: 2px 6px; font-size: 11px; color: var(--paper);
  background: color-mix(in srgb, var(--dc) 22%, var(--ink)); cursor: pointer; }
.k-chip:hover { background: color-mix(in srgb, var(--dc) 38%, var(--ink)); }
.k-chip.work { background: transparent; border-left-style: dotted; color: var(--dim); }
.k-chip.proposed { background: transparent; outline: 1px dashed var(--dc); outline-offset: -1px; }
.k-ic { color: var(--dc); flex: none; }
.k-time { color: var(--dim); flex: none; font-variant-numeric: tabular-nums; }
.k-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.k-grid.week .k-t { white-space: normal; }
.k-s { margin-left: auto; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: var(--warn); flex: none; }
.k-more { background: none; border: 0; color: var(--cyan); font-size: 11px; text-align: left; cursor: pointer; padding: 2px 4px; }
.grid3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .k-grid { grid-template-columns: 1fr; } .k-head { display: none; } .k-day.out { display: none; } .k-legend { display: none; } .grid3 { grid-template-columns: 1fr; } }

/* ---------- social ---------- */
.social { display: grid; gap: 14px; max-width: 1400px; margin: 0 auto; }
.so-accts { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.so-steps { margin: 8px 0; padding-left: 18px; font-size: 12px; color: var(--dim); display: grid; gap: 4px; }
.so-app { display: grid; gap: 8px; }
.so-ig { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.so-ig a { position: relative; display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--ink); }
.so-ig img { width: 100%; height: 100%; object-fit: cover; display: block; }
.so-ig-meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.so-group { display: grid; gap: 8px; }
.so-posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 10px; }
.so-post { display: grid; grid-template-columns: 150px 1fr; gap: 12px; background: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.so-post img, .so-noimg { width: 150px; height: 150px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.so-noimg { display: grid; place-items: center; color: var(--dim); font-size: 12px; }
.so-post-body { display: grid; gap: 8px; min-width: 0; align-content: start; }
.so-post textarea { min-height: 96px; font-size: 13px; }
.so-results { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; }
@media (max-width: 640px) { .so-posts { grid-template-columns: 1fr; } .so-post { grid-template-columns: 1fr; } .so-post img, .so-noimg { width: 100%; height: auto; aspect-ratio: 1; } }

/* social: brands, profile kit, manual channels */
.so-brands { display: flex; gap: 8px; flex-wrap: wrap; }
.so-brands button { display: grid; text-align: left; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; color: var(--paper); cursor: pointer; min-width: 220px; }
.so-brands button span { font-size: 11px; }
.so-brands button[aria-selected="true"] { border-color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
.so-kit { display: grid; gap: 6px; background: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.so-kit-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: start; font-size: 13px; }
.so-kit-val { white-space: pre-wrap; overflow-wrap: anywhere; }
.so-copy { padding: 2px 8px; }
.so-profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.so-manual { display: grid; gap: 6px; border-top: 1px dashed var(--line); padding-top: 8px; }
.so-manual-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.so-manual-row b { min-width: 110px; }
@media (max-width: 640px) { .so-kit-row { grid-template-columns: 1fr auto; } .so-kit-row .label { grid-column: 1 / -1; } }

/* ---------- talk to the Brain ---------- */
.o-voice { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 2; }
.v-mic { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: rgba(37,42,63,.92); color: var(--paper); border-radius: 999px; cursor: pointer; font: 600 12px var(--mono); letter-spacing: .06em; }
.v-mic.big { padding: 9px 18px; box-shadow: 0 10px 24px rgba(0,0,0,.35); }
.v-mic.small { padding: 4px 10px; }
.v-mic.small .v-label { display: none; }
.v-mic:hover { border-color: var(--cyan); }
.v-mic.on { border-color: #ff6f5e; box-shadow: 0 0 0 3px rgba(255,111,94,.25); animation: vpulse 1.2s infinite; }
.v-mic.on .v-label::after { content: " · listening"; color: #ff9d90; }
.v-mic.talking { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(156,198,255,.25); }
.v-mic.talking .v-label::after { content: " · speaking"; color: var(--cyan); }
@keyframes vpulse { 50% { box-shadow: 0 0 0 7px rgba(255,111,94,.08); } }
@media (prefers-reduced-motion: reduce) { .v-mic.on { animation: none; } }
body.demo .o-voice { display: none; }

/* ---------- studio photos ---------- */
.so-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.so-photo { margin: 0; display: grid; gap: 8px; align-content: start; }
.so-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #1c2033; }
.so-photo figcaption { display: grid; gap: 2px; font-size: 13px; }
.so-photo figcaption .muted { font-size: 12px; }

/* ---------- agent sketches & diagrams ---------- */
.sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 8px; }
.sk-item { margin: 0; display: grid; gap: 6px; }
.sk-open { padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: zoom-in; overflow: hidden; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.sk-open img { width: 100%; height: 100%; object-fit: contain; }
.sk-item figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }

/* ---------- Peppas Rules ---------- */
.rules { display: grid; gap: 14px; max-width: 900px; margin: 0 auto; }
.ru-title { margin: 0 0 6px; font-family: Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: .02em; }
.ru-sec .head { gap: 10px; }
.ru-sec-title { flex: 1; background: transparent; border: 0; border-bottom: 1px solid transparent; color: var(--paper); font: 600 15px var(--sans, inherit); padding: 4px 0; }
.ru-sec-title:focus { outline: none; border-bottom-color: var(--cyan); }
.ru-text { width: 100%; resize: vertical; background: rgba(0,0,0,.15); color: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: 14px/1.6 inherit; }
.ru-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ru-summary .output { font-size: 14px; }

/* ---------- team tools & connections ---------- */
.tt { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: rgba(0,0,0,.12); }
.tt > summary { cursor: pointer; list-style: none; }
.tt > summary::-webkit-details-marker { display: none; }
.tt-group { margin-top: 8px; }
.tt-title { font: 600 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted, #9aa3c0); margin-bottom: 4px; }
.tt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tt-row { display: grid; grid-template-columns: 10px auto 1fr; gap: 6px; align-items: baseline; font-size: 12px; }
.tt-row .muted { font-size: 11px; justify-self: end; text-align: right; }
.tt-dot { width: 7px; height: 7px; border-radius: 50%; background: #5fd38d; box-shadow: 0 0 0 2px rgba(95,211,141,.18); align-self: center; }
.tt-row.off .tt-dot { background: #6b7391; box-shadow: none; }
.tt-row.off b { color: var(--muted, #9aa3c0); font-weight: 500; }
