:root {
  --bg: #14180d;          /* night olive */
  --panel: #1f2614;
  --panel-2: #283019;
  --line: #3b4526;
  --olive: #4b5320;       /* olive drab */
  --tan: #c2b280;         /* coyote/khaki */
  --tan-dim: #8f8460;
  --text: #e7e2cf;
  --muted: #a8a38b;
  --green: #5fbf4a;
  --amber: #e0a526;
  --red: #e0483a;
  --flash: #ff5a3c;
  --stencil: "Black Ops One", "Impact", sans-serif;
  --sans: "IBM Plex Sans Condensed", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 16px; }
body { min-height: 100dvh; background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.012) 0 2px, transparent 2px 6px); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--tan); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 96px; }

/* header */
.topbar { position: sticky; top: 0; z-index: 5; background: linear-gradient(#1c2112, #1c2112ee); border-bottom: 2px solid var(--olive); padding: 10px 16px; }
.topbar .row { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.brand { font-family: var(--stencil); letter-spacing: .06em; font-size: 20px; color: var(--tan); }
.clock { margin-left: auto; font-family: var(--mono); color: var(--muted); font-size: 14px; }
.signout { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 4px 10px; color: var(--muted); cursor: pointer; }

/* soldier card */
.dogtag { margin: 16px 0; background: var(--panel); border: 1px solid var(--line); border-left: 6px solid var(--olive); border-radius: 6px; padding: 14px; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; }
.avatar { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-family: var(--stencil); font-size: 20px; color: #14180d; background: var(--tan); border: 3px solid var(--olive); grid-row: span 2; }
.dogtag h2 { margin: 0; font-size: 18px; }
.rank { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--tan); text-transform: uppercase; }
.meters { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.meter label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.bar { height: 8px; background: #0e110a; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: var(--tan); }
.bar.load > i { background: var(--green); }
.bar.load.warn > i { background: var(--amber); }
.bar.load.hot > i { background: var(--red); }

/* banners */
.banner { margin: 12px 0; padding: 10px 12px; border-radius: 4px; border: 1px dashed var(--tan-dim); color: var(--tan); font-size: 14px; }
.banner.alert { border: 2px solid var(--flash); color: #fff; background: #3a120c; animation: pulse 1.2s infinite; font-weight: 600; }

/* tabs */
.tabs { display: flex; gap: 6px; margin: 8px 0 12px; }
.tabs button { flex: 1; padding: 10px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; font-family: var(--stencil); letter-spacing: .05em; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--olive); color: var(--text); border-color: var(--tan-dim); }

h3.section { font-family: var(--stencil); font-weight: 400; letter-spacing: .06em; color: var(--tan); font-size: 16px; margin: 20px 0 8px; display: flex; align-items: center; gap: 8px; }
h3.section::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* order cards */
.order { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin-bottom: 10px; position: relative; }
.order.active { border-color: var(--tan-dim); box-shadow: 0 0 0 1px var(--tan-dim) inset; }
.order .top { display: flex; gap: 8px; align-items: flex-start; }
.order h4 { margin: 0; font-size: 17px; line-height: 1.25; flex: 1; }
.prec { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 3px; letter-spacing: .06em; white-space: nowrap; border: 1px solid; }
.prec.routine { color: var(--muted); border-color: var(--line); }
.prec.priority { color: var(--tan); border-color: var(--tan-dim); }
.prec.immediate { color: var(--amber); border-color: var(--amber); }
.prec.flash { color: #fff; background: var(--flash); border-color: var(--flash); }
.meta { margin-top: 6px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; font-family: var(--mono); }
.desc { margin-top: 8px; font-size: 14px; color: #cfc9b2; line-height: 1.4; }
details.more summary { cursor: pointer; color: var(--tan-dim); font-size: 13px; margin-top: 6px; }
.actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.actions > .btn:first-child { flex: 1; }
.reorder { display: flex; gap: 6px; margin-left: auto; }
.btn { padding: 10px 14px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-weight: 600; letter-spacing: .04em; min-height: 44px; }
.btn.go { background: var(--olive); border-color: var(--tan-dim); }
.btn.done { background: #2f4a1e; border-color: var(--green); }
.btn.small { min-height: 36px; padding: 6px 10px; font-weight: 500; }
.btn:disabled { opacity: .45; cursor: default; }
.timer { font-family: var(--mono); font-weight: 600; padding: 2px 8px; border-radius: 3px; }
.timer.ahead { color: #0d1408; background: var(--green); animation: pulse 1.4s infinite; }
.timer.behind { color: #fff; background: var(--red); animation: pulse 0.9s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .timer, .banner.alert { animation: none; } }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; border: 1px dashed var(--line); border-radius: 6px; }

/* forms */
form.card, .card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px; margin-bottom: 12px; }
.field { display: grid; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.field input, .field select, .field textarea { width: 100%; background: #0e110a; border: 1px solid var(--line); border-radius: 4px; padding: 10px; min-height: 44px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.err { color: var(--red); font-size: 14px; min-height: 1.2em; }
.note { color: var(--muted); font-size: 13px; }

/* login */
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.login .crest { text-align: center; font-family: var(--stencil); color: var(--tan); font-size: 30px; letter-spacing: .08em; }
.login .sub { text-align: center; color: var(--muted); margin: 4px 0 20px; font-family: var(--mono); font-size: 13px; }

/* roster (command post) */
.roster { display: grid; gap: 10px; }
.troop { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.troop .hd { display: flex; align-items: center; gap: 10px; }
.troop .avatar { width: 36px; height: 36px; font-size: 14px; grid-row: auto; border-width: 2px; }
.troop .nm { font-weight: 600; }
.troop .st { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.troop ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.troop li { display: flex; gap: 8px; align-items: center; }
.troop li .t { flex: 1; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.in_progress { background: var(--amber); }
.dot.done { background: var(--green); }

@media (max-width: 420px) { .hide-sm { display: none; } .brand { font-size: 17px; } .actions .btn { padding: 10px; } .grid2 { grid-template-columns: 1fr; } .meters { grid-template-columns: 1fr; } }

/* modal (password reset) */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { max-width: 460px; width: 100%; border-color: var(--tan-dim); }
.pass { font-family: var(--mono); font-size: 20px; padding: 14px; background: #0e110a; border: 1px dashed var(--tan); border-radius: 4px; word-break: break-all; color: var(--tan); user-select: all; }

/* Overseer TV */
.tv { display: grid; grid-template-columns: 1fr 360px; gap: 16px; padding: 12px 16px 24px; }
.tvmap { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.floor { width: 100%; height: auto; background: #10140a; border: 1px solid var(--line); border-radius: 6px; }
.rm { fill: #222a16; stroke: #4b5320; stroke-width: 1.5; }
.rm.classroom { fill: #1d2a33; } .rm.office { fill: #33261a; } .rm.specialty { fill: #2a1f33; } .rm.restroom { fill: #2e2c18; }
.rm.gym_mpr { fill: #1d2e1a; } .rm.common { fill: #2a1717; } .rm.outdoor { fill: none; stroke-dasharray: 4 4; } .rm.open_above { fill: #161616; stroke: #2a2a2a; }
.rl { fill: #a8a38b; font: 600 10px var(--sans); text-anchor: middle; }
.av { fill: var(--tan); stroke: #14180d; stroke-width: 2; }
.avt { fill: #14180d; font: 700 10px var(--stencil); text-anchor: middle; }
.tvside .card.sched { padding: 8px 10px; margin-bottom: 6px; }
.board, .where { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.board li, .where li { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; font-size: 14px; }
.board .t { flex: 1; } .where .note { margin-left: auto; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; border-width: 2px; grid-row: auto; }
.redalert { position: fixed; inset: 0; z-index: 40; display: grid; place-content: center; text-align: center; gap: 12px;
  background: #b3140a; color: #fff; font-family: var(--stencil); font-size: clamp(36px, 7vw, 110px); letter-spacing: .06em;
  animation: redflash 1s steps(2, jump-none) infinite; pointer-events: none; }
.redalert .sm { font-family: var(--sans); font-size: clamp(18px, 2.4vw, 34px); font-weight: 700; letter-spacing: 0; }
@keyframes redflash { 0% { background: #b3140a; } 100% { background: #4a0703; } }
@media (prefers-reduced-motion: reduce) { .redalert { animation: none; } }
@media (max-width: 1100px) { .tv { grid-template-columns: 1fr; } .tvmap { grid-template-columns: 1fr; } }
