/* Stazione · restyling v2: "dark cockpit". Loaded AFTER app.css: it only overrides.
   v1 looked like every generated dashboard (pills, round cards, an italic serif, five accent colours). Three rules:
   1. 60-30-10. The page is 60, the panels are 30, amber is at most 10, and amber means one thing: a human is
      needed here (it's your turn, a caution, the focus of your keyboard). What the crews do on their own stays
      grey: when everything is fine nothing lights up, as in an Airbus cockpit. Red only for errors and for the
      keys that refuse or delete.
   2. Hard edges. No rounded corners, pills, shadows, gradients, glow or blur: hairlines, a grid, keys.
   3. Type from the cockpit: B612 (drawn for Airbus cockpit screens) to read, B612 Mono for labels, ids and numbers.
   Other colours are data: each Claude's suit and each room, as small squares and thin rules, never as text.
   The sky follows the viewer's clock (restyle.js sets data-sky on <html>): day is the light variant.
   Fonts are self-hosted in /fonts: the CSP allows only 'self' (see README). */

@font-face { font-family: 'B612'; src: url('/fonts/b612-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'B612'; src: url('/fonts/b612-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'B612 Mono'; src: url('/fonts/b612-mono-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'B612 Mono'; src: url('/fonts/b612-mono-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

/* ---------- tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #0f0e11;                                                     /* 60: the page */
  --panel: #18171b; --panel-2: #201f24;                              /* 30: the panels */
  --well: #0a090c; --line: #2d2b32; --line-2: #48454f;
  --fg: #ece9e3; --dim: #98949f;
  --accent: #ffb020; --accent-ink: #ffb020; --on-accent: #171003;    /* 10: a human is needed */
  --bad: #ff5a4e;                                                    /* errors only */
  /* app.css's colours, folded into the three */
  --amber: var(--accent); --amber-deep: var(--accent); --pink: var(--accent); --teal: var(--fg); --ok: var(--fg);
  --shadow: transparent; --glow: transparent;
  --font-display: 'B612 Mono', ui-monospace, Menlo, monospace;
  --font-body: 'B612', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'B612 Mono', ui-monospace, Menlo, monospace;
}
:root[data-sky="day"] {
  color-scheme: light;
  --bg: #e7e4dd; --panel: #f4f2ed; --panel-2: #ebe8e1;
  --well: #fbfaf8; --line: #d2cec5; --line-2: #aaa59b;
  --fg: #151418; --dim: #5f5c64;
  --accent: #f2a31b; --accent-ink: #8f5200; --on-accent: #171003;
  --bad: #c0301e;
}

/* ---------- base ---------- */
html, body { background: var(--bg); color: var(--fg); }
body { font-family: var(--font-body); font-size: 14px; line-height: 1.45; background: var(--bg); }
html { scrollbar-color: var(--line-2) var(--bg); }
::selection { background: var(--accent); color: var(--on-accent); }
a { color: inherit; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
.sub, .meta { color: var(--dim); }
.meta { font-size: 12.5px; line-height: 1.45; }
.empty { font-size: 13px; }
.status-line { font-size: 12.5px; }
code.res { font-family: var(--font-mono); font-size: 11.5px; background: var(--well); border: 1px solid var(--line); padding: 0 5px; }

/* ---------- header: wordmark, clock, then a row of keys ---------- */
.bar { gap: 8px 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); box-shadow: none; }
@media (min-width: 1200px) { .bar { flex-wrap: nowrap; } .bar > * { flex-shrink: 0; } .bar .sub, .bar .spacer { flex-shrink: 1; } }
.bar h1 { font-family: var(--font-mono); font-size: 14px; font-weight: 700; letter-spacing: .24em; color: var(--fg); text-shadow: none; }
.bar .clock { display: inline-flex; align-items: baseline; gap: 7px; padding-left: 12px; border-left: 1px solid var(--line); font-family: var(--font-mono); line-height: 1; }
.bar .clock b { font-family: var(--font-body); font-size: 15px; font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.bar .clock small { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.bar .sub { min-width: 0; padding-left: 12px; border-left: 1px solid var(--line); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1199px) { .bar .sub { display: none; } }
.bar button, .bar .btn { padding: 7px 10px; }
.theme-btn, .sky-btn { color: var(--dim); }
.theme-btn b, .sky-btn b { margin-left: .6em; color: var(--fg); font-weight: 700; }
@media (max-width: 640px) { .bar { gap: 6px; } .bar button, .bar .btn { padding: 6px 8px; font-size: 10px; } .bar a.btn[href="/m/ideas"]::before { font-size: 10px; } }

/* the emoji of the old labels stay in the HTML (the classic theme uses them) and for screen readers; here, words */
.bar a.btn[href="/m/ideas"], .views button, .roombar .diary-link, .entry > span:first-child { font-size: 0; }
.bar a.btn[href="/m/ideas"]::before { content: "Ideas"; content: "Ideas" / ""; font-size: 11px; letter-spacing: .12em; }
.views button::before { font-size: 11px; letter-spacing: .12em; }
.views button[data-go="station"]::before { content: "Station"; content: "Station" / ""; }
.views button[data-go="missions"]::before { content: "Missions"; content: "Missions" / ""; }
.views button[data-go="journal"]::before { content: "Logbook"; content: "Logbook" / ""; }
.views button[data-go="tech"]::before { content: "Tech"; content: "Tech" / ""; }
.roombar .diary-link::before { content: "Logbook"; content: "Logbook" / ""; font-size: 12.5px; }
/* the same words in Italian (i18n.js sets <html lang>) */
:lang(it) .bar a.btn[href="/m/ideas"]::before { content: "Idee"; content: "Idee" / ""; }
:lang(it) .views button[data-go="station"]::before { content: "Stazione"; content: "Stazione" / ""; }
:lang(it) .views button[data-go="missions"]::before { content: "Missioni"; content: "Missioni" / ""; }
:lang(it) .views button[data-go="journal"]::before, :lang(it) .roombar .diary-link::before { content: "Diario"; content: "Diario" / ""; }
:lang(it) .views button[data-go="tech"]::before { content: "Tecnico"; content: "Tecnico" / ""; }

/* ---------- chips: unlit labels; a filled square = active, half = talking, hollow = waiting ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 7px; border: 1px solid var(--line-2); border-radius: 0; background: transparent; color: var(--dim); font-family: var(--font-mono); font-size: 10px; font-weight: 700; line-height: 1.2; letter-spacing: .1em; text-transform: uppercase; }
.chip.ok, .chip.teal, .chip.pink { color: var(--fg); }
.chip.warn, .chip.dim { color: var(--dim); }
.chip.bad { color: var(--accent-ink); border-color: var(--accent); }
#conn.chip.bad { color: var(--bad); border-color: var(--bad); }
.chip.ok::before, .chip.warn::before, .chip.pink::before, .chip.bad::before { content: ""; width: 6px; height: 6px; flex: none; border: 1px solid currentColor; }
.chip.ok::before, .chip.bad::before { background: currentColor; }
.chip.pink::before { background: linear-gradient(90deg, currentColor 50%, transparent 0); }
/* a room's name: the room's colour stays in the square, the text is plain */
.chip:not(.ok, .warn, .bad, .dim, .teal, .pink) { -webkit-text-fill-color: var(--fg); }
.chip:not(.ok, .warn, .bad, .dim, .teal, .pink)::before { content: ""; width: 7px; height: 7px; flex: none; background: currentColor; }
/* where a chip is a caution, it is amber */
.card .chip.warn, .msg .chip.pink { color: var(--accent-ink); border-color: var(--accent); }
.card .chip.pink::before { display: none; }
details.recap .chip.pink { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
details.recap .chip.pink::before { display: none; }

/* ---------- keys ---------- */
button, .btn { font-family: var(--font-mono); font-size: 11px; font-weight: 700; line-height: 1.2; letter-spacing: .12em; text-transform: uppercase; padding: 8px 13px; border: 1px solid var(--fg); border-radius: 0; background: var(--fg); color: var(--bg); box-shadow: none; transition: none; }
button:hover, .btn:hover { filter: none; background: var(--dim); border-color: var(--dim); }
button:active:not(:disabled), .btn:active { transform: none; box-shadow: none; }
button.ghost, .btn.ghost { background: transparent; color: var(--fg); border-color: var(--line-2); }
button.ghost:hover, .btn.ghost:hover { background: var(--panel-2); border-color: var(--dim); }
button.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
button.danger:hover { background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: var(--bad); }
.approval .opts button, .poll .opt-head button, .poll > button, .crew button.forget, .note-acts button, .proj-goal button, .proj-ms button { font-size: 10px; padding: 6px 9px; }
.yourturn button:not(.ghost, .danger) { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.yourturn button:not(.ghost, .danger):hover { background: color-mix(in srgb, var(--accent) 82%, var(--fg)); }
.snd { gap: 0; }
.snd button { min-width: 34px; padding: 7px 9px; font-size: 11px; }
.snd button + button { margin-left: -1px; }
.snd button[aria-pressed="false"] { color: var(--dim); opacity: 1; }
.snd button[aria-pressed="true"] { color: var(--fg); border-color: var(--line-2); background: var(--panel-2); }
.bell { padding: 6px 9px; }
.bell .badge, .views .badge { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 0; background: var(--accent); color: var(--on-accent); font-family: var(--font-mono); font-size: 10px; font-weight: 700; line-height: 16px; letter-spacing: 0; box-shadow: none; }
.bell .badge { top: -6px; right: -6px; }
.avatar-btn { width: 32px; height: 32px; border: 1px solid var(--line-2); border-radius: 0; box-shadow: none; background: var(--panel); }
a.avatar-btn:hover { border-color: var(--fg); }

/* ---------- fields ---------- */
input, select, textarea { font-family: var(--font-body); font-size: 13.5px; font-weight: 400; letter-spacing: normal; text-transform: none; color: var(--fg); background: var(--well); border: 1px solid var(--line-2); border-radius: 0; padding: 7px 9px; }
input:focus, select:focus, textarea:focus { border-color: var(--fg); }
input[type="checkbox"], input[type="radio"] { padding: 0; accent-color: var(--fg); }
::placeholder { color: var(--dim); }
label.field { gap: 5px; color: var(--dim); font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }

/* ---------- sections (tabs with an underline) and rooms (a strip of keys) ---------- */
.views { gap: 0; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.views button { margin-bottom: -1px; padding: 13px 16px 11px; background: transparent; color: var(--dim); border: 0; border-bottom: 2px solid transparent; }
.views button:hover { background: transparent; color: var(--fg); }
.views button.on { background: transparent; color: var(--fg); border-bottom-color: var(--fg); }
.views .badge { position: static; display: inline-block; margin-left: 8px; vertical-align: 1px; }
.rooms { gap: 0; margin-bottom: 0; }
.rooms button { margin: 0 -1px -1px 0; padding: 7px 12px; gap: 8px; background: transparent; color: var(--fg); border: 1px solid var(--line); border-radius: 0; box-shadow: none; font-family: var(--font-body); font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.rooms button::before { width: 8px; height: 8px; border-radius: 0; box-shadow: none; }
.rooms button:first-child::before { display: none; } /* "All rooms" is not a room */
.rooms button .n { font-family: var(--font-mono); font-size: 11px; color: var(--dim); }
.rooms button:hover { background: var(--panel); border-color: var(--line); }
.rooms button[aria-pressed="true"] { position: relative; background: var(--fg); color: var(--bg); border-color: var(--fg); }
.rooms button[aria-pressed="true"] .n { color: var(--bg); opacity: .65; }
.roombar { padding: 2px 0 2px 12px; border: 0; border-left: 2px solid var(--room, var(--line-2)); border-radius: 0; background: transparent; color: var(--dim); font-size: 12.5px; }
.roombar b { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--fg); }
.roombar a { color: var(--fg); }

/* ---------- panels: a placard on top, hairlines inside ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 0 16px 16px; gap: 12px; }
.panel h2 { margin: 0 -16px; padding: 11px 16px 10px; border-bottom: 1px solid var(--line); align-items: baseline; color: var(--fg); font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .14em; }
.panel h2::before { display: none; }
.panel h2 .count { color: var(--dim); font-family: var(--font-mono); font-size: 11px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; }
.wrap[style*="--room"] .panel:not(.alert) h2 { color: var(--fg); }
.panel.alert { border-color: var(--line); box-shadow: none; }
.panel.alert h2 { color: var(--fg); }
.panel > p.meta { margin: 2px 0; }
ul.list { gap: 0; padding-right: 0; }
ul.list li.group { display: flex; padding: 14px 0 6px; color: var(--dim); font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .14em; }
ul.list li.group::before { content: ""; width: 8px; height: 8px; flex: none; background: var(--g, var(--dim)); }
ul.list li.group::after { border-top: 1px solid var(--line); opacity: 1; }

/* ---------- the station: a dark porthole, by day too ---------- */
.screen { border: 1px solid var(--line); border-radius: 0; box-shadow: none; background: #0b0812; }
.screen::after { display: none; }
.legend { gap: 4px 14px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--panel); color: var(--dim); font-family: var(--font-mono); font-size: 10.5px; }

/* ---------- crew, comms ---------- */
.crew li { grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.crew .name { font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.sw { width: 10px; height: 10px; border-radius: 0; box-shadow: none; }
.crew .sw { width: 10px; height: 10px; margin-top: 5px; box-shadow: none; }
.msg ul.list { gap: 14px; padding-top: 4px; }
.msg li { gap: 3px; padding: 0 0 0 11px; background: transparent; border: 0; border-left: 2px solid var(--c, var(--line-2)); border-radius: 0; box-shadow: none; }
.msg li.secure { border-left-color: var(--accent); }
.msg .hdr { gap: 6px; color: var(--dim); font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.msg .hdr b { color: var(--fg); font-weight: 700; }
.msg .hdr .rt { -webkit-text-fill-color: var(--dim); }
.msg .hdr .rt::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; background: currentColor; }
.msg .txt { font-size: 13.5px; }
.revealed { background: var(--well); border: 1px solid var(--accent); }
.secret-box { background: var(--well); border: 1px solid var(--line-2); font-family: var(--font-mono); font-size: 13px; }

/* ---------- missions, locks ---------- */
.cols { gap: 16px; }
.col h3, .col:nth-child(2) h3, .col:nth-child(3) h3 { margin: 0 0 10px; padding: 0 0 8px; background: transparent; border: 0; border-bottom: 1px solid var(--line); color: var(--dim); font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .14em; }
.col ul.list { gap: 8px; }
.card { gap: 5px; padding: 9px 11px; background: transparent; border: 1px solid var(--line); border-left: 2px solid var(--rc, var(--line-2)); border-radius: 0; box-shadow: none; }
.card:hover { border-color: var(--line-2); border-left-color: var(--rc, var(--line-2)); }
.card .t { font-size: 13.5px; }
.card .tags > .meta:first-child { font-family: var(--font-mono); font-size: 10.5px; }
.locks li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.ttl { max-width: 160px; height: 2px; background: var(--line); border: 0; border-radius: 0; }
.ttl i { background: var(--dim); }
.approval { background: transparent; border: 1px solid var(--line-2); border-left: 2px solid var(--accent); border-radius: 0; padding: 12px; }

/* ---------- it's your turn: the one place that lights up (below the scene: the rooms come first) ---------- */
.yourturn { gap: 0; padding: 0; border: 1px solid var(--accent); background: var(--panel); }
.yourturn-title { margin: 0; padding: 10px 16px; background: var(--accent); color: var(--on-accent); font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: .2em; }
.yourturn > .panel { border: 0; border-top: 1px solid var(--line); }

/* ---------- diary, recaps, decisions, stats, context, log, votes, projects ---------- */
.day { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.day h3 { color: var(--fg); font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; letter-spacing: .14em; }
.day ul { gap: 0; }
.entry { grid-template-columns: 34px minmax(0, 1fr) auto; padding: 8px 0; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.entry > span:first-child::before { color: var(--dim); font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.entry.recap > span:first-child::before { content: "REC"; content: "REC" / ""; }
.entry.mission > span:first-child::before { content: "MIS"; content: "MIS" / ""; }
.entry.decision > span:first-child::before { content: "DEC"; content: "DEC" / ""; color: var(--fg); }
.entry.release > span:first-child::before { content: "REL"; content: "REL" / ""; }
:lang(it) .entry.release > span:first-child::before { content: "RIL"; content: "RIL" / ""; }
.entry .body { font-size: 13px; }
.entry details summary, .diary-filters { font-size: 12.5px; }
details.recap { padding: 10px 12px; background: transparent; border: 1px solid var(--line); border-left: 2px solid var(--rc, var(--line-2)); border-radius: 0; box-shadow: none; }
details.recap summary b { font-size: 14.5px; font-weight: 700; }
details.recap .body { border-top: 1px solid var(--line); font-size: 13.5px; }
.stats-fig { background: transparent; border: 1px solid var(--line); border-radius: 0; }
.stats-fig figcaption { font-size: 13px; }
.stats-h { color: var(--dim); font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .14em; }
svg.chart .grid { stroke: var(--line); stroke-dasharray: none; }
svg.chart .axis { fill: var(--dim); font-family: var(--font-mono); font-size: 10.5px; }
svg.chart .label, svg.chart .value { font-family: var(--font-body); font-size: 12px; }
svg.chart g[tabindex] path { fill: var(--dim); }
svg.chart g[tabindex]:hover path, svg.chart g[tabindex]:focus path { fill: var(--fg); }
.chart-tip { background: var(--bg); border: 1px solid var(--line-2); border-radius: 0; box-shadow: none; font-size: 12.5px; }
table.stats-table, table.tokens { font-size: 13px; }
table.stats-table th, table.stats-table td, table.tokens th, table.tokens td { border-bottom: 1px solid var(--line); }
.ctx details { padding: 8px 0 8px 10px; border-bottom: 1px solid var(--line); border-left: 2px solid var(--rc, var(--line-2)); }
.ctx summary { color: var(--fg); }
.ctx pre { font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5; }
.log li.commit { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.log li.commit.live { border-left: 2px solid var(--fg); }
.newvote summary { color: var(--fg); font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.poll .opt { border: 1px solid var(--line); border-radius: 0; }
.poll .opt.win { border-color: var(--fg); }
.proj-row { padding: 10px 12px; background: transparent; color: var(--fg); border: 1px solid var(--line); border-left: 2px solid var(--rc, var(--line-2)); font-family: var(--font-body); font-size: 13.5px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.proj-row:hover { background: var(--panel-2); border-color: var(--line-2); border-left-color: var(--rc, var(--line-2)); }
.proj-row b { font-size: 14.5px; font-weight: 700; }

/* ---------- bell, avatars, ideas, auth pages ---------- */
.bellpop { border: 1px solid var(--line-2); border-radius: 0; box-shadow: none; }
.bellpop button.note { padding: 8px 10px; background: transparent; border-left: 2px solid var(--line-2); border-radius: 0; font-family: var(--font-body); font-size: 13px; }
.bellpop button.note.new { border-left-color: var(--accent); }
.bellpop button.note:hover, .bellpop button.note:focus-visible { background: var(--panel-2); outline: 0; }
.avatar-choice { background: transparent; color: var(--fg); border: 1px solid var(--line); font-size: 10px; }
.avatar-choice canvas, .note-avatar { border-radius: 0; }
.avatar-choice.on { background: var(--panel-2); border-color: var(--fg); }
.notes .note { background: transparent; border-left: 2px solid var(--line-2); border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.notes .note.mine { border-left-color: var(--fg); }
.notes .note.pinned { background: transparent; border-left-color: var(--accent); }
.note-new textarea { font-family: var(--font-body); font-size: 13.5px; }
.auth h1 { color: var(--fg); font-family: var(--font-mono); font-size: 16px; font-weight: 700; letter-spacing: .22em; line-height: 1.4; text-shadow: none; }
.warn-box { border: 1px solid var(--accent); color: var(--accent-ink); }
.phrase { background: var(--well); border: 1px solid var(--accent); }
.phrase li { font-family: var(--font-mono); font-size: 14px; }

/* ---------- phones: the sections become a bottom bar ---------- */
@media (max-width: 700px) {
  .views { padding: 0; gap: 0; background: var(--bg); border-top: 1px solid var(--line); border-bottom: 0; }
  .views button { margin: 0; padding: 15px 2px 13px; border-bottom: 0; border-top: 2px solid transparent; }
  .views button::before { font-size: 10px; letter-spacing: .08em; }
  .views button.on { border-top-color: var(--fg); }
}

/* the admin console tabs have no emoji to hide: plain words */
.views.admin-tabs button { font-size: 11px; letter-spacing: .12em; }
