:root {
  --bg: #f3f0e6; --card: #fbf9f2; --ink: #23261c; --muted: #646a55; --line: #d6d1bf;
  --olive: #55642c; --olive-ink: #fff; --red: #a8321f; --gold: #b58a1b; --ok: #2f6b2f; --bad: #a8321f;
  --head: #2f3820; --row: #f0ecde;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171a12; --card: #20241a; --ink: #e8e6da; --muted: #a2a78f; --line: #3a4030; --olive: #8aa04a; --olive-ink: #12150c; --red: #e0664f; --gold: #d8b03c; --ok: #8bc78b; --bad: #ef7c68; --head: #0f120b; --row: #272c20;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.45; }
a { color: var(--olive); }
h1 { font-size: 1.7rem; margin: 0.4em 0 0.5em; }
h2 { font-size: 1.2rem; margin: 0 0 0.6em; display: flex; align-items: center; gap: 0.5em; flex-wrap: wrap; }
h3 { font-size: 1.02rem; margin: 1em 0 0.4em; display: flex; align-items: center; gap: 0.5em; flex-wrap: wrap; }
h4 { margin: 0.8em 0 0.3em; }
.app { max-width: 1100px; margin: 0 auto; padding: 0 16px 24px; }
.top { background: var(--head); color: #f1eedd; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 10px 16px; position: sticky; top: 0; z-index: 20; }
.brand { color: #f1eedd; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none; font-size: 1.05rem; }
.brand span { font-weight: 400; opacity: 0.7; text-transform: none; letter-spacing: 0; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a { color: #d8d5c0; text-decoration: none; padding: 6px 12px; border-radius: 6px; font-size: 0.95rem; }
nav a:hover { background: rgba(255, 255, 255, 0.1); }
nav a.on { background: var(--olive); color: var(--olive-ink); font-weight: 600; }
.foot { color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line); margin-top: 30px; padding-top: 12px; }
.foot p { margin: 4px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 12px 0; }
.card.ref h3 { margin-top: 0; }
.card.ref { overflow-x: auto; }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 14px; align-items: start; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 14px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 14px; margin: 8px 0; align-items: end; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 0.88rem; color: var(--muted); }
label.inl { flex-direction: row; align-items: center; gap: 6px; }
label.chk { flex-direction: row; align-items: flex-start; gap: 6px; color: var(--ink); font-size: 0.92rem; }
.lab { display: block; font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
input[type=text], input[type=search], input[type=number], select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; min-width: 0; width: 100%; }
select.sm { padding: 4px; }
input.num { width: 90px; } input.num.sm { width: 64px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--olive); }
.btn { font: inherit; font-size: 0.92rem; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--olive); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--olive); color: var(--olive-ink); border-color: var(--olive); font-weight: 600; }
.btn.small { padding: 2px 8px; font-size: 0.82rem; }
.btn.add { min-width: 34px; }
button.link { background: none; border: 0; color: var(--olive); font: inherit; cursor: pointer; padding: 0; text-align: left; text-decoration: underline; text-underline-offset: 2px; }
button.link.big { font-size: 1.08rem; font-weight: 700; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.toolbar input[type=search], .toolbar input[type=text] { width: 260px; max-width: 100%; }
.toolbar select { width: auto; }
.sp-grow { flex: 1; }
.presets { display: flex; gap: 4px; margin-top: 4px; }
.hint { color: var(--muted); font-size: 0.86rem; }
.lead { font-size: 1.1rem; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--bad); }
.pg { display: inline-block; font-size: 0.74rem; font-weight: 600; background: var(--row); border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: 0 7px; margin-left: 4px; white-space: nowrap; }
.badge { font-size: 0.74rem; background: var(--gold); color: #1c1708; border-radius: 10px; padding: 1px 8px; font-weight: 700; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 10px 0; }
.tab { font: inherit; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
.tab.on { background: var(--olive); color: var(--olive-ink); border-color: var(--olive); font-weight: 600; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.tablewrap.tall { max-height: 70vh; overflow-y: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 0.88rem; background: var(--card); }
table.data th, table.data td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { background: var(--row); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
table.data tbody tr:nth-child(even) { background: var(--row); }
table.data.narrow { width: auto; min-width: 280px; }
table.sticky th { position: sticky; top: 0; z-index: 2; }
th.sortable { cursor: pointer; } th.sortable.on { color: var(--olive); }
td.c { text-align: center; }
.sp { color: var(--red); font-weight: 600; }
ul.plain { list-style: none; padding: 0; margin: 4px 0; }
ul.warns { color: var(--bad); margin: 6px 0; }
.totals, .strip, .facts { display: flex; gap: 22px; flex-wrap: wrap; margin: 8px 0; align-items: end; }
.totals b, .facts b, .strip b { font-size: 1.3rem; display: block; }
.strip { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.strip input[type=text] { font-weight: 700; }
.tank-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; background: var(--bg); }
.tc-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tc-head .pts { font-weight: 700; color: var(--olive); }
.tc-meta { color: var(--muted); font-size: 0.84rem; margin: 2px 0 6px; }
.rollrow, .stepper { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.big { font-size: 1.25rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; text-decoration: none; color: var(--ink); border-left: 5px solid var(--olive); }
.tile:hover { border-color: var(--olive); }
.tile h2 { margin: 0 0 4px; } .tile p { margin: 0; color: var(--muted); font-size: 0.92rem; }
details { margin: 6px 0; } summary { cursor: pointer; font-weight: 600; }
.tool { background: var(--row); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.checks { display: grid; gap: 6px; margin: 6px 0; }
.letters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.letters a { padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }
.idx .letter { margin: 14px 0 4px; border-bottom: 2px solid var(--olive); color: var(--olive); }
.idx-row { display: grid; grid-template-columns: minmax(180px, 2fr) 2fr 1.5fr; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.idx-row .term { font-weight: 600; } .idx-row .sect { color: var(--muted); font-size: 0.84rem; }
@media (max-width: 640px) { .idx-row { grid-template-columns: 1fr; } }
.rpchart { display: grid; grid-template-columns: repeat(10, minmax(48px, 1fr)); gap: 4px; margin: 10px 0; overflow-x: auto; }
.rp { border: 1px solid var(--line); border-radius: 6px; text-align: center; padding: 4px 2px; min-height: 58px; background: var(--bg); }
.rp .n { font-weight: 700; font-size: 1.05rem; }
.rp.reached { background: var(--row); } .rp.here { outline: 3px solid var(--olive); }
.mk { font-size: 1.1rem; color: var(--muted); } .mk.got { color: var(--gold); font-weight: 800; }
.vacant td { background: rgba(168, 50, 31, 0.1); }
.pending { border-color: var(--gold); }
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 3vh 12px; overflow-y: auto; }
.modal { background: var(--card); border-radius: 12px; width: 100%; max-width: 640px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; } .modal-body { padding: 14px 16px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--head); color: #f1eedd; padding: 8px 16px; border-radius: 8px; z-index: 80; }

/* Datacard */
.dc { --paper: #f2ecda; --dk: #3a4048; --acc: #a8321f; background: var(--paper); color: #1d1d1a; border: 3px solid var(--dk); border-radius: 10px; padding: 8px; font-size: 11px; width: 100%; max-width: 760px; margin: 0 auto; font-family: var(--font); }
.dc.nation-german { --dk: #3b4248; } .dc.nation-british { --dk: #4a4a2c; } .dc.nation-us { --dk: #2f4a2f; } .dc.nation-soviet { --dk: #5a2a22; }
.dc * { color: inherit; }
.dc-top { display: grid; grid-template-columns: 78px 1fr 58px; gap: 8px; align-items: stretch; }
.dc-id, .dc-class { background: var(--dk); color: #fff; border-radius: 6px; padding: 4px; text-align: center; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; text-transform: uppercase; font-size: 10px; }
.dc-id *, .dc-class *, .dc-t th, .dc-t th *, .dc-name { color: #fff; }
.dc-class b { font-size: 20px; line-height: 1; } .dc-class { background: var(--dk); }
.ring { display: block; width: 30px; height: 30px; border: 2px solid #fff; border-radius: 50%; margin-top: 3px; font-style: normal; text-align: center; line-height: 26px; font-size: 14px; font-weight: 800; }
.ring.sm { width: 22px; height: 22px; border: 2px solid var(--dk); display: inline-block; margin-right: 4px; }
.dc-name { background: var(--dk); border-radius: 6px; padding: 6px 10px; display: flex; flex-direction: column; justify-content: center; }
.dc-n { font-size: 18px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; line-height: 1.1; } .dc-nick { font-size: 11px; opacity: 0.85; font-style: italic; }
.dc-chips { display: flex; gap: 8px; margin: 7px 0; flex-wrap: wrap; }
.chip { background: var(--dk); border-radius: 6px; padding: 3px 10px; display: flex; gap: 8px; align-items: center; color: #fff; text-transform: uppercase; font-size: 10px; font-weight: 700; }
.chip *, .chip b { color: #fff; } .chip b { background: var(--paper); color: #1d1d1a; border-radius: 4px; padding: 1px 8px; font-size: 13px; } .chip b { color: #1d1d1a !important; }
.dc-grid { display: grid; grid-template-columns: 150px 1fr; gap: 10px; }
.dc-t { border-collapse: collapse; width: 100%; border: 1.5px solid var(--dk); background: #fffdf5; }
.dc-t th { background: var(--dk); text-transform: uppercase; font-size: 10px; padding: 3px 5px; text-align: center; }
.dc-t td { border: 1px solid #b9b39c; text-align: center; padding: 3px 5px; font-weight: 600; }
.dc-t td:first-child { text-align: left; }
.dc-t.calib tr.sel td { background: var(--acc); color: #fff; }
.dc-crew { margin-top: 8px; border: 1.5px solid var(--dk); border-radius: 6px; overflow: hidden; background: #fffdf5; }
.dc-lab { background: var(--dk); color: #fff; font-weight: 700; text-transform: uppercase; text-align: center; font-size: 10px; padding: 2px; }
.dc-val { text-align: center; padding: 6px 2px; font-weight: 600; min-height: 26px; }
.dc-cmd { margin-top: 8px; border: 2px dashed var(--dk); border-radius: 6px; height: 56px; display: flex; align-items: flex-end; justify-content: center; font-weight: 700; text-transform: uppercase; font-size: 10px; padding: 3px; }
.dc-armtar { display: grid; grid-template-columns: 1.6fr 1fr; gap: 8px; }
.dc-gunrow { display: grid; grid-template-columns: 1fr 74px; gap: 8px; margin-top: 8px; }
.dc-t.gun th { font-size: 11px; }
.dc-t.gun thead tr:first-child th { text-transform: none; font-size: 12px; } .dc-t.gun tr.sub th { background: #6b7078; font-size: 9px; }
.nogun { padding: 14px; text-align: center; font-weight: 700; }
.dc-ammo { display: flex; flex-direction: column; gap: 2px; }
.am { border-radius: 4px; text-align: center; font-weight: 800; padding: 3px 0; font-size: 10px; text-transform: uppercase; color: #fff; }
.am.ap { background: #1d1d1a; } .am.he { background: #d9b21c; color: #1d1d1a !important; } .am.spc { background: #8e2b1b; } .am.sm { background: #5d6c78; }
.dc-foot { font-size: 9px; margin-top: 3px; }
.dc-traits { margin-top: 8px; border: 1.5px solid var(--dk); border-radius: 6px; display: grid; grid-template-columns: 60px 1fr; min-height: 34px; background: #fffdf5; }
.dc-traits span { background: var(--dk); color: #fff; font-weight: 700; text-transform: uppercase; font-size: 10px; display: flex; align-items: center; justify-content: center; }
.dc-traits b { padding: 5px 8px; font-weight: 600; }
.dc-bottom { display: grid; grid-template-columns: 90px 1fr; gap: 8px; margin-top: 8px; }
.dc-smoke { background: var(--dk); border-radius: 6px; padding: 4px; text-align: center; color: #fff; font-weight: 700; text-transform: uppercase; font-size: 9px; }
.dc-smoke * { color: #fff; } .dc-smoke .ring.sm { border-color: #fff; }
.dc-rack { display: grid; grid-template-columns: 3fr 1fr 1fr; gap: 6px; }
.box { border: 1.5px solid var(--dk); border-radius: 5px; min-height: 52px; position: relative; background: #fffdf5; }
.box em { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; color: #fff; font-style: normal; font-weight: 700; text-transform: uppercase; font-size: 9px; padding: 2px; }
.box.rack em { background: #a8321f; } .box.load em { background: #c9791c; } .box.ready em { background: #2c6a3a; }

/* Printing */
#print-root { display: none; }
.pr-cards { display: flex; flex-wrap: wrap; gap: 0.15in; align-content: flex-start; }
.pr-cards .dc { max-width: none; width: calc(50% - 0.08in); flex: none; font-size: 8.8px; break-inside: avoid; margin: 0; padding: 6px; }
.pr-cards .dc-cmd { height: 38px; margin-top: 5px; } .pr-cards .dc-val { padding: 3px 2px; min-height: 18px; } .pr-cards .box { min-height: 38px; }
.pr-cards .dc-chips { margin: 4px 0; } .pr-cards .dc-crew, .pr-cards .dc-traits, .pr-cards .dc-bottom, .pr-cards .dc-gunrow { margin-top: 5px; } .pr-cards .dc-n { font-size: 13px; } .pr-cards .dc-top { grid-template-columns: 64px 1fr 48px; } .pr-cards .ring { width: 24px; height: 24px; line-height: 20px; } .pr-cards .dc-class b { font-size: 16px; } .pr-cards .dc-traits { min-height: 26px; }
.pr-sheet h1, .pr-roster h1 { font-size: 20pt; margin: 0 0 6pt; }
.pr-roster { font-size: 9pt; color: #000; }
.pr-block { border: 1px solid #555; margin: 6pt 0; padding: 4pt; break-inside: avoid; }
.pr-block h3 { margin: 0 0 3pt; font-size: 10pt; }
.pr-row { display: flex; gap: 6pt; margin: 2pt 0; }
.pr-f { flex: 1; border-bottom: 1px solid #333; min-height: 16pt; font-size: 8pt; }
.pr-f span { display: block; color: #555; font-size: 7pt; } .pr-f b { font-size: 9pt; font-weight: 600; }
.pr-wl { display: flex; gap: 4pt; align-items: center; margin: 4pt 0; }
.pr-wl div { flex: 1; border: 1px solid #333; height: 20pt; text-align: center; font-weight: 700; padding-top: 3pt; }
.pr-repcells { display: flex; gap: 3pt; margin: 3pt 0; }
.pr-repcells div { flex: 1; border: 1px solid #333; height: 30pt; text-align: center; font-size: 8pt; }
.pr-repcells span { display: block; background: #ddd; font-weight: 700; } .pr-repcells i { font-style: normal; font-weight: 800; font-size: 11pt; }
.pr-repcells .got { background: #e6e6e6; } .pr-repcells .here { outline: 2px solid #000; }
.pr-roster table.data th, .pr-roster table.data td, .pr-sheet table.data th, .pr-sheet table.data td { border: 1px solid #555; padding: 2pt 4pt; font-size: 8pt; background: #fff !important; color: #000; }
.pr-roster table.data th, .pr-sheet table.data th { background: #ddd !important; }
@page { margin: 0.4in; }
@media print {
  body.printing { background: #fff; color: #000; }
  body.printing .top, body.printing main, body.printing .foot, body.printing .toast, body.printing .modal-back { display: none !important; }
  body.printing #print-root { display: block; }
  body.print-landscape { }
  .dc { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pr-cards .dc { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (max-width: 560px) {
  .dc-grid { grid-template-columns: 1fr; } .dc-top { grid-template-columns: 66px 1fr 48px; }
}
@page cards { size: letter landscape; margin: 0.25in; }
@page sheet { size: letter portrait; margin: 0.4in; }
.pr-cards { page: cards; }
.pr-sheet, .pr-roster { page: sheet; }
.pr-cards .dc-t td { padding: 1px 4px; } .pr-cards .dc-t th { padding: 2px 4px; }
.pr-cards .dc-val { min-height: 0; padding: 2px; } .pr-cards .box { min-height: 32px; } .pr-cards .dc-cmd { height: 30px; }
.pr-cards .chip { padding: 2px 8px; } .pr-cards .dc-traits b { padding: 3px 6px; }
.pr-cards { gap: 0.1in; }
.pr-roster, .pr-sheet { padding-right: 2pt; }
.pr-roster *, .pr-sheet * { box-sizing: border-box; }
.pr-roster table.data, .pr-sheet table.data { width: 100%; table-layout: auto; border-collapse: collapse; }
/* Quick reference layout */
.refnav { display: flex; gap: 6px 22px; flex-wrap: wrap; margin: 6px 0 4px; }
.refgrp .tabs { margin: 2px 0 6px; }
.refgrp .lab { margin-bottom: 0; }
.when { margin: 4px 0 10px; }
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 0 14px; align-items: start; }
.step h3 { margin-top: 0; }
.stepn { display: inline-flex; align-items: center; justify-content: center; width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--olive); color: var(--olive-ink); font-size: 0.85rem; font-weight: 700; flex: none; }
h2.sec { margin: 22px 0 2px; font-size: 1.05rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
.chipref { background: var(--row); border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px 2px 8px; font-size: 0.9rem; }
.step ol, .step ul { margin: 4px 0; padding-left: 1.2em; }
.flow.wide { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }
@media (max-width: 500px) { .flow.wide, .flow, .cols2 { grid-template-columns: 1fr; } }
.step.span { grid-column: 1 / -1; }
/* Platoon builder: tank list left, platoon right */
details.setup > summary { cursor: pointer; padding: 2px 0; }
details.setup[open] > summary { margin-bottom: 8px; }
.plat-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.plat-grid > section { margin: 12px 0; }
.pick-card h2 { align-items: baseline; }
.pick-card h2 .hint { font-weight: 400; }
.pick-list { max-height: calc(100vh - 210px); overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.pick-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 7px 10px; border-bottom: 1px solid var(--line); border-left: 4px solid transparent; }
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover { background: var(--row); }
.pick-row.added { background: color-mix(in srgb, var(--olive) 14%, var(--card)); border-left-color: var(--olive); }
.pk-main { min-width: 0; flex: 1; }
.pk-name { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pk-meta { color: var(--muted); font-size: 0.78rem; line-height: 1.3; }
.inplat { font-size: 0.74rem; font-weight: 700; background: var(--olive); color: var(--olive-ink); border-radius: 10px; padding: 0 8px; }
.pk-add { display: flex; gap: 4px; flex: none; }
.btn.cal { display: flex; flex-direction: column; align-items: center; line-height: 1.15; min-width: 46px; padding: 3px 6px; }
.btn.cal span { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.btn.cal b { font-size: 1rem; }
.btn.cal:hover { background: var(--olive); color: var(--olive-ink); }
.btn.cal:hover span { color: var(--olive-ink); }
.plat-panel { position: sticky; top: 64px; max-height: calc(100vh - 76px); overflow-y: auto; border-color: var(--olive); }
.pp-head { position: sticky; top: -14px; background: var(--card); margin: -14px -16px 8px; padding: 12px 16px 6px; z-index: 2; border-bottom: 1px solid var(--line); }
.pp-head h2 { margin-bottom: 0; }
.pp-head .hint { font-weight: 400; }
.pp-head .totals { margin: 4px 0; }
.meter { height: 8px; background: var(--row); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--olive); }
.meter.over i { background: var(--bad); }
.empty { color: var(--muted); border: 2px dashed var(--line); border-radius: 8px; padding: 22px 12px; text-align: center; }
.tc-head { flex-wrap: nowrap; }
.tc-head .link.big { min-width: 0; }
.tc-n { background: var(--head); color: #f1eedd; border-radius: 4px; padding: 0 7px; font-weight: 700; font-size: 0.85rem; flex: none; }
.tank-card.flash { animation: apflash 1.8s ease-out; }
@keyframes apflash { 0% { background: color-mix(in srgb, var(--gold) 55%, var(--bg)); box-shadow: 0 0 0 3px var(--gold); } 100% { background: var(--bg); box-shadow: 0 0 0 0 transparent; } }
.toast { z-index: 60; }
@media (max-width: 900px) {
  .plat-grid { grid-template-columns: 1fr; }
  .pick-list { max-height: 55vh; }
  .plat-panel { position: static; max-height: none; }
  .pp-head { position: static; }
}
.tc-head .pts { white-space: nowrap; }
details.setup { padding: 8px 14px; }
details.setup > summary { list-style-position: inside; }

/* Theme switch */
.top .sp-grow { flex: 1; }
.theme-sw { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; color: #d8d5c0; font: inherit; font-size: 0.9rem; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.theme-sw:hover { background: rgba(255, 255, 255, 0.1); }
.theme-sw .track { width: 38px; height: 20px; border-radius: 10px; background: rgba(255, 255, 255, 0.28); position: relative; flex: none; transition: background 0.15s; }
.theme-sw .track i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #f1eedd; transition: left 0.15s; }
.theme-sw[aria-checked="true"] .track { background: var(--olive); }
.theme-sw[aria-checked="true"] .track i { left: 20px; }
@media print {
  :root[data-theme="dark"] { color-scheme: light; --bg: #f3f0e6; --card: #fbf9f2; --ink: #23261c; --muted: #646a55; --line: #d6d1bf; --olive: #55642c; --olive-ink: #fff; --red: #a8321f; --gold: #b58a1b; --ok: #2f6b2f; --bad: #a8321f; --head: #2f3820; --row: #f0ecde; }
}

/* Mobile */
.mobile-tabs { display: none; }
@keyframes apbump { 0% { transform: scale(1); } 35% { transform: scale(1.08); background: var(--gold); color: #1c1708; } 100% { transform: scale(1); } }
@media (max-width: 900px) {
  .mobile-tabs { display: grid; grid-template-columns: 1fr 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--head); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); gap: 6px; box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3); }
  .mt-btn { font: inherit; color: #d8d5c0; background: rgba(255, 255, 255, 0.08); border: 0; border-radius: 8px; padding: 8px 6px; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; cursor: pointer; }
  .mt-btn b { font-size: 1rem; } .mt-btn span { font-size: 0.78rem; opacity: 0.8; }
  .mt-btn.on { background: var(--olive); color: var(--olive-ink); }
  .mt-btn.bump { animation: apbump 0.8s ease-out; }
  body:has(.mobile-tabs) .app, body:has(.mobile-tabs) .foot { padding-bottom: 72px; }
  .plat-grid.mv-list .plat-panel, .plat-grid.mv-platoon .pick-card { display: none; }
  .pick-list { max-height: none; overflow: visible; border: 0; background: none; }
  .pick-card { padding: 12px 10px; }
  .plat-grid { display: block; }
  .plat-grid > section { margin: 8px 0; }
  .toast { bottom: 84px; width: max-content; max-width: 92vw; text-align: center; }
}
@media (max-width: 700px) {
  html { font-size: 16px; }
  input[type=text], input[type=search], input[type=number], select { font-size: 16px; min-height: 42px; }
  .btn { min-height: 40px; }
  .btn.small { min-height: 36px; padding: 4px 12px; }
  .app { padding: 0 12px 24px; }
  h1 { font-size: 1.45rem; }
  .top { position: static; padding: 8px 12px; gap: 6px 10px; }
  .top .brand { font-size: 0.98rem; }
  nav { width: 100%; order: 3; flex-wrap: nowrap; overflow-x: auto; gap: 2px; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  nav a { white-space: nowrap; padding: 8px 12px; }
  .top .sp-grow { display: block; }
  .theme-sw #theme-lab { display: none; }
  .toolbar { gap: 6px; }
  .toolbar input[type=search] { width: 100%; }
  /* tank rows: name on top, three big add buttons below */
  .pick-row { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px; }
  .pk-add { gap: 8px; }
  .pk-add .btn.cal { flex: 1; min-height: 52px; min-width: 0; }
  .btn.cal b { font-size: 1.15rem; }
  .btn.cal:hover { background: var(--card); color: var(--ink); }
  .btn.cal:hover span { color: var(--muted); }
  .btn.cal:active { background: var(--olive); color: var(--olive-ink); }
  .pk-meta { font-size: 0.8rem; }
  .tank-card { padding: 10px; }
  .tc-head { flex-wrap: wrap; row-gap: 4px; }
  .tc-head .link.big { flex: 1 1 60%; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .pp-head { margin: -10px -10px 8px; padding: 10px; }
  .card { padding: 12px; }
  .tablewrap.tall { max-height: 65vh; }
  .modal-back { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; }
}
@media (max-width: 900px) {
  .plat-page.mv-platoon > h1, .plat-page.mv-platoon > .plat-hdr, .plat-page.mv-platoon > .setup { display: none; }
}
.mcard.picked { border-color: var(--olive); box-shadow: 0 0 0 2px var(--olive); }
.mcard h2 { margin-bottom: 4px; } .mcard p { margin: 4px 0 0; }
