/* ============================================================================
 * components.css — the one standard every page shares, loaded after tokens.css:
 * base elements, page chrome (headers, titles), buttons, tables, tabs, cards,
 * forms, badges, modals, toasts, empty/loading states and the .ui-* helpers.
 * A rule that only one page needs goes in that page's own sheet instead.
 * ========================================================================== */
@layer app {
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

html, body { height: 100%; }

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.container {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}

.roster-section {
  padding: 0;
  overflow: hidden;
}

.roster-column {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.compact-table {
  width: 100%;
  border-collapse: collapse;
}

/* Drag affordances */
.dragging {
  opacity: 0.4;
  border: 2px dashed var(--accent);
}

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr; }
}

:root.theme-light body {
  background: var(--page-backdrop) !important;
}

/* ── Modals: center in main column (rail + drawer offset), sync with drawer toggle ── */
.modal,
.modal-overlay,
#claim-modal {
  left: calc(var(--shell-rail-w, 0px) + var(--shell-drawer-col, 0px)) !important;
  right: 0;
  width: auto !important;
  top: 0;
  bottom: 0;
  transition: left 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.pool-pts-badge {
  display: inline-block;
  min-width: 1.9rem;
  padding: 2px 8px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font);
  font-size: var(--fs-lg);
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

/* -------------------------------------------------------------
 * Global Cleanups
 * ------------------------------------------------------------- */
body {
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Standard panels/cards always use theme text — not inherited pool-brand colors */
.trade-card,
.control-panel,
.glass:not(.modal-content),
.stat-card,
.roster-card,
.empty-state,
.loading-state,
.data-table,
.modal-content {
  color: var(--text-primary);
}

.trade-card .asset-label,
.trade-card .empty-hint,
.empty-hint {
  color: var(--text-muted);
}

/* -------------------------------------------------------------
 * Shared selects (legacy top-nav chrome removed with the shell)
 * ------------------------------------------------------------- */
.league-select-nav {
  background: var(--bg-translucent-md);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text-primary);
}

.league-select-nav:hover {
  border-color: var(--accent);
  background: var(--bg-translucent-lg);
}

/* -------------------------------------------------------------
 * Shared page chrome — single source for titles, badges, headers.
 * Do not re-declare these in page stylesheets / page \3c style> blocks.
 * ------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6, .team-info h1, .page-header h1,
.draft-page-head h1, .trade-wizard__header h1 {
  font-family: var(--font);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-primary);
}

header:not(.trade-wizard__header), .page-header, .draft-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid var(--panel-border);
  background: transparent;
  box-shadow: none;
  padding: 40px 0 20px 0;
  margin-bottom: 32px;
}

.header-content {
  min-width: 0;
}

.page-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.team-info h1, .page-header h1, .draft-page-head h1, .trade-wizard__header h1 {
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  margin: 4px 0 0 0;
  line-height: 1.15;
}

.team-info p, .page-header p, .draft-page-head .team-info > p:first-child {
  color: var(--text-muted);
  font-size: var(--fs-base);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  margin-top: 0;
  margin-bottom: 0;
}

.page-header p + h1,
.team-info p + h1,
.team-info p + div {
  margin-top: 4px;
}

.header-badge {
  display: inline-block;
  background: var(--bg-translucent-md);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-size: var(--fs-micro);
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.gm-info {
  background: var(--bg-translucent-md);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 6px 12px;
  letter-spacing: var(--tracking-wide);
  border-radius: var(--radius-sm);
}

/* -------------------------------------------------------------
 * Dashboard Stats Grid & Cards
 * ------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

/* Cards: one surface for every panel. .card is the name to use in new markup; the
   older names share this definition until their markup moves over. */
.card,
.stat-card,
.control-panel,
.roster-section,
.data-section,
.standings-card,
.league-card {
  background: var(--surface);
  border: var(--panel-border-width, 1px) solid var(--panel-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
}

.card,
.stat-card,
.control-panel {
  padding: 20px;
}

.roster-section,
.data-section,
.standings-card {
  margin-bottom: 24px;
}

.league-card {
  background: var(--bg-translucent-sm);
  padding: 12px 20px;
}

.stat-card:hover,
.league-card:hover {
  border-color: var(--accent);
}

.stat-label {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  margin-bottom: 8px;
}

.stat-value {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--text-primary);
}

/* -------------------------------------------------------------
 * Filter bars, tabs, inputs — shared across every page
 * ------------------------------------------------------------- */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--panel-border);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  gap: 16px;
  margin-bottom: 24px;
}

.tab-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-translucent-sm);
  border: 1px solid var(--panel-border);
  padding: 4px;
  border-radius: var(--radius-sm);
}

/* The one tab row: .sub-tabs-container holding .sub-tab buttons or links (scrolls sideways on phones) */
.sub-tabs-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 8px;
}

.sub-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 6px 16px;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

.sub-tab:hover {
  color: var(--text-primary);
  background: var(--bg-translucent-md);
}

.sub-tab.active {
  background: var(--bg-translucent-lg);
  color: var(--text-primary);
}

a.sub-tab {
  text-decoration: none;
}

.search-box input {
  background: var(--bg);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
  padding: 8px 12px 8px 32px;
  font-size: var(--fs-base);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.search-box input:focus {
  border-color: var(--accent);
}

.select-group select {
  background: var(--bg);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
  padding: 8px 12px;
  font-size: var(--fs-base);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.select-group select:focus {
  border-color: var(--accent);
}

/* Option list must follow the theme too (white-on-white otherwise in light mode). */
.select-group select option,
.league-select-nav option {
  background: var(--surface);
  color: var(--text-primary);
}

/* -------------------------------------------------------------
 * Data Sections & Tables
 * ------------------------------------------------------------- */

.data-section h3 {
  font-size: var(--fs-base);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  color: var(--text-primary);
}

.data-table, .compact-table, .standings-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead, .compact-table thead, .standings-table thead {
  background: var(--surface-head);
}

.data-table th, .compact-table th, .standings-table th {
  font-size: var(--fs-micro);
  font-weight: 700;
  color: var(--text-muted);
  padding: 12px 12px;
  letter-spacing: var(--tracking-wide);
  border-bottom: 1px solid var(--panel-border);
  text-transform: uppercase;
  background: var(--surface-head);
}

.data-table td, .compact-table td, .standings-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--panel-border);
  font-size: var(--fs-base);
  font-weight: 400;
  color: var(--text-primary);
}

.compact-table th.col-live_pts,
.compact-table td.col-live_pts,
.data-table th.col-live_pts,
.data-table td.col-live_pts,
.standings-table th.col-live_pts,
.standings-table td.col-live_pts {
  color: var(--live-pts);
  font-weight: 800 !important;
  text-shadow: var(--live-pts-glow);
}

.data-table td:nth-child(n+3), 
.compact-table td:nth-child(n+3),
.standings-table td:nth-child(n+3),
.history-table td:nth-child(n+3),
.points-cell,
.stat-value,
.timer,
.rank-cell {
  font-family: var(--font);
  font-weight: 400;
}

.data-table tr:hover, .compact-table tr:hover, .standings-table tr:hover {
  background: var(--bg-translucent-hover);
}

.data-table tr:last-child td,
.compact-table tr:last-child td,
.standings-table tr:last-child td {
  border-bottom: none;
}

.player-name {
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--text-primary);
}

.player-pos {
  font-size: var(--fs-micro);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-translucent-md);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
  text-transform: uppercase;
}

.player-pos.pos-d {
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

.player-pos.pos-g {
  background: color-mix(in srgb, var(--ltir) 15%, transparent);
  color: var(--ltir);
  border-color: color-mix(in srgb, var(--ltir) 35%, transparent);
}

/* Badges: .badge is tinted with its status colour (--badge); add .badge--solid for a
   filled one. Status: --success, --warning, --danger, --ltir, --info, --accent. */
.badge {
  --badge: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--badge) 30%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--badge) 12%, transparent);
  /* The status colour pulled a fifth toward the text colour reads 4.5:1 on its own tint. */
  color: color-mix(in srgb, var(--badge) 80%, var(--text-primary));
  font-size: var(--fs-micro);
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
}

.badge--success { --badge: var(--success); }
.badge--warning { --badge: var(--warning); }
.badge--danger { --badge: var(--danger); }
.badge--ltir { --badge: var(--ltir); }
.badge--info { --badge: var(--accent-blue); }
.badge--accent { --badge: var(--accent); }
.badge--neutral { --badge: var(--text-primary); }

/* A badge that carries a value (a salary, a count): table-sized monospaced digits. */
.badge--data {
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: inherit;
}

.badge--solid {
  background: var(--badge);
  border-color: transparent;
  color: var(--on-status);
}

.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
  font-weight: 600;
  font-style: italic;
  background: var(--surface);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-base);
}

.empty-hint {
  color: var(--text-muted);
  font-style: italic;
  font-size: var(--fs-sm);
}

/* A value that opens details (a salary, a player's name): a real button, styled as the text. */
.cell-link-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
  cursor: pointer;
}

.cell-link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Team page chrome (roster board, home): section titles, cap chips, panels ──
   On a team-branded page (shell.css) these keep the theme's surface on the team colour. */
.pl-sechead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.pl-sechead h2 {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  margin: 0;
}

.pl-sechead__meta {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-shrink: 0;
}

.pl-sechead__caps {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}

.pl-sechead__caps .pl-capchip {
  width: 100%;
  justify-content: flex-start;
  box-sizing: border-box;
}

.pl-capchip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  padding: 6px 12px;
}

.pl-capchip b { color: var(--text-primary); font-weight: 800; }
.pl-capchip .sp { color: var(--success); }

/* Over an enforced cap: both the total and the "over by" label read as danger. */
:root .pl-capchip.is-over b,
:root .pl-capchip.is-over .sp {
  color: var(--danger) !important;
}

.pl-link {
  color: var(--accent-blue);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-decoration: none;
}

.pl-link:hover { text-decoration: underline; }

.pl-tier {
  background: var(--surface);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.pl-tier__head {
  background: var(--bg);
  padding: 12px 16px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

:root.theme-light .pl-tier__head {
  background: var(--surface);
}

.pl-tier__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
}

.pl-tier__dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.pl-tier__head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 768px) {
  .pl-sechead {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .pl-sechead__caps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
  }

  .pl-capchip {
    font-size: var(--fs-xs);
    line-height: 1.25;
    white-space: normal !important;
  }

  .pl-tier__head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .pl-tier__head-actions {
    flex-wrap: wrap;
  }
}

/* Tonight's points are coming in (standings, home): a dot that breathes while games are on. */
.live-indicator-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--live-pts);
  box-shadow: var(--live-pts-glow);
  animation: live-dot-pulse 2.4s ease-in-out infinite;
}

@keyframes live-dot-pulse {
  50% { opacity: 0.45; transform: scale(0.8); }
}

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

/* Buttons: .btn + one look (.btn-primary, .btn-secondary, .btn-danger) + one size (.btn-sm, .btn-xs) + .btn-block */
.btn {
  color: var(--text-primary);
  padding: 6px 16px;
  min-height: 34px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--fs-xs);
  letter-spacing: 0;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
  /* Without a look modifier a .btn is the secondary (outlined) button, never the browser's grey one. */
  background: transparent;
  border: 1px solid var(--panel-border);
  box-shadow: none;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  line-height: 1.2;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-sm {
  padding: 4px 12px;
  min-height: 28px;
  font-size: var(--fs-xs);
}

.btn-xs {
  padding: 2px 6px;
  min-height: 24px;
  font-size: var(--fs-micro);
}

.btn-block {
  width: 100%;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

/* A button waiting on the server: set aria-busy="true" while the request runs. */
.btn[aria-busy="true"] {
  cursor: progress;
  opacity: 0.7;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(0.9);
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-translucent-md);
  border-color: var(--btn-border-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: var(--on-status);
  border-color: transparent;
}

.btn-tint {
  --tint: var(--accent-blue);
  background: color-mix(in srgb, var(--tint) 12%, transparent);
  color: color-mix(in srgb, var(--tint) 80%, var(--text-primary));
  border-color: color-mix(in srgb, var(--tint) 35%, transparent);
}

.btn-tint:hover:not(:disabled) {
  background: color-mix(in srgb, var(--tint) 20%, transparent);
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(0.92);
}

/* Control Panel & Forms */
.control-panel input,
.control-panel select,
.control-panel textarea {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-base);
  width: 100%;
}

.control-panel input:focus,
.control-panel select:focus,
.control-panel textarea:focus {
  border-color: var(--accent);
}

/* Modals Overrides — always follow light/dark theme, never pool-branded table colors */
.modal,
.modal-overlay {
  background-color: rgba(0, 0, 0, 0.75) !important;
  -webkit-backdrop-filter: blur(5px) !important;
  backdrop-filter: blur(5px);
}

:root.theme-light .modal,
:root.theme-light .modal-overlay {
  background-color: rgba(15, 23, 42, 0.45) !important;
}

.modal .modal-content,
.modal-overlay .modal-content,
#claim-modal .modal-content {
  background-color: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--panel-border) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6) !important;
  border-radius: var(--radius-sm) !important;
  padding: 24px !important;
  max-width: 900px !important;
}

:root.theme-light .modal .modal-content,
:root.theme-light .modal-overlay .modal-content {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12) !important;
}

.modal .modal-content .data-table thead,
.modal .modal-content .data-table th {
  background: var(--surface-head) !important;
  color: var(--text-muted);
}

.modal .modal-content .data-table td {
  color: var(--text-primary) !important;
}

.modal .modal-header h2,
.modal .modal-header h3,
.modal .modal-body h4 {
  color: var(--text-primary) !important;
}

.close-modal {
  color: var(--text-muted);
  font-size: var(--fs-2xl) !important;
  top: 15px;
  right: 20px;
}

.close-modal:hover {
  color: var(--text-primary) !important;
  transform: none !important;
}

.modal-header {
  border-bottom: 1px solid var(--panel-border) !important;
  padding-bottom: 16px;
  margin-bottom: 20px !important;
}

.modal-body h4 {
  font-size: var(--fs-xs);
  font-weight: 700 !important;
  color: var(--text-muted);
  letter-spacing: var(--tracking-caps);
  margin-bottom: 12px !important;
}

/* -------------------------------------------------------------
 * Shared page utilities (formerly pages.css leftovers)
 * ------------------------------------------------------------- */
.search-box {
  flex: 1;
  min-width: 160px;
}

.search-box input {
  width: 100%;
}

.toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-weight: 700;
  font-size: var(--fs-base);
  box-shadow: var(--shadow-card);
  transition: opacity 0.3s, transform 0.3s;
  max-width: min(360px, 90vw);
}

.toast-success { border-color: var(--accent); }

.toast-warning { border-color: var(--warning); color: var(--warning); }

.toast-error { border-color: var(--danger); color: var(--danger); }

/* Modal shell layout — theme colors live in “Modals Overrides” above */
/* The one modal: .modal (overlay, centred when shown as flex) > .modal-content. */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  overflow: auto;
  padding: 20px;
  align-items: center;
  justify-content: center;
}

.modal-content {
  margin: 5% auto;
  width: 90%;
  position: relative;
}

/* A long read (career stats, contracts): 90% of the screen, scrolling inside. */
.modal-content--tall {
  height: 90vh;
  margin: auto;
  overflow-y: auto;
}

.close-modal {
  position: absolute;
  cursor: pointer;
  line-height: 1;
}

input.cash-inp,
input.no-spin {
  -moz-appearance: textfield;
  appearance: textfield;
}

input.cash-inp::-webkit-outer-spin-button,
input.cash-inp::-webkit-inner-spin-button,
input.no-spin::-webkit-outer-spin-button,
input.no-spin::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Footer Overrides */
footer {
  margin-top: 64px;
  background: var(--surface);
  padding: 40px 20px;
  border-top: 1px solid var(--panel-border);
  color: var(--text-muted);
  text-align: center;
}

/* -------------------------------------------------------------
 * Selection & Drag Highlights Overrides
 * ------------------------------------------------------------- */
::selection {
  background-color: var(--accent) !important;
  color: var(--on-accent) !important;
}

@keyframes pulse-valid-slot {
  from { background-color: rgba(16, 185, 129, 0.04); }
  to { background-color: rgba(16, 185, 129, 0.15); }
}

/* Collapsible Roster Columns Revamp */
.roster-grid {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  width: 100%;
}

@media (max-width: 1024px) {
  .roster-grid {
    flex-direction: column;
  }
}

/* A player marked on the trade block (available) or untradable, beside his name. */
.trade-status {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  vertical-align: middle;
}

.trade-status--available {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 14%, transparent);
}

.trade-status--untradable {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, transparent);
}

/* Sticky AHL and ECHL Columns */
#col-wrapper-ahl, #col-wrapper-echl {
  position: sticky;
  top: 100px;
  z-index: 10;
}

/* Injury indicator — red "personal_injury" Material Symbol shown to the left
   of an injured player's name in every table (see nameCellHtml / injuryIconHtml
   in common.js). Sized to sit inline with the name text. */
.injury-icon {
  color: var(--danger);
  font-size: inherit;
  vertical-align: -0.15em;
  margin-right: 4px;
  cursor: help;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'opsz' 20;
}

/* ── Game-time roster lock banner (views/partials/roster_lock_banner.ejs) ── */
.roster-lock-region {
  flex-shrink: 0; /* the roster board's .app-main.is-locked is a flex column */
}

.roster-lock-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 20px;
  padding: 12px 16px;
  background: var(--surface);
  border: var(--panel-border-width) solid var(--panel-border);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
}

.roster-lock-banner[hidden] { display: none; }

.roster-lock-banner__icon {
  flex-shrink: 0;
  color: var(--warning);
}

.roster-lock-banner__body {
  flex: 1;
  min-width: 0;
}

.roster-lock-banner__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-bottom: 4px;
}

.roster-lock-banner__title {
  font-family: var(--font);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.roster-lock-banner__reason {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  background: var(--bg-translucent-md);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.roster-lock-banner__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
}

/* Broadcast-style "on air" dot while games are being played. It pulses three
   times (under 5 s) when the banner appears, then holds, so nothing blinks for
   the whole evening. */
.roster-lock-banner[data-reason="GAMES_IN_PROGRESS"] .roster-lock-banner__dot {
  background: var(--danger);
  animation: roster-lock-live 1.6s ease-in-out 3;
}

@keyframes roster-lock-live {
  50% { opacity: 0.3; transform: scale(0.7); }
}

@media (prefers-reduced-motion: reduce) {
  .roster-lock-banner__dot { animation: none !important; }
}

.roster-lock-banner__message {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-base);
  line-height: 1.4;
}

.roster-lock-banner__link {
  flex-shrink: 0;
  color: var(--accent-blue);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.roster-lock-banner__link:hover,
.roster-lock-banner__link:focus-visible { text-decoration: underline; }

/* One keyboard focus ring for every control (review A P1). Mouse clicks don't
   show it; keyboard and switch users always do. */
:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* The main region is a tab stop only so keyboard users can scroll it; draw its
   ring inside so the viewport edge doesn't clip it. */
#app-main:focus-visible { outline-offset: -2px; }

@media (max-width: 768px) {
  .roster-lock-banner {
    flex-wrap: wrap;
    align-items: flex-start; /* the icon stays by the title when the text wraps */
    gap: 8px 12px;
    padding: 12px 12px;
  }

  /* Lines up under the text: 20px icon + 12px gap. */
  .roster-lock-banner__link {
    flex-basis: 100%;
    padding-left: 32px;
  }
}

/* In-app confirm (confirmDialog in common.js) */
.confirm-dialog {
  /* The base `* { margin: 0 }` would pin the modal to the top-left corner. */
  margin: auto;
  max-width: min(440px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
}

.confirm-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }

.confirm-dialog__message {
  margin: 0 0 20px;
  white-space: pre-line;
  line-height: 1.5;
}

.confirm-dialog__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 20px;
  font-size: var(--fs-base);
  font-weight: 600;
}

.confirm-dialog__field input,
.confirm-dialog__field select {
  padding: 8px 12px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-primary);
  font: inherit;
  font-weight: 400;
}

.confirm-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* -------------------------------------------------------------
 * Shared form / panel chrome (P3 — was repeated as inline styles)
 * ------------------------------------------------------------- */
.ui-field-label {
  display: block;
  font-size: var(--fs-micro);
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.ui-field-label--sm { font-size: var(--fs-xs); }

.ui-field-label--tight { margin-bottom: 8px; }

.ui-field-label--spaced { margin: 16px 0 6px; }

.ui-field-label--inline {
  display: inline;
  margin-bottom: 0;
}

.ui-section-title {
  font-size: var(--fs-base);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  border-bottom: 2px solid var(--panel-border);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.ui-section-title--compact { margin-bottom: 8px; }

.ui-section-title--accent {
  color: var(--accent-blue);
  border-bottom-color: var(--panel-border);
}

.ui-panel-title {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
}

.ui-panel-title--flush { margin: 0 0 6px; }

.ui-desc {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-bottom: 12px;
}

.ui-desc--sm { margin-bottom: 12px; }

.ui-desc--md { margin-bottom: 16px; }

.ui-desc--lg { margin-bottom: 16px; }

.ui-desc--xl { margin-bottom: 20px; }

.ui-muted {
  color: var(--text-muted);
  font-size: var(--fs-base);
}

.ui-col-label {
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ui-badge-compact {
  padding: 4px 8px;
  font-size: var(--fs-micro);
  font-weight: 700;
}

.ui-row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.ui-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ui-row--wrap {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.ui-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ui-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ui-card-head {
  background: var(--bg);
  padding: 16px 20px;
  border-bottom: 3px solid var(--accent);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ui-card-head--lg { padding: 20px 24px; }

.ui-card-head--solo {
  display: block;
  padding: 20px 24px;
}

.ui-card-head--accent { border-bottom-color: var(--accent-blue); }

.ui-card-head--warn { border-bottom-color: var(--warning); }

.ui-card-head--teal { border-bottom-color: var(--surface); }

.ui-hint-label {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ui-subhead {
  margin: 0;
  font-size: var(--fs-base);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
}

.ui-input {
  width: 100%;
  padding: 8px 12px;
  font-size: var(--fs-base);
}

.ui-input--sm {
  width: 100%;
  padding: 8px 12px;
  font-size: var(--fs-sm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: var(--bg-translucent-lg);
  color: var(--text-primary);
}

.ui-input--flex {
  flex: 1;
  padding: 6px 8px;
  font-size: var(--fs-base);
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: var(--bg);
  color: var(--text-primary);
}

.ui-stat-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 24px;
  width: 100%;
  max-width: none;
  margin-bottom: 20px;
  border: 1px solid var(--accent);
  flex-wrap: wrap;
}

.ui-row-gap {
  display: flex;
  gap: 8px;
}

.ui-select {
  padding: 12px;
  background: var(--bg);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
}

.ui-link-accent {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 900;
  border-bottom: 2px solid var(--accent);
}

.ui-panel-rule {
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.ui-search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--bg-card);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
}

@media (max-width: 768px) {
  /* Notification panel — full width above bottom nav */
  #notif-panel {
    left: 12px !important;
    right: 12px;
    width: auto !important;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    max-height: 50vh !important;
  }

  /* ---- Page gutters ----------------------------------------------------- */
  /* Horizontal inset lives on .app-main (5vw). Don't stack another gutter. */
  .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* ---- Headings --------------------------------------------------------- */
  header { margin-bottom: 24px !important; }

  .team-info h1,
  .page-header h1 { font-size: var(--fs-xl); }

  /* ---- Filter bars: wrap, full-width controls --------------------------- */
  .filter-bar {
    flex-wrap: wrap;
    padding: 12px !important;
    gap: 12px !important;
  }

  .filter-bar .search-box,
  .filter-bar input[type="text"],
  .filter-bar input[type="search"],
  .filter-bar select {
    flex: 1 1 100% !important;
    width: 100%;
    min-width: 0;
  }

  .select-group { flex-wrap: wrap; width: 100%; }

  /* ---- Tab strips: scroll horizontally ---------------------------------- */
  .tab-group, .sub-tabs-container {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    scrollbar-width: none;
  }

  .tab-group::-webkit-scrollbar,
  .sub-tabs-container::-webkit-scrollbar { display: none; }

  .sub-tab, .sub-tabs-container > * { flex: 0 0 auto !important; white-space: nowrap !important; }

  /* ---- Stat cards ------------------------------------------------------- */
  .stat-card.ui-stat-split {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .stat-card.ui-stat-split > div { width: 100%; flex-wrap: wrap; }

  /* ---- Multi-column layouts collapse ------------------------------------ */
  .inbox-layout, .trade-card-body, .hub-grid-2col, .filter-bar-grid, .ui-grid-2 { grid-template-columns: 1fr !important; }

  .roster-column { position: static; top: auto; }

  /* ---- Stats grid ------------------------------------------------------- */
  .stats-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* ============================================================================
 * Compact tables on mobile — tables stay tabular (one horizontal row per
 * player/record), but only the most important columns are shown; the rest are
 * fully hidden. No "one card per player". See [[mobile-css-convention]].
 *
 * Two hiding strategies, both pure-CSS:
 *   • Roster tables already class every cell `col-<field>` on both <th> and
 *     <td>, so we hide the non-essential ones by class — no markup changes.
 *   • Every other table opts in with class `mobile-compact` on the <table>;
 *     the columns to keep are marked `m-keep` on their <th> and <td>. This is
 *     robust even for tables whose columns change at runtime (e.g. the players
 *     hub skater/goalie toggle), since the keepers are tagged per rendered row.
 * Player names collapse to "F. Lastname" via the .pname-abbr / .pname-full
 * swap (markup produced by nameCellHtml() in common.js).
 * ========================================================================== */
/* Abbreviated name + the under-name salary line are desktop-hidden. */
.pname-abbr { display: none; }

@media (max-width: 768px) {
  /* Player name → initial + last name */
  .pname-full { display: none; }

  .pname-abbr { display: inline; }

  /* ---- GM dashboard roster (NHL/AHL/ECHL + simulator): columns are controlled
     by the Views picker on mobile too (applyColumnVisibility). GP, points, and
     live points stay visible, with Name and Action always on. No blanket hiding
     here — just tighten the cell padding so the set fits before horizontal scrolling. */
  .compact-table th,
  .compact-table td { padding: 12px 8px !important; }

  /* ---- Every other opted-in table: show only the m-keep columns. ---- */
  table.mobile-compact th,
  table.mobile-compact td { display: none; }

  table.mobile-compact th.m-keep,
  table.mobile-compact td.m-keep {
    display: table-cell !important;
    padding: 12px 8px !important;
  }

  /* Loading / empty-state rows span all columns — always keep them visible. */
  table.mobile-compact td[colspan] { display: table-cell !important; }

  /* Classement fits the screen: rank, logo, GM (two lines if the last name
     is compound), Pts/pool, Pts/live, 1J. Every data row is the same height. */
  .standings-card { overflow-x: hidden; }

  .standings-table { width: 100%; table-layout: fixed; }

  .standings-table th,
  .standings-table td { white-space: nowrap; }

  table.mobile-compact.standings-table th.m-keep,
  table.mobile-compact.standings-table td.m-keep {
    padding: 6px 4px !important;
    letter-spacing: 0;
    vertical-align: middle;
  }

  .standings-table tbody tr { height: 58px; }

  .standings-table tbody td { height: 58px; overflow: hidden; }

  .standings-table td.points-cell,
  .standings-table td.col-live_pts,
  .standings-table td.rank-cell,
  .standings-table tbody td.m-keep:last-child { text-align: center !important; }

  .standings-table td.m-keep > div { gap: 4px !important; min-width: 0; }

  .standings-table td.m-keep img { width: 31px !important; height: 31px !important; }
}

@media (max-width: 768px) {
  .modal,
  .modal-overlay,
  #claim-modal {
    left: 0 !important;
    right: 0;
  }
}

@media (max-width: 480px) {
  /* Full-screen modals on small phones. */
  .modal {
    padding: 0;
    top: 0;
    height: 100%;
  }

  .modal-content {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    padding: 16px;
    overflow-y: auto;
  }

  .team-info h1,
  .page-header h1 { font-size: var(--fs-xl); }
}

@media (max-width: 1024px) {
  /* ============================================================================
 * Roster columns stack at ≤1024px. The AHL/ECHL wrappers are sticky on the
 * desktop 3-column layout; once stacked that stickiness makes the ECHL column
 * ride over the rosters above it while scrolling. Force normal flow so the page
 * scrolls top-to-bottom (NHL → AHL → ECHL). See [[mobile-css-convention]].
 * ========================================================================== */
  #col-wrapper-ahl,
  #col-wrapper-echl {
    position: static !important;
    top: auto !important;
  }
}

@media (max-width: 768px) {
  /* ============================================================================
 * Move Player sheet — render as a bottom sheet on phones/small tablets instead
 * of the centered modal. ID + !important needed to beat the shared
 * .modal / .modal-content full-screen rules above. See [[mobile-css-convention]].
 * ========================================================================== */
  #move-sheet {
    top: 0;
    height: 100%;
    align-items: flex-end !important;
    padding: 0;
  }
}

/* Phones: iOS Safari zooms into any field under 16px when it gets focus. !important
   because this platform floor must beat every field's own size. */
@media (max-width: 768px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea {
    font-size: var(--fs-md) !important;
  }
}

/* Acquisition (claim) modal */
.modal-overlay { display: none; }
.drop-selector:focus { border-color: var(--accent); }

/* One-off sizes and colours that were inline styles. */
#claim-modal {
  background: rgba(0,0,0,0.8);
  z-index: 1000;
}

#fa-claim-blocked {
  background: rgba(248,113,113,0.12);
  border: 1px solid rgba(248,113,113,0.4);
}

#target-tier {
  border: 2px solid var(--text-muted);
}

#drop-player-select {
  border: 2px solid var(--text-muted);
}

#confirm-claim-btn {
  flex: 2;
}

/* Row Action Dropdown Menu Styling */
.action-dropdown-menu {
  background-color: var(--surface);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  padding: 6px 0;
}

.action-menu-item {
  appearance: none;
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  font-family: inherit;
  min-height: 44px;
  padding: 12px 20px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Hover and keyboard focus look the same; the text keeps its own color so it
   stays readable on the light theme too (review F). */
.action-menu-item:hover,
.action-menu-item:focus-visible {
  background-color: var(--bg-translucent-hover);
  outline-offset: -2px;
}

/* On/off items (menuitemcheckbox): the check sits at the end, so labels stay aligned. */
.action-menu-check {
  margin-left: auto;
  padding-left: 12px;
  color: var(--success);
  font-weight: 900;
}

.action-menu-divider {
  height: 1px;
  margin: 6px 0;
  background: var(--panel-border);
}

.action-menu-empty {
  padding: 12px 16px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-style: italic;
}

.action-menu-item.danger {
  color: var(--danger);
}

.action-menu-item.danger:hover,
.action-menu-item.danger:focus-visible {
  background-color: rgba(239, 68, 68, 0.15);
}

#row-action-menu {
  z-index: 3000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  min-width: 150px;
}

#scouting-modal {
  background: rgba(0,0,0,0.8);
  z-index: 2000;
}

  /* One-off sizes and colours that were inline styles in the page's script. */
  .teams-col-id {
    width: 60px;
  }

  .teams-col-narrow {
    width: 80px;
  }

  .cap-adjust-input {
    width: 110px;
  }

  .btn-plain-border {
    border-color: var(--panel-border);
  }

  .trade-sides {
    grid-template-columns: 1fr auto 1fr;
  }

  /* A traded pick's original owner: logo + GM, beside the pick (league log, home, trade wizard). */
  .pick-origin-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 600;
  }

  .pick-origin-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
  }

  .cash-input {
    width: 88px;
  }

  .cash-totals-row {
    border-top: 2px solid var(--panel-border);
  }

  .archive-pick-year {
    width: 90px;
  }

  .archive-pick-round {
    width: 110px;
  }

  .archive-retention-pct {
    width: 120px;
  }

  .trophy-row-grid {
    grid-template-columns: 1.2fr 1.4fr 100px;
  }

  .slot-buttons-cell {
    width: 3.4rem;
  }

  .slot-buttons {
    min-width: 2.8rem;
  }

  .roster-action-select {
    max-width: 9.5rem;
  }

  .retention-season-label {
    min-width: 64px;
  }

  .contract-expired-row {
    border-bottom: 1px solid color-mix(in srgb, var(--danger) 20%, transparent);
  }
}
