/* ChoresOfDuty — Operator Terminal — design system + all components.
   Dark night-ops theme, deliberately distinct from the arcade's violet.
   Locked tokens — do not invent new colors. Mission/military theming,
   no Call of Duty trademarks/assets/fonts. Mobile-first, touch-first. */

/* Rajdhani (600, 700) is loaded via <link rel="preconnect"> + Google Fonts <link>
   tags in index.html <head> — not @import here, so the browser can start the font
   fetch in parallel with CSS parsing instead of discovering it only after this
   stylesheet loads. */

:root {
  --bg: #0A0E0B;          /* near-black green */
  --bg-2: #10160F;
  --card: #141C14;
  --card-2: #1A241A;
  --line: #263422;
  --text: #EDF3EA;
  --muted: #93A48D;
  --accent: #77C043;      /* HUD green — actions, success */
  --accent-dim: rgba(119,192,67,.16);
  --gold: #FFB020;        /* coins, rewards */
  --flame: #FF7A1A;       /* streaks */
  --danger: #FF5D5D;
  --radius: 16px;
  --shadow: 0 10px 36px rgba(0,0,0,.5);
  --font-head: 'Rajdhani', system-ui, sans-serif;   /* 600/700, uppercase, letter-spacing .04em */
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* spacing scale — multiples of 4px */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100dvh;
}

body {
  background:
    radial-gradient(900px 500px at -5% -10%, rgba(119,192,67,.14), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  padding: max(env(safe-area-inset-top), 0px) max(env(safe-area-inset-right), 0px)
           max(env(safe-area-inset-bottom), 0px) max(env(safe-area-inset-left), 0px);
}

a { color: inherit; }

h1, h2, h3, .rank-badge, .chip.xp, .pill, .flame {
  font-family: var(--font-head);
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 var(--sp-2);
}

h1 { font-size: clamp(22px, 5vw, 32px); }
h2 { font-size: clamp(18px, 4vw, 24px); }
h3 { font-size: clamp(15px, 3vw, 18px); }

p { margin: 0 0 var(--sp-3); color: var(--text); }

/* focus ring — every interactive element */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-dim);
  border-radius: 8px;
}

/* ---- App shell / layout ---- */

main {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 32px) clamp(16px, 4vw, 32px) clamp(40px, 8vw, 64px);
}

/* ---- Sticky glassy header ---- */

#hq-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  row-gap: var(--sp-2);
  padding: var(--sp-3) clamp(16px, 4vw, 32px);
  background: rgba(10, 14, 11, .7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

/* Offsets the sticky header below the pinned comms banner so Sign Out stays clickable. */
body:has(#comms-banner:not([hidden])) #hq-header { top: 38px; }

#hq-header .brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: auto;
}

#hq-header .brand .brand-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(16px, 4vw, 20px);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  white-space: nowrap;
}

#hq-header .brand .tagline {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .02em;
}

/* ---- Operator card (M6 — Loadout, header chip: avatar + callsign style) ---- */

.operator-card {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px var(--sp-3);
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
}

.operator-card[hidden] { display: none; }

.operator-card .op-avatar {
  font-size: 18px;
  line-height: 1;
}

.operator-card .op-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text);
  white-space: nowrap;
}

#hq-header .hq-stats {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ---- Comms banner ---- */

#comms-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  min-height: 38px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-2) clamp(16px, 4vw, 32px);
  background: rgba(255, 93, 93, .14);
  border-bottom: 1px solid var(--danger);
  color: var(--danger);
  font-weight: 600;
  font-size: 14px;
  text-align: center;
}

#comms-banner[hidden] { display: none; }

/* ---- Cards ---- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}

.mission-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: var(--sp-4);
  touch-action: pan-y;
  will-change: transform;
  transition: transform .14s ease, border-color .14s ease, opacity .14s ease;
}

.mission-card:hover { border-color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .mission-card { transition: none; }
}

/* Status stripe — open=green edge, redo=amber edge. Claimed cards use .staged
   instead (dashed gold border, no stripe) and are never swipeable. */
.mission-card.status-open { border-left: 4px solid var(--accent); }
.mission-card.status-redo { border-left: 4px solid var(--gold); }

.mission-card.staged {
  border: 1px dashed var(--gold);
}

/* .card-face is the part that actually translates during a swipe — the outer
   .mission-card stays put (border/shadow/status-stripe) and clips it via overflow. */
.mission-card .card-face {
  position: relative;
  z-index: 1;
  background: linear-gradient(160deg, var(--card), var(--card-2));
  padding: var(--sp-5);
  will-change: transform;
}

.mission-card.staged .card-face {
  background: linear-gradient(160deg, rgba(255,176,32,.08), var(--card-2));
}

.mission-card h3 { margin: 0 0 var(--sp-1); }

.mission-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: var(--sp-3) 0;
}

.mission-card .actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

.mission-card .redo-note {
  color: var(--gold);
  font-style: italic;
  font-size: 13px;
}

/* Tap-to-expand briefing — collapsed by default, grows via max-height transition. */
.mission-card .briefing {
  overflow: hidden;
  max-height: 0;
  transition: max-height .22s ease;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.mission-card .briefing.expanded { max-height: 320px; margin-bottom: var(--sp-2); }

@media (prefers-reduced-motion: reduce) {
  .mission-card .briefing { transition: none; }
}

.chip.due.overdue {
  color: var(--danger);
  border-color: rgba(255,93,93,.35);
  background: rgba(255,93,93,.12);
}

/* Swipe-to-complete reveal layer — sits behind .card-face, uncovered as the card
   is dragged. Full-bleed green with the commit label centered. */
.mission-card .swipe-reveal {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  background: var(--accent);
  color: #0A0E0B;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---- Coin celebration burst ---- */

.coin-burst {
  position: fixed;
  width: 0;
  height: 0;
  z-index: 70;
  pointer-events: none;
}

.coin-particle {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 20px;
  transform: translate(-50%, -50%);
  animation: coin-pop .6s ease-out forwards;
}

@keyframes coin-pop {
  0%   { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .coin-particle { animation: none; opacity: 0; }
}

/* ---- Mission-complete stamp (Task 6) ----
   Overlay on the mission card at claim time — absolutely positioned inside
   the (already position:relative, overflow:hidden) .mission-card, so it
   never affects layout/height. Two variants: .variant-complete (auto-
   approved — green chip + coin readout) and .variant-awaiting (sent to
   debrief — gold chip). z-index 2 sits above .card-face (1) and
   .swipe-reveal (0). Whole thing is ≤900ms and lives inside a card that
   JS removes/replaces shortly after, so it never lingers. */

.mission-card .mission-stamp {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  background: rgba(10, 14, 11, .72);
  pointer-events: none;
  animation: stamp-fade .7s ease forwards;
}

.mission-stamp .stamp-chip {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--bg);
  background: var(--accent);
  padding: 10px 18px;
  border-radius: 10px;
  border: 2px solid var(--text);
  transform: scale(0);
  animation: stamp-scale-in .7s cubic-bezier(.2, 1.6, .4, 1) forwards;
}

.mission-stamp.variant-awaiting .stamp-chip {
  background: var(--gold);
}

.mission-stamp .stamp-coin {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  color: var(--gold);
  opacity: 0;
  animation: stamp-coin-in .7s ease forwards;
  animation-delay: .12s;
}

@keyframes stamp-fade {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  78%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes stamp-scale-in {
  0%   { transform: scale(0) rotate(-6deg); }
  60%  { transform: scale(1.08) rotate(-1deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes stamp-coin-in {
  0%   { opacity: 0; transform: translateY(6px); }
  35%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  /* Instant show/instant fade, no transform animation — JS still removes
     the overlay after a short fixed hold (see shared/missions.js). */
  .mission-stamp {
    animation: none;
    opacity: 1;
  }
  .mission-stamp .stamp-chip {
    animation: none;
    transform: scale(1);
  }
  .mission-stamp .stamp-coin {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* Coin-flip pulse on the header balance pill (Task 6) — paired with the
   existing count-up tween in missions.js. */
@keyframes pill-flip {
  0%   { transform: rotateX(0deg); }
  50%  { transform: rotateX(90deg); }
  100% { transform: rotateX(0deg); }
}

.pill.flip { animation: pill-flip .5s ease; }

@media (prefers-reduced-motion: reduce) {
  .pill.flip { animation: none; }
}

/* ---- Buttons ---- */

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #0A0E0B;
  background: var(--accent);
  padding: 12px 20px;
  min-height: 44px;
  min-width: 44px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform .08s ease, filter .15s ease;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
}

.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:active { transform: none; }
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  filter: grayscale(.3);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn.ghost:hover { border-color: var(--accent); }

/* ---- Alerts bell (M5 push opt-in — shared/notify.js) ---- */

.bell-btn.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

/* ---- Pills (stat pills — header) ---- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  min-height: 32px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid rgba(119,192,67,.35);
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

.pill.gold {
  background: rgba(255,176,32,.14);
  border-color: rgba(255,176,32,.4);
  color: var(--gold);
}

/* ---- Chips (small labels — mission card metadata) ---- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 4px var(--sp-2);
  border-radius: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}

.chip.xp {
  font-family: var(--font-head);
  color: var(--accent);
  border-color: rgba(119,192,67,.35);
  background: var(--accent-dim);
}

.chip.gold {
  font-family: var(--font-head);
  color: var(--gold);
  border-color: rgba(255,176,32,.35);
  background: rgba(255,176,32,.12);
}

.chip.proof {
  color: var(--gold);
  border-color: rgba(255,176,32,.35);
  background: rgba(255,176,32,.1);
}

.chip.squad {
  color: var(--muted);
}

/* ---- Rank badge ---- */

.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text);
  font-size: 13px;
}

/* ---- Flame / killstreak ---- */

.flame {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--flame);
  font-weight: 700;
  font-size: 13px;
}

.mult-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255,122,26,.16);
  border: 1px solid rgba(255,122,26,.4);
  color: var(--flame);
  font-size: 11px;
  font-weight: 700;
}

.rank-badge .rank-name { white-space: nowrap; }
.rank-badge .chevrons { display: block; }

/* ---- Scoreboard ---- */

.group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.group-chip {
  cursor: pointer;
  background: var(--bg-2);
  color: var(--muted);
}

.group-chip.active {
  color: var(--accent);
  border-color: rgba(119,192,67,.35);
  background: var(--accent-dim);
}

.scoreboard-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.scoreboard-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
}

.scoreboard-row.own-row {
  background: var(--accent-dim);
  border-color: rgba(119,192,67,.35);
}

.scoreboard-row .rank-pos {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--muted);
  width: 24px;
  text-align: center;
}

/* M6 — equipped avatar emoji, painted by loadout.js's applyCosmetics(). :empty
   collapses the span (incl. its flex gap) entirely for a member with no avatar
   equipped, so a non-buyer's row keeps the exact pre-M6 spacing/layout. */
.scoreboard-row .row-avatar {
  font-size: 18px;
  line-height: 1;
}
.scoreboard-row .row-avatar:empty {
  display: none;
}

.scoreboard-row .name {
  flex: 1;
  font-weight: 600;
}

.scoreboard-row .xp-total {
  font-family: var(--font-head);
  color: var(--accent);
  font-weight: 700;
}

/* ---- History ---- */

.history-day { margin-bottom: var(--sp-5); }

.history-day .day-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: var(--sp-3);
}

.history-row {
  padding: var(--sp-3) var(--sp-4);
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  margin-bottom: var(--sp-2);
}

.history-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.history-title { font-weight: 600; }

.history-note {
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
  margin: var(--sp-2) 0 0;
}

.chip.outcome.approved {
  color: var(--accent);
  border-color: rgba(119,192,67,.35);
  background: var(--accent-dim);
}

.chip.outcome.partial {
  color: var(--gold);
  border-color: rgba(255,176,32,.35);
  background: rgba(255,176,32,.12);
}

.chip.outcome.redo {
  color: var(--gold);
  border-color: rgba(255,176,32,.35);
  background: rgba(255,176,32,.1);
}

.chip.outcome.rejected {
  color: var(--danger);
  border-color: rgba(255,93,93,.35);
  background: rgba(255,93,93,.1);
}

.chip.outcome.expired {
  color: var(--muted);
  border-color: var(--line);
  background: var(--bg-2);
}

/* ---- Form fields ---- */

.field {
  display: block;
  margin-bottom: var(--sp-4);
}

.field label {
  display: block;
  margin-bottom: var(--sp-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
}

.field input::placeholder { color: var(--muted); }

.error {
  color: var(--danger);
  font-size: 14px;
  min-height: 18px;
  margin: var(--sp-1) 0 0;
}

/* ---- Tabs ---- */

#tabs {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--sp-2);
  /* Narrow viewports (≤~380px): 4-5 uppercase tab labels don't fit at
     flex:1's default min-width:auto, which was blowing out the whole
     page horizontally instead of shrinking (Task 6 sweep finding). Scroll
     the bar itself instead of the page — same look wherever it fits. */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  appearance: none;
  cursor: pointer;
  flex: 1 0 auto;
  min-width: max-content;
  min-height: 44px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .04em;
  transition: color .15s ease, background .15s ease;
}

@media (prefers-reduced-motion: reduce) {
  .tab-btn { transition: none; }
}

.tab-btn[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(119,192,67,.35);
}

/* ---- Empty state ---- */

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: var(--sp-10) var(--sp-4);
}

.empty-state .icon {
  font-size: 40px;
  margin-bottom: var(--sp-3);
  display: block;
}

/* ---- Overlay / dialog ---- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(6,8,7,.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: var(--sp-5);
}

.overlay[hidden] { display: none; }

.dialog {
  width: min(420px, 92vw);
  background: linear-gradient(160deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-6);
  box-shadow: var(--shadow);
}

.dialog h2 { margin: 0 0 var(--sp-1); }
.dialog p { color: var(--muted); margin: 0 0 var(--sp-4); }

.dialog .row {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.dialog .row .btn { flex: 1; }

.proof-preview {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: var(--sp-4);
  display: block;
  max-height: 260px;
  object-fit: cover;
}

/* ---- Toasts ---- */

#toast-root {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(env(safe-area-inset-bottom), var(--sp-4));
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-4);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  max-width: min(400px, 92vw);
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
  animation: toast-in .22s ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}

/* ---- Views ---- */

#view-login, #view-dash { }
#view-login[hidden], #view-dash[hidden] { display: none; }

#view-login {
  max-width: 380px;
  margin: clamp(24px, 8vh, 64px) auto 0;
}

[hidden] { display: none !important; }

/* ---- Command shell (M3) ---- */
.cmd-bar { display: flex; gap: var(--sp-2); align-items: center; margin: var(--sp-3) 0; }
.select {
  flex: 1; min-width: 0; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--sp-2) var(--sp-3); font-family: var(--font-head);
  font-size: 16px; letter-spacing: .04em;
}
#cmd-tabs {
  display: flex;
  gap: var(--sp-1);
  margin-bottom: var(--sp-3);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip: rect(0 0 0 0); overflow: hidden;
}

/* ---- Debrief (M3) ---- */
.section-head { font-family: var(--font-head); font-size: 15px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin: var(--sp-4) 0 var(--sp-2); }
.debrief-card { margin-bottom: var(--sp-3); }
.debrief-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); }
.debrief-meta { color: var(--muted); font-size: 13px; margin: var(--sp-1) 0; }
.debrief-note { font-style: italic; color: var(--text); margin: var(--sp-2) 0; }
.queue-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.action-panel { margin-top: var(--sp-2); display: grid; gap: var(--sp-2); }
.action-panel input, .action-panel textarea {
  width: 100%; background: var(--card-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-2);
}
.proof-thumb { width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius);
  border: 1px solid var(--line); cursor: pointer; }
.proof-full { max-width: 92vw; max-height: 86vh; border-radius: var(--radius); }
.claw-row { display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-2); }
.claw-main { display: grid; gap: 2px; }

/* ---- After-Action Report (M6) ---- */
.after-action-card { cursor: default; }
.after-action-card > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0;
}
.after-action-card > summary::-webkit-details-marker { display: none; }
.after-action-card > summary::before {
  content: '▸';
  display: inline-block;
  color: var(--accent);
  transition: transform .15s ease;
}
.after-action-card[open] > summary::before { transform: rotate(90deg); }
.aa-week-bar { margin: var(--sp-3) 0; }
.aa-body { display: grid; gap: var(--sp-3); }
.aa-headline { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.aa-stat {
  flex: 1 1 120px;
  display: grid;
  gap: 2px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-3);
  text-align: center;
}
.aa-stat-value { font-family: var(--font-head); font-size: 22px; color: var(--accent); }
.aa-stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.aa-mvp {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--accent-dim);
  border: 1px solid rgba(119,192,67,.35);
  border-radius: var(--radius);
  padding: var(--sp-2) var(--sp-3);
}
.aa-mvp [data-cosmetic-avatar] { font-size: 18px; line-height: 1; }
.aa-mvp [data-cosmetic-avatar]:empty { display: none; }
.aa-mvp [data-cosmetic-name] { font-weight: 600; flex: 1; }
.aa-members { display: grid; gap: var(--sp-2); }
.aa-member-row { display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-2) var(--sp-3); }

/* ---- Mission builder (M3) ---- */
.mission-row { display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-2); }
.mission-row.retired { opacity: .55; }
.mission-row-main { flex: 1; display: grid; gap: 2px; min-width: 0; }
.mission-row-actions { display: flex; gap: var(--sp-1); flex-shrink: 0; }
.form-grid { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.form-grid label { display: grid; gap: var(--sp-1); font-size: 14px; color: var(--muted); }
.form-grid input, .form-grid select, .form-grid textarea {
  background: var(--card-2); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-2); font-size: 16px; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.check-row { display: flex !important; align-items: center; gap: var(--sp-2); }
.weekday-picker, .assignee-picker { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.chip.wd { cursor: pointer; user-select: none; }
.chip.wd input { margin-right: 4px; }
.chip.wd:has(input:checked) { border-color: var(--accent); color: var(--accent); }

/* ---- Join (M4) ---- */
#view-join { max-width: 380px; margin: clamp(24px, 8vh, 64px) auto 0; }
.field .hint { margin: var(--sp-1) 0 0; font-size: 12px; color: var(--muted); }
.password-field { display: flex; gap: var(--sp-2); align-items: stretch; }
.password-field input { flex: 1; min-width: 0; }
.password-toggle { min-height: 44px; padding: 12px 16px; font-size: 13px; flex-shrink: 0; }

/* ---- Squad & Ledger (M3) ---- */
.roster-row { display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-2);
  flex-wrap: wrap; }
.roster-row.retired { opacity: .55; }
.trust-select { flex: 0 1 auto; font-size: 14px; padding: var(--sp-1) var(--sp-2); }
.invite-code { font-family: var(--font-head); font-size: 18px; letter-spacing: .35em; color: var(--accent); }
.invite-code.big { font-size: 32px; margin: var(--sp-2) 0; }
.ledger-row { display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-2); }
.chip.neg { border-color: var(--danger); color: var(--danger); }

/* ---- Welcome wizard (M4) ---- */
.wizard-dots { display: flex; justify-content: center; gap: var(--sp-2); margin: 0 0 var(--sp-5); }
.wizard-dots .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line);
  transition: background .15s ease; }
.wizard-dots .dot.active { background: var(--accent); }
.wizard-dots .dot.done { background: var(--accent-dim); }
.wizard-step[hidden] { display: none; }
.coin-input { width: 76px; min-height: 40px; padding: 8px; border-radius: 10px;
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  font-size: 15px; text-align: center; }
.coin-input:disabled, .pick-check:disabled { opacity: .5; }

/* ---- Loadout shop (M6) ---- */

.loadout-section { margin-bottom: var(--sp-6); }

.loadout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-3);
}

.loadout-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-4);
}

.loadout-item.locked { opacity: .55; }

.loadout-item-avatar { font-size: 32px; line-height: 1; }

.loadout-item-swatch {
  width: 64px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--card-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
}

.loadout-item-main { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.loadout-item-name { font-weight: 600; font-size: 14px; }

.loadout-item-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  margin-top: var(--sp-1);
}

.loadout-item-action .btn { width: 100%; }

/* Rarity chips — common uses the default muted .chip look as-is. */
.chip.rarity-rare {
  color: var(--accent);
  border-color: rgba(119,192,67,.35);
  background: var(--accent-dim);
}
.chip.rarity-epic {
  color: var(--gold);
  border-color: rgba(255,176,32,.35);
  background: rgba(255,176,32,.12);
}
.chip.rarity-legendary {
  color: var(--flame);
  border-color: rgba(255,122,26,.4);
  background: rgba(255,122,26,.16);
}

.chip.owned {
  color: var(--accent);
  border-color: rgba(119,192,67,.35);
  background: var(--accent-dim);
}
.chip.equipped {
  color: var(--gold);
  border-color: rgba(255,176,32,.35);
  background: rgba(255,176,32,.12);
}
.chip.locked { color: var(--muted); }

/* ---- Cosmetic classes — callsign_style (text treatment) + card_camo (border/
   bg treatment). Locked night-ops palette only, no new colors invented; keyed
   on the exact cosmetic_items.name values from 006/020 via loadout.js's
   slugify(). Applied by loadout.js's applyCosmetics() to `[data-cosmetic-name]`
   (cs-*) and to the card/row surface itself (camo-*). ---- */

.cs-neon-stencil { color: var(--accent); text-shadow: 0 0 6px var(--accent-dim); }
.cs-gold-braid { color: var(--gold); font-weight: 700; letter-spacing: .08em; }
.cs-red-stencil { color: var(--danger); text-transform: uppercase; letter-spacing: .02em; }
.cs-ice-type { color: var(--text); text-shadow: 0 0 4px var(--muted); }
.cs-steel-type { color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); }

.camo-digital-forest { border-color: var(--accent); background: var(--accent-dim); }
.camo-night-tiger { border-color: var(--flame); background: rgba(255,122,26,.12); }
.camo-arctic-wolf { border-color: var(--text); background: var(--bg-2); }
.camo-desert-storm { border-color: var(--gold); background: rgba(255,176,32,.12); }
.camo-neon-grid { border-color: var(--danger); background: rgba(255,93,93,.12); }
