/* ============================================================
   Hajime — Auth UI (spec 029 G4). Concept stylesheet.
   Reuses Hajime tokens: warm-charcoal topbar (#16110A), gold
   brand (#D9A441), Inter + IBM Plex Mono, control.css light/dark
   density. Topbar chrome is theme-agnostic (Linear/Slack pattern);
   the WORKSPACE swaps via [data-theme] on .app-body.
   ============================================================ */

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@supports (font-variation-settings: normal) {
  body { font-family: 'InterVariable', 'Inter', system-ui, sans-serif; }
}
a { color: inherit; }
button { font-family: inherit; }

/* ---- WORKSPACE TOKENS ---- */
.app-body, .auth-shell { --gold: #D9A441; }

.app-body[data-theme="light"], .auth-shell[data-theme="light"] {
  --bg:            #F6F8FA;
  --surface:       #FFFFFF;
  --surface-2:     #F0F3F6;
  --surface-3:     #E7ECF1;
  --border:        #D0D7DE;
  --border-strong: #A8B3BD;
  --ink:           #1F2328;
  --ink-2:         #59636E;
  --ink-muted:     rgba(31, 35, 40, 0.55);
  --ink-faint:     rgba(31, 35, 40, 0.30);
  --running:  #1F8A4D;
  --running-bg: rgba(31, 138, 77, 0.10);
  --pending:  #1F7BD8;
  --pending-bg: rgba(31, 123, 216, 0.08);
  --amber:    #B88300;
  --amber-bg: rgba(184, 131, 0, 0.10);
  --red:      #C5372B;
  --red-bg:   rgba(197, 55, 43, 0.08);
  --violet:   #6D4FC0;
  --violet-bg: rgba(109, 79, 192, 0.10);
  --shadow-sm: 0 1px 2px rgba(31,35,40,0.06), 0 1px 1px rgba(31,35,40,0.04);
  --shadow-md: 0 4px 14px rgba(31,35,40,0.08), 0 1px 3px rgba(31,35,40,0.06);
}

.app-body[data-theme="dark"], .auth-shell[data-theme="dark"] {
  --bg:            #1A1712;
  --surface:       #232019;
  --surface-2:     #2A2620;
  --surface-3:     #332E26;
  --border:        rgba(242, 235, 224, 0.13);
  --border-strong: rgba(242, 235, 224, 0.26);
  --ink:           #F2EBE0;
  --ink-2:         rgba(242, 235, 224, 0.64);
  --ink-muted:     rgba(242, 235, 224, 0.44);
  --ink-faint:     rgba(242, 235, 224, 0.24);
  --running:  #3FB984;
  --running-bg: rgba(63, 185, 132, 0.13);
  --pending:  #3FA4E8;
  --pending-bg: rgba(63, 164, 232, 0.12);
  --amber:    #E8B23A;
  --amber-bg: rgba(232, 178, 58, 0.13);
  --red:      #E0594C;
  --red-bg:   rgba(224, 89, 76, 0.13);
  --violet:   #A48BE8;
  --violet-bg: rgba(164, 139, 232, 0.14);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 28px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.35);
}

/* ============================================================
   TOPBAR — theme-agnostic warm charcoal (matches /standings,
   /cuadro, control header). Identity + role + dashboard + logout.
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 20px;
  background: #16110A;
  border-bottom: 1px solid #2A2620;
  color: #F2EBE0;
}
.tb-brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 900; letter-spacing: -0.02em; font-size: 16px;
  white-space: nowrap;
}
.tb-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--gold); color: #16110A;
  font-weight: 800; font-size: 16px; line-height: 1;
}
.tb-brand .jp { color: rgba(242,235,224,0.92); font-weight: 800; }
.tb-brand .dot { color: var(--gold); margin: 0 1px; }
.tb-context {
  margin-left: 4px; padding-left: 12px;
  border-left: 1px solid #34302A;
  font: 700 10.5px/1 'IBM Plex Mono', monospace;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(242,235,224,0.50);
}
.tb-nav { display: flex; align-items: center; gap: 2px; margin-left: 18px; }
.tb-nav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 7px;
  color: rgba(242,235,224,0.62); text-decoration: none;
  font: 700 10.5px/1 'IBM Plex Mono', monospace;
  letter-spacing: 0.16em; text-transform: uppercase; cursor: pointer;
}
.tb-nav a:hover { color: #F2EBE0; background: rgba(242,235,224,0.06); }
.tb-nav a.active { color: #F2EBE0; background: rgba(217,164,65,0.14); }
.tb-spacer { flex: 1; }

.tb-action {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; height: 34px; padding: 0 10px; border-radius: 8px;
  background: transparent; border: 1px solid transparent;
  color: rgba(242,235,224,0.70); cursor: pointer;
  font: 500 13px/1 'Inter', sans-serif;
}
.tb-action:hover { color: #F2EBE0; background: rgba(242,235,224,0.07); }
.tb-action .ico { width: 17px; height: 17px; display: block; }

/* security badge (system_admin) */
.tb-alert {
  position: relative;
}
.tb-alert .count {
  position: absolute; top: -3px; right: -3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; background: #E0594C; color: #fff;
  font: 700 10px/1 'IBM Plex Mono', monospace;
  border: 2px solid #16110A;
}

/* user menu */
.tb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 6px 5px 12px; border-radius: 9px;
  border: 1px solid #34302A; cursor: pointer;
}
.tb-user:hover { background: rgba(242,235,224,0.05); }
.tb-user .who { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; line-height: 1; }
.tb-user .name { font-size: 13px; font-weight: 600; color: #F2EBE0; }
.tb-user .role {
  font: 600 9.5px/1 'IBM Plex Mono', monospace;
  letter-spacing: 0.08em; color: var(--gold);
}
.tb-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3a342b, #262019);
  color: #F2EBE0; font-weight: 700; font-size: 12px;
  border: 1px solid #443e34;
}
.tb-theme { display:inline-flex; }

/* ============================================================
   WORKSPACE SHELL
   ============================================================ */
.app-body { background: var(--bg); color: var(--ink); min-height: 100vh; }
.workspace { display: none; }
.workspace.is-active { display: block; }

.content {
  max-width: 1200px; margin: 0 auto;
  padding: 30px clamp(18px, 3vw, 36px) 80px;
}
.content.wide { max-width: 1340px; }

/* page-header (ADR-0030 pattern) */
.page-header { margin-bottom: 26px; }
.page-header .eyebrow {
  font: 600 11px/1 'IBM Plex Mono', monospace;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 10px;
}
.page-header h1 {
  margin: 0 0 7px; font-weight: 800;
  font-size: clamp(24px, 2.4vw, 32px); letter-spacing: -0.02em;
}
.page-header .sub {
  margin: 0; color: var(--ink-2); font-size: 14px; max-width: 70ch;
}
.page-header .sub a {
  color: var(--ink); text-decoration: underline;
  text-underline-offset: 3px; text-decoration-color: var(--border-strong);
}
.ph-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
/* Cross-navigation buttons in a page header (process pages). */
.ph-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   CARDS / SECTIONS
   ============================================================ */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.sidebar { grid-template-columns: minmax(0,1fr) 320px; align-items: start; }
/* a narrower aside (e.g. the Sorteo summary) so the main column gets more room */
@media (min-width: 901px) { .grid.sidebar.sidebar-narrow { grid-template-columns: minmax(0,1fr) 250px; } }
@media (max-width: 900px) { .grid.cols-2, .grid.cols-3, .grid.sidebar { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.card-head h2 {
  margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 9px;
}
.card-head .count {
  font: 600 11px/1 'IBM Plex Mono', monospace;
  color: var(--ink-muted); letter-spacing: 0.04em;
}
.card-head .grow { flex: 1; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-note {
  padding: 11px 18px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--ink-muted);
  display: flex; align-items: center; gap: 8px;
}

/* stat row */
.stat-row { display: flex; gap: 28px; flex-wrap: wrap; }
.stat .n { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--ink-2); margin-top: 2px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; height: 38px; padding: 0 16px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink); font: 600 13.5px/1 'Inter', sans-serif;
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary {
  background: var(--gold); border-color: var(--gold); color: #1c1407;
}
.btn-primary:hover { background: #e6b455; border-color: #e6b455; }
.btn-ink {
  background: var(--ink); border-color: var(--ink); color: var(--surface);
}
.btn-ink:hover { opacity: 0.9; background: var(--ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--red); border-color: var(--border); background: var(--surface); }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
/* state-coloured outline buttons (match the Activo / Inscrito badges) */
.btn-ok { color: var(--running); border-color: var(--border); background: var(--surface); }
.btn-ok:hover { background: var(--running-bg); border-color: var(--running); }
.btn-warn { color: var(--amber); border-color: var(--border); background: var(--surface); }
.btn-warn:hover { background: var(--amber-bg); border-color: var(--amber); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
/* icon-only button: a square the height of its size class, no text/gap. The
   label moves to title/aria-label (tooltip). */
.btn-icon { width: 30px; padding: 0; gap: 0; flex: none; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   FORMS
   ============================================================ */
.field { margin-bottom: 16px; }
.field > label {
  display: block; margin-bottom: 7px;
  font-size: 13px; font-weight: 600; color: var(--ink);
}
.field .hint { font-weight: 400; color: var(--ink-muted); font-size: 12px; }
.input {
  width: 100%; height: 42px; padding: 0 13px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 9px; color: var(--ink); font-size: 14px;
  transition: border-color .12s, box-shadow .12s;
}
.input::placeholder { color: var(--ink-faint); }
.input:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(217,164,65,0.22);
}
.input.has-error { border-color: var(--red); }
.input.has-error:focus { box-shadow: 0 0 0 3px var(--red-bg); }
.input-wrap { position: relative; }
.input-wrap .reveal {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: 0; background: transparent;
  color: var(--ink-muted); cursor: pointer; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
}
.input-wrap .reveal:hover { background: var(--surface-2); color: var(--ink); }
.field-error {
  display: none; margin-top: 7px; font-size: 12.5px; color: var(--red);
  align-items: center; gap: 6px;
}
.field-error.show { display: flex; }

/* select */
.select {
  height: 38px; padding: 0 34px 0 12px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink); font-size: 13.5px; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2359636E' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}

/* ============================================================
   BADGES / PILLS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px; padding: 0 8px; border-radius: 6px;
  font: 600 11px/1 'Inter', sans-serif; white-space: nowrap;
  border: 1px solid transparent;
}
.badge .pulse, .badge .dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.badge-running { color: var(--running); background: var(--running-bg); border-color: color-mix(in srgb, var(--running) 30%, transparent); }
.badge-pending { color: var(--pending); background: var(--pending-bg); border-color: color-mix(in srgb, var(--pending) 30%, transparent); }
.badge-amber   { color: var(--amber); background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber) 32%, transparent); }
.badge-red     { color: var(--red); background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 32%, transparent); }
.badge-blue    { color: var(--pending); background: var(--pending-bg); border-color: color-mix(in srgb, var(--pending) 30%, transparent); }
.badge-violet  { color: var(--violet); background: var(--violet-bg); border-color: color-mix(in srgb, var(--violet) 34%, transparent); }
.badge-muted   { color: var(--ink-2); background: var(--surface-2); border-color: var(--border); }
/* Live (en curso): green chip whose dot wears a soft halo. */
.badge-live    { color: var(--running); background: var(--running-bg); border-color: color-mix(in srgb, var(--running) 34%, transparent); }
.badge-live .dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--running) 20%, transparent); }
.badge .pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Tournament process widget (homologated chips) -- the state flow with arrows
   plus a reference legend, shown on the club list, Administrar and Bases. */
.proc-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 15px 17px; margin: 0 0 18px;
}
.proc-eyebrow {
  font: 600 11px/1 'Inter', sans-serif; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-2); margin-bottom: 10px;
}
.proc-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 4px; }
/* a step = its leading arrow + chip, kept together so a wrap never orphans
   the arrow; a wrapped line then starts with the arrow (reads as "continues"). */
.proc-step { display: inline-flex; align-items: center; gap: 4px; }
.proc-arrow { color: var(--ink-faint); font-size: 14px; }
.proc-note { font-size: 12.5px; color: var(--ink-muted); margin: 10px 0 0; }
.proc-note b { color: var(--amber); font-weight: 600; }
.proc-ref {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 8px 18px;
}
.proc-ref-item { display: flex; align-items: center; gap: 10px; min-width: 0; }
.proc-ref-item .badge { flex: none; min-width: 104px; }
.proc-ref-item > span:last-child { font-size: 12.5px; color: var(--ink-2); }
/* Two side-by-side boxes on the club list: Referencia (left, narrow) + flow
   (right, wide enough to keep the chain on one line). */
.proc-split {
  display: grid; grid-template-columns: minmax(200px, 0.62fr) 1.38fr;
  gap: 18px; align-items: start; margin: 0 0 18px;
}
.proc-split .proc-card { margin: 0; }
@media (max-width: 760px) { .proc-split { grid-template-columns: 1fr; } }

/* Pre-draw preview (Sorteo page): per-category roster tables + the categories
   below the minimum that won't be drawn. */
.prev-cat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; flex-wrap: wrap; }
.prev-cat-head b { font-size: 13.5px; }
.prev-orphans { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 14px; }
/* Each category block (preview + lone-judoka + drawn brackets) is a bounded
   card so its table/controls read as one unit — without the border the next
   block's button sits right under the previous judoka and looks like its
   action. */
.prev-cat { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: color-mix(in srgb, var(--ink) 2.5%, transparent); }
/* Post-draw record (a1) — per-mode draw block (claude/design v2 + author R2).
   Each drawn category is a bordered block: a preview-style header (name + count
   badge + actions), a mode subline, then a two-column body — the seeded judokas
   on the left, the drawn combats stacked one per line in the centre. Two atoms
   recur: a LOT CHIP (number coloured by identity) and a BOUT PILL (two chips =
   one cruce). Colours are 1:1 with the detail views. */
.draw-cats { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; }
.draw-cat { border: 1px solid var(--border); border-radius: 11px; padding: 12px 14px; background: var(--surface); }
/* name on its own line; system chips + medals share the line below it */
.draw-cat__head { display: flex; flex-direction: column; gap: 7px; align-items: stretch; }
.draw-cat__name { font: 700 14px/1.25 'Inter', sans-serif; }
.draw-cat__meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.draw-cat__chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
/* medals this category awards (place medallion + ribbon) */
.medals { display: flex; align-items: flex-end; gap: 3px; flex: none; }
.medal { display: block; }
.medal-n { font: 800 10.5px 'IBM Plex Mono', ui-monospace, monospace; }
.draw-cat__sub { margin-top: 5px; font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.draw-cat__sub .d { color: var(--ink-faint); }
.draw-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
/* system chip (left of the count) — one colour per combat system */
.sys-chip { flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 7px; font: 700 11px/1 'Inter', sans-serif; color: #fff; letter-spacing: .01em; }
/* Reuse the pool palette (A blue, B green, C red, D orange): one per system. */
.sys-bo3 { background: #D9483A; } .sys-rr { background: #4D8BE8; }
.sys-pool { background: #6CB47D; } .sys-elim { background: #E89148; color: #1F1810; }
/* Lone judoka: already champion, so the chip is gold (no trophy icon). */
.sys-chip--gold { background: #E1B23C; color: #3D2E08; }
/* Non-system chips share one carbon look (author R6): only the system chip */
/* keeps a colour. Count, combats, per-combat time and category ETA are all */
/* carbon + white; the thin light border keeps them legible on dark themes. */
.badge-count,
.chip-combats,
.chip-time,
.chip-eta { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 7px; font: 700 11px/1 'Inter', sans-serif; color: #fff; background: #2F313A; border: 1px solid rgba(255, 255, 255, 0.12); }
.chip-time svg, .chip-eta svg { stroke: currentColor; }
/* «Ver cuadro» — yellow, more visible, left-aligned so they line up */
.btn-view { background: #F4C430; border-color: #D9AE2A; color: #1F1810; }
.btn-view:hover { background: #F6D154; border-color: #D9AE2A; }
.btn-view svg { color: #1F1810; }
/* column subtitles shown above each body column */
.dr-col-h { font: 700 11.5px/1 'Inter', sans-serif; color: var(--ink-2); padding-bottom: 4px; border-bottom: 1px solid var(--border); }
/* 2-col body (best_of_3 / round_robin): judokas | combats */
/* Author: the judoka column is a fixed width so the bouts column starts at the
   same x across every non-elimination category (best_of_3 / round_robin /
   pool_5). Narrow now that names are short (one given + one surname). */
.dr-grid2 { margin-top: 11px; display: grid; grid-template-columns: var(--dr-roster-w, 168px) minmax(0, 1fr); gap: 7px 22px; align-items: start; }
/* 3-col body (pool_5 / single_elim): judokas | combats | cierres, per pool */
.dr-pools { margin-top: 11px; display: grid; grid-template-columns: var(--dr-roster-w, 168px) minmax(0, 1.3fr) auto; gap: 7px 18px; align-items: start; }
.dr-cierres { grid-column: 3; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.dr-people, .dr-combats { display: flex; flex-direction: column; gap: 5px; min-width: 0; align-items: flex-start; }
.dr-pool-tag { font: 700 9px/1 'IBM Plex Mono', ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--pc, var(--ink-muted)); margin-bottom: 1px; }
@media (max-width: 720px) { .dr-grid2, .dr-pools { grid-template-columns: 1fr; } .dr-cierres { grid-column: 1; } }
/* lot chip — number coloured by identity (data-lot 1..5) */
.lot { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 7px; background: var(--surface-3); color: var(--ink-2); font: 800 12px/1 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.lot--xs { min-width: 18px; height: 18px; padding: 0 4px; border-radius: 6px; font-size: 11px; }
.lot[data-lot="1"] { background: #4D8BE8; color: #fff; }
.lot[data-lot="2"] { background: #6CB47D; color: #fff; }
.lot[data-lot="3"] { background: #D9483A; color: #fff; }
.lot[data-lot="4"] { background: #E89148; color: #1F1810; }
.lot[data-lot="5"] { background: #3FB8C2; color: #1F1810; }
/* pool-coloured chip (pool_5 / single_elim): identity is the pool */
.lot--pool { background: var(--pc); color: #fff; }
.pc-a { --pc: #4D8BE8; } .pc-b { --pc: #6CB47D; } .pc-c { --pc: #D9483A; } .pc-d { --pc: #E89148; }
.lot--pool.pc-d { color: #1F1810; }
/* seed chip — lot + name with the full club on a second line below it */
.seed { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 3px 10px 3px 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; }
.seed__id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.seed__name { font: 600 12.5px/1.15 'Inter', sans-serif; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seed__club { font: 500 10.5px/1.15 'Inter', sans-serif; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* bout pill — a drawn cruce (two lot chips) with its combat number */
.bt { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; white-space: nowrap; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.bt__v { font: 700 9px/1 'IBM Plex Mono', ui-monospace, monospace; color: var(--ink-faint); text-transform: uppercase; }
.bt__c { font: 700 9px/1 'IBM Plex Mono', ui-monospace, monospace; letter-spacing: .06em; color: var(--ink-muted); text-transform: uppercase; }
/* closer / decider label — same solid pill + size as the bout pills */
.bt__note { font: 700 11px/1 'Inter', sans-serif; color: var(--ink-2); letter-spacing: .01em; }
.bt__bye { font: 700 9.5px/1 'IBM Plex Mono', ui-monospace, monospace; color: var(--ink-faint); text-transform: uppercase; padding: 0 3px; }
/* Mini bracket (author R5-5, elimination only): roster pills (homologated with
   the .seed component) beside the combat tree (SVG). Vertical stacked cells,
   pool-coloured seed chips, ▲ green = winner advances / ▼ red = loser drops.
   Classes use the app theme tokens so it follows the light/dark toggle. */
.dr-mc { margin-top: 11px; display: flex; gap: 20px; align-items: flex-start; }
/* roster column width is shared across categories (set by club.js to the
   widest roster) so the combat column starts at the same x everywhere. */
.dr-mc__legend { flex: 0 0 var(--dr-roster-w, 168px); display: flex; flex-direction: column; gap: 9px; }
.dr-mc__tree { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dr-mc__scroll { overflow-x: auto; }
.mc-svg { display: block; }
@media (max-width: 720px) { .dr-mc { flex-direction: column; } .dr-mc__legend { flex: 0 0 auto; } }
.mc-cell { fill: var(--surface-2); stroke: var(--border); stroke-width: 1; }
.mc-cell--final { stroke: #D9A441; }
.mc-cell--bronze { stroke: #C0843E; }
.mc-gold { fill: #C99A2E; }
.mc-sep { stroke: var(--border); stroke-opacity: .55; }
.mc-conn { stroke: var(--border); stroke-width: 1.3; fill: none; stroke-linejoin: round; }
.mc-id { font: 800 8px 'IBM Plex Mono', ui-monospace, monospace; fill: var(--ink-muted); }
.mc-cn { font: 800 10.5px 'Inter', sans-serif; fill: #fff; }
.mc-bye { font: 700 9px 'Inter', sans-serif; fill: var(--ink-muted); }
.mc-ref { font: 700 10px 'Inter', sans-serif; fill: var(--ink-2); }
.mc-up { font: 800 9px 'Inter', sans-serif; fill: var(--running); }
.mc-dn { font: 800 9px 'Inter', sans-serif; fill: var(--red); }
.mc-col { font: 700 9px 'IBM Plex Mono', ui-monospace, monospace; fill: var(--ink-faint); letter-spacing: .12em; }
.mc-col2 { font: 700 8.5px 'IBM Plex Mono', ui-monospace, monospace; fill: var(--ink-faint); letter-spacing: .1em; }
/* lone judoka = automatic winner (no rival): gold tint + trophy + gold tag */
.draw-cat--win { background: color-mix(in srgb, var(--gold) 7%, transparent); border-color: color-mix(in srgb, var(--gold) 35%, var(--border)); }
.dr-win { margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.win-trophy { width: 28px; height: 28px; flex: none; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #16110A; background: linear-gradient(160deg, #E7C36B, var(--gold)); }
.win-trophy svg { width: 16px; height: 16px; }
.seed--gold { background: color-mix(in srgb, var(--gold) 12%, transparent); border-color: color-mix(in srgb, var(--gold) 40%, var(--border)); }
.lot--gold { background: var(--gold); color: #16110A; }
.win-tag { font: 700 12px/1 'Inter', sans-serif; color: var(--gold); }
/* N=5 system choice, pre-draw (Option 1 pools / Option 2 round-robin) */
.n5-pre { display: flex; flex-direction: column; gap: 7px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.n5-pre__lbl { font: 700 10.5px/1 'IBM Plex Mono', ui-monospace, monospace; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.n5-pre__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.n5-pre__cat { font-weight: 600; color: var(--ink); flex: 1 1 12rem; min-width: 0; }
/* collapsible preview card (a2): the card-head doubles as the click target,
   with a chevron that flips open (▶ collapsed → ▼ open). */
summary.prev-summary { cursor: pointer; list-style: none; }
summary.prev-summary::-webkit-details-marker { display: none; }
summary.prev-summary::after { content: ""; flex: none; width: 7px; height: 7px; border-right: 2px solid var(--ink-muted); border-bottom: 2px solid var(--ink-muted); transform: rotate(-45deg); transition: transform .15s ease; }
details[open] > summary.prev-summary::after { transform: rotate(45deg); }
.prev-section-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.prev-section-head b { font-size: 13.5px; }
/* All preview roster tables share the same fixed column widths so they line up
   no matter the content. */
.prev-card .tbl { table-layout: fixed; width: 100%; }
.prev-card .tbl th, .prev-card .tbl td {
  overflow: hidden; text-overflow: ellipsis;
}
.prev-card .tbl th:nth-child(1), .prev-card .tbl td:nth-child(1) { width: 38%; }
.prev-card .tbl th:nth-child(2), .prev-card .tbl td:nth-child(2) { width: 38%; }
.prev-card .tbl th:nth-child(3), .prev-card .tbl td:nth-child(3) { width: 13%; }
.prev-card .tbl th:nth-child(4), .prev-card .tbl td:nth-child(4) { width: 11%; }
/* Orphan move control: on its own line below the category header. The select
   stays neutral (grey); the "Mover" button is the gold primary action. */
.prev-move-row { margin: 0 0 9px; }
.prev-move { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.input-move { font-size: 11px; }
/* Moved-judoka note (ADR-0073 D9): an info icon with a hover tooltip telling
   where the judoka came from (inline in the destination roster). */
.moved-cell { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.moved-info { display: inline-flex; color: var(--violet); cursor: help; }
/* Category-change log (its own card): a transparent, auditable list of every
   orphan move with a "Deshacer" button to revert it. */
.moves-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.moves-item { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 12.5px; }
.moves-text { color: var(--ink-2); }
.moves-arrow { color: var(--ink-faint); }
.moved-undo { display: inline; margin: 0 0 0 auto; }
.prev-empty { border-top: 1px solid var(--border); padding-top: 13px; }
.prev-empty > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.prev-empty-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.prev-empty-item { font-size: 12px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; }

.role-tag {
  font: 600 10.5px/1 'IBM Plex Mono', monospace;
  letter-spacing: 0.04em; padding: 4px 7px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2);
}

/* ============================================================
   TABLES
   ============================================================ */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl thead th {
  text-align: left; padding: 11px 14px;
  font: 600 11px/1 'IBM Plex Mono', monospace;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-muted); background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.tbl tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
/* Club tournaments: the action stack wraps to 2 rows, so middle-align floats
   the single-line cells off the reading line -- top-align keeps every value on
   the same baseline as the row's first action. */
#club-tournaments-table tbody td { vertical-align: top; }
.tbl .num { font-variant-numeric: tabular-nums; }
.tbl .mono { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; color: var(--ink-2); }
.cell-user { display: flex; align-items: center; gap: 11px; }
.cell-avatar {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--ink); font-weight: 700; font-size: 12px;
}
.cell-user .meta { display: flex; flex-direction: column; gap: 1px; }
.cell-user .meta .nm { font-weight: 600; }
.cell-user .meta .em { font-size: 12px; color: var(--ink-muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ============================================================
   BANNERS
   ============================================================ */
.banner {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px; border-radius: 11px; margin-bottom: 22px;
  border: 1px solid; font-size: 13.5px;
  transition: opacity .4s ease, transform .4s ease;
}
/* auto-dismiss (driven by auth.js [data-autodismiss]) */
.banner.is-dismissing { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.banner .ico { width: 20px; height: 20px; flex: none; }
.banner .grow { flex: 1; }
.banner strong { font-weight: 700; }
.banner-alert { background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 38%, transparent); color: var(--ink); }
.banner-alert .ico { color: var(--red); }
.banner-info { background: var(--pending-bg); border-color: color-mix(in srgb, var(--pending) 35%, transparent); color: var(--ink); }
.banner-info .ico { color: var(--pending); }

/* segmented (read-only banner etc) */
.callout {
  display: flex; gap: 12px; padding: 13px 15px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; color: var(--ink-2); align-items: flex-start;
}
.callout .ico { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--ink-muted); }
.callout strong { color: var(--ink); }

.divider { height: 1px; background: var(--border); margin: 24px 0; border: 0; }
.muted { color: var(--ink-muted); }
.mono { font-family: 'IBM Plex Mono', monospace; }
