:root {
  --bg: #09090b; --bg2: #0e0e11; --panel: #131316; --panel2: #1a1a1f; --line: #26262c; --line2: #34343c;
  --text: #ececf1; --muted: #8e8e9a; --red: #e5322d; --red-hi: #ff4a44; --red-dim: #5a1a18; --green: #36c98b; --amber: #f2a93b; --blue: #5aa9ff;
  --radius: 10px; --nav-w: 208px; --top-h: 52px;
  --font: ui-sans-serif, -apple-system, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: radial-gradient(1200px 500px at 70% -10%, #1a0c0c 0%, transparent 60%), var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--red-hi); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: .01em; }
h1 { font-size: 1.5rem; } h3 { font-size: 1rem; } h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 1rem 0 .4rem; }
p { margin: .4rem 0; } ul, ol { margin: 0; padding: 0; } code { font-family: var(--mono); font-size: .85em; color: #ffb3b0; }
.muted { color: var(--muted); } .small { font-size: .82rem; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 99; background: var(--red); color: #fff; padding: .5rem .8rem; border-radius: 6px; }
:focus-visible { outline: 2px solid var(--red-hi); outline-offset: 2px; border-radius: 4px; }
.noscript { padding: 2rem; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; grid-template-rows: var(--top-h) 1fr; grid-template-areas: "top top" "nav main"; min-height: 100vh; }
.topbar { grid-area: top; display: flex; align-items: center; justify-content: space-between; padding: 0 1rem; border-bottom: 1px solid var(--line); background: rgba(9, 9, 11, .85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; letter-spacing: .04em; }
.brand-sub { color: var(--muted); font-weight: 500; letter-spacing: .12em; text-transform: uppercase; font-size: .72rem; margin-left: .2rem; }
.logo { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--red); color: #0b0b0d; font-family: var(--mono); font-weight: 800; box-shadow: 0 0 0 1px #ff7b76 inset, 0 0 18px rgba(229, 50, 45, .35); }
.conn { font-size: .75rem; padding: .2rem .6rem; border-radius: 99px; border: 1px solid var(--line2); color: var(--muted); }
.conn::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: .45rem; background: currentColor; }
.conn-live { color: var(--green); border-color: #1f5a43; } .conn-warn { color: var(--amber); border-color: #5a4318; } .conn-bad { color: var(--red-hi); border-color: var(--red-dim); }
.nav { grid-area: nav; display: flex; flex-direction: column; gap: 2px; padding: .8rem .6rem; border-right: 1px solid var(--line); position: sticky; top: var(--top-h); align-self: start; height: calc(100vh - var(--top-h)); }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 8px; color: var(--muted); font-weight: 550; text-decoration: none; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a[aria-current="page"] { background: linear-gradient(90deg, rgba(229, 50, 45, .18), transparent); color: #fff; box-shadow: inset 2px 0 0 var(--red); }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.main { grid-area: main; padding: 1.25rem clamp(.9rem, 2.5vw, 2rem) 3rem; min-width: 0; outline: none; max-width: 1200px; width: 100%; }
.page { display: flex; flex-direction: column; gap: 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.page-head p { max-width: 62ch; } .page-actions { display: flex; gap: .5rem; align-items: center; }

/* ---- primitives ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.card-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .6rem; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: .6rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .8rem; margin: .6rem 0 1rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.pcard { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.pcard:hover { border-color: var(--red); text-decoration: none; transform: translateY(-1px); }
.pcard-top { display: flex; justify-content: space-between; gap: .6rem; align-items: center; }
.badge { display: inline-block; font-size: .7rem; font-weight: 650; letter-spacing: .04em; padding: .08rem .5rem; border-radius: 99px; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.badge-ok { color: var(--green); border-color: #1d5640; background: rgba(54, 201, 139, .08); } .badge-warn { color: var(--amber); border-color: #5e4719; background: rgba(242, 169, 59, .08); }
.badge-bad { color: var(--red-hi); border-color: var(--red-dim); background: rgba(229, 50, 45, .1); } .badge-live { color: var(--blue); border-color: #234a73; background: rgba(90, 169, 255, .08); }
.btn { font: inherit; font-weight: 600; font-size: .85rem; color: var(--text); background: var(--panel2); border: 1px solid var(--line2); padding: .45rem .8rem; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--red); text-decoration: none; } .btn:active { transform: translateY(1px); }
.btn-primary { background: var(--red); border-color: #ff6b66; color: #fff; } .btn-primary:hover { background: var(--red-hi); }
.btn-ghost { background: transparent; } .btn-small { padding: .15rem .55rem; font-size: .75rem; }
.btn-chip { border-radius: 99px; padding: .35rem .8rem; } .btn-chip[aria-pressed="true"] { background: var(--red-dim); border-color: var(--red); color: #fff; }
.input { width: 100%; font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: .5rem .7rem; }
.input:focus { border-color: var(--red); outline: none; box-shadow: 0 0 0 3px rgba(229, 50, 45, .25); }
.filters { display: grid; grid-template-columns: 1fr 200px; gap: .6rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .7rem; }
.stat { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; color: var(--text); text-decoration: none; }
a.stat:hover { border-color: var(--red); text-decoration: none; }
.stat-v { font-size: 1.6rem; font-weight: 700; font-family: var(--mono); line-height: 1.1; } .stat-l { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.tone-ok .stat-v { color: var(--green); } .tone-warn .stat-v { color: var(--amber); } .tone-bad .stat-v { color: var(--red-hi); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: .4rem 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.plain { list-style: none; } .plain li { padding: .3rem 0; } .rows li { border-bottom: 1px solid var(--line); padding: .55rem 0; } .rows li:last-child { border: 0; }
.empty { color: var(--muted); padding: .6rem 0; } .error-box { color: var(--red-hi); border: 1px solid var(--red-dim); background: rgba(229, 50, 45, .08); padding: .7rem 1rem; border-radius: 8px; }
.note { border-left: 3px solid var(--red); padding: .4rem .8rem; background: var(--bg2); color: #d8d8e0; border-radius: 0 6px 6px 0; }
.alert-banner { display: block; padding: .6rem 1rem; border: 1px solid var(--red-dim); background: rgba(229, 50, 45, .12); border-radius: 8px; color: #ffb3b0; }
.health-strip { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; } .health-overall { color: var(--text); } .health-chip { font-size: .85rem; color: var(--muted); }
.overall { font-size: 1.05rem; }
.table { width: 100%; border-collapse: collapse; } .table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .4rem .5rem; border-bottom: 1px solid var(--line2); } .table td:last-child, .table th:last-child { white-space: nowrap; }
.table td { padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.finding { border-top: 1px solid var(--line); padding: .8rem 0; } .finding:first-of-type { border: 0; } .ref { font-family: var(--mono); color: var(--red-hi); }

/* ---- events ---- */
.events { list-style: none; }
.ev { display: grid; grid-template-columns: 82px 1fr auto; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line); align-items: baseline; } .ev:last-child { border: 0; }
.ev-time { color: var(--muted); font-size: .8rem; font-family: var(--mono); } .ev-meta { text-align: right; }

/* ---- office ---- */
.office { background: linear-gradient(180deg, #121215, #0c0c0f); border: 1px solid var(--line); border-radius: 14px; padding: .8rem; box-shadow: 0 0 0 1px #000 inset, 0 12px 40px rgba(0, 0, 0, .45); position: relative; }
.office-head { display: flex; align-items: center; gap: .8rem; padding: .1rem .2rem .6rem; flex-wrap: wrap; }
.office-reason { margin: 0; color: #cfcfd8; flex: 1 1 260px; }
.office-state { font-weight: 700; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; padding: .2rem .65rem; border-radius: 6px; border: 1px solid var(--red); color: #fff; background: var(--red-dim); }
.office-state.tone-ok { border-color: #1d5640; background: rgba(54, 201, 139, .12); color: var(--green); } .office-state.tone-warn { border-color: #5e4719; background: rgba(242, 169, 59, .12); color: var(--amber); }
.office-state.tone-dim { border-color: var(--line2); background: var(--panel2); color: #cfcfd8; } .office-state.tone-bad { border-color: var(--red); background: var(--red-dim); color: #ffb3b0; }
.office-stage { width: min(100%, calc(72vh * 5 / 3)); aspect-ratio: 5 / 3; background: #07070a; border-radius: 8px; overflow: hidden; border: 1px solid #000; margin-inline: auto; }
.office-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; touch-action: manipulation; }
.office-tools { display: flex; flex-wrap: wrap; gap: .45rem; padding-top: .7rem; }
.drawer { margin-top: .8rem; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); padding: .9rem 1rem; outline: none; }
.drawer[hidden] { display: none; } .drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; } .kcol h4 { margin-top: 0; }
.timeline { list-style: none; border-left: 2px solid var(--line2); padding-left: .8rem; } .timeline li { padding: .25rem 0; } .timeline time { color: var(--muted); font-size: .78rem; margin-right: .4rem; }
.trail { padding-left: 1.2rem; color: #cfcfd8; } details summary { cursor: pointer; color: var(--muted); margin: .5rem 0; }

/* ---- forms / login ---- */
.form { display: flex; flex-direction: column; gap: .6rem; max-width: 520px; } .form label { font-size: .82rem; color: var(--muted); } fieldset { border: 1px solid var(--line2); border-radius: 8px; padding: .5rem .8rem; } legend { color: var(--muted); font-size: .82rem; padding: 0 .3rem; }
.days { display: flex; flex-wrap: wrap; gap: .4rem .9rem; } .check { display: inline-flex; gap: .4rem; align-items: center; color: var(--text) !important; font-size: .9rem !important; } .row2, .row3 { display: grid; gap: .6rem; } .row2 { grid-template-columns: 1fr 1fr; } .row3 { grid-template-columns: 2fr 1fr 1fr; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(700px 400px at 50% 30%, #240c0b, transparent 70%); }
.login-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 1.6rem; display: flex; flex-direction: column; gap: .7rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.login-card label { font-size: .82rem; color: var(--muted); } .login-msg { color: var(--red-hi); min-height: 1.2em; margin: 0; } .brand-lg { font-size: 1.15rem; margin-bottom: .5rem; }
.login-fields { display: flex; flex-direction: column; gap: .5rem; }
.login-fields.hidden { display: none; }
.link-btn { background: none; border: none; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 0; text-align: left; font: inherit; }
.link-btn.small { font-size: .82rem; }

/* ---- responsive ---- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: var(--top-h) 1fr; grid-template-areas: "top" "main"; }
  .nav { position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; top: auto; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-top: 1px solid var(--line); background: rgba(9, 9, 11, .96); backdrop-filter: blur(8px); padding: .3rem .4rem calc(.3rem + env(safe-area-inset-bottom)); gap: 0; justify-content: space-between; }
  .nav a { flex-direction: column; gap: .15rem; font-size: .66rem; padding: .35rem .5rem; min-width: 52px; justify-content: center; text-align: center; }
  .nav a[aria-current="page"] { box-shadow: inset 0 2px 0 var(--red); background: rgba(229, 50, 45, .12); }
  .main { padding-bottom: 6rem; } .brand-sub { display: none; }
  .ev { grid-template-columns: 70px 1fr; } .ev-meta { grid-column: 2; text-align: left; }
  .filters { grid-template-columns: 1fr; } .office { padding: .5rem; border-radius: 10px; } .office-stage { width: 100%; }
  .office-tools { overflow-x: auto; flex-wrap: nowrap; padding-bottom: .3rem; } .office-tools .btn { flex: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---- composer ---- */
.composer-form { display: flex; flex-direction: column; gap: .5rem; }
.composer-input { resize: vertical; min-height: 2.4em; font-family: inherit; }
.composer-row { display: flex; align-items: center; gap: .8rem; }
.composer-reply { border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.composer-you { color: var(--muted); }
.composer-ace { color: var(--text); }
