/* Quartermaster — WAR-ROOM TABLE (REDESIGN-WARROOM.md, D-101).
   The painted theater map fills the screen like a campaign map on a desk; the desk itself is walnut; every panel is a
   manila dossier that slides over the map (requisition on the left, the General's plan / assessment / requests /
   inspector on the right); type is typewriter + stencil; verdicts are rubber stamps. Class names are unchanged from
   slices 1-8 — this file only restyles. Fonts: ui/assets/fonts (OFL / Apache, licences alongside). */

@font-face { font-family: 'Plex Cond'; src: url(./assets/fonts/ibm-plex-sans-condensed-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex Cond'; src: url(./assets/fonts/ibm-plex-sans-condensed-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plex Cond'; src: url(./assets/fonts/ibm-plex-sans-condensed-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Plex Cond'; src: url(./assets/fonts/ibm-plex-sans-condensed-latin-700-normal.woff2) format('woff2'); font-weight: 700 900; font-display: swap; }
@font-face { font-family: 'Courier Prime'; src: url(./assets/fonts/courier-prime-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Courier Prime'; src: url(./assets/fonts/courier-prime-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Special Elite'; src: url(./assets/fonts/special-elite-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Stardos Stencil'; src: url(./assets/fonts/stardos-stencil-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Stardos Stencil'; src: url(./assets/fonts/stardos-stencil-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --desk: #241811;
  --desk-hi: #3a281b;
  --paper: #e6d9ba;
  --paper-2: #d9c9a2;
  --paper-3: #f2e9d3;
  --ink: #2a2117;
  --muted: #6c5f47;
  --line: rgba(74, 54, 28, 0.3);
  --line-2: rgba(74, 54, 28, 0.55);
  --accent: #8e2a1e;
  --brass: #b08436;
  --ok: #3d6a2a;
  --warn: #9a5d12;
  --bad: #a8241a;
  --cream: #f1e6c8;
  --f-body: 'Plex Cond', 'Arial Narrow', system-ui, sans-serif;
  --f-type: 'Courier Prime', 'Courier New', monospace;
  --f-elite: 'Special Elite', 'Courier Prime', monospace;
  --f-stencil: 'Stardos Stencil', 'Plex Cond', sans-serif;
  --lbody: min(330px, 27vw);
  --rbody: min(350px, 28vw);
  --rail: 30px;
  font-family: var(--f-body);
  font-size: 13px;
  color: var(--ink);
  background: var(--desk);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--desk) url(./assets/warroom/ui.desk.jpg) center / 512px; }
button {
  font: inherit; color: var(--ink); background: var(--paper-3); border: 1px solid var(--line-2);
  border-radius: 2px; padding: 4px 8px; cursor: pointer; box-shadow: 0 1px 0 rgba(60, 40, 15, 0.25);
}
button:hover:not(:disabled) { background: #fff6e2; border-color: var(--ink); }
button:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
h2 { font-family: var(--f-stencil); font-weight: 700; font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 0 0 6px; }
h3 { font-size: 13px; margin: 6px 0 4px; }
p { margin: 4px 0; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.small { font-size: 11px; }

/* paper: the dossier surface (texture + a soft edge shadow) */
.paper, .drawer-body, .overlay-card, .save-manager, .coach, .log-panel, .legend, .alert-list, .toast {
  background: var(--paper) url(./assets/warroom/ui.paper.jpg) center / 420px;
  color: var(--ink);
}

/* ================================================================ layout: desk, strip, full-bleed map, drawers */
#app {
  position: relative; display: grid; height: 100vh;
  grid-template-columns: 1fr;
  grid-template-rows: 54px 1fr;
  grid-template-areas: 'status' 'map';
  --lw: var(--rail); --rw: var(--rail);
}
#app.l-open { --lw: calc(var(--lbody) + var(--rail)); }
#app.r-open { --rw: calc(var(--rbody) + var(--rail)); }
#status { grid-area: status; position: relative; z-index: 12; }
#map-wrap { grid-area: map; position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #2a2f2a; }
#map-area { position: relative; flex: 1 1 auto; min-height: 0; }
/* the map sits IN the table: a dark inner bevel all round */
#map-area::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 3px rgba(20, 12, 6, 0.85), inset 0 0 38px rgba(10, 6, 2, 0.55); z-index: 1; }

.drawer { position: absolute; top: calc(54px + 36px); bottom: 0; display: flex; z-index: 8; transition: transform 0.24s ease; }
.drawer-body { overflow-y: auto; min-height: 0; box-shadow: 0 0 0 1px rgba(40, 25, 10, 0.55), 0 8px 26px rgba(0, 0, 0, 0.55); }
#left { left: 0; flex-direction: row; transform: translateX(calc(-1 * var(--lbody))); }
#left .drawer-body { width: var(--lbody); }
.l-open #left { transform: none; }
#right { right: 0; flex-direction: row; transform: translateX(var(--rbody)); }
#right .tab-body { width: var(--rbody); flex: none; }
.r-open #right { transform: none; }
.col { background: none; border: 0; }
.panel { padding: 12px 14px 14px; }

/* the rails: manila folder tabs sticking out of each drawer, always on the map's edge */
.rail { width: var(--rail); flex: none; display: flex; flex-direction: column; gap: 4px; padding: 10px 0 0; background: none; border: 0; }
.rail-tab, .tab-btn {
  writing-mode: vertical-rl; text-orientation: mixed; width: var(--rail); padding: 14px 0; margin: 0;
  font-family: var(--f-stencil); font-weight: 700; font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase;
  background: linear-gradient(90deg, #cdb98d, #dcc9a0); color: #4a3a22; border: 1px solid rgba(40, 25, 10, 0.6);
  box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.45); position: relative;
}
#left .rail-tab { border-left: 0; border-radius: 0 7px 7px 0; }
#right .tab-btn { transform: rotate(180deg); border-left: 0; border-radius: 0 7px 7px 0; }
.rail-tab:hover:not(:disabled), .tab-btn:hover:not(:disabled) { background: var(--paper-3); }
.l-open .rail-tab, .tab-btn.on { background: var(--paper); color: var(--accent); }
.tab-btn .badge { writing-mode: horizontal-tb; display: inline-block; transform: rotate(180deg); min-width: 18px; margin: 6px 0 0; padding: 1px 4px; border-radius: 9px; background: var(--warn); color: #fff4dc; font-family: var(--f-body); font-size: 10.5px; font-weight: 800; letter-spacing: 0; line-height: 15px; }
.tab-btn .badge.bad { background: var(--bad); }
.tabs { border: 0; }
.tab-body { overflow-y: auto; min-height: 0; }
.tab-pane[hidden] { display: none; }

/* ================================================================ the desk strip: status plates + End Day */
.status-bar { display: flex; align-items: center; gap: 8px; height: 54px; padding: 0 10px 0 14px; background: linear-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.45)), url(./assets/warroom/ui.desk.jpg) center / 512px; border-bottom: 2px solid #120b06; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5); color: var(--cream); }
.status-bar__turn { font-family: var(--f-stencil); font-weight: 700; font-size: 20px; letter-spacing: 0.1em; color: #f3d48a; white-space: nowrap; text-shadow: 0 1px 0 #000; }
.status-bar__resources { display: flex; gap: 5px; flex: 1; min-width: 0; overflow: hidden; }
.stat-badge { display: flex; flex-direction: column; padding: 2px 8px 3px; background: rgba(12, 7, 3, 0.55); border: 1px solid rgba(243, 212, 138, 0.25); border-radius: 3px; white-space: nowrap; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6); }
.stat-badge__label { font-family: var(--f-stencil); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: #c9ae76; }
.stat-badge__value { font-family: var(--f-type); font-weight: 700; font-size: 13px; color: var(--cream); }
.stat-badge[data-stat-id=conf] { min-width: 80px; }
.stat-badge[data-stat-id=conf].low .stat-badge__value { color: #ff8f80; }
.conf-meter { position: relative; height: 5px; background: rgba(0, 0, 0, 0.55); border-radius: 2px; overflow: hidden; min-width: 60px; flex: 1; }
.conf-fill { position: absolute; inset: 0 auto 0 0; background: #c9a03a; }
.conf-fill.low { background: #d8483a; }
.conf-fill.high { background: #7fbf5a; }
.stat-badge .conf-meter { margin-top: 2px; }
.status-bar__actions { display: flex; gap: 8px; align-items: center; }
.menu-btns { display: flex; gap: 3px; }
.menu-btns button { background: rgba(12, 7, 3, 0.45); color: #e7d3a6; border-color: rgba(243, 212, 138, 0.3); padding: 4px 7px; font-size: 12px; box-shadow: none; }
.menu-btns button:hover:not(:disabled) { background: rgba(243, 212, 138, 0.15); color: #fff; border-color: #f3d48a; }
.end-day {
  font-family: var(--f-stencil); font-size: 16px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; padding: 7px 16px;
  background: linear-gradient(#a8352a, #7c1f16); color: #fbe9c8; border: 2px solid #f0c9a0; border-radius: 4px;
  box-shadow: 0 0 0 2px #2a0b06, 0 3px 10px rgba(0, 0, 0, 0.6); text-shadow: 0 1px 0 #3a0c06;
}
.end-day:hover:not(:disabled) { background: linear-gradient(#bd4134, #8e2a1e); border-color: #fff0d6; }
.end-week { font-family: var(--f-stencil); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 7px 10px; border: 1px solid #c9a35a; background: linear-gradient(#5a4220, #3b2a14); color: #f6dfa8; border-radius: 4px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.end-week:hover:not(:disabled) { background: linear-gradient(#6e5228, #48331a); color: #fff; }
@media (max-width: 1500px) {
  .status-bar__turn { font-size: 17px; }
  .stat-badge[data-stat-id=weather], .stat-badge[data-stat-id=exposed] { display: none; }
  .stat-badge[data-stat-id=conf] { min-width: 72px; }
}
@media (max-width: 1340px) {
  .stat-badge[data-stat-id=intel] { display: none; }
  .menu-btns button { padding: 3px 5px; font-size: 11.5px; }
}

/* the command strip under the desk edge: map tools on the left, the teletype alert on the right */
.command-strip { flex: 0 0 36px; display: flex; align-items: center; gap: 8px; padding: 0 8px; background: linear-gradient(#1b120c, #2a1c13); border-bottom: 1px solid #0d0804; position: relative; z-index: 9; min-width: 0; }
.map-toolbar { display: flex; gap: 3px; flex: none; flex-wrap: nowrap; overflow: hidden; max-width: 64%; }
.map-toolbar button { padding: 3px 8px; white-space: nowrap; font-size: 12px; font-weight: 600; background: var(--paper-2); border-color: #0f0904; }
.map-toolbar button.on, #place-mode.on { background: #f7e7b4; color: var(--accent); font-weight: 800; outline: 2px solid #f3d48a; }
#build-aa.on { color: #1f4f86; } #build-checkpoint.on { color: var(--ok); }
#threat-overlay.on, #intel-overlay.on { background: var(--paper-3); color: var(--accent); }
.map-toolbar button:disabled { opacity: 1; color: #8a7c62; background: #b9aa88; }

/* ================================================================ breach-alert teletype (in the strip) */
.alert-bar { flex: 1 1 auto; display: flex; align-items: center; gap: 6px; min-width: 0; position: relative; z-index: 6; }
.alert-bar .quiet { color: #a8916a; font-family: var(--f-type); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert { display: flex; width: 100%; gap: 8px; align-items: baseline; text-align: left; font-family: var(--f-type); font-size: 12px; line-height: 1.3; padding: 4px 8px; background: var(--paper-3); border: 1px solid var(--line-2); border-left-width: 5px; border-radius: 2px; }
.alert span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.alert b, .alert-bar .alert-latest b { flex: none; font-family: var(--f-stencil); font-size: 11px; letter-spacing: 0.12em; padding: 0 4px; border: 2px solid currentColor; border-radius: 3px; transform: rotate(-2deg); }
.alert-bar .alert-latest { flex: 1 1 auto; min-width: 0; display: flex; gap: 8px; align-items: center; text-align: left; font-family: var(--f-type); font-size: 12px; padding: 3px 8px; background: var(--paper-3); border: 1px solid #0f0904; border-left-width: 5px; border-radius: 2px; }
.alert-bar .alert-latest span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.alert--warning, .alert-bar .alert-latest.alert--warning { border-left-color: var(--warn); } .alert--warning b, .alert-latest.alert--warning b { color: var(--warn); }
.alert--breach, .alert-bar .alert-latest.alert--breach { border-left-color: var(--bad); } .alert--breach b, .alert-latest.alert--breach b { color: var(--bad); }
.alert--critical, .alert-bar .alert-latest.alert--critical { border-left-color: #7a1660; background: #f4dfe9; } .alert--critical b, .alert-latest.alert--critical b { color: #7a1660; }
.alert--good, .alert-bar .alert-latest.alert--good { border-left-color: var(--ok); } .alert--good b, .alert-latest.alert--good b { color: var(--ok); }
.alert-count { flex: none; font-size: 11.5px; padding: 3px 8px; background: var(--paper-2); border-color: #0f0904; }
.alert-count.on { background: #f7e7b4; color: var(--accent); }
.alert-list { position: absolute; top: 34px; right: 0; width: min(480px, 80vw); display: flex; flex-direction: column; gap: 3px; padding: 6px; border: 1px solid var(--line-2); border-radius: 0 0 4px 4px; max-height: 50vh; overflow-y: auto; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55); }
.alert-list[hidden] { display: none; }

/* ================================================================ map chrome (inside the visible map, between the drawers) */
#board { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.zoom-bar { position: absolute; top: 10px; right: calc(var(--rw) + 10px); display: flex; flex-direction: column; gap: 3px; z-index: 4; transition: right 0.24s ease; }
.zoom-bar button { width: 32px; padding: 3px 0; font-weight: 800; background: var(--paper-3); border-color: #1a1006; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); }
.zoom-bar #fit { font-size: 10.5px; }
.zoom-bar button:disabled { opacity: 1; color: #8a7c62; background: #b9aa88; }
.map-name { position: absolute; bottom: 136px; right: calc(var(--rw) + 12px); z-index: 2; font-family: var(--f-stencil); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: #f6ead0; text-shadow: 0 1px 2px #000, 0 0 6px #000; transition: right 0.24s ease; }
#minimap { position: absolute; right: calc(var(--rw) + 10px); bottom: 10px; width: 170px; height: 115px; z-index: 2; background: #1b130c; border: 3px solid #d9c9a2; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6); transition: right 0.24s ease; }
.legend { position: absolute; left: calc(var(--lw) + 10px); bottom: 64px; z-index: 3; display: flex; flex-wrap: wrap; gap: 6px 10px; max-width: min(640px, calc(100% - var(--lw) - var(--rw) - 30px)); padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 2px; font-size: 11.5px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5); }
.legend.collapsed { display: none; }
.legend span { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.legend-terrain { display: contents; }
.lg { display: inline-block; width: 16px; height: 8px; }
.lg.route-ok { background: #3fae5a; }
.lg.route-open { background: repeating-linear-gradient(90deg, #d39522 0 5px, transparent 5px 8px); }
.lg.dot-red { width: 8px; border-radius: 50%; background: #e0342b; }
.lg.zone { border: 1px dashed #c33; background: rgba(200, 40, 40, 0.25); }
.lg.front { height: 5px; background: #b3261e; }
.lg.front-old { height: 0; border-top: 2px dashed rgba(90, 70, 50, 0.8); background: none; }
.lg.ring { height: 0; border-top: 2px dashed #c79b1c; }
.lg.ring2 { height: 0; border-top: 2px dashed #8d8d8d; background: none; }
.lg.counter { height: 9px; background: repeating-linear-gradient(135deg, rgba(220, 70, 30, 0.75) 0 2px, transparent 2px 5px); border: 1px dashed #c84a1e; }
.lg.strike { height: 0; border-top: 2px dashed #e0562c; background: none; }
.lg.aa { background: rgba(80, 160, 255, 0.35); border: 1px solid #3d7fd0; }
.lg.recon { width: 10px; height: 10px; border-radius: 50%; border: 1px dotted #555; }
.lg.eye { width: 10px; height: 10px; border-radius: 50%; background: #d42a1e; }
.lg.intel { width: 10px; background: #5fbf5a; border-radius: 50%; border: 1px solid #101418; }
.lg.rail { height: 0; border-top: 3px solid #1e1812; background: none; }
.lg.town { background: #a49a8c; border-top: 3px solid #c4553f; }
.lg.hills { width: 16px; height: 12px; background: #9b8158; }
.lg.enemyheld { width: 16px; height: 12px; background: repeating-linear-gradient(135deg, #9a3b2a 0 2px, #c98f74 2px 5px); }
.lg.emergency { width: 10px; height: 10px; border-radius: 50%; background: #ff5a3c; box-shadow: 0 0 0 2px #2a0d08; }
.lg.art { width: 16px; height: 16px; border-radius: 50%; background-size: cover; background-position: center; background-color: rgba(22, 34, 50, 0.8); border: 2px solid #5f87b8; }
.lg.foe { width: 16px; height: 16px; border-radius: 50%; background: rgba(52, 20, 14, 0.8) url(./assets/props/marker.enemy.armor.png) center / cover; border: 2px solid #b8452c; }
.lg.brigade { background-image: url(./assets/props/marker.friendly.brigade.png); }
.lg.depot { background-image: url(./assets/props/prop.depot.plain.png); }
.lg.aasite { background-image: url(./assets/props/prop.aa_site.png); border-color: #3d7fd0; }
.lg.checkpoint { background-image: url(./assets/props/prop.checkpoint.png); border-color: #3fae5a; }
.lg.convoy { background-image: url(./assets/props/unit.convoy_truck.png); border-color: #3fae5a; }
.lg.drone { background: rgba(52, 20, 14, 0.8) url(./assets/props/unit.recon_drone.png) center / cover; border-color: #b8452c; }
.legend .lg.terrain { width: 16px; height: 12px; border: 1px solid rgba(0, 0, 0, 0.5); }

/* the teletype: the event log as a strip of paper on the map's lower edge (click to unroll) */
.log-panel { position: absolute; z-index: 3; left: calc(var(--lw) + 10px); right: calc(var(--rw) + 192px); bottom: 10px; height: 46px; display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 2px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55); overflow: hidden; transition: left 0.24s ease, right 0.24s ease, height 0.2s ease; }
.log-panel.open { height: min(42vh, 360px); }
.ticker-head { flex: none; text-align: left; padding: 1px 8px; font-family: var(--f-stencil); font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); background: rgba(120, 90, 40, 0.12); border: 0; border-bottom: 1px dashed var(--line-2); border-radius: 0; box-shadow: none; }
.ticker-head::after { content: ' ▴'; }
.log-panel.open .ticker-head::after { content: ' ▾'; }
#log { flex: 1; overflow-y: auto; font-family: var(--f-type); font-size: 12px; display: flex; flex-direction: column-reverse; padding: 0 8px; }
.event-log { display: flex; flex-direction: column; }
.event-log__entry { padding: 2px 0; border-bottom: 1px dotted var(--line); }
.event-log__entry--good { color: var(--ok); }
.event-log__entry--warn { color: var(--warn); }
.event-log__entry--bad { color: var(--bad); font-weight: 700; }

/* toasts: paper slips at the top of the visible map, left of the zoom bar */
#map-area > #toasts, #toasts { position: absolute; top: 10px; right: calc(var(--rw) + 52px); left: auto; bottom: auto; transform: none; width: min(340px, calc(100% - var(--lw) - var(--rw) - 80px)); z-index: 5; pointer-events: none; }
.toaster { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.toast { padding: 6px 10px; border: 1px solid var(--line-2); border-left: 5px solid var(--muted); border-radius: 2px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); font-family: var(--f-type); font-size: 12px; }
.toast--bad { border-left-color: var(--bad); color: #6e130c; }
.toast--good { border-left-color: var(--ok); }
.toast--warn { border-left-color: var(--warn); }
#overlay:not([hidden]) ~ #toasts, body:has(#confirm:not([hidden])) #toasts, body:has(#overlay:not([hidden])) #toasts { display: none; }
body:has(#coach:not([hidden])) #toasts, body:has(.save-manager:not([style*='none'])) #toasts { display: none; }

/* tutorial coach: a briefing card on the map, above the teletype */
.coach { position: absolute; left: calc(var(--lw) + 10px); bottom: 64px; width: min(400px, calc(100% - var(--lw) - var(--rw) - 30px)); z-index: 7; border: 1px solid var(--line-2); border-top: 5px solid var(--accent); border-radius: 2px; padding: 10px 14px; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.6); font-size: 13px; }
.coach[hidden] { display: none; }
.coach h3 { margin: 0 0 4px; font-family: var(--f-stencil); font-size: 15px; letter-spacing: 0.08em; color: var(--accent); text-transform: uppercase; }
.coach .coach-step { font-family: var(--f-type); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.coach p { margin: 4px 0; line-height: 1.4; }
.coach .coach-do { font-family: var(--f-type); color: #5a1a10; font-weight: 700; }
.coach .btn-row { margin-top: 6px; justify-content: flex-end; }
.coach .coach-progress { height: 4px; background: rgba(74, 54, 28, 0.2); margin-top: 6px; overflow: hidden; }
.coach .coach-progress i { display: block; height: 100%; background: var(--accent); }
.coach-target { outline: 3px solid #d0481e !important; outline-offset: 2px; animation: coach-pulse 1.4s ease-in-out infinite; }
@keyframes coach-pulse { 50% { outline-color: rgba(208, 72, 30, 0.2); } }
.coach.tut-note { position: static; width: auto; margin: 0 0 10px; box-shadow: none; }
body.reduced-motion .coach-target { animation: none; }
body.reduced-motion * { transition: none !important; scroll-behavior: auto !important; }

/* ================================================================ dossier components (shared by both drawers) */
.drawer-body h2 { border-bottom: 2px solid var(--accent); padding-bottom: 3px; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.drawer-body h2 small { font-family: var(--f-body); font-weight: 500; font-size: 11px; letter-spacing: 0.02em; text-transform: none; color: var(--muted); }
.why { color: var(--muted); font-size: 11.5px; }
.chip { padding: 2px 9px; border-radius: 12px; background: var(--paper-3); font-weight: 600; }
.chip.on { background: var(--ink); color: var(--paper-3); border-color: var(--ink); font-weight: 700; }
.chip.req { border-style: dashed; }
.chip.air.on { background: #1f4f86; border-color: #1f4f86; color: #fff; }
.dest-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 6px 0; }
.dest-row .label { color: var(--muted); margin-right: 2px; font-family: var(--f-type); font-size: 12px; }
.ship-by { margin-top: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
button.danger { border-color: #a8241a; color: #7c1810; }
button.danger.armed { background: #a8241a; color: #fff; font-weight: 700; }
.why-inline { display: block; width: 100%; color: var(--warn); font-size: 11px; line-height: 1.3; margin-top: 2px; font-style: italic; }

/* meters: pencil-drawn bars on the paper */
.meter { position: relative; height: 20px; background: rgba(74, 54, 28, 0.12); border: 1px solid var(--line-2); margin: 6px 0; overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; background: repeating-linear-gradient(135deg, rgba(142, 42, 30, 0.55) 0 3px, rgba(142, 42, 30, 0.35) 3px 6px); }
.meter span { position: relative; display: block; text-align: center; line-height: 18px; font-family: var(--f-type); font-size: 12px; font-weight: 700; }
.meter-mini { display: inline-block; width: 70px; height: 7px; background: rgba(74, 54, 28, 0.15); border: 1px solid var(--line-2); vertical-align: middle; overflow: hidden; }
.meter-mini i { display: block; height: 100%; background: var(--ok); }
.meter-mini.mid i { background: var(--warn); }
.meter-mini.low i { background: var(--bad); }
.score-bar { display: inline-block; width: 70px; height: 7px; background: rgba(74, 54, 28, 0.15); vertical-align: middle; overflow: hidden; }
.score-bar i { display: block; height: 100%; background: var(--ok); }

/* rubber stamps */
.stamp, .short-row b, .mood, .op-kind, .ledger-tag {
  font-family: var(--f-stencil); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}
.short-row b { color: var(--bad); border: 2px solid var(--bad); border-radius: 3px; padding: 0 3px; font-size: 9.5px; transform: rotate(-3deg); justify-self: end; opacity: 0.9; }
.short-row:not(.short) b { color: var(--ok); border-color: var(--ok); }

/* ---- requisition (left dossier) */
.sku-list { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.group { display: flex; flex-direction: column; gap: 3px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; width: 100%; text-align: left; padding: 3px 6px; background: rgba(74, 54, 28, 0.1); border-color: var(--line); font-family: var(--f-stencil); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; box-shadow: none; }
.group-head small { font-family: var(--f-body); font-weight: 500; letter-spacing: 0; text-transform: none; font-size: 11px; color: var(--muted); }
.group-head.late { border-color: var(--bad); }
.sku { display: grid; grid-template-columns: 24px 1fr auto; gap: 6px; align-items: center; padding: 3px 5px; background: rgba(255, 250, 236, 0.45); border: 1px solid var(--line); border-radius: 2px; }
.sku.needed { border-color: var(--brass); }
.sku.counts { border-color: rgba(61, 106, 42, 0.6); }
.sku.no-use { opacity: 0.9; border-color: rgba(154, 93, 18, 0.7); }
.sku.open { border-color: var(--accent); background: rgba(255, 250, 236, 0.8); }
.sku-glyph { width: 24px; height: 24px; border-radius: 3px; display: grid; place-items: center; font-weight: 900; color: #15191a; font-size: 13px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35); }
.sku-copy { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: inherit; display: flex; flex-direction: column; min-width: 0; box-shadow: none; }
.sku-copy:hover:not(:disabled) { background: none; text-decoration: underline dotted; }
.sku-copy b { font-size: 12.5px; }
.sku-copy small { color: var(--muted); font-size: 10.5px; }
.sku-btns { display: flex; gap: 3px; }
.sku-btns button { display: flex; flex-direction: column; align-items: center; min-width: 34px; padding: 2px 5px; font-family: var(--f-type); font-weight: 700; }
.sku-btns small { font-size: 9px; font-weight: 400; color: var(--muted); }
.crit { color: var(--warn); }
.qty { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; padding: 4px 6px; margin: -2px 0 2px 30px; background: var(--paper-3); border: 1px solid var(--accent); border-top: 0; }
.qty input { width: 56px; font-family: var(--f-type); font-size: 13px; font-weight: 700; padding: 2px 4px; background: #fffaf0; color: var(--ink); border: 1px solid var(--line-2); }
.qty button { padding: 2px 7px; font-size: 11.5px; }
.qty .qty-go { background: var(--accent); color: #fff4dc; font-weight: 800; border-color: #5a140c; }
.pending { margin-top: 8px; }
.pending-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 3px 0; border-bottom: 1px dashed var(--line); font-family: var(--f-type); font-size: 12px; }
.pending-row .x { padding: 0 7px; }
.pending-row.late { color: var(--bad); }
.pending-row.no-use { color: var(--warn); }
.pending-row small { font-size: 10.5px; }
.landing { font-family: var(--f-type); font-size: 12px; margin: 4px 0; padding: 4px 7px; border: 1px dashed var(--line-2); background: rgba(255, 250, 236, 0.5); }
.landing.ok { color: var(--ok); border-color: rgba(61, 106, 42, 0.6); }
.landing.bad { color: #7c1810; border: 2px solid var(--bad); background: rgba(168, 36, 26, 0.08); font-weight: 700; }
.forecast { font-size: 11.5px; }
.legend-line { margin: 2px 0 0; }

/* who goes short: a carbon-copy slip pinned at the top of the requisition */
.short-box { border: 1px solid var(--line-2); margin: 4px 0 8px; padding: 0 0 4px; font-size: 11.5px; background: rgba(255, 250, 236, 0.55); box-shadow: 2px 2px 0 rgba(74, 54, 28, 0.2); }
.short-box .group-head { width: 100%; border: 0; border-bottom: 1px solid var(--line); }
.short-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 4em; gap: 6px; padding: 2px 6px; align-items: center; font-family: var(--f-type); }
.short-row.short .short-who { color: #7c1810; }
.short-who { overflow-wrap: anywhere; }
.short-val { text-align: right; white-space: nowrap; }
.short-brigades { display: flex; flex-wrap: wrap; gap: 1px 8px; padding: 0 6px 1px 14px; font-family: var(--f-type); }
.chip-days.bad { color: var(--bad); font-weight: 700; }
.short-foot { display: block; padding: 3px 6px 0; font-size: 10.5px; line-height: 1.3; }

/* ---- the General's plan (right dossier) */
#op h2 small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.conf-row { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 2px 0 6px; }
.conf-row > span:first-child { color: var(--muted); }
.conf-row .conf-meter { background: rgba(74, 54, 28, 0.15); border: 1px solid var(--line-2); height: 7px; }
.op-card { position: relative; border: 1px solid var(--line-2); padding: 9px 10px; margin: 8px 0; background: var(--paper-3); box-shadow: 2px 3px 0 rgba(74, 54, 28, 0.18); }
.op-card.next { border-left: 5px solid var(--accent); }
.op-card.next.kind-objective { border-left-color: var(--brass); }
.op-card.tentative { opacity: 0.85; border-style: dashed; background: rgba(255, 250, 236, 0.35); box-shadow: none; }
.op-title { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.op-title b { font-family: var(--f-stencil); font-size: 16px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.op-card.tentative .op-title b { color: var(--muted); }
.op-kind { font-size: 10px; color: var(--accent); white-space: nowrap; border: 1.5px solid currentColor; padding: 0 4px; border-radius: 2px; transform: rotate(-2deg); }
.op-meta { font-size: 12px; color: var(--ink); margin: 2px 0; }
.op-why { font-size: 11.5px; color: var(--muted); font-style: italic; margin: 2px 0 4px; }
.op-orders { font-family: var(--f-elite); font-size: 13px; line-height: 1.45; margin: 6px 0; color: #1d1710; letter-spacing: 0.01em; }
.op-ground { font-size: 11.5px; margin: 2px 0; }
.op-ground[data-mud='1'] b, .op-ground[data-mud='1'] { color: var(--warn); }
.op-ring { font-size: 11px; color: var(--muted); margin: 4px 0 2px; }
.op-ring b { color: var(--ink); font-weight: 600; }
.op-fights { font-size: 11px; display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin: 2px 0; color: var(--muted); }
.foe { background: rgba(168, 36, 26, 0.1); border: 1px solid rgba(168, 36, 26, 0.55); color: #6e130c; border-radius: 2px; padding: 0 4px; font-size: 11px; }
.foe.stale { border-style: dashed; opacity: 0.8; }
.advice { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line-2); }
.advice .label { color: var(--accent); font-family: var(--f-stencil); letter-spacing: 0.08em; font-weight: 700; font-size: 12px; margin-right: 2px; text-transform: uppercase; }
.advice button { font-size: 11.5px; padding: 3px 7px; }
.op-history { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.hist { font-size: 11px; padding: 2px 6px; font-family: var(--f-stencil); letter-spacing: 0.06em; }
.hist--success { border-color: var(--ok); color: var(--ok); }
.hist--altered { border-color: var(--warn); color: var(--warn); }
.hist--stall { border-color: var(--bad); color: var(--bad); }
.portrait { float: right; width: 74px; margin: -2px -2px 4px 8px; padding: 3px 3px 12px; background: #fbf6ea; box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.35); transform: rotate(2.5deg); position: relative; }
.portrait img { display: block; width: 100%; filter: sepia(0.25) contrast(1.05); }
.portrait::before { content: ''; position: absolute; top: -9px; left: 42%; width: 10px; height: 24px; border: 2px solid #8b8f94; border-radius: 6px; border-bottom-color: transparent; }
.portrait figcaption { position: absolute; left: 0; right: 0; bottom: 1px; text-align: center; font-family: var(--f-type); font-size: 8.5px; color: var(--muted); }
.portrait.small { width: 54px; padding-bottom: 4px; transform: rotate(-2deg); }
.counter-card { border: 2px solid var(--bad); background: rgba(168, 36, 26, 0.07); padding: 8px 10px; margin: 6px 0 8px; box-shadow: 2px 3px 0 rgba(74, 54, 28, 0.18); }
.counter-card.reinforced { border-color: #1f4f86; background: rgba(31, 79, 134, 0.07); }
.counter-card .op-title b { color: var(--bad); }
.counter-card.reinforced .op-title b { color: #1f4f86; }
.counter-card .label { font-size: 11px; color: var(--muted); }
.counter-card .advice { flex-wrap: wrap; }
.hold-ways { list-style: none; margin: 2px 0 4px; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.hold-ways li { padding: 2px 0; }
.hold-ways button { font-size: 11px; padding: 2px 6px; }
.transfer-row { flex-wrap: wrap; align-items: center; }
.transfer-row .label { font-size: 11px; color: var(--muted); margin-right: 2px; }
.campaign-card { margin: 10px 0; padding: 7px 9px; border: 1px solid var(--line-2); background: rgba(255, 250, 236, 0.4); }
.campaign-nodes { display: grid; gap: 2px; margin: 4px 0; }
.cnode { font-family: var(--f-type); font-size: 12px; line-height: 1.35; }
.cnode-dot { display: inline-block; width: 14px; text-align: center; font-weight: 800; }
.cnode-won { color: var(--ok); }
.cnode-open .cnode-dot { color: var(--accent); }
.cnode-locked { opacity: 0.55; }

/* ---- assessment: intel cards with a recon photo */
.assess-head { margin: 8px 0 3px; font-family: var(--f-stencil); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.assess-head small { font-family: var(--f-body); text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); }
.assessment { display: flex; flex-direction: column; gap: 6px; }
.intel-card { position: relative; border: 1px solid var(--line-2); padding: 6px 7px; background: var(--paper-3); box-shadow: 2px 2px 0 rgba(74, 54, 28, 0.15); overflow: hidden; }
.intel-card.stale { border-color: var(--bad); }
.intel-card.unknown { border-style: dashed; }
.intel-photo { float: left; width: 92px; margin: 0 8px 2px 0; padding: 2px; background: #fbf6ea; box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.35); position: relative; }
.intel-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; filter: contrast(1.1); }
.intel-photo .stamp { position: absolute; left: 6px; bottom: 8px; font-size: 9px; padding: 0 3px; color: #c62a1c; border: 1.5px solid #c62a1c; background: rgba(251, 246, 234, 0.75); transform: rotate(-8deg); }
.intel-head { display: grid; grid-template-columns: 1fr 44px; gap: 2px 6px; align-items: center; font-size: 12px; }
.intel-head small { grid-column: 1 / -1; font-size: 10.5px; }
.intel-conf { height: 5px; background: rgba(74, 54, 28, 0.15); overflow: hidden; display: block; }
.intel-conf i { display: block; height: 100%; background: linear-gradient(90deg, var(--warn), var(--ok)); }
.intel-facts { display: flex; flex-wrap: wrap; gap: 2px 8px; font-family: var(--f-type); font-size: 11.5px; margin: 3px 0; }
.intel-facts em { font-style: normal; color: var(--muted); font-size: 10.5px; font-family: var(--f-body); }
.intel-btns { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; clear: both; padding-top: 2px; }
.intel-btns button { font-size: 11px; padding: 1px 6px; }

/* ---- requests: the demand-vs-supply ledger */
.ledger-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 4px 0 8px; }
.ledger-sum div { background: var(--paper-3); border: 1px solid var(--line-2); padding: 3px 5px; text-align: center; }
.ledger-sum b { display: block; font-family: var(--f-type); font-size: 15px; }
.ledger-sum small { color: var(--muted); font-family: var(--f-stencil); letter-spacing: 0.08em; font-size: 10px; text-transform: uppercase; }
.ledger-row { position: relative; border: 1px solid var(--line-2); border-left-width: 5px; padding: 6px 8px; margin: 6px 0; background: var(--paper-3); box-shadow: 2px 2px 0 rgba(74, 54, 28, 0.15); overflow: hidden; }
.ledger-row.short { border-left-color: var(--warn); }
.ledger-row.kind-emergency { border-left-color: var(--bad); background: #f6e2d6; }
.ledger-row.kind-general { border-left-color: var(--accent); }
.ledger-head { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.ledger-head b { font-size: 13px; }
.ledger-tag { font-size: 9.5px; color: var(--muted); }
.ledger-ask { font-family: var(--f-elite); font-size: 12px; color: #2e2418; margin: 3px 0; }
.ledger-bar { position: relative; height: 13px; background: rgba(74, 54, 28, 0.13); border: 1px solid var(--line-2); margin: 3px 0; overflow: hidden; }
.ledger-bar i { position: absolute; inset: 0 auto 0 0; background: rgba(61, 106, 42, 0.55); }
.ledger-bar.short i { background: rgba(154, 93, 18, 0.55); }
.ledger-bar span { position: relative; display: block; font-family: var(--f-type); font-size: 10.5px; line-height: 11px; text-align: center; font-weight: 700; }
.ledger-row .btn-row { margin-top: 3px; }
.ledger-row .btn-row button { font-size: 11px; padding: 2px 6px; }
.ledger-lines { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.mood { font-size: 9.5px; padding: 0 4px; border: 1.5px solid currentColor; border-radius: 2px; }
.mood-satisfied { color: var(--ok); }
.mood-content { color: var(--muted); }
.mood-unhappy { color: var(--warn); }
.mood-furious { color: var(--bad); transform: rotate(-3deg); display: inline-block; }

/* ---- inspector */
.stock { width: 100%; border-collapse: collapse; margin: 4px 0; font-family: var(--f-type); }
.stock td { padding: 2px 0; border-bottom: 1px dashed var(--line); text-align: center; }
.stock td:last-child { text-align: right; font-weight: 700; }
.exposure { margin: 6px 0; padding: 6px 8px; background: var(--paper-3); border: 1px solid var(--line-2); }
.exposure h4 { margin: 0 0 4px; font-family: var(--f-stencil); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.xrow { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 1px 0; }
.xrow span { color: var(--muted); }
.xrow b { text-align: right; font-weight: 600; font-family: var(--f-type); }
.xrow.ok b { color: var(--ok); } .xrow.warn b { color: var(--warn); } .xrow.bad b { color: var(--bad); }
.tags { color: var(--ok); font-weight: 400; }
.sku-dot { font-style: normal; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 3px; color: #15191a; font-weight: 900; font-size: 9px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3); }

/* ================================================================ overlays: dossiers on the desk */
#overlay { position: fixed; inset: 0; background: rgba(14, 8, 4, 0.72); display: grid; place-items: center; z-index: 20; }
#overlay[hidden] { display: none; }
.overlay-card { position: relative; width: min(640px, 92vw); border: 1px solid #3a2a14; border-radius: 2px; padding: 24px 28px; box-shadow: 0 14px 50px rgba(0, 0, 0, 0.75), 6px 6px 0 rgba(0, 0, 0, 0.25); }
.overlay-card h2 { font-size: 17px; }
.start-menu-title { margin: 0 0 4px; font-family: var(--f-stencil); font-weight: 700; font-size: 44px; letter-spacing: 0.16em; color: var(--ink); }
.start-card::before { content: 'TOP SECRET · EYES ONLY'; position: absolute; top: 18px; right: 22px; font-family: var(--f-stencil); font-weight: 700; font-size: 13px; letter-spacing: 0.14em; color: #b3261e; border: 3px double #b3261e; padding: 2px 8px; transform: rotate(6deg); opacity: 0.85; }
.start-menu-entries { display: flex; gap: 8px; flex-wrap: wrap; }
.start-menu-entry { padding: 8px 16px; font-family: var(--f-stencil); font-size: 14px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.start-menu-entry[data-entry-id='new'] { background: var(--accent); color: #fbe9c8; border-color: #5a140c; }
.brief { margin-top: 14px; border-top: 1px dashed var(--line-2); padding-top: 10px; }
.brief ol { padding-left: 18px; color: var(--muted); }
.brief li { margin: 3px 0; }
.brief-short { margin-top: 10px; }
.brief-short p { line-height: 1.5; font-family: var(--f-elite); font-size: 13.5px; }
.brief-short details summary { cursor: pointer; color: var(--accent); margin: 6px 0; font-family: var(--f-stencil); letter-spacing: 0.08em; }
.start-tutorial { display: flex; gap: 10px; align-items: center; margin: 12px 0 2px; padding: 8px 10px; border: 2px solid var(--accent); background: rgba(142, 42, 30, 0.07); }
.start-tutorial button { font-family: var(--f-stencil); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; background: var(--accent); color: #fbe9c8; border-color: #5a140c; }
.difficulty { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.difficulty h4 { width: 100%; margin: 0; font-family: var(--f-stencil); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.diff-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: 1 1 30%; min-width: 150px; text-align: left; padding: 6px 8px; }
.diff-btn small { font-size: 11px; opacity: 0.85; font-weight: 400; }
.diff-btn.on { outline: 2px solid var(--accent); background: #fff6e2; }
.end h1 { margin: 0; font-family: var(--f-stencil); font-size: 40px; letter-spacing: 0.14em; display: inline-block; border: 4px double currentColor; padding: 2px 14px; transform: rotate(-3deg); }
.end.won h1 { color: var(--ok); }
.end.lost h1 { color: var(--bad); }
.end-sub { font-size: 14px; }
.end-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.end-table th, .end-table td { text-align: left; padding: 4px 6px; border-bottom: 1px dashed var(--line-2); }
.end-table th { font-family: var(--f-stencil); letter-spacing: 0.06em; font-size: 11.5px; text-transform: uppercase; color: var(--muted); }
.end-table td { font-family: var(--f-type); font-size: 12px; }
.end-table tr.short td { color: var(--warn); }
.end-table tr.crit-short td { color: var(--bad); font-weight: 700; }
.end-stats { color: var(--muted); }
.end-btns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.end-btns button:first-child { background: var(--accent); color: #fbe9c8; border-color: #5a140c; font-weight: 700; }
.overlay-card.end { max-height: 92vh; overflow-y: auto; }
.end-aar { margin: 6px 0; }
.end-aar summary { cursor: pointer; color: var(--accent); }
.rating { margin: 10px 0; padding: 8px 10px; background: rgba(255, 250, 236, 0.5); border: 1px solid var(--line-2); }
.rating-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.rating-letter { font-family: var(--f-stencil); font-size: 54px; font-weight: 700; line-height: 1; width: 70px; height: 70px; display: grid; place-items: center; border: 4px double currentColor; border-radius: 50%; color: var(--accent); transform: rotate(-8deg); }
.rating-A .rating-letter, .rating-B .rating-letter { color: var(--ok); }
.rating-D .rating-letter, .rating-F .rating-letter { color: var(--bad); }
.rating-copy { display: flex; flex-direction: column; gap: 2px; }
.rating-copy small { opacity: 0.85; }
.rating-table td small { display: block; font-size: 10.5px; }

/* after-action report */
.aar-card { width: min(920px, 96vw); max-height: 92vh; overflow: auto; }
.aar-card h2 { margin-bottom: 4px; }
.outcome-report-title { display: inline-block; font-family: var(--f-stencil); font-size: 26px; margin: 6px 0; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink); border: 4px double currentColor; padding: 1px 12px; transform: rotate(-2deg); }
.aar--success .outcome-report-title { color: var(--ok); }
.aar--altered .outcome-report-title { color: var(--warn); }
.aar--stall .outcome-report-title { color: var(--bad); }
.aar-report ul, .aar-report ol { margin: 4px 0; padding-left: 18px; }
.aar-report p { margin: 3px 0; }
.aar-line { margin: 3px 0; font-size: 13px; }
.aar-line.orders { font-family: var(--f-elite); font-size: 12.5px; }
.ops-table td:last-child { font-size: 12px; color: var(--muted); }
.aar-needs td, .aar-needs th, .truth-table td, .truth-table th { font-size: 11.5px; padding: 2px 6px; }
.aar-needs td small { font-size: 10px; }
.manual-card { width: min(980px, 96vw); max-height: 92vh; overflow: auto; }
.manual-table td, .manual-table th { font-size: 11.5px; padding: 2px 6px; border-bottom: 1px dotted var(--line); }
.manual-factors p, .manual-recon p { font-size: 12px; margin: 4px 0; }
.manual-factors h3, .manual-recon h3 { margin: 10px 0 2px; font-family: var(--f-stencil); letter-spacing: 0.08em; font-size: 14px; color: var(--accent); text-transform: uppercase; }
table { border-collapse: collapse; }

/* settings */
.settings-card h2 { margin-bottom: 10px; }
.setting { display: grid; grid-template-columns: 170px 1fr; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line-2); }
.setting .label { color: var(--muted); }
.setting .opts { display: flex; flex-wrap: wrap; gap: 4px; }
.setting .opts button.on { background: var(--ink); color: var(--paper-3); border-color: var(--ink); font-weight: 700; }
.setting small { grid-column: 2; color: var(--muted); font-size: 11px; }

/* confirm dialogs */
.confirm-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(14, 8, 4, 0.7); display: grid; place-items: center; }
.confirm-backdrop[hidden] { display: none; }
.confirm-card { width: min(520px, 92vw); }
.confirm-card .confirm-yes { background: var(--accent); color: #fbe9c8; font-weight: 800; border-color: #5a140c; }
.confirm-check { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; margin: 8px 0 0; }

/* save manager (ui-shell) */
.save-manager { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); width: min(540px, 92vw); max-height: 70vh; overflow-y: auto; z-index: 30; border: 1px solid #3a2a14; padding: 18px; box-shadow: 0 14px 50px rgba(0, 0, 0, 0.75); }
.save-manager-title { margin: 0 0 10px; font-family: var(--f-stencil); font-size: 18px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.save-manager-name-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.save-manager-name { flex: 1; font-family: var(--f-type); font-size: 13px; padding: 4px 6px; background: #fffaf0; color: var(--ink); border: 1px solid var(--line-2); }
.save-manager-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line-2); }
.save-manager-row-copy { display: flex; flex-direction: column; }
.save-manager-row-meta { color: var(--muted); font-family: var(--f-type); font-size: 11.5px; }
.save-manager-row-buttons { display: flex; gap: 4px; }
.save-manager-list-host { margin-top: 8px; }

/* UI scale (Settings): the whole shell zooms; the map canvas re-measures itself (board.resize) */
body { zoom: var(--ui-scale, 1); }
#app { height: calc(100vh / var(--ui-scale, 1)); }

/* ================================================================ battle replay (D-102): the op on its own ground */
.replay { margin: 4px 0 12px; }
.replay-canvas { display: block; width: 100%; border: 3px solid #2a1d12; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45); cursor: pointer; background: #2a2f2a; }
.replay-phases { display: flex; gap: 6px; align-items: center; margin: 6px 0 2px; flex-wrap: wrap; }
.replay-chip { font-family: var(--f-stencil); font-weight: 700; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; padding: 1px 7px; border: 1.5px solid var(--line-2); color: var(--muted); }
.replay-chip.now { color: var(--accent); border-color: var(--accent); background: rgba(142, 42, 30, 0.08); }
.replay-chip.done[data-grade=ok] { color: var(--ok); border-color: var(--ok); }
.replay-chip.done[data-grade=warn] { color: var(--warn); border-color: var(--warn); }
.replay-chip.done[data-grade=bad] { color: var(--bad); border-color: var(--bad); }
.replay-skip { margin-left: auto; font-size: 11px; padding: 2px 8px; }
.replay-caption { min-height: 2.6em; margin: 2px 0 0; font-family: var(--f-type); font-size: 13px; font-weight: 700; color: #2b2015; }
/* standing orders (D-104): one click repeats last week's train */
.repeat-btn { display: flex; flex-direction: column; align-items: flex-start; width: 100%; margin: 0 0 8px; padding: 6px 10px; text-align: left; font-family: var(--f-stencil); font-weight: 700; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); background: var(--paper-3); border: 2px dashed var(--accent); }
.repeat-btn small { font-family: var(--f-type); font-size: 11.5px; letter-spacing: 0; text-transform: none; color: var(--ink); font-weight: 400; }
/* playtest 3: an emergency's answer button reads as the urgent thing it is; the coach card clears the minimap */
button.urgent:not(:disabled) { background: var(--bad); color: #fff4dc; border-color: #5a140c; font-weight: 800; }
.coach { width: min(400px, calc(100% - var(--lw) - var(--rw) - 210px)); min-width: 260px; }

/* ================================================================ playtest 4: readability pass */
:root { font-size: 14px; }
.hint, .why, .op-ring, .op-why, .forecast, .landing, .short-box, .intel-facts, .ledger-ask, .xrow, .pending-row { font-size: 12.5px; }
.sku-copy b { font-size: 13.5px; } .sku-copy small { font-size: 11.5px; }
.op-orders { font-size: 14px; } .op-meta, .op-ground { font-size: 12.5px; }
.short-foot, .intel-head small, .ledger-tag { font-size: 11.5px; }
.log-panel { height: 78px; }
#log { font-size: 12.5px; }
.outcome-report-cause { margin: 2px 0; }
.outcome-report-cause-pct { display: inline-block; min-width: 3.2em; margin-right: 6px; font-family: var(--f-type); font-weight: 700; color: var(--accent); }
.outcome-report-cause-factor { font-weight: 700; }
.outcome-report-cause-detail::before { content: ' — '; color: var(--muted); }
.outcome-report-cause-detail { color: var(--muted); }
.aar-more summary { cursor: pointer; margin: 8px 0 4px; font-family: var(--f-stencil); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.zoom-bar #frame-op { font-size: 14px; color: var(--accent); }
@media (max-width: 1400px) {
  #minimap { width: 132px; height: 90px; }
  .map-name { bottom: 108px; }
  .log-panel { right: calc(var(--rw) + 152px); }
}
/* playtest 5: off the theater is the walnut desk (the board canvas is transparent there); the teletype covers less map */
#map-wrap, #map-area { background: #241811 url(./assets/warroom/ui.desk.jpg) center / 512px; }
.log-panel { right: auto; width: min(640px, calc(100% - var(--lw) - var(--rw) - 210px)); }

/* ================================================================ D-109: reused stamp icons, compass, start-screen desk */
.group-head[data-group] > span::before, #place-mode::before, #build-aa::before, #build-checkpoint::before, #build-railyard::before {
  content: ''; display: inline-block; width: 20px; height: 20px; margin-right: 6px; vertical-align: -5px; border-radius: 50%;
  background: #3a2a1a var(--icon) center / 14px no-repeat; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5);
}
#place-mode::before, #build-aa::before, #build-checkpoint::before, #build-railyard::before { width: 18px; height: 18px; margin-right: 5px; vertical-align: -4px; background-size: 12px; }
.group-head[data-group=fuel] { --icon: url(./assets/icons/logistics.png); }
.group-head[data-group=food] { --icon: url(./assets/icons/resupply.png); }
.group-head[data-group=artillery] { --icon: url(./assets/icons/artillery.png); }
.group-head[data-group=ammo] { --icon: url(./assets/icons/armor.png); }
.group-head[data-group=missiles] { --icon: url(./assets/icons/air_defense.png); }
.group-head[data-group=parts] { --icon: url(./assets/icons/replacements_medical.png); }
#place-mode { --icon: url(./assets/icons/resupply.png); }
#build-aa { --icon: url(./assets/icons/air_defense.png); }
#build-checkpoint { --icon: url(./assets/icons/infantry.png); }
#build-railyard { --icon: url(./assets/icons/supply_network.png); }
.compass { position: absolute; z-index: 2; top: 12px; left: calc(var(--lw) + 14px); width: 84px; opacity: 0.88; pointer-events: none; filter: drop-shadow(1px 2px 3px rgba(0, 0, 0, 0.55)); transition: left 0.24s ease; }
#overlay.desk { background: #241811 url(./assets/warroom/ui.desk.jpg) center / 512px; overflow: hidden; }
#overlay.desk .overlay-card { z-index: 2; }
.desk-prop { position: absolute; pointer-events: none; filter: drop-shadow(6px 10px 10px rgba(0, 0, 0, 0.6)); z-index: 1; }
.desk-map1 { width: min(520px, 40vw); left: 4vw; top: 8vh; transform: rotate(-9deg); opacity: 0.95; }
.desk-binoculars1 { width: min(240px, 18vw); right: 6vw; bottom: 8vh; transform: rotate(18deg); }
.desk-radio4 { width: min(300px, 22vw); right: 5vw; top: 7vh; transform: rotate(4deg); }
/* D-110: the key shows the painted counters */
.lg.brigade { border-radius: 3px; border: 0; background: url(./assets/counters/friendly.brigade.png) center / cover; }
.lg.foe { border-radius: 3px; border: 0; background: url(./assets/counters/enemy.armor.png) center / cover; }

/* ================================================================ playtest 7 */
/* the report waits for the replay's verdict (no spoilers), then unfolds */
.aar { transition: opacity 0.5s ease; }
.aar.veiled { opacity: 0; max-height: 0; overflow: hidden; }
/* the teletype's oldest visible line fades out at the top instead of being sliced */
#log { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16px); mask-image: linear-gradient(to bottom, transparent 0, #000 16px); }
.repeat-btn small.bad { color: var(--bad); font-weight: 700; }
/* playtest 8 */
.alert-bar .alert-respond { flex: none; font-size: 12px; padding: 3px 10px; }
.start-card::before { top: -16px; right: -14px; background: rgba(242, 233, 211, 0.92); }
.op-card.next .op-title { padding-right: 80px; }
/* D-113 / D-114 */
.sku-btns .fill-btn { background: var(--accent); color: #fbe9c8; border-color: #5a140c; }
button.on-keep { color: var(--ok); border-color: var(--ok); }

/* ================================================================ playtest 9 */
/* nothing can scroll the page sideways (focus inside a closed drawer did) */
html, body, #app, #map-wrap, #map-area { overflow: clip; }
/* the teletype is one slim line until you open it */
.log-panel { height: 40px; }
.log-panel.open { height: min(42vh, 360px); }
/* the primary start entry keeps its oxblood on hover (it went cream-on-cream) */
.start-menu-entry[data-entry-id='new']:hover:not(:disabled), .start-tutorial button:hover:not(:disabled), .end-btns button:first-child:hover:not(:disabled), .confirm-card .confirm-yes:hover:not(:disabled), .qty .qty-go:hover:not(:disabled), button.urgent:hover:not(:disabled), .sku-btns .fill-btn:hover:not(:disabled) { background: #a8352a; color: #fff4dc; border-color: #5a140c; }
/* the walkthrough link in the start dossier, and its player over the desk */
.walkthrough-link { display: flex; gap: 12px; align-items: center; width: 100%; margin: 10px 0 4px; padding: 6px; text-align: left; background: rgba(255, 250, 236, 0.6); border: 2px solid var(--accent); }
.walkthrough-link img { width: 132px; aspect-ratio: 16 / 10; object-fit: cover; border: 2px solid #2a1d12; filter: sepia(0.15); }
.walkthrough-link b { display: block; font-family: var(--f-stencil); font-size: 16px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.walkthrough-link small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.walkthrough-link:hover:not(:disabled) { background: #fff6e2; }
.video-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(14, 8, 4, 0.82); }
.video-card { width: min(1100px, 94vw); padding: 14px 16px 16px; border: 1px solid #3a2a14; box-shadow: 0 14px 50px rgba(0, 0, 0, 0.75); background: var(--paper) url(./assets/warroom/ui.paper.jpg) center / 420px; }
.video-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.video-head h2 { margin: 0; }
.video-card video { display: block; width: 100%; background: #000; border: 3px solid #2a1d12; }
