/*
 * Franchise Fantasy Football — design system
 * --------------------------------------------------
 * Single source of styling truth. Light theme on :root; dark theme overrides
 * under html[data-theme="dark"]. Every component across the app reads
 * from these tokens.
 */

:root {
  /* Surfaces */
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --border: #e2e6ee;

  /* Text */
  --text: #0a1424;
  --text-muted: #5b6676;
  --text-dim: #8592a4;

  /* Brand */
  --brand: #0b5ed7;
  --brand-dark: #0a2540;
  --accent: #f4c843;
  --accent-deep: #ec9f05;

  /* Semantic */
  --success: #0ea271;
  --warn: #e69a1f;
  --danger: #dc3545;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(10, 20, 40, 0.06);
  --shadow-md: 0 6px 16px rgba(10, 20, 40, 0.08);
  --shadow-lg: 0 16px 32px rgba(10, 20, 40, 0.12);

  /* Type scale */
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-md: 15px;
  --fs-lg: 18px;
  --fs-xl: 24px;
  --fs-2xl: 32px;
  --fs-hero: 48px;

  /* Geometry */
  --radius: 10px;
  --radius-hero: 14px;
  --radius-pill: 999px;

  /* Legacy aliases — kept so existing templates keep rendering. Eventually
     every reference should move to the newer names above. */
  --brand-accent: var(--accent);
  --ok: var(--success);
  --muted: var(--text-muted);
  --surface-alt: var(--bg);
}

html[data-theme="dark"] {
  --bg: #0b0f17;
  --surface: #141925;
  --surface-2: #1c2230;
  --border: #272e3e;

  --text: #e8ecf5;
  --text-muted: #a1acc0;
  --text-dim: #7a8599;

  --brand: #3d8bff;
  --accent: #f4c843;
  --accent-deep: #ffda5a;
  --success: #10b981;
  --warn: #fbbf24;
  --danger: #f87171;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 18px 36px rgba(0, 0, 0, 0.65);
}

body {
  background: var(--surface-alt);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
}
.navbar {
  background: var(--brand-dark) !important;
  box-shadow: 0 2px 6px rgba(10, 37, 64, 0.12);
}
.navbar-brand {
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.navbar-brand .brand-mark {
  background: var(--brand-accent);
  color: var(--brand-dark);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.8em;
  font-weight: 800;
}
/* When the navbar shows a league logo + name, keep them on a shared baseline. */
.navbar-brand--league {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
}
.navbar-brand .navbar-league-logo {
  height: 32px;
  width: 32px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
  vertical-align: middle;
}
.navbar-brand .navbar-league-name {
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  vertical-align: middle;
}
.nav-link { font-weight: 500; opacity: .85; }
.nav-link.active, .nav-link:hover { opacity: 1; }
.nav-link.active { color: var(--brand-accent) !important; }
.navbar .dropdown-toggle.active { background: rgba(255,255,255,0.06); border-radius: 6px; }
.navbar .dropdown-menu {
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  min-width: 220px;
}
.navbar .dropdown-menu .dropdown-header {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.55);
}
.navbar .dropdown-item .bi { margin-right: 6px; width: 16px; display: inline-block; text-align: center; }
.navbar .dropdown-item-text { line-height: 1.3; }

/* Mobile bottom nav — visible only < lg */
.mobile-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--brand-dark);
  display: flex; justify-content: space-around; align-items: stretch;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom)) 0;
  z-index: 1030;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.25);
  border-top: 1px solid rgba(255,255,255,0.08);
}
.mobile-bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  color: rgba(255,255,255,.6); font-size: .7rem; font-weight: 600;
  padding: 6px 2px; text-decoration: none; gap: 2px;
}
.mobile-bottom-nav a i { font-size: 1.25rem; }
.mobile-bottom-nav a.active { color: var(--brand-accent); }
.mobile-bottom-nav a:hover { color: var(--surface); }
@media (max-width: 991.98px) {
  main.container-xxl { padding-bottom: 80px !important; }
}

/* Floating toast stack */
.toast-stack {
  position: fixed; top: 76px; right: 20px; z-index: 1040;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
  pointer-events: none;
}
.toast-item {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  font-size: 14px;
  animation: toast-in .25s ease;
}
.toast-item i { font-size: 18px; flex: 0 0 auto; }
.toast-item span { flex: 1; }
.toast-item.toast-success { border-left: 4px solid var(--ok); }
.toast-item.toast-success i { color: var(--ok); }
.toast-item.toast-info { border-left: 4px solid var(--brand); }
.toast-item.toast-info i { color: var(--brand); }
.toast-item.toast-warning { border-left: 4px solid var(--warn); }
.toast-item.toast-warning i { color: var(--warn); }
.toast-item.toast-error { border-left: 4px solid var(--danger); }
.toast-item.toast-error i { color: var(--danger); }
.toast-item .toast-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 20px; line-height: 1; padding: 0 4px; cursor: pointer;
}
.toast-item .toast-close:hover { color: #000; }
.toast-exit { animation: toast-out .25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* Polish: soft fade-in on main content */
main.container-xxl { animation: content-fade-in .2s ease; }
@keyframes content-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Polish: card hover lift */
.card { transition: transform .15s ease, box-shadow .15s ease; }
.card:hover { box-shadow: 0 6px 20px rgba(10, 37, 64, 0.08); }

/* Polish: global form control styling for consistency */
.form-control, .form-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 94, 215, 0.12);
}
.form-label { color: var(--text); font-weight: 600; font-size: 13px; }
.input-group-text { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }

/* Polish: button refinement */
.btn { font-weight: 600; border-radius: 8px; transition: transform .08s ease, box-shadow .12s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); }

/* Login CTA: high-contrast accent fill — visible on any navbar background
   (default dark navy, custom league primary, or whatever the commish chose). */
.btn-login-cta {
  background: var(--accent);
  color: #0a2540;
  border: 1px solid var(--accent);
  font-weight: 700;
}
.btn-login-cta:hover,
.btn-login-cta:focus {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #0a2540;
}
.btn-primary:hover { background: #0a4fb6; border-color: #0a4fb6; }

/* Polish: sticky table header on tall lists */
.table thead th { background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
/* But not inside cards with their own sticky header */
.card > .table-responsive .table thead th { position: static; }

/* Refined base table: uppercase header labels, tighter row dividers,
   hover highlight. Applies to every Bootstrap .table on the site. */
.table {
  color: var(--text);
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
}
.table > thead > tr > th {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.table > tbody > tr { border-color: var(--border); }
.table > tbody > tr:hover { background: var(--surface-2); }
.table > tbody > td, .table > tbody > tr > td { border-color: var(--border); }

/* Polish: link emphasis */
a { color: var(--brand); text-decoration: none; }
a:hover { color: #0a4fb6; text-decoration: underline; }

h1, h2, h3, h4, h5 { letter-spacing: -0.015em; font-weight: 700; }

/* Base .card refined to match the v2 vocabulary — applies to every Bootstrap
   card on the site without touching templates. */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  color: var(--text);
}
.card-header {
  background: transparent !important;
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
  color: var(--text);
  font-weight: 600;
}
.card-body { color: var(--text); padding: 16px 18px; }
.card-footer {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.card-hero {
  /* Tighter dark gradient (deep navy → slightly lighter navy) so white text
     stays high-contrast across the whole card — the previous gradient ran
     all the way to bright blue and washed out headlines on the right side. */
  background: linear-gradient(135deg, #06182d 0%, #0e2e52 60%, #122c52 100%);
  color: #fff;
  border: none;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.card-hero::before {
  /* Thin accent rail along the left edge for branding pop. */
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent);
}
/* Force white headings/text inside the hero — overrides Bootstrap's
   default heading-color cascade so the team name never inherits the
   default near-black. */
.card-hero h1, .card-hero h2, .card-hero h3,
.card-hero .hero-team-name {
  color: #fff !important;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.card-hero .hero-team-name {
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
}
.card-hero .hero-eyebrow {
  color: var(--accent);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 4px;
}
.card-hero .hero-gm {
  color: rgba(255,255,255,0.75);
  font-size: .9rem;
  margin-top: 2px;
}
.card-hero .stat-label { font-size: .72rem; color: rgba(255,255,255,0.7); text-transform: uppercase; letter-spacing: .12em; }
.card-hero .stat-value { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.card-hero .stat-value.stat-value--accent { color: var(--accent); }
.card-hero .team-logo-hero {
  border: 2px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
}

/* .stat-card refined — matches .stat-tile look so existing dashboards
   automatically upgrade. */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.stat-card:hover {
  border-color: color-mix(in srgb, var(--brand) 20%, var(--border));
}
.stat-card .label {
  font-size: var(--fs-xs);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
}
.stat-card .value {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.pos-badge {
  display: inline-block;
  min-width: 36px; text-align: center;
  padding: 2px 8px; border-radius: 6px;
  font-weight: 700; font-size: .75rem; letter-spacing: .04em;
  color: var(--surface);
}
.pos-QB { background: #0d6efd; }
.pos-RB { background: #198754; }
.pos-WR { background: #dc3545; }
.pos-TE { background: #6f42c1; }
.pos-K  { background: var(--text-muted); }
.pos-DEF { background: #343a40; }

.badge-injury { font-size: .7rem; padding: 3px 7px; border-radius: 4px; }
.badge-injury-Out, .badge-injury-IR { background: var(--danger); color: var(--surface); }
.badge-injury-Questionable, .badge-injury-Doubtful { background: var(--warn); color: var(--text); }
.badge-injury-Healthy { display: none; }

.trend-arrow { font-size: .75rem; padding: 2px 6px; border-radius: 4px; }
.trend-ADD { background: #d1f2e1; color: #126c3b; }
.trend-DROP { background: #f0d6d6; color: #8a1e24; }

.cap-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.cap-bar > div { height: 100%; background: var(--brand); transition: width .3s ease; }
.cap-bar.full > div { background: var(--danger); }
.cap-bar.high > div { background: var(--warn); }
.cap-bar.projected { height: 6px; background: #fff1c7; }
.cap-bar.projected > div { background: #8a6d00; }
.cap-bar.projected.high > div { background: var(--warn); }
.cap-bar.projected.full > div { background: var(--danger); }

.re-sign-cost {
  font-size: .72rem; color: #8a6d00; font-weight: 700;
  background: #fff7d6; padding: 1px 6px; border-radius: 4px;
  margin-left: 2px;
}
.ext-chip {
  font-size: .7rem; color: #0b5ed7; font-weight: 600;
  background: #e6edfa; padding: 1px 6px; border-radius: 4px;
}
.tag-chip {
  font-size: .7rem; color: #6f42c1; font-weight: 600;
  background: #efe6fa; padding: 1px 6px; border-radius: 4px;
}
.release-cost {
  font-size: .8rem; color: var(--danger); font-weight: 600;
}
.release-free {
  font-size: .8rem; color: var(--ok); font-weight: 600;
}

/* === Per-row Actions column (Tag / Extend / Intent / Drop) ===
   Borderless ghost icon buttons. At rest: muted gray icon, no chrome —
   the row reads as a clean strip. On hover: a soft semantic pill slides
   in behind the icon. Disabled actions are not rendered at all, so each
   row shows only the affordances it can act on. */
.row-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  gap: 2px;
  justify-content: flex-end;
}
.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #9ca3af;
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .12s ease;
}
.row-action:focus { outline: none; }
.row-action:focus-visible {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, .35);
}
.row-action:hover:not(.is-muted):not(:disabled) { transform: scale(1.05); }

/* Disabled / unavailable slot — keeps the column aligned without shouting. */
.row-action.is-muted,
.row-action:disabled {
  opacity: .25;
  cursor: not-allowed;
  background: transparent !important;
  color: #9ca3af !important;
}
.row-action.is-muted:hover { transform: none; background: transparent !important; }

/* Per-action hover palettes. Soft tinted background + semantic icon color. */
.row-action--tag:hover     { background: #fef3c7; color: #b45309; }
.row-action--extend:hover  { background: #dcfce7; color: #15803d; }
.row-action--intent:hover  { background: #dbeafe; color: #1d4ed8; }
.row-action--edit:hover    { background: #ede9fe; color: #6d28d9; }
.row-action--drop:hover    { background: #fee2e2; color: #b91c1c; }

/* "Set" state for Intent — persistent amber pill so the row signals
   "this contract has a plan" at a glance. */
.row-action--intent.is-set {
  background: #fef3c7;
  color: #b45309;
}
.row-action--intent.is-set:hover { background: #fde68a; }

/* Dropdown toggle wrapper sits inline-flex with siblings without extra space. */
.row-actions .dropdown { display: inline-flex; }
/* Strip Bootstrap's default caret on our tag dropdown. */
.row-actions .dropdown-toggle::after { display: none; }

/* Dark-mode friendly defaults (when the theme adds [data-theme="dark"]). */
[data-theme="dark"] .row-action {
  color: #94a3b8;
}
[data-theme="dark"] .row-action--tag:hover    { background: rgba(180, 83,   9, .18); color: #fbbf24; }
[data-theme="dark"] .row-action--extend:hover { background: rgba(21,  128, 61, .18); color: #4ade80; }
[data-theme="dark"] .row-action--intent:hover { background: rgba(29,  78,216, .18); color: #60a5fa; }
[data-theme="dark"] .row-action--drop:hover   { background: rgba(185, 28, 28, .18); color: #f87171; }
[data-theme="dark"] .row-action--intent.is-set { background: rgba(180, 83, 9, .25); color: #fbbf24; }

/* Inline contract-edit row (expands under a roster row when commish clicks pencil). */
.roster-table tr.contract-edit-row > td {
  background: var(--surface-2, #f8fafc);
  border-top: 2px solid var(--brand, #4f46e5);
  padding: 14px 16px !important;
}
.roster-table tr.contract-edit-row > td:hover { background: var(--surface-2, #f8fafc); }
.contract-edit-form .form-label { font-size: .68rem; letter-spacing: .04em; }
.contract-edit-years input,
.contract-edit-years select { font-size: .8rem; }
.contract-edit-years thead th {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}

/* === Unified roster table === */
.roster-table { table-layout: fixed; font-size: .86rem; }
.roster-table th, .roster-table td {
  padding: .3rem .45rem;
  vertical-align: middle;
  overflow: hidden; text-overflow: ellipsis;
}
.roster-head th {
  /* No sticky: sticky thead was overlapping the first player row when
     scrolled. Short compact rows + sortable headers make this unnecessary. */
  background: var(--surface-2);
  font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600;
  border-bottom: 2px solid var(--border) !important;
  white-space: nowrap;
}
.roster-table tbody tr:hover td { background: var(--surface-2); }
.roster-table td.salary-cell { font-variant-numeric: tabular-nums; }

/* Section divider rows. No sticky — stacking multiple sticky sections
   was hiding player rows beneath them. Thead remains sticky. */
.roster-table tr.section-row td {
  background: #0a2540;
  color: var(--surface);
  padding: .4rem .75rem !important;
}
.roster-table tr.section-row .section-head {
  display: flex; align-items: center; gap: .5rem;
}
.roster-table tr.section-row .section-icon { opacity: .6; }
.roster-table tr.section-row .section-label {
  font-weight: 700; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .08em;
}
.roster-table tr.section-row .section-count {
  background: rgba(255,255,255,.2); color: var(--surface);
  padding: 1px 8px; border-radius: 10px; font-size: .7rem;
  margin-left: .25rem;
}
.roster-table tr.section-row .section-total {
  margin-left: auto;
  font-weight: 700; font-family: inherit;
  font-size: .78rem; opacity: .9;
}
.roster-table tr.section-retained td { background: #6f42c1; }
.roster-table tr.section-ir td { background: #a23636; }
.roster-table tr.section-taxi td { background: var(--text-muted); }

/* Player cell secondary row */
.roster-sub {
  display: flex; align-items: center; gap: 6px;
  font-size: .7rem; line-height: 1; margin-top: 2px;
}
.roster-sub .pos-badge {
  font-size: .58rem; padding: 1px 5px; min-width: 22px;
}

/* Compact chips inside status-stack */
.status-stack {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
}
.status-stack .status-chip { font-size: .68rem; padding: 1px 6px; }
.status-stack .re-sign-cost,
.status-stack .ext-chip,
.status-stack .tag-chip { font-size: .62rem; padding: 0 5px; }
.intent-cell { padding: 2px 5px; }
.intent-tag { font-size: .55rem; }

/* Taxi rows lighter */
.roster-table tr.taxi-row td { color: var(--muted); font-style: italic; }
.roster-table tr.taxi-row td:first-child a { color: var(--muted) !important; }

/* Team logos (from Sleeper) */
.team-logo-sm, .team-logo-md, .team-logo-hero {
  object-fit: cover; border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.team-logo-sm   { width: 24px;  height: 24px; }
.team-logo-md   { width: 36px;  height: 36px; }
.team-logo-hero { width: 64px;  height: 64px; border-radius: 10px; }

/* Player headshots (Sleeper CDN) */
.player-headshot-xs, .player-headshot-sm, .player-headshot-hero {
  object-fit: cover; object-position: top;
  background: var(--surface-2); border-radius: 50%;
  flex-shrink: 0;
}
.player-headshot-xs   { width: 28px; height: 28px; }
.player-headshot-sm   { width: 40px; height: 40px; }
.player-headshot-hero { width: 96px; height: 96px; border-radius: 12px; border: 2px solid var(--border); }

/* NFL team logos (Sleeper CDN) */
.nfl-logo-xs  { width: 20px; height: 20px; object-fit: contain; }
.nfl-logo-sm  { width: 28px; height: 28px; object-fit: contain; }

/* Compact the player cell when headshot is present */
.roster-table .roster-player-name { min-width: 0; flex: 1; }

/* Pick chips (v2, richer) */
.pick-chip-v2 {
  display: inline-flex; align-items: stretch; overflow: hidden;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); font-size: .85rem;
  min-width: 170px;
}
.pick-chip-v2.pick-acquired { background: #fff7d6; border-color: #f4c843; }
.pick-chip-v2.pick-owed { background: #fff0f0; border-color: #e8a5a5; opacity: .85; }
.pick-chip-v2 .pick-label {
  flex: 1; padding: 6px 10px;
  display: flex; flex-direction: column;
}
.pick-chip-v2 .pick-via,
.pick-chip-v2 .pick-native { font-size: .68rem; color: var(--muted); }
.pick-chip-v2 .pick-value {
  padding: 6px 10px;
  background: rgba(0,0,0,.04);
  display: flex; align-items: center;
  font-weight: 700; font-size: .85rem;
  color: var(--brand);
}
.pick-chip-v2.pick-owed .pick-value { color: var(--danger); }

/* Legacy pick chip class still used elsewhere */
.pick-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: 5px 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
  font-size: .85rem;
}
.pick-chip.pick-acquired {
  background: #fff7d6; border-color: #f4c843;
}

/* === Trade Finder redesign === */
.trade-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
}
@media (max-width: 991px) { .trade-layout { grid-template-columns: 1fr; } }

.trade-sidebar .card { border-radius: 12px; }
.trade-sidebar .accordion-button:not(.collapsed) { background: #e9f0ff; color: var(--brand); }
.trade-sidebar .accordion-button::after { transform: scale(.8); }
.trade-sidebar .accordion-button:focus { box-shadow: none; }

.tf-card {
  display: flex; position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px rgba(10,37,64,0.04);
}
.tf-card-left-rail {
  width: 6px; flex-shrink: 0;
  background: #9fb3c8;  /* balanced default */
}
.tf-card.edge-green .tf-card-left-rail { background: #198754; }
.tf-card.edge-red .tf-card-left-rail   { background: #dc3545; }
.tf-card.edge-balanced .tf-card-left-rail { background: #0d6efd; }
.tf-card-body { flex: 1; padding: 1rem 1.25rem; }
.tf-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.75rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border);
}
.tf-num { font-size: 1.05rem; color: var(--muted); }
.fairness-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: .7rem; font-weight: 600; background: var(--surface-2); color: var(--muted);
}
.edge-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: .7rem; font-weight: 700; background: #e9f0ff; color: var(--brand);
}
.edge-badge.edge-pos { background: #d1f2e1; color: #126c3b; }
.edge-badge.edge-neg { background: #f0d6d6; color: #8a1e24; }
.score-pill {
  background: #198754; color: var(--surface); padding: 5px 14px;
  border-radius: 20px; font-weight: 700; font-size: .85rem;
}

.tf-legs {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.tf-leg {
  background: var(--surface-2); border-radius: 8px; padding: .75rem;
  border: 1px solid var(--border);
}
.tf-leg-head {
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .25rem;
}
.tf-team { font-weight: 600; font-size: .88rem; }
.tf-delta { font-weight: 700; font-size: .95rem; }
.d-pos { color: var(--ok); }
.d-neg { color: var(--danger); }
.tf-cap { margin-bottom: .5rem; }
.tf-direction { margin-top: .5rem; margin-bottom: .25rem; }
.tf-arrow { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.tf-chips { display: flex; flex-wrap: wrap; gap: 4px; }

.tfc {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; font-size: .8rem;
  cursor: help;
}
.tfc:hover { border-color: var(--brand); }
.tfc-pos { min-width: 26px; font-size: .6rem; padding: 1px 4px; }
.tfc-name { font-weight: 600; }
.tfc-cap { color: var(--muted); font-weight: 500; }
.tfc-icon { font-size: .75rem; }
.tfc-retained { background: #fff7d6; border-color: #f4c843; }
.tfc-pick { background: #f3e9ff; border-color: #b893e0; }
.tfc-retain-badge {
  font-size: .65rem; font-weight: 700;
  color: #8a6d00; background: #fff1c7;
  padding: 1px 5px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: .04em;
}
.retain-pill {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  background: #fff7d6; color: #8a6d00;
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}

.value-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.value-bar > div { height: 100%; background: linear-gradient(90deg, #28a745, #0d6efd); }

.table { background: var(--surface); }
.table thead { background: var(--surface-2); }
.table thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border) !important;
}
.table tbody td { vertical-align: middle; }
.sortable thead th { cursor: pointer; user-select: none; }
.sortable thead th.sort-asc::after { content: " ▲"; color: var(--brand); font-size: .6rem; }
.sortable thead th.sort-desc::after { content: " ▼"; color: var(--brand); font-size: .6rem; }

.my-team { background: linear-gradient(90deg, #fff7d6 0%, #fffdf5 100%) !important; }
.my-team td:first-child { border-left: 3px solid var(--brand-accent); }

.taxi-row td { color: var(--muted); font-style: italic; }

.trade-card {
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  margin-bottom: 1rem; overflow: hidden;
}
.trade-card .trade-header {
  background: linear-gradient(90deg, var(--bg) 0%, var(--surface) 100%);
  padding: .75rem 1rem; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.trade-card .score-pill {
  background: var(--ok); color: var(--surface); padding: 4px 12px;
  border-radius: 20px; font-weight: 700; font-size: .85rem;
}
.trade-leg {
  padding: 1rem; border-right: 1px solid var(--border);
}
.trade-leg:last-child { border-right: none; }
.trade-leg .leg-team { font-weight: 600; font-size: .9rem; }
.trade-leg .leg-delta { font-size: .8rem; }
.trade-leg .delta-pos { color: var(--ok); }
.trade-leg .delta-neg { color: var(--danger); }
.trade-leg .player-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: 4px 8px; margin: 3px 3px 0 0;
  background: var(--surface-2); border-radius: 6px; font-size: .82rem;
}
.trade-leg .arrow-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: .5rem; }

.intent-cell {
  display: inline-flex; flex-direction: column; align-items: flex-end; gap: 0;
  background: #fff7d6; padding: 2px 8px; border-radius: 6px;
  border: 1px solid #f4c843;
}
.intent-tag {
  font-size: .62rem; color: #8a6d00; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 700;
}
.intent-tag .bi { font-size: .6rem; }

.status-chip {
  font-size: .72rem; color: var(--muted);
  padding: 2px 8px; background: var(--surface-2); border-radius: 10px;
}
/* Per-status color variants. UFA / UFA-TAG keep their established colors;
   FRANCHISE switches to yellow and RFA-TAG to lime green so the committed
   tags are visually distinct from the planning markers. */
.status-chip--ufa       { background: #dc3545; color: #fff; }
.status-chip--ufa-tag   { background: #0dcaf0; color: #000; }
.status-chip--franchise { background: #facc15; color: #000; }
.status-chip--rfa-tag   { background: #a3e635; color: #000; }
.status-chip--rookie    { background: #ffc107; color: #000; }

.intent-btn { white-space: nowrap; }

.tier-badge {
  display: inline-block; padding: 3px 10px; border-radius: 4px;
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.tier-CRUNCH { background: #dc3545; color: var(--surface); }
.tier-TIGHT { background: #f0ad4e; color: var(--text); }
.tier-HEALTHY { background: #d1f2e1; color: #126c3b; }

.target-card.target-CRUNCH { border-left: 4px solid #dc3545; }
.target-card.target-TIGHT { border-left: 4px solid #f0ad4e; }
.target-card.target-HEALTHY { border-left: 4px solid #d1f2e1; opacity: .85; }

.player-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: 4px 8px; margin: 3px 3px 0 0;
  background: var(--surface-2); border-radius: 6px; font-size: .82rem;
}
a.player-chip:hover { background: #e3e9f5; }

footer {
  color: var(--muted); font-size: .8rem;
  padding: 2rem 0 1rem; text-align: center;
}

/* --- Global command palette --- */

  .global-palette[hidden] { display: none !important; }
  .global-palette {
    position: fixed; inset: 0; z-index: 1050;
    display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh;
  }
  .global-palette-backdrop { position: absolute; inset: 0; background: rgba(10, 20, 40, 0.5); backdrop-filter: blur(4px); }
  .global-palette-panel {
    position: relative; width: min(560px, 92vw); max-height: 70vh;
    background: var(--surface); border-radius: 12px; overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    display: flex; flex-direction: column;
  }
  .global-palette-input-row {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
  }
  .global-palette-input-row i { color: var(--muted); font-size: 17px; }
  .global-palette-input-row input {
    flex: 1; border: none; outline: none; font-size: 15px; padding: 0; background: transparent;
  }
  .global-palette-input-row kbd {
    background: var(--bg); border: 1px solid var(--border); color: var(--muted);
    font-size: 10.5px; padding: 2px 6px; border-radius: 4px;
  }
  #global-palette-results {
    list-style: none; padding: 4px 0; margin: 0; overflow-y: auto; flex: 1;
  }
  #global-palette-results li {
    padding: 10px 16px; display: flex; align-items: center; gap: 10px;
    cursor: pointer; font-size: 14px; border-left: 3px solid transparent;
  }
  #global-palette-results li i { color: var(--brand); font-size: 15px; width: 20px; }
  #global-palette-results li .group {
    margin-left: auto; font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase;
    color: var(--muted); padding: 2px 8px; background: var(--bg); border-radius: 999px;
  }
  #global-palette-results li:hover, #global-palette-results li.is-active {
    background: var(--bg); border-left-color: var(--brand);
  }
  #global-palette-results .empty { padding: 24px 16px; text-align: center; color: var(--muted); }
  .global-palette-footer {
    display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--border);
    color: var(--muted); font-size: 11.5px; background: var(--surface-2);
  }
  .global-palette-footer kbd {
    background: var(--surface); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px;
    font-size: 10.5px;
  }

/* =====================================================================
 * THEME TOGGLE BUTTON
 * ===================================================================== */
.theme-toggle {
  background: transparent;
  border: 0;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
}
.theme-toggle:hover { color: #fff; }
.theme-toggle .theme-icon-light,
.theme-toggle .theme-icon-dark { display: none; }
html[data-theme="light"] .theme-toggle .theme-icon-dark { display: inline-block; }
html[data-theme="dark"] .theme-toggle .theme-icon-light { display: inline-block; }
html:not([data-theme="dark"]) .theme-toggle .theme-icon-dark { display: inline-block; }


/* =====================================================================
 * DARK THEME COMPONENT OVERRIDES
 * ===================================================================== */
html[data-theme="dark"] body {
  background: var(--bg);
  color: var(--text);
}

html[data-theme="dark"] .text-muted { color: var(--text-muted) !important; }
html[data-theme="dark"] .text-dark  { color: var(--text) !important; }
html[data-theme="dark"] .bg-white   { background-color: var(--surface) !important; }
html[data-theme="dark"] .bg-light   { background-color: var(--surface-2) !important; }

html[data-theme="dark"] .card {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] .card:hover { box-shadow: var(--shadow-md); }
html[data-theme="dark"] .card-header { background: var(--surface) !important; border-color: var(--border); color: var(--text); }
html[data-theme="dark"] .card-footer { background: var(--surface-2); border-color: var(--border); color: var(--text-muted); }
html[data-theme="dark"] .card-body   { color: var(--text); }
html[data-theme="dark"] .alert-light.border { background: var(--surface-2); border-color: var(--border) !important; color: var(--text-muted); }

html[data-theme="dark"] .table {
  color: var(--text);
  background: transparent;
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: color-mix(in srgb, var(--surface-2) 40%, transparent);
  --bs-table-striped-color: var(--text);
  --bs-table-hover-bg: var(--surface-2);
  --bs-table-hover-color: var(--text);
}
html[data-theme="dark"] .table thead,
html[data-theme="dark"] .table-light,
html[data-theme="dark"] thead.table-light { background: var(--surface-2) !important; color: var(--text-muted) !important; }
html[data-theme="dark"] .table thead th,
html[data-theme="dark"] .roster-table thead th,
html[data-theme="dark"] .roster-head th {
  background: var(--surface-2) !important;
  color: var(--text-muted) !important;
  border-color: var(--border);
}
html[data-theme="dark"] .table tbody tr { border-color: var(--border); }
html[data-theme="dark"] .table tbody td { border-color: var(--border); }
html[data-theme="dark"] .roster-table tbody tr:hover { background: var(--surface-2); }

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] input.form-control,
html[data-theme="dark"] textarea.form-control {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="dark"] .form-control::placeholder { color: var(--text-dim); }
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
  background: var(--surface);
  color: var(--text);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(61, 139, 255, 0.18);
}
html[data-theme="dark"] .form-label { color: var(--text-muted); }
html[data-theme="dark"] .form-text { color: var(--text-dim); }
html[data-theme="dark"] .input-group-text {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-muted);
}

html[data-theme="dark"] .btn-outline-secondary { color: var(--text-muted); border-color: var(--border); }
html[data-theme="dark"] .btn-outline-secondary:hover { background: var(--surface-2); color: var(--text); }
html[data-theme="dark"] .btn-outline-primary { color: var(--brand); border-color: var(--brand); }
html[data-theme="dark"] .btn-outline-primary:hover { background: var(--brand); color: #fff; }
html[data-theme="dark"] .btn-light { background: var(--surface-2); color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .btn-link { color: var(--brand); }

html[data-theme="dark"] .dropdown-menu {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  --bs-dropdown-color: var(--text);
  --bs-dropdown-link-color: var(--text);
  --bs-dropdown-link-hover-bg: var(--surface-2);
  --bs-dropdown-link-hover-color: var(--text);
}

html[data-theme="dark"] .badge.bg-warning.text-dark { color: #1a1203 !important; }

html[data-theme="dark"] .list-group {
  --bs-list-group-bg: var(--surface);
  --bs-list-group-color: var(--text);
  --bs-list-group-border-color: var(--border);
  --bs-list-group-action-hover-bg: var(--surface-2);
  --bs-list-group-action-hover-color: var(--text);
}
html[data-theme="dark"] .list-group-item { background: var(--surface); color: var(--text); border-color: var(--border); }

html[data-theme="dark"] .stat-card { background: var(--surface); border-color: var(--border); color: var(--text); }
html[data-theme="dark"] .stat-card .label { color: var(--text-muted); }
html[data-theme="dark"] .stat-card .value { color: var(--text); }
html[data-theme="dark"] .cap-bar { background: var(--surface-2); }
html[data-theme="dark"] code,
html[data-theme="dark"] pre code { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

html[data-theme="dark"] .toast-item { background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }

html[data-theme="dark"] .global-palette-panel { background: var(--surface); box-shadow: var(--shadow-lg); }
html[data-theme="dark"] .global-palette-input-row { border-color: var(--border); }
html[data-theme="dark"] .global-palette-input-row input { color: var(--text); }
html[data-theme="dark"] .global-palette-input-row kbd {
  background: var(--surface-2); border-color: var(--border); color: var(--text-muted);
}
html[data-theme="dark"] #global-palette-results li { color: var(--text); }
html[data-theme="dark"] #global-palette-results li:hover,
html[data-theme="dark"] #global-palette-results li.is-active { background: var(--surface-2); }
html[data-theme="dark"] #global-palette-results li .group { background: var(--surface-2); color: var(--text-muted); }
html[data-theme="dark"] .global-palette-footer { background: var(--surface); border-color: var(--border); color: var(--text-muted); }
html[data-theme="dark"] .global-palette-footer kbd { background: var(--surface-2); border-color: var(--border); color: var(--text-muted); }

html[data-theme="dark"] .section-row { background: var(--brand-dark); }

html[data-theme="dark"] .status-chip { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
html[data-theme="dark"] .pick-chip, html[data-theme="dark"] .pick-chip-v2 { background: var(--surface-2); border-color: var(--border); color: var(--text); }
html[data-theme="dark"] .pick-chip-v2 .pick-value { background: var(--brand-dark); color: var(--accent); }
html[data-theme="dark"] .pick-chip-v2.pick-acquired { background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); border-color: var(--accent); }
html[data-theme="dark"] .pick-chip-v2.pick-owed { background: color-mix(in srgb, var(--danger) 10%, var(--surface-2)); border-color: var(--danger); }

html[data-theme="dark"] .tf-card { background: var(--surface); border-color: var(--border); color: var(--text); }
html[data-theme="dark"] .tf-leg { background: var(--surface-2); }
html[data-theme="dark"] .tfc { background: var(--surface); border-color: var(--border); color: var(--text); }

html[data-theme="dark"] footer { color: var(--text-dim); }

/* =====================================================================
 * V2 COMPONENT SYSTEM
 * Introduces a refined, Sleeper-adjacent component vocabulary that sits
 * alongside the Bootstrap primitives. Use these classes on new UI and
 * wherever you want a more deliberate look than .card / .btn give you.
 *
 * All rules read from the tokens set in :root (light) and
 * html[data-theme="dark"] so they flip themes automatically.
 * ===================================================================== */

/* ---------- Eyebrow + section title ---------- */
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 8px;
}
.eyebrow--muted { color: var(--text-muted); }
.eyebrow--accent { color: var(--accent-deep); }

.section-title {
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 14px;
  line-height: 1.1;
  position: relative;
}
.section-title--accent::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  background: var(--accent);
  border-radius: 999px;
  margin-top: 10px;
}

/* ---------- Card v2 ---------- */
.card-v2 {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card-v2--hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--brand) 30%, var(--border));
}
.card-v2-head {
  padding: 16px 20px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.card-v2-head h3,
.card-v2-head h4 {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  font-size: var(--fs-lg);
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.card-v2-body { padding: 14px 20px 18px; color: var(--text); }
.card-v2-foot {
  padding: 12px 20px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.card-v2--elevated { box-shadow: var(--shadow-md); }
.card-v2--accent {
  border-top: 3px solid var(--accent);
}
.card-v2--brand {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  border-color: transparent;
}
.card-v2--brand .card-v2-head h3,
.card-v2--brand .card-v2-head h4,
.card-v2--brand .eyebrow { color: #fff; }

/* ---------- Stat tile ---------- */
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 92px;
  transition: border-color .15s ease;
}
.stat-tile:hover {
  border-color: color-mix(in srgb, var(--brand) 20%, var(--border));
}
.stat-tile-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.stat-tile-value {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-tile-value--accent { color: var(--accent-deep); }
.stat-tile-value--success { color: var(--success); }
.stat-tile-value--danger  { color: var(--danger); }
.stat-tile-sub {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: 500;
}
.stat-tile-sub .delta-up   { color: var(--success); }
.stat-tile-sub .delta-down { color: var(--danger); }

/* Inverted variant — dark on light, accent foreground (hero use) */
.stat-tile--dark {
  background: var(--brand-dark);
  border-color: transparent;
  color: #fff;
}
.stat-tile--dark .stat-tile-label { color: rgba(255,255,255,.6); }
.stat-tile--dark .stat-tile-value { color: var(--accent); }
.stat-tile--dark .stat-tile-sub   { color: rgba(255,255,255,.75); }

/* ---------- Chip ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .02em;
  border: 1px solid transparent;
}
.chip .bi { font-size: 12px; opacity: .85; }
.chip--accent  { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-deep); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.chip--brand   { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 22%, transparent); }
.chip--success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.chip--danger  { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.chip--warn    { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.chip--solid-dark {
  background: var(--brand-dark);
  color: #fff;
  border-color: transparent;
}

/* ---------- Sleek table ---------- */
.table-sleek {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  color: var(--text);
}
.table-sleek thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.table-sleek tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s ease;
}
.table-sleek tbody tr:hover { background: var(--surface-2); }
.table-sleek tbody td {
  padding: 12px;
  vertical-align: middle;
}
.table-sleek .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.table-sleek--zebra tbody tr:nth-child(odd) {
  background: color-mix(in srgb, var(--surface-2) 50%, transparent);
}
.table-sleek--dense tbody td { padding: 8px 10px; }

/* ---------- Buttons v2 ---------- */
.btn-primary-v2 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-dark);
  color: #fff;
  border: 1px solid transparent;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: var(--fs-sm);
  letter-spacing: .02em;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  cursor: pointer;
}
.btn-primary-v2:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background: color-mix(in srgb, var(--brand-dark) 85%, var(--brand));
  color: #fff;
}
.btn-primary-v2:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn-primary-v2--accent {
  background: var(--accent);
  color: var(--brand-dark);
}
.btn-primary-v2--accent:hover {
  background: var(--accent-deep);
  color: var(--brand-dark);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
  cursor: pointer;
}
.btn-ghost:hover {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--brand) 25%, var(--border));
  color: var(--text);
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text-muted);
}
.empty-state .empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 10%, var(--surface-2));
  color: var(--brand);
  font-size: 26px;
  margin-bottom: 14px;
}
.empty-state h3 {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
}
.empty-state p {
  margin: 0 0 14px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Divider ---------- */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
  border: 0;
}
.divider--accent {
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  height: 2px;
}

/* ---------- Refined navbar (applied via body class) ---------- */
body .navbar {
  min-height: 56px;
  padding-top: 6px;
  padding-bottom: 6px;
}
.navbar .navbar-brand {
  font-size: 18px;
  letter-spacing: -0.02em;
}
.navbar .navbar-brand .brand-mark {
  padding: 2px 7px;
  font-size: 0.72em;
  letter-spacing: .02em;
}
.navbar .navbar-nav > .nav-item > .nav-link {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  transition: background .15s ease, color .15s ease;
}
.navbar .navbar-nav > .nav-item > .nav-link:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
  opacity: 1;
}
.navbar .navbar-nav > .nav-item > .nav-link.active,
.navbar .navbar-nav > .nav-item > .dropdown-toggle.active {
  background: var(--accent);
  color: var(--brand-dark) !important;
  opacity: 1;
}
.navbar .navbar-nav > .nav-item > .nav-link.active::after,
.navbar .navbar-nav > .nav-item > .dropdown-toggle.active::after {
  filter: brightness(0);
}
.navbar .dropdown-menu {
  border-radius: 12px;
  padding: 8px;
}
.navbar .dropdown-menu .dropdown-item {
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
}
.navbar .dropdown-menu .dropdown-header {
  padding-left: 10px;
}

/* =====================================================================
 * AUTH SHELL — login / signup / password-change
 * Centered column, branded header, token-driven so both themes flip.
 * ===================================================================== */
.auth-shell {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px 80px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 440px;
  padding: 36px 32px 32px;
}
.auth-card--wide { max-width: 480px; }

.auth-hero {
  text-align: center;
  margin-bottom: 26px;
}
.auth-hero .auth-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: var(--accent);
  font-size: 26px;
  box-shadow: var(--shadow-md);
  margin-bottom: 14px;
}
.auth-hero h2 {
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: -0.015em;
  font-size: 1.45rem;
  color: var(--text);
}
.auth-tagline {
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 340px;
  margin: 0 auto;
}

.auth-form label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.auth-form .form-control,
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14.5px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-form .form-control:focus,
.auth-form input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}
.auth-form .form-text {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 4px;
}
.auth-form .field {
  margin-bottom: 14px;
}
.auth-form .field:last-of-type {
  margin-bottom: 18px;
}

.auth-submit {
  width: 100%;
  padding: 12px 18px;
  background: var(--brand-dark);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: .02em;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background: color-mix(in srgb, var(--brand-dark) 80%, var(--brand));
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 13px;
}
.auth-footer a { color: var(--brand); font-weight: 600; }
.auth-footer a:hover { color: var(--brand); text-decoration: underline; }

.auth-alert {
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.auth-alert--error {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
}

.auth-errors {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
}
