/* vets-anni — glassmorphism, adapted from website/public/returns/56/style.css.
   Anni additions: grid-2, bars, pill variants, countdown, and the role/status
   colour custom-properties (overridden by colourblind.css when body.cb). */

*, *::before, *::after { box-sizing: border-box; }

:root {
  /* Canonical chip palette — the single source mirrors STYLES in
     app/constants.py. body.cb (colourblind.css) overrides ONLY the --c-*
     base hue; the role/status aliases below follow automatically. */
  --c-red:     #ff0000; --c-red-light:     #ff9292; --c-red-dark:     #990000;
  --c-yellow:  #fffb00; --c-yellow-light:  #f5f36e; --c-yellow-dark:  #696800;
  --c-green:   #15ff00; --c-green-light:   #83ff78; --c-green-dark:   #0a7700;
  --c-blue:    #0400ff; --c-blue-light:    #9290ff; --c-blue-dark:    #0300ac;
  --c-cyan:    #00e1ff; --c-cyan-light:    #4aeaff; --c-cyan-dark:    #007e8f;
  --c-magenta: #ff00dd; --c-magenta-light: #ff7aff; --c-magenta-dark: #6000b9;
  --c-grey:    #888888; --c-grey-light:    #d6d6d6; --c-grey-dark:    #3d3d3d;

  /* Role → shared colour (spec.md [^5]; see ROLE_STYLES). */
  --role-primary:   var(--c-red);
  --role-secondary: var(--c-yellow);
  --role-tertiary:  var(--c-magenta);
  --role-healer:    var(--c-green);
  --role-tank:      var(--c-blue);
  --role-fill:      var(--c-cyan);
  --role-unassigned:var(--c-grey);
  /* Legible dark shades — chip BODIES use these (white text is readable on
     them for every role; the bright base hues above are not). Not CB-swapped
     by design: CB leans on the glyph swatch (raw hue, swapped) + glyph/label.*/
  --role-primary-dark:   var(--c-red-dark);
  --role-secondary-dark: var(--c-yellow-dark);
  --role-tertiary-dark:  var(--c-magenta-dark);
  --role-healer-dark:    var(--c-green-dark);
  --role-tank-dark:      var(--c-blue-dark);
  --role-fill-dark:      var(--c-cyan-dark);
  --role-unassigned-dark:var(--c-grey-dark);
  /* Light tints — used for the capability-dot halo so small dots remain
     readable against any card background (the dark fills on `.person` make
     a dark-grey/black outline disappear into the card; a light same-hue
     halo pops). CB mode re-declares these under body.cb so the halo stays
     same-hue under Okabe-Ito too (see colourblind.css). */
  --role-primary-light:   var(--c-red-light);
  --role-secondary-light: var(--c-yellow-light);
  --role-tertiary-light:  var(--c-magenta-light);
  --role-healer-light:    var(--c-green-light);
  --role-tank-light:      var(--c-blue-light);
  /* Status → the SAME shared colour as its paired role (spec.md [^6];
     see STATUS_STYLES). */
  --st-gone:        var(--c-red);
  --st-offhard:     var(--c-green);
  --st-offsoft:     var(--c-yellow);
  --st-elsewhere:   var(--c-blue);
  --st-world:       var(--c-cyan);
  --st-party:       var(--c-magenta);
  --st-unknown:     var(--c-grey);
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #111827;
  min-height: 100vh;
}
/* Background image + soft dark overlay so text stays readable — reference
   parity with website/public/returns/56/ vendored into static/img/. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background: url("/static/img/vets_background.webp") center/cover no-repeat fixed;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(circle at top, rgba(255,255,255,.25), rgba(15,23,42,.9));
}

.page {
  max-width: 1400px; margin: 1.5rem auto; padding: 1.5rem;
  border-radius: 24px; background: rgba(249,250,251,.82);
  backdrop-filter: blur(10px); box-shadow: 0 18px 40px rgba(15,23,42,.5);
  opacity: 0; animation: fadeInUpSoft .6s ease-out forwards;
}
/* Auth screens (staff login): the frosted panel should hug the small sign-in
   box, not span the full 1400px — see the guild-password reference. */
.page.page-auth { max-width: 560px; margin: 4rem auto; }
h1 { margin: 0 0 .25rem; }
h2 { margin: 0 0 .5rem; }
.muted { font-size: .9rem; color: #6b7280; }

.card {
  background: rgba(255,255,255,.95); border-radius: 18px;
  padding: 1rem 1.25rem; margin-top: 1rem; border: 1px solid #e5e7eb;
  box-shadow: 0 10px 26px rgba(15,23,42,.15);
  opacity: 0; animation: fadeInUpSoft .6s ease-out forwards;
}
.card:nth-of-type(1) { animation-delay: .10s; }
.card:nth-of-type(2) { animation-delay: .18s; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

label { display:block; font-size:.85rem; margin: .6rem 0 .2rem; }
input, textarea, select, button {
  font: inherit; border-radius: 8px; border: 1px solid #d1d5db;
  background: #f9fafb; color: #111827; padding: .45rem .6rem; width: 100%;
}
button {
  cursor: pointer; border: none; background: #2563eb; color: #fff;
  padding: .5rem 1.1rem; font-weight: 500; width: auto; margin-top: .6rem;
  border-radius: 999px;
}
button:hover { filter: brightness(1.05); }

/* Pills + status/role chips ------------------------------------------------ */
.pill {
  display:inline-flex; align-items:center; gap:.3rem;
  padding:.15rem .65rem; border-radius:999px; font-size:.75rem; font-weight:600;
}
.pill-ok      { background:#bbf7d0; color:#166534; }
.pill-muted   { background:#e5e7eb; color:#374151; }
.pill-danger  { background:#fecaca; color:#b91c1c; }

/* Bottom "bars" used across dashboards (status/likelihood/warnings). */
.bar {
  margin-top:.6rem; padding:.5rem .75rem; border-radius:10px;
  font-size:.85rem; font-weight:500;
}
.bar-ok      { background:#dcfce7; color:#166534; }
.bar-info    { background:#cffafe; color:#0369a1; }
.bar-warn    { background:#fef9c3; color:#854d0e; }
.bar-danger  { background:#fee2e2; color:#b91c1c; }
/* Flash = a pulsing focus RING, never an opacity dip — the text stays fully
   readable at every moment (the old opacity flash made the off-tick
   illegible). Disabled under prefers-reduced-motion by the global rule. */
.bar-flash   { animation: barPulse 1.15s ease-in-out infinite; }
.preline     { white-space: pre-line; }  /* honour \n in server text */

.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }

/* Navbar (reference parity) ------------------------------------------------ */
.navbar {
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px);
  background: linear-gradient(to right, rgba(187,98,47,.77), rgba(39,72,184,.71));
  border-bottom: 1px solid rgba(148,163,184,.4);
}
.nav-inner {
  max-width: 1400px; margin: 0 auto; padding: 1rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
a { color: inherit; text-decoration: none; }
.nav-brand {
  font-weight: 700; font-size: 1.3rem; letter-spacing: .14em;
  text-transform: uppercase; color: #e5e7eb; white-space: nowrap;
}
.nav-links { display:flex; align-items:center; gap:.75rem; font-size:1.05rem; }
.nav-links a {
  color:#e5e7eb; opacity:.85; padding:.25rem .7rem; border-radius:999px;
  transition: background .15s, opacity .15s, transform .15s;
}
.nav-links a:hover {
  opacity:1; background: rgba(191,219,254,.16); transform: translateY(-1px);
}
.cb-toggle { border: 1px solid rgba(229,231,235,.5); }

@keyframes fadeInUpSoft {
  from { opacity:0; transform: translateY(12px); filter: blur(4px); }
  to   { opacity:1; transform: translateY(0);    filter: blur(0); }
}
/* Border/ring pulse — content opacity is untouched so the bar is always
   legible; only the surrounding ring breathes to draw the eye. */
@keyframes barPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0);
             outline: 2px solid rgba(220,38,38,0); outline-offset: 1px; }
  50%      { box-shadow: 0 0 0 4px rgba(220,38,38,.30);
             outline: 2px solid rgba(220,38,38,.65); outline-offset: 1px; }
}

/* ===== Phase 1 — user dashboard ========================================= */
.dash-head { display:flex; align-items:center; gap:1rem; flex-wrap:wrap; }
.dash-head h1 { margin:0; }
.avatar { border-radius:10px; image-rendering:pixelated; background:#0002; }

h3 { margin:1rem 0 .35rem; font-size:1rem; }
.btn-sm {
  width:auto; margin:0; padding:.25rem .6rem; font-size:.78rem;
  border-radius:999px; background:#e5e7eb; color:#111827; border:none;
  cursor:pointer;
}
.btn-sm.btn-danger { background:#fecaca; color:#b91c1c; }
/* Add actions (Add Party / Add player) — a visible accent so they don't
   vanish into the white card like the neutral grey .btn-sm did. */
.btn-sm.btn-add { background:#2563eb; color:#fff; }
.btn-sm.btn-add:hover { filter:brightness(1.06); }
.btn-sm.btn-add:disabled { background:#9db8ef; cursor:not-allowed; }
/* Secondary action — same base `button` box as the primary (identical
   height/shape), just a neutral palette. */
.btn-secondary { background:#e5e7eb; color:#111827; }
/* Small muted explainer under a form label. */
.field-help { font-size:.78rem; color:#6b7280; line-height:1.4;
  margin:.1rem 0 .4rem; }

/* Optional weapon lookup — deliberately NOT styled like the boxed (required-
   looking) inputs. Recessed: no box, faint dashed underline, muted/small,
   so it reads as a "search helper", not a field you must fill. */
.weapon-search {
  width:100%; border:none; border-bottom:1px dashed #cbd5e1;
  border-radius:0; background:transparent; color:#6b7280;
  font-size:.8rem; padding:.25rem .15rem; margin-top:.25rem;
}
.weapon-search::placeholder { color:#9ca3af; }
.weapon-search:focus {
  outline:none; border-bottom-style:solid; border-bottom-color:#9ca3af;
  color:#111827;
}
.add-cap {
  width:auto; margin-top:.8rem; background:#1d4ed8; color:#fff;
  border:none; border-radius:999px; padding:.45rem 1rem; cursor:pointer;
}

/* Role-background chip — colour from the swappable --c-* via the alias var.
   Glyph + aria-label are emitted regardless of colour (CB hard rule). */
.role-chip {
  display:inline-flex; align-items:center; gap:.4rem;
  padding:.2rem .55rem .2rem .25rem; border-radius:8px;
  font-weight:700; color:#fff;            /* legible on the -dark body */
}
/* Glyph swatch carries the raw identifying hue; white text with a thin
   black outline (no shadow) stays crisp on any hue — bright green/yellow
   AND dark blue/red. `paint-order` keeps the white fill from being eaten. */
.role-chip .glyph {
  font-size:.7rem; letter-spacing:.04em; color:#fff;
  -webkit-text-stroke:.6px #000; paint-order:stroke fill; text-shadow:none;
  padding:.1rem .4rem; border-radius:6px;
}
.status-dot {
  display:inline-flex; align-items:center; justify-content:center;
  width:1.5rem; height:1.5rem; border-radius:50%; vertical-align:middle;
  background:rgba(255,255,255,.7);
}
.status-dot .glyph { font-size:.8rem; font-weight:700; color:#111827; }

/* Role-capacity list */
.cap-list { list-style:none; margin:.5rem 0 0; padding:0; }
.cap-row {
  display:grid; gap:.5rem 1rem; align-items:center; padding:.6rem 0;
  border-top:1px solid #e5e7eb;
  grid-template-columns:minmax(150px,auto) 1fr auto auto;
}
@media (max-width:760px){ .cap-row{ grid-template-columns:1fr; } }
.cap-weapons { display:flex; flex-wrap:wrap; gap:.3rem; }
.cap-levels { display:flex; flex-wrap:wrap; gap:.4rem; align-items:center; }
.cap-actions { display:flex; gap:.4rem; }
.pill-weapon { background:#e0e7ff; color:#3730a3; }
.pill-region { background:#cffafe; color:#155e75; }

/* Preferred regions ------------------------------------------------------
   Read view only (the picker is the #modal-mount popup, styled by .modal*).
   Just the bubbles + an "Edit Regions." button on the right of the
   Membership line — no caption, so it adds no height above that line.
   Nothing here expands in place, so the card never warps. */
.regions { display:flex; flex-wrap:wrap; gap:.4rem; align-items:center; }

/* Membership line + region block, one row. margin-top reproduces the
   h2→first-paragraph gap the other cards get from the <p> (a flex row's
   own top margin still collapses with the h2; its children's don't — so we
   zero .reg-status and put the gap here) → spacing matches the other cards. */
.reg-line {
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:.4rem 1.5rem; flex-wrap:wrap; margin-top:1rem;
}
.reg-status { margin:0; flex:1 1 16rem; }
.reg-aside { text-align:right; }
.reg-aside .regions { justify-content:flex-end; }
/* The popup's multi-select: a real, full-height dropdown box (not shrunk). */
.modal select[multiple] {
  width:100%; min-height:10rem; padding:.3rem;
  border-radius:.5rem; border:1px solid #cbd5e1;
}
@media (max-width:760px){
  /* Narrow: the region block wraps below the membership line, left-aligned. */
  .reg-aside { text-align:left; }
  .reg-aside .regions { justify-content:flex-start; }
}

/* High/Moderate/Low meter — count of filled bars carries the level, not hue */
.level {
  display:inline-flex; align-items:center; gap:.35rem; font-size:.72rem;
  background:#f3f4f6; padding:.15rem .5rem; border-radius:999px;
}
.level-bars { display:inline-flex; gap:2px; }
.level-bars i {
  width:6px; height:12px; border-radius:2px; background:#d1d5db; display:block;
}
.level-bars i.on { background:#374151; }
.level-label { color:#6b7280; }
.level-word { font-weight:700; }

/* Attendance likelihood meter. The whole bar gets a LIGHT tint of the
   band's colour (worst->best red<orange<yellow<green<blue) with DARK
   same-hue text so it's always legible (e.g. dark-red on light-red).
   The band LABEL is always shown (never the %), so colour is never the
   only signal. */
.likelihood { display:flex; align-items:center; gap:.6rem;
  background:#f1f5f9; color:#0f172a; }
.likelihood-track {
  flex:1; height:.6rem; border-radius:999px; overflow:hidden;
  background:rgba(0,0,0,.10);            /* hairline track on any tint */
}
.likelihood-fill { height:100%; border-radius:999px; background:currentColor; }
.likelihood-label { font-weight:700; white-space:nowrap; color:inherit; }

/* light background · dark same-hue text+fill (combined selector beats the
   neutral default above) */
.likelihood.lk-red    { background:#fee2e2; color:#991b1b; }
.likelihood.lk-orange { background:#ffedd5; color:#9a3412; }
.likelihood.lk-yellow { background:#fef9c3; color:#854d0e; }
.likelihood.lk-green  { background:#dcfce7; color:#166534; }
.likelihood.lk-blue   { background:#e0f2fe; color:#075985; }

/* Page-level section divider — lives OUTSIDE the white cards, on the frosted
   .page panel. Plain heading (no underline) to match the page title. The
   live countdown now rides in the title itself, in a fancy gradient. */
.section-title { margin: 1.7rem 0 .4rem; font-size: 1.9rem; letter-spacing:.01em; }
.section-when { font-size:.62em; font-weight:700; color:#475569; }
.section-when .countdown {
  font-variant-numeric:tabular-nums;
  background:linear-gradient(180deg,#1d4ed8,#7c3aed);
  -webkit-background-clip:text; background-clip:text; color:transparent;
}

/* Today's-anni: two INDEPENDENT stable cards (Your Participation |
   Tentative Information) in the existing .grid-2. Cards are flex columns
   and grid-2 stretches them to equal height. Tentative is all fields now
   (the uninformative always-yellow stage bar was demoted to a "Party stage"
   row), so only Participation has a trailing .bar; pinning it to the card
   foot keeps it at the bottom of its stretched card. */
.spec-card { display:flex; flex-direction:column; }
.spec-col { display:flex; flex-direction:column; flex:1; }
.spec-col > .bar:last-child { margin-top:auto; }
.spec-col .kv { max-width:none; }

/* Current online/world state — colour is backed by the word too (CB-safe). */
.online-line { display:flex; align-items:center; gap:.5rem; margin:.2rem 0 .6rem; }
.kv td .online-line { margin:0; }   /* sit flush like any other kv row */
.online-dot {
  width:.7rem; height:.7rem; border-radius:50%; flex:none;
  background:#9ca3af; box-shadow:0 0 0 3px rgba(156,163,175,.25);
}
.online-on     .online-dot { background:#16a34a; box-shadow:0 0 0 3px rgba(22,163,74,.25); }
.online-queue  .online-dot { background:#d97706; box-shadow:0 0 0 3px rgba(217,119,6,.25); }
.online-off    .online-dot { background:#dc2626; box-shadow:0 0 0 3px rgba(220,38,38,.22); }
.online-unknown .online-dot{ background:#7c3aed; box-shadow:0 0 0 3px rgba(124,58,237,.22); }

.kv { border-collapse:collapse; width:100%; max-width:560px; }
.kv th, .kv td { text-align:left; padding:.35rem .6rem; border-bottom:1px solid #e5e7eb; }
.kv th { color:#6b7280; font-weight:600; width:9rem; }
/* Host shown as an avatar+name bubble (degrades to just the name if the
   face render fails — the <img> onerror-removes itself). */
.host-pill {
  display:inline-flex; align-items:center; gap:.35rem;
  padding:.1rem .6rem .1rem .15rem; border-radius:999px;
  background:#e5e7eb; color:#374151; font-weight:600; font-size:.85rem;
}
.host-pill img { border-radius:50%; image-rendering:pixelated; background:#0002; }
.staff-users { max-width:none; }
.staff-users form { display:inline; }

/* Modal (HTMX-mounted) */
.modal-overlay {
  position:fixed; inset:0; z-index:50; display:flex;
  align-items:flex-start; justify-content:center; padding:4vh 1rem;
  background:rgba(15,23,42,.55); backdrop-filter:blur(3px); overflow:auto;
}
.modal {
  background:#fff; border-radius:16px; padding:1.25rem 1.4rem;
  max-width:560px; width:100%; box-shadow:0 24px 60px rgba(15,23,42,.5);
}
.modal-head { display:flex; justify-content:space-between; align-items:center; }
.modal-head h2 { margin:0; }
.modal .guidance {
  background:#f8fafc; border:1px solid #e5e7eb; border-radius:10px;
  padding:.6rem .8rem; margin:.6rem 0;
}
/* align-items:center (NOT the default stretch) + zeroing the global button
   margin-top is what stops Cancel rendering ~40% taller: stretch was
   inflating the small button to the row height, and the primary's inherited
   margin-top:.6rem ate into its own stretched height. Both buttons now share
   the base `button` box and sit at their natural, equal height. */
.modal-actions { display:flex; gap:.6rem; margin-top:.9rem; align-items:center; }
.modal-actions button { margin-top:0; }

/* ===== Phase 2 — organizer board ======================================== */
.chip-row { display:flex; flex-wrap:wrap; gap:.35rem; margin:.3rem 0 .6rem; }
.org-form { display:flex; gap:.5rem; align-items:flex-end; flex-wrap:wrap;
  margin-top:.6rem; }
.org-form select { width:auto; min-width:14rem; }
.org-form .btn-sm { margin:0; }

/* Board header: title + live pill on the left, the one-line "Lead organiser
   [dropdown]" aligned right; the drag hint is a subheader under it. */
.board-head {
  display:flex; align-items:center; justify-content:space-between;
  gap:.6rem 1.5rem; flex-wrap:wrap;
}
.board-title {
  display:flex; align-items:center; gap:.6rem; margin:0; flex-wrap:wrap;
}
.board-title #ws-state { font-size:.7rem; font-weight:600; }
.board-sub { margin:.15rem 0 0; }
.org-inline { display:flex; align-items:center; gap:.5rem; }
.org-inline label { display:inline; margin:0; font-size:.85rem; color:#374151; }
.org-inline select { width:auto; min-width:12rem; }

.board { display:block; }
.board-grid {
  display:grid; grid-template-columns: 1.4fr 1fr; gap:1rem; margin-top:1rem;
  align-items:start;
}
@media (max-width:1000px){ .board-grid { grid-template-columns:1fr; } }
.board-col-head {
  display:flex; align-items:center; justify-content:space-between; gap:1rem;
}
.board-col-head form { margin:0; }
.board-parties, .board-buckets { display:flex; flex-direction:column; gap:.8rem; }

.party-card, .bucket {
  background:rgba(255,255,255,.95); border:1px solid #e5e7eb;
  border-radius:14px; padding:.7rem .85rem;
  box-shadow:0 8px 20px rgba(15,23,42,.12);
}
.party-head { display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; }
.party-head strong { font-size:1.05rem; }
/* Collapse caret — unobtrusive, the whole party-head reads as one line when
   collapsed. */
.party-collapse {
  width:1.5rem; height:1.5rem; flex:none; margin:0; padding:0;
  border:1px solid #d1d5db; border-radius:6px; background:#f3f4f6;
  color:#374151; font-size:.8rem; line-height:1; cursor:pointer;
}
.party-collapse:hover { background:#e5e7eb; }
.party-summary { font-size:.82rem; }
/* Delete-X for empty parties — rendered only when the party has no members
   (template-gated), so click→confirm→delete is always a safe action. */
.party-delete {
  margin-left:auto; width:1.5rem; height:1.5rem; flex:none; padding:0;
  border:0; background:transparent; color:#dc2626;
  font-size:1.25rem; line-height:1; cursor:pointer; border-radius:6px;
}
.party-delete:hover { background:#fee2e2; }
.party-delete:focus-visible { outline:2px solid #dc2626; outline-offset:1px; }
.party-card.collapsed { padding:.5rem .85rem; }
.party-set { margin:.4rem 0; }
/* Flex (not an even auto-fit grid) so fields take only the width their
   content needs: world ≤5 chars, result ≤"loss" — the freed space goes to
   the stage dropdown, which now shows a readable description per stage. */
.party-form {
  display:flex; flex-wrap:wrap; gap:.4rem .7rem; align-items:flex-end;
  margin-top:.5rem;
}
.party-form label {
  margin:0; font-size:.78rem; display:flex; flex-direction:column; gap:.15rem;
}
.party-form input, .party-form select { padding:.3rem .4rem; width:100%; }
.party-form .pf-host   { flex:1 1 9rem; }
.party-form .pf-stage  { flex:4 1 16rem; }     /* widest — readable label */
.party-form .pf-world  { flex:0 0 5.5rem; }    /* ≤5 chars */
.party-form .pf-result { flex:0 0 6rem; }      /* ≤"loss" */
.party-form .btn-sm { margin:0; align-self:flex-end; }

.bucket h3 { margin:.1rem 0 .4rem; font-size:1rem; }
.late-head { margin:.5rem 0 .25rem; font-size:.82rem; color:#6b7280;
  text-transform:uppercase; letter-spacing:.05em; }
.addign { display:flex; gap:.5rem; margin:.2rem 0 .4rem; }
.addign input { flex:1; }
.addign .btn-sm { margin:0; }
/* "+ Party" and "Add" render identically sized (their label widths differ). */
.board-col-head .btn-sm,
.addign .btn-sm { min-width:6rem; text-align:center; }

/* Drop containers. A min-height keeps an empty zone a real drop target. */
.dropzone {
  display:flex; flex-direction:column; gap:.45rem; min-height:3rem;
  padding:.4rem; border-radius:10px; background:#f1f5f9;
  border:1px dashed #cbd5e1;
}
.dropzone.late { background:#fff7ed; border-color:#fdba74; }
.dz-empty { margin:.35rem .25rem; font-size:.8rem; }

/* The person object. Background = assigned-role -dark shade (white text is
   legible on every role), border = status colour + a non-colour pattern
   (from colourblind.css, applied in BOTH modes) + glyph + aria-label, so the
   card reads with no colour at all (spec hard rule). */
.person {
  display:flex; align-items:center; gap:.6rem;
  padding:.4rem .55rem; border-radius:10px;
  color:#fff; background:var(--c-grey-dark);
  cursor:grab; user-select:none;
}
.person:active { cursor:grabbing; }
.person-ghost { opacity:.4; }
.person-face { border-radius:6px; image-rendering:pixelated; background:#0003;
  flex:none; }
.person-main { display:flex; flex-direction:column; gap:.15rem; min-width:0;
  flex:1; }
.person-name { font-weight:700; font-size:.9rem; }
.person-name .muted { color:#e5e7eb; opacity:.8; font-weight:400; }
.person-tags { display:flex; flex-wrap:wrap; gap:.3rem; align-items:center;
  font-size:.72rem; }
.role-tag, .status-tag {
  display:inline-flex; align-items:center; gap:.25rem;
  background:rgba(0,0,0,.28); padding:.05rem .4rem; border-radius:999px;
  font-weight:600;
}
.role-tag .glyph {
  font-size:.62rem; color:#fff; -webkit-text-stroke:.6px #000;
  paint-order:stroke fill; padding:.05rem .3rem; border-radius:5px;
}
.status-tag .glyph { font-size:.8rem; }
.person .pill { font-size:.68rem; }
.person-actions { flex:none; }
.person-role {
  width:auto; font-size:.74rem; padding:.2rem .35rem; border-radius:6px;
  background:rgba(255,255,255,.92); color:#111827; border:none;
}
/* The status border itself (width/style/pattern come from colourblind.css,
   which applies in both modes; colour is the inline var(--st-*)). */
.person.status-border { border-width:3px; }

/* Label-density toggles (deps.label_visible -> base.html body class). Default
   off in both modes — the role card background, status border colour+pattern,
   and capability dots already carry the signal; the text tag is opt-in. */
body.hide-rolelabel  .person .role-tag    { display:none; }
body.hide-statuslabel .person .status-tag { display:none; }

/* Capability dots — "what can this player do?". Sit inline after the name on
   the title row, full raw role hue (PRIM=red/SUNK=yellow/HDMG=magenta/
   HEAL=green/TANK=blue; FILL is not a capability so cyan never appears). The
   wrapper anchors the absolutely-positioned popover so each dot owns its own
   info panel; the popover is a sibling so the CSS-only hover path (the
   default) is one `+` selector away. */
.person-name .cap-dots {
  display:inline-flex; align-items:center; gap:.25rem;
  margin-left:.4rem; vertical-align:middle;
  /* Nudge up: `vertical-align:middle` aligns the dot's vertical centre to
     the parent's lowercase x-height (not the cap-height), which reads ~3px
     low next to a bold capitalised name. */
  transform:translateY(-3px);
}
.cap-dot-wrap { position:relative; display:inline-flex; }
.cap-dot {
  width:.85rem; height:.85rem; padding:0; margin:0; border:none;
  border-radius:50%; cursor:pointer; flex:none;
  display:inline-flex; align-items:center; justify-content:center;
  background-color: var(--cap-fill, currentColor);
  /* Outer halo in the role's light same-hue tint — a dark fill (e.g. blue)
     on a dark person-card background needs a light outline to be visible.
     Pair with a subtle drop shadow so the dot still looks "lifted". */
  box-shadow:0 0 0 1.5px var(--cap-halo, rgba(255,255,255,.7)),
             0 1px 2px rgba(0,0,0,.35);
  /* The button is interactive, not a drag handle — keep it crisp. */
  -webkit-touch-callout:none; user-select:none;
}
.cap-dot:focus-visible { outline:2px solid #fff; outline-offset:1px; }
/* Letter glyph (P/S/M/H/T): the CB non-colour channel. Hidden in default
   mode (the colour conveys it for non-CVD users); CSS in colourblind.css
   shows it under body.cb so colour is never the only signal there.
   White-with-thin-black-outline mirrors the existing role-chip glyph trick
   — legible on every role hue including yellow. */
.cap-letter {
  display:none; font-size:.55rem; font-weight:800; line-height:1;
  color:#fff; -webkit-text-stroke:.4px #000; paint-order:stroke fill;
  text-shadow:none;
}

/* The info popover. Anchored at the left edge of the dot so it grows
   rightward — the dots sit on the left side of the card (inline after the
   name), so opening leftward would clip the popover off the page on narrow
   windows. z-index sits above neighbouring person cards but below the
   pinned legend (15) and the navbar (20). */
.cap-popover {
  display:none; position:absolute; top:calc(100% + .35rem); left:0;
  z-index:14; min-width:14rem; max-width:22rem;
  padding:.5rem .65rem; border-radius:10px;
  background:#fff; color:#111827; border:1px solid #e5e7eb;
  box-shadow:0 14px 30px rgba(15,23,42,.25);
  font-weight:400; font-size:.78rem; line-height:1.35;
  /* The card itself is a flex row centred on the avatar; reset so each block
     inside the popover stacks naturally. */
  text-align:left;
}
.cap-popover-title { display:block; font-size:.85rem; margin-bottom:.3rem; }
.cap-popover-meta {
  display:flex; flex-wrap:wrap; gap:.3rem; margin-bottom:.3rem;
}
.cap-popover-weapons { display:flex; flex-wrap:wrap; gap:.25rem; }
.cap-popover .muted { color:#6b7280; font-size:.75rem; }

/* Default (hover) mode: open on pointer hover OR keyboard focus-within so
   the dot stays usable with no mouse. */
body:not(.dotmode-click) .cap-dot-wrap:hover > .cap-popover,
body:not(.dotmode-click) .cap-dot-wrap:focus-within > .cap-popover {
  display:block;
}
/* Click mode: only the JS-applied .open class shows the popover. board.js
   handles the toggle + outside-click dismissal. */
body.dotmode-click .cap-popover.open { display:block; }

/* Stacking-order fix.
   (1) `.cap-dots` has a `transform` (the upward nudge), so it forms its own
       stacking context; the popover's z-index then only competes WITHIN
       that context.
   (2) Under CB, every .person has a ::after ring (`inset:-4px`) that paints
       4px outside the card. With .person at `z-auto` it does NOT establish
       a stacking context, so the ring escapes UP to the nearest ancestor
       stacking context (effectively body) — where it can paint over a
       hovered card's popover that overhangs into the next card's area.
   Fix in two parts: `isolation: isolate` makes every .person its own
   stacking context so its ring stays contained; then bump the hovered/open
   card above its siblings so the popover overhangs cleanly. 18 sits above
   sibling .person (auto) but below the navbar (20), so the popover never
   overlays page chrome. */
.person { position: relative; isolation: isolate; }
body:not(.dotmode-click) .person:has(.cap-dot-wrap:hover),
body:not(.dotmode-click) .person:has(.cap-dot-wrap:focus-within),
body.dotmode-click .person:has(.cap-popover.open) { z-index: 18; }

/* Legend (~90%) beside the Configs box (~10%). */
.legend-wrap {
  display:flex; gap:1rem; margin-top:1rem; align-items:stretch;
  flex-wrap:wrap;
}
.legend-wrap > .legend { flex:90 1 18rem; margin-top:0; }
.legend-wrap > .board-controls { flex:10 1 7rem; margin-top:0; }
@media (max-width:780px){ .legend-wrap > * { flex-basis:100%; } }

/* Pinned: keep the legend/Configs bar just under the sticky navbar while
   the board scrolls (per-user config, default on). z-index sits below the
   navbar (20); the child cards are opaque so scrolled content can't bleed
   through. Honours prefers-reduced-motion implicitly (no animation). */
.legend-wrap.pinned {
  position:sticky; top:3.6rem; z-index:15;
}

.board-controls h3 { margin:.1rem 0 .4rem; font-size:.95rem; }
.cfg-list { list-style:none; margin:.3rem 0 0; padding:0;
  display:flex; flex-direction:column; gap:.45rem; }
/* Each config = a "Name  [switch]" row. The whole row is the toggle (an <a>
   that round-trips a cookie + reload — same no-JS pattern as the CB link);
   the switch is a pure-CSS track + sliding knob, green when on. */
.cfg-row {
  display:flex; align-items:center; justify-content:space-between; gap:.5rem;
  font-size:.82rem; font-weight:600; color:#374151;
  padding:.15rem 0;
}
.cfg-switch {
  flex:none; position:relative; width:2.1rem; height:1.1rem;
  border-radius:999px; background:#cbd5e1; box-sizing:border-box;
  transition:background .15s;
}
.cfg-switch::after {
  content:""; position:absolute; top:.13rem; left:.13rem;
  width:.84rem; height:.84rem; border-radius:50%; background:#fff;
  box-shadow:0 1px 2px rgba(0,0,0,.35); transition:transform .15s;
}
.cfg-switch.on { background:#16a34a; }
.cfg-switch.on::after { transform:translateX(1rem); }
a.cfg-row:hover .cfg-switch { filter:brightness(.97); }

/* Legend — every channel that carries meaning shown explicitly. */
.legend { margin-top:1rem; }
.legend-block { margin:.2rem 0 .8rem; }
.legend-block h3 { margin:.2rem 0 .35rem; font-size:.95rem; }
.legend-row { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; }
.legend-status {
  display:inline-flex; align-items:center; gap:.3rem;
  padding:.15rem .55rem; border-radius:8px; font-size:.75rem; font-weight:600;
  background:#f8fafc; color:#0f172a;
}
.legend-status .glyph { font-weight:700; }

/* ===== Phase 2 — roles dashboard ======================================== */
/* "Active only" toggle sits to the LEFT of the search bar; it owns the
   margin-left:auto so both controls anchor together at the right edge. */
.active-toggle {
  margin-left:auto;
  display:inline-flex; align-items:center; gap:.5rem;
  font-size:.82rem; font-weight:600; color:#374151;
  cursor:pointer; user-select:none;
}
.active-toggle .active-toggle-name { white-space:nowrap; }
.roles-search {
  width:260px;  /* explicit — override generic input{width:100%} */
  padding:.4rem .7rem; font-size:.85rem; color:#374151;
  background:#f3f4f6; border:1px solid #e5e7eb; border-radius:8px;
}
.roles-search::placeholder { color:#9ca3af; }
.roles-search:focus { outline:none; background:#fff; border-color:#cbd5e1; }
.roles-filters {
  display:flex; flex-wrap:wrap; gap:.6rem .9rem; align-items:flex-end;
  /* Override .card defaults: sit tight under the heading, slimmer padding. */
  margin-top:.25rem; padding:.6rem .9rem;
}
.roles-filters label {
  display:flex; flex-direction:column; gap:.15rem;
  font-size:.78rem; line-height:1.5; color:#475569;
}
.roles-filters select {
  font-size:.85rem; padding:.25rem .4rem;
  border:1px solid #cbd5e1; border-radius:6px; background:#fff;
}
/* Reset stack mirrors a <label>+<select> column: count text in the label
   slot, Reset button matched to the select's vertical metrics so the two
   columns share an intrinsic height and everything top-aligns cleanly. */
.roles-reset {
  display:flex; flex-direction:column; gap:.15rem; align-items:flex-start;
  /* Nudge up: bottom-aligned columns leave a 2-3px optical gap from the
     select bottoms because the button's rounded box visually centres higher.*/
  margin-bottom:.2rem;
}
.roles-reset .roles-count { font-size:.78rem; line-height:1.5; }
.roles-reset .btn-sm {
  font-size:.85rem; padding:.25rem .6rem;
  border:1px solid transparent;  /* matches the 1px select border for height */
}
.roles-list { list-style:none; margin:0; padding:0; }
.roles-row {
  display:grid; grid-template-columns:minmax(180px,1fr) 3fr; gap:1rem;
  align-items:start; padding:.7rem 0; border-top:1px solid #e5e7eb;
}
.roles-row:first-child { border-top:none; }
/* Beats `.roles-row { display:grid }` so li.hidden = true actually hides the
   row — without this, the UA `[hidden]{display:none}` (specificity 0,1,0)
   ties with `.roles-row` and source-order keeps the row displayed. */
.roles-row[hidden] { display:none; }
@media (max-width:820px){ .roles-row{ grid-template-columns:1fr; } }
.roles-who { display:flex; gap:.6rem; align-items:flex-start; }
.roles-avatar-col {
  display:flex; flex-direction:column; align-items:center; gap:.25rem;
  flex:none;
}
/* RSVP badge under the avatar — ✓ (green) when RSVP'd, ✗ (red) when not.
   Glyph + aria-label carry the meaning so the badge reads under CB. The
   badge is omitted entirely when no active event exists (rsvp_state='na'). */
.rsvp-badge {
  display:inline-flex; align-items:center; justify-content:center;
  width:1.1rem; height:1.1rem; border-radius:50%;
  font-size:.78rem; font-weight:700; line-height:1;
  border:1px solid currentColor;
}
.rsvp-badge.rsvp-yes  { color:#15803d; background:#dcfce7; }
.rsvp-badge.rsvp-soft { color:#708a14; background:#f1f7cf; }
.rsvp-badge.rsvp-no   { color:#b91c1c; background:#fee2e2; }
.roles-name { font-weight:700; display:block; }
.roles-meta { display:flex; flex-wrap:wrap; gap:.3rem; margin-top:.25rem;
  align-items:center; }
.roles-regions { display:flex; flex-wrap:wrap; gap:.3rem; margin-top:.25rem;
  align-items:center; }
.roles-caps { display:flex; flex-direction:column; gap:.4rem; }
.roles-cap {
  display:flex; flex-wrap:wrap; gap:.5rem 1rem; align-items:center;
  background:#f8fafc; border:1px solid #e5e7eb; border-radius:10px;
  padding:.35rem .6rem;
}
/* Row 1 = badge + weapons; row 2 = .cap-bottom (levels left, actions right).
   flex-basis:100% on cap-bottom forces the wrap so the bottom row is always
   full-width regardless of how the row-1 content fits. */
.roles-cap .cap-bottom {
  flex-basis:100%; display:flex; flex-wrap:wrap; gap:.4rem 1rem;
  align-items:center;
}
.roles-cap .cap-bottom .cap-actions { margin-left:auto; }

/* Respect reduced-motion (reference parity). Covers the new flash/anim too. */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration:.01ms !important; animation-iteration-count:1 !important;
      transition-duration:.01ms !important; }
}
