:root {
  --navy: #141C2B; --orange: #E2580C; --paper: #F7F6F3;
  --bg: #F3F2EE; --surface: #FFFFFF; --surface-2: #F7F6F3; --ink: #141C2B; --ink-2: #4A5466; --ink-3: #7A8394;
  --line: #DEDBD3; --accent: #E2580C; --accent-ink: #B8440A; --accent-soft: #FBE7DC;
  --green: #2F7D4F; --green-soft: #E1F1E7; --amber: #A86A00; --amber-soft: #FBF0D6; --red: #B3261E; --red-soft: #F9E1DF;
  --side: #141C2B; --side-ink: #C9CED8; --side-hi: #FFFFFF;
  --display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --body: Inter, "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
  --r: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0E141D; --surface: #161F2C; --surface-2: #1B2534; --ink: #ECEAE5; --ink-2: #AAB2C0; --ink-3: #7D8698;
    --line: #283345; --accent: #F07A3A; --accent-ink: #F59A66; --accent-soft: #3A2418;
    --green: #6CC48F; --green-soft: #17301F; --amber: #E9B44C; --amber-soft: #33280F; --red: #F08A82; --red-soft: #3A1A18;
    --side: #0A0F16;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; text-wrap: balance; }
h1 { font-size: 34px; font-weight: 700; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 600; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.eyebrow { font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }

/* layout */
.app { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-family: var(--display); font-size: 26px; font-weight: 700; color: #fff; padding: 4px 10px 14px; }
.brand span { color: var(--orange); }
.side a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 6px; color: var(--side-ink); text-decoration: none; font-weight: 500; }
.side a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side a.on { background: rgba(226,88,12,.18); color: #fff; }
.side .count { font-family: var(--mono); font-size: 11px; background: var(--orange); color: #fff; padding: 1px 6px; border-radius: 10px; }
.side .spacer { flex: 1; }
.side .who { font-size: 12.5px; padding: 8px 10px; color: #9BA3B2; }
main { padding: 26px 28px 90px; max-width: 1240px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.bottom { display: none; }

/* bits */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g-office { grid-template-columns: 3fr 2fr; }
@media (max-width: 1100px) { .g-office { grid-template-columns: 1fr; } }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.btn { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=number], input[type=time], input[type=email], input[type=tel], select, textarea {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; width: 100%; }
textarea { resize: vertical; min-height: 80px; }
label.f { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11.5px; padding: 3px 8px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.pill.good { background: var(--green-soft); color: var(--green); border-color: transparent; }
.pill.warn { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.pill.bad { background: var(--red-soft); color: var(--red); border-color: transparent; }
.pill.hot { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ink-3); }
.dot.working { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); animation: pulse 1.4s infinite; }
.dot.idle { background: var(--green); }
.dot.off { background: var(--red); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }
.banner { background: var(--amber-soft); color: var(--amber); padding: 10px 14px; border-radius: var(--r); font-weight: 500; margin-bottom: 14px; }
.banner.stop { background: var(--red); color: #fff; }
.empty { padding: 26px; text-align: center; color: var(--ink-3); }
.toast { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 50; max-width: 90vw; }

/* avatars */
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-family: var(--display); font-weight: 700; font-size: 18px; flex: none; position: relative; }
.av.lg { width: 64px; height: 64px; font-size: 26px; }
.av.speaking { box-shadow: 0 0 0 4px var(--surface), 0 0 0 7px var(--accent); animation: talk .7s infinite alternate; }
@keyframes talk { to { transform: scale(1.06); } }
.av .hand { position: absolute; top: -6px; right: -6px; background: var(--amber); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; font-size: 13px; }

/* office */
.composer { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: end; }
.composer textarea { min-height: 48px; max-height: 200px; }
.mic { width: 48px; height: 48px; border-radius: 50%; border: none; background: var(--navy); color: #fff; cursor: pointer; display: grid; place-items: center; font-size: 20px; flex: none; }
.mic.rec { background: var(--red); animation: talk .6s infinite alternate; }
.mic.big { width: 76px; height: 76px; font-size: 30px; }
.reply { border-left: 4px solid var(--accent); background: var(--surface-2); padding: 12px 14px; border-radius: 0 var(--r) var(--r) 0; white-space: pre-wrap; }
.person { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; text-align: left; width: 100%; }
.person:hover { border-color: var(--accent); }
.person .t { font-size: 12.5px; color: var(--ink-3); }
.stat { display: grid; gap: 2px; }
.stat b { font-family: var(--display); font-size: 30px; line-height: 1; }
.meter { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.meter i { display: block; height: 100%; background: var(--green); }
.meter i.warn { background: var(--amber); } .meter i.bad { background: var(--red); }
.feed .item { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 34px 1fr; gap: 10px; }
.feed .item:last-child { border-bottom: 0; }
.feed .av { width: 30px; height: 30px; font-size: 14px; }
.feed .text { white-space: pre-wrap; font-size: 14px; }

/* chat */
.thread { display: flex; flex-direction: column; gap: 10px; min-height: 300px; max-height: calc(100vh - 300px); overflow-y: auto; padding: 4px; }
.msg { max-width: 78%; padding: 10px 13px; border-radius: 12px; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 3px; }
.msg.them { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.msg .meta { font-size: 11px; opacity: .7; margin-top: 4px; font-family: var(--mono); }

/* board */
.board { display: grid; grid-template-columns: repeat(4, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; display: grid; gap: 8px; }
.col h3 { display: flex; justify-content: space-between; font-size: 16px; padding: 2px 4px 6px; }
.task { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px; cursor: pointer; display: grid; gap: 6px; }
.task:hover { border-color: var(--accent); }
.task .who { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.task .av { width: 22px; height: 22px; font-size: 11px; }
.task .progress { font-size: 12px; color: var(--accent-ink); font-family: var(--mono); }

/* modal */
.scrim { position: fixed; inset: 0; background: rgba(10,15,22,.55); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: var(--surface); border-radius: 10px; width: min(720px, 100%); max-height: 88vh; overflow-y: auto; padding: 20px; display: grid; gap: 12px; }
.pre { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 12px; font-size: 14px; max-height: 50vh; overflow-y: auto; }

/* switchboard */
.power { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.power button { padding: 16px; border-radius: var(--r); border: 2px solid var(--line); background: var(--surface); font-family: var(--display); font-size: 22px; font-weight: 700; cursor: pointer; }
.power button.on.running { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.power button.on.paused { border-color: var(--amber); background: var(--amber-soft); color: var(--amber); }
.power button.on.stopped, .power button.stopbtn:hover { border-color: var(--red); background: var(--red); color: #fff; }
.cap { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cap:last-child { border-bottom: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 12px; font-family: var(--mono); font-size: 12px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on.off { background: var(--red-soft); color: var(--red); font-weight: 600; }
.seg button.on.ask { background: var(--amber-soft); color: var(--amber); font-weight: 600; }
.seg button.on.auto { background: var(--green-soft); color: var(--green); font-weight: 600; }

/* boardroom */
.room { display: grid; grid-template-columns: 1fr 360px; gap: 14px; }
.table { position: relative; aspect-ratio: 1.5; max-height: 460px; background: radial-gradient(ellipse at center, var(--surface) 0 38%, var(--surface-2) 39% 100%); border: 1px solid var(--line); border-radius: 12px; }
.seat { position: absolute; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 4px; text-align: center; width: 92px; cursor: default; }
.seat .n { font-size: 12.5px; font-weight: 600; }
.seat.hand { cursor: pointer; }
.centre { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; display: grid; gap: 6px; justify-items: center; width: 50%; }
.captions { height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.turn { font-size: 14px; }
.turn b { font-weight: 600; }
.turn.system { color: var(--ink-3); font-size: 12.5px; font-style: italic; }
.controls { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 14px; }
.level { width: 120px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; border: 1px solid var(--line); }
.level i { display: block; height: 100%; width: 0; background: var(--green); transition: width .08s; }

/* settings */
.set h3 { margin-bottom: 4px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 500; }
.files { display: grid; grid-template-columns: 260px 1fr; gap: 14px; }
.files .list { max-height: 70vh; overflow-y: auto; }
.files .list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 13.5px; }
.files .list button.on, .files .list button:hover { background: var(--accent-soft); }
.files textarea { min-height: 60vh; font-family: var(--mono); font-size: 13px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.bars i { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--navy); }
.login .card { width: min(400px, 100%); display: grid; gap: 12px; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  main { padding: 16px 16px 96px; }
  .bottom { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: var(--side); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); z-index: 30; }
  .bottom a { color: var(--side-ink); text-decoration: none; display: grid; justify-items: center; font-size: 11px; gap: 2px; padding: 4px; position: relative; }
  .bottom a b { font-size: 19px; line-height: 1; font-weight: 400; }
  .bottom a.on { color: #fff; }
  .bottom .count { position: absolute; top: 0; right: 18%; font-family: var(--mono); font-size: 10px; background: var(--orange); color: #fff; padding: 0 5px; border-radius: 8px; }
  .room { grid-template-columns: 1fr; }
  .captions { height: 260px; }
  .files { grid-template-columns: 1fr; }
  .msg { max-width: 90%; }
  h1 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
