:root {
  --bg: #14171c; --panel: #1d222b; --panel2: #252b36; --line: #333b48;
  --txt: #e8ecf2; --muted: #93a0b4; --accent: #d4af37; --err: #ff6b6b;
  --ok: #4caf50; --run: #ffb300; --pend: #6b7686;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--txt);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--err); min-height: 1em; }
.center { min-height: 100vh; display: grid; place-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 28px; width: 340px; display: flex; flex-direction: column; gap: 12px; }
input, select, textarea { background: var(--panel2); border: 1px solid var(--line);
  color: var(--txt); border-radius: 8px; padding: 10px; font-size: 14px; }
button { background: var(--accent); color: #1a1a1a; border: 0; border-radius: 8px;
  padding: 10px 14px; font-weight: 600; cursor: pointer; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.active { outline: 2px solid var(--accent); }
header { display: flex; flex-direction: column; gap: 8px; padding: 16px 24px;
  border-bottom: 1px solid var(--line); background: var(--panel); }
header h1 { margin: 0; font-size: 20px; }
nav { display: flex; gap: 8px; align-items: center; }
nav .spacer { flex: 1; }
main { padding: 24px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; }
tr:hover td { background: var(--panel2); }
.faction { font-weight: 600; color: var(--accent); }
.pill { padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.s-done { background: rgba(76,175,80,.2); color: var(--ok); }
.s-running { background: rgba(255,179,0,.2); color: var(--run); }
.s-pending { background: rgba(107,118,134,.2); color: var(--pend); }
.s-error { background: rgba(255,107,107,.2); color: var(--err); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 16px; }
.unitcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.unitcard img { width: 100%; display: block; background: #fff; }
.unitcard .body { padding: 12px; }
.stats { display: flex; gap: 10px; font-size: 13px; color: var(--muted); }
.badge { font-size: 12px; color: var(--muted); }
.printed { color: var(--ok); font-weight: 600; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-box { background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; width: min(760px, 96vw); max-height: 92vh; overflow: auto;
  padding: 20px; position: relative; }
.modal-close { position: absolute; top: 10px; right: 12px; background: transparent;
  color: var(--muted); font-size: 22px; border: 0; cursor: pointer; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.col { flex: 1 1 220px; display: flex; flex-direction: column; gap: 8px; }
label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.viewer { width: 100%; height: 320px; background: #0e1116; border: 1px solid var(--line);
  border-radius: 10px; }
.inline { display: flex; gap: 8px; align-items: center; }
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.ok-msg { color: var(--ok); }
.swatch { width: 20px; height: 20px; border-radius: 4px; border: 1px solid var(--line); display: inline-block; }
.clickable { cursor: pointer; }
.asset-missing { color: var(--muted); font-size: 12px; padding: 20px; text-align: center; }

/* movement cards + labels styled per army */
.deckgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 14px; }
.mcard { border-radius: 10px; padding: 12px; min-height: 120px; color: #fff;
  border: 3px solid; display: flex; flex-direction: column; gap: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.mcard .mc-army { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: .85; }
.mcard .mc-title { font-size: 17px; font-weight: 700; line-height: 1.1; }
.mcard .mc-action { font-size: 12px; opacity: .9; margin-top: auto; }
.mcard .mc-units { font-size: 12px; }
.mcard .mc-badge { align-self: flex-start; font-size: 10px; padding: 2px 7px; border-radius: 999px;
  background: rgba(255,255,255,.22); }
.mcard.group { border-style: double; border-width: 5px; }
.army-section { margin-bottom: 26px; }
.army-section h3 { display: flex; align-items: center; gap: 10px; }
.label-base { border-radius: 6px 6px 10px 10px; padding: 10px 14px; color: #fff;
  border: 2px solid; display: inline-block; min-width: 220px; text-align: center;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.25)); }
.label-base .lb-name { font-weight: 700; font-size: 15px; }
.label-base .lb-stats { font-size: 12px; letter-spacing: 1px; opacity: .95; }
.label-base .lb-ability { font-size: 10px; opacity: .85; margin-top: 2px; }
.labelgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 14px; }

/* Print sheet: Avery Presta 95272 — 2.5x3.5in cards, 10 per 8.5x11 letter sheet */
.printsheet { display: none; }
.print-card { width: 2.5in; height: 3.5in; box-sizing: border-box; overflow: hidden;
  border: 1px dashed #bbb; } /* dashed = manual cut guide */
.print-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media print {
  @page { size: letter portrait; margin: 0.5in 0.75in; } /* ~10 cards: 2 cols x 5 rows */
  body * { visibility: hidden; }
  #printsheet, #printsheet * { visibility: visible; }
  #printsheet { display: grid !important; position: absolute; left: 0; top: 0;
    grid-template-columns: 2.5in 2.5in; grid-auto-rows: 3.5in; gap: 0; }
  .print-card { border: 1px dashed #999; }
  header, nav, .toolbar, #modal { display: none !important; }
}
