:root {
  --bg: #0e1117; --panel: #161b24; --panel-2: #1c2230; --line: #2a3242; --text: #e6e9ef; --muted: #8b93a7;
  --accent: #7c9cff; --accent-2: #5eead4; --ok: #4ade80; --warn: #facc15; --err: #f87171; --orange: #fb923c;
  --radius: 12px; --shadow: 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, sans-serif; }
[hidden] { display: none !important; }
h2 { margin: 0; font-size: 20px; } h3 { margin: 18px 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); } h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
code, pre, .mono { font-family: "IBM Plex Mono", monospace; }
.muted { color: var(--muted); } .small { font-size: 12px; } .tiny { font-size: 11px; } .error { color: var(--err); min-height: 1em; }
a { color: var(--accent); }

.btn { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); padding: 7px 14px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 500; }
.btn:hover { border-color: #3b4660; } .btn.small { padding: 4px 10px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0b1020; }
.btn.danger { background: #7f1d1d; border-color: #b91c1c; color: #fff; font-weight: 600; }
.btn.ok { background: #14532d; border-color: #16a34a; } .btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.chip-btn { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 4px 12px; cursor: pointer; font: inherit; }
.chip-btn b { background: var(--warn); color: #111; border-radius: 999px; padding: 0 7px; margin-left: 4px; }
.chip-btn b:empty, .chip-btn b.zero { background: var(--line); color: var(--muted); }
input, select, textarea { background: #0b0f16; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 10px; font: inherit; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.row { display: flex; gap: 8px; align-items: center; }

.login { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, #1b2340, var(--bg)); }
.login-card { width: min(380px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; } .brand.big { font-size: 22px; } .logo { color: var(--accent-2); }

.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.topbar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.demo-banner, .estop-banner { padding: 4px 12px; border-radius: 6px; font-weight: 600; font-size: 12px; letter-spacing: .03em; }
.demo-banner { background: #422006; color: #fde68a; border: 1px solid #a16207; }
.estop-banner { background: #450a0a; color: #fecaca; border: 1px solid #b91c1c; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.meter { display: flex; align-items: center; gap: 8px; font-size: 12px; } .meter .bar { width: 90px; height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; } .meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .4s; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: var(--err); } .conn.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--panel); overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 10px 14px; cursor: pointer; font: inherit; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
main { padding: 16px 18px 40px; }
.view { display: none; } .view.active { display: block; }
.section-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.list { display: grid; gap: 8px; align-content: start; }
.split { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 14px; }
.roadmap { max-width: 680px; }

/* Office */
.office-layout { display: grid; grid-template-columns: 1fr 300px; gap: 14px; }
.stage-card { background: #0b0d12; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.stage { height: calc(100vh - 230px); min-height: 360px; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 6px; }
.office-wrap { position: relative; }
#office { display: block; image-rendering: pixelated; border-radius: 6px; }
#office.hover { cursor: pointer; }
.labels { position: absolute; inset: 0; pointer-events: none; }
.label { position: absolute; transform: translate(-50%, 0); text-align: center; white-space: nowrap; font-family: Silkscreen, monospace; font-size: 10px; line-height: 1.25; color: #f5f0e6; text-shadow: 0 1px 0 #000, 0 0 6px rgba(0,0,0,.9); }
.label small { display: block; font-family: "IBM Plex Mono", monospace; font-size: 9px; color: #d9d3c5; }
.label.selected { color: var(--accent-2); }
.labels.compact .label small { display: none; }
.room-label { position: absolute; transform: translate(-50%, 0); font-family: Silkscreen, monospace; font-size: 9px; letter-spacing: 2px; color: rgba(40,30,20,.45); white-space: nowrap; }
.labels.compact .room-label { display: none; }
.st-chip { display: inline-block; margin-top: 2px; padding: 0 5px; border-radius: 4px; font: 600 9px/14px Inter, sans-serif; letter-spacing: .03em; text-shadow: none; color: #0b0d12; }
.st-chip.ambient { background: rgba(139,147,167,.35) !important; color: #e5e7eb; font-weight: 400; }
.st-chip.sim::after { content: " · SIM"; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 6px 2px; font-size: 12px; color: var(--muted); }
.legend span i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.roster-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 12px 12px; max-height: calc(100vh - 150px); overflow: auto; }
.emp { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 8px; cursor: pointer; }
.emp:hover { background: var(--panel-2); }
.emp .dot { width: 10px; height: 10px; border-radius: 50%; }
.emp b { display: block; } .emp .sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }

.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; color: #0b0d12; }
.status-pill.ambient { background: var(--line) !important; color: var(--muted); }
.sim-tag { background: #a16207; color: #fff7d6; border-radius: 4px; padding: 0 5px; font-size: 10px; font-weight: 700; margin-left: 6px; letter-spacing: .04em; }

/* Feed */
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.feed li { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 6px 8px; border-radius: 6px; font-size: 13px; }
.feed li:nth-child(odd) { background: rgba(255,255,255,.02); }
.feed time { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 11px; }
.feed .who { font-weight: 600; margin-right: 6px; }
.feed .type { color: var(--muted); font-size: 11px; margin-right: 6px; text-transform: uppercase; letter-spacing: .04em; }
.feed.compact li { grid-template-columns: 48px 1fr; font-size: 12px; padding: 4px 6px; }
.feed li.refused { color: var(--orange); } .feed li.err { color: var(--err); }

/* Board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.col h4 { display: flex; justify-content: space-between; }
.tcard { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 9px 10px; margin-top: 8px; cursor: pointer; }
.tcard:hover { border-color: #3b4660; }
.tcard .t { font-weight: 600; font-size: 13px; } .tcard .m { color: var(--muted); font-size: 11px; margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Approvals */
.approval { border-left: 3px solid var(--warn); }
.approval pre, .pre { background: #0b0f16; border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow: auto; max-height: 260px; font-size: 12px; white-space: pre-wrap; word-break: break-word; }
.approval .actions { display: flex; gap: 8px; margin-top: 10px; }

/* Meetings */
.mitem { padding: 10px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; cursor: pointer; }
.mitem.active { border-color: var(--accent); }
.utter { padding: 8px 10px; border-radius: 8px; background: var(--panel-2); margin: 6px 0; }
.utter b { color: var(--accent-2); }
.minutes { white-space: pre-wrap; }

/* Costs */
.costs { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.big-num { font-size: 30px; font-weight: 700; }
.hbar { display: grid; grid-template-columns: 110px 1fr 80px; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.hbar .track { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; } .hbar .fill { height: 100%; background: var(--accent); }
.vbars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.vbars div { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.vbars div span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); white-space: nowrap; }

/* Drawer, modal, toast */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--panel); border-left: 1px solid var(--line); z-index: 40; overflow-y: auto; padding: 16px; box-shadow: var(--shadow); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; }
.drawer-actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.drawer-section { border-top: 1px solid var(--line); padding: 12px 0; }
.status-line { margin-top: 8px; font-size: 13px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal-card { position: relative; width: min(760px, 100%); max-height: 90vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.modal-close { position: absolute; right: 12px; top: 10px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 80; box-shadow: var(--shadow); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 10px; font-size: 13px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; } .checks label { display: flex; gap: 6px; align-items: center; color: var(--text); margin: 0; font-size: 13px; } .checks input { width: auto; }

@media (max-width: 980px) {
  .office-layout, .split { grid-template-columns: 1fr; }
  .stage { height: min(55vh, 80vw); min-height: 240px; }
  .roster-panel { max-height: none; }
}
@media (max-width: 560px) {
  main { padding: 12px; } .topbar { gap: 8px; padding: 8px 12px; } .meter .bar { width: 50px; }
  .kv { grid-template-columns: 1fr; }
}

/* Milestone 2: hiring + conversations */
.hire-top { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; align-items: start; }
.hire-top .btn { white-space: nowrap; }
.hire-top textarea { min-height: 90px; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 18px; }
.role { border-top: 3px solid var(--accent); display: flex; flex-direction: column; gap: 6px; }
.role .btn { align-self: flex-start; margin-top: auto; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tags span { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: rgba(255,255,255,.07); color: var(--muted); }
.tags span.warn { background: rgba(250,204,21,.18); color: #facc15; }
.hire-card { border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.hire-card .actions { margin-top: 8px; display: flex; gap: 8px; }
.thread { max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 6px; margin: 6px 0 8px; }
.msg { padding: 7px 10px; border-radius: 10px; max-width: 92%; white-space: pre-wrap; font-size: 13px; line-height: 1.4; }
.msg.owner { align-self: flex-end; background: rgba(97,175,239,.18); }
.msg.agent { align-self: flex-start; background: rgba(255,255,255,.06); }
.msg.system { align-self: center; color: var(--err); font-size: 12px; }
.msg.pending { align-self: flex-start; color: var(--muted); font-style: italic; }
.row.between { justify-content: space-between; align-items: center; }
.btn.danger-outline { border: 1px solid var(--err); color: var(--err); background: transparent; }
@media (max-width: 760px) { .hire-top { grid-template-columns: 1fr; } }
.row.between h4 { white-space: nowrap; margin: 0; } #d-conv { max-width: 65%; }
