/* ==========================================
   U N I T Y ™ - Global Styles (v3.0)
   Architectural Design Guide Implementation
   ========================================== */

/* --- Design Tokens --- */
:root,
[data-theme="dark"] {
  /* Base palette */
  --color-void: #06080D;
  --color-surface: #11141D;
  --color-primary: #D90429;
  --color-accent: #E5B80B;
  --color-accent-text: #000000;
  --color-admin-bg: #191124;
  --color-admin-accent: #9D4EDD;
  --color-admin-glass: rgba(157, 78, 221, 0.2);
  --color-text-main: #F8F9FA;
  --color-text-muted: #8B949E;
  --color-glass: rgba(255, 255, 255, 0.05);
  --color-divider: rgba(255, 255, 255, 0.12);
  --color-lime: #2E8B57;
  --color-role-admin: #9D4EDD;
  --color-role-moderator: #1E40AF;
  --color-role-member: #0D9488;
  --color-role-sysadmin: #E5B80B;
  --color-accent-text: #E5B80B;

  /* Button system */
  --color-btn-muted-bg: #1A1E2C;
  --color-btn-muted-hover: #2A2E3E;

  /* Table system */
  --color-zebra-even: rgba(55, 55, 55, 0.6);
  --color-zebra-odd: rgba(0, 0, 0, 0.6);
  --color-table-header-bg: rgba(20, 20, 20, 0.8);
  --color-table-departed-bg: #0a0c10;
  --color-table-club-total-bg: rgba(217, 4, 41, 0.1);

  /* Overlay tints (week columns) */
  --color-week-tint-a: rgba(16, 185, 129, 0.1);
  --color-week-tint-b: rgba(245, 158, 11, 0.1);

  /* Delta text, yellow tier (darker in light mode for contrast on tints) */
  --color-delta-warn: #E5B80B;

  /* SVG tracks */
  --color-track: rgba(255, 255, 255, 0.06);
  --color-track-strong: rgba(255, 255, 255, 0.1);

  /* Card style inactive */
  --color-card-style-bg: #1A1E2C;
  --color-card-style-hover: #2A2E3E;

  /* Modals */
  --color-modal-overlay: rgba(6, 8, 13, 0.8);

  /* Splash */
  --color-splash-backlight: rgba(217, 4, 41, 0.2);

  /* Gold button text — same in both modes */
  --color-btn-gold-text: #000000;

  /* Scrollbars */
  --color-scroll-track: #11141D;
  --color-scroll-thumb: #D90429;
  --color-scroll-thumb-admin: #9D4EDD;

  /* Shadows */
  --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-admin: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-popover: 0 10px 25px -5px rgba(0, 0, 0, 0.8);
}

[data-theme="light"] {
  --color-void: #F4E8E6;
  --color-surface: #FCF2F0;
  --color-primary: #B8032A;
  --color-accent: #E5B80B;
  --color-accent-text: #000000;
  --color-admin-bg: #EBDFF9;
  --color-admin-accent: #5B21B6;
  --color-admin-glass: rgba(91, 33, 182, 0.18);
  --color-text-main: #0F172A;
  --color-text-muted: #64748B;
  --color-glass: rgba(0, 0, 0, 0.08);
  --color-divider: rgba(0, 0, 0, 0.1);
  --color-lime: #15803D;
  --color-role-admin: #5B21B6;
  --color-role-moderator: #1E3A8A;
  --color-role-member: #0F766E;
  --color-role-sysadmin: #A57C00;
  --color-accent-text: #A87A00;

  --color-btn-muted-bg: #EDE2DF;
  --color-btn-muted-hover: #DFD0CC;

  --color-zebra-even: rgba(0, 0, 0, 0.02);
  --color-zebra-odd: rgba(0, 0, 0, 0.05);
  --color-table-header-bg: rgba(226, 232, 240, 0.9);
  --color-table-departed-bg: #E8ECF2;
  --color-table-club-total-bg: rgba(184, 3, 42, 0.08);

  --color-week-tint-a: rgba(71, 99, 163, 0.18);
  --color-week-tint-b: rgba(71, 99, 163, 0.07);
  --color-delta-warn: #856000;

  --color-track: rgba(0, 0, 0, 0.08);
  --color-track-strong: rgba(0, 0, 0, 0.12);

  --color-card-style-bg: #E4E8EF;
  --color-card-style-hover: #D0D6E0;

  --color-modal-overlay: rgba(15, 23, 42, 0.5);

  --color-splash-backlight: rgba(217, 4, 41, 0.15);

  --color-btn-gold-text: #000000;

  --color-scroll-track: #E4E8EF;
  --color-scroll-thumb: #B8032A;
  --color-scroll-thumb-admin: #5B21B6;

  --shadow-card: 0 4px 16px rgba(120, 40, 30, 0.08);
  --shadow-admin: 0 4px 16px rgba(91, 33, 182, 0.10);
  --shadow-popover: 0 4px 16px rgba(120, 40, 30, 0.14);
}

/* --- Base --- */
body {
  font-family: 'Aptos', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background-color: var(--color-void);
  color: var(--color-text-main);
  margin: 0;
  padding: 0;
}

.brand-text {
  font-family: 'Aptos', 'Russo One', sans-serif;
  white-space: nowrap;
}

.font-ui {
  font-family: 'Aptos', 'Roboto', sans-serif;
}

/* --- Background & Surface --- */
.bg-brand-void {
  background-color: var(--color-void);
}

.surface-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-glass);
  box-shadow: var(--shadow-card);
}

.surface-admin {
  background-color: var(--color-admin-bg);
  border: 1px solid var(--color-admin-glass);
  box-shadow: var(--shadow-admin);
}

/* --- Text --- */
.text-brand-textMain {
  color: var(--color-text-main);
}
.text-brand-textMuted {
  color: var(--color-text-muted);
}

/* --- Borders & Dividers --- */
.border-brand-glass {
  border-color: var(--color-glass);
}
.divide-brand-glass {
  border-color: var(--color-glass);
}

/* --- Buttons (Solid fills only) --- */
.btn-solid-primary {
  background-color: var(--color-primary);
  color: #fff;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  border: none;
  box-shadow: 0 4px 15px rgba(217,4,41,0.2);
  transition: all 0.2s ease;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-solid-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-solid-gold {
  background-color: var(--color-accent);
  color: var(--color-btn-gold-text);
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  border: none;
  box-shadow: 0 4px 15px rgba(229,184,11,0.3);
  transition: all 0.2s ease;
  text-transform: uppercase;
  cursor: pointer;
}
.btn-solid-gold:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-solid-admin {
  background-color: var(--color-admin-accent);
  color: #fff;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  border: none;
  box-shadow: 0 4px 15px rgba(157,78,221,0.3);
  transition: all 0.2s ease;
  text-transform: uppercase;
  cursor: pointer;
}
.btn-solid-admin:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-solid-muted {
  background-color: var(--color-btn-muted-bg);
  color: var(--color-text-main);
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  border: 1px solid var(--color-glass);
  transition: all 0.2s ease;
  text-transform: uppercase;
  cursor: pointer;
}
.btn-solid-muted:hover {
  background-color: var(--color-btn-muted-hover);
}

/* --- Modals --- */
.modal-overlay {
  background-color: rgba(6,8,13,0.8);
  backdrop-filter: blur(8px);
}

/* --- Tables --- */
.table-row-zebra-even {
  background-color: var(--color-zebra-even);
}
.table-row-zebra-odd {
  background-color: var(--color-zebra-odd);
}

/* --- Toast --- */
.toast-pill {
  border-radius: 9999px;
  padding: 0.75rem 1.5rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  display: inline-block;
  white-space: nowrap;
  transition: all 0.3s ease;
}
.toast-pill-success {
  background-color: #2E8B57;
  box-shadow: 0 8px 25px rgba(46,139,87,0.4);
}
.toast-pill-error {
  background-color: var(--color-primary);
  box-shadow: 0 8px 25px rgba(217,4,41,0.4);
}
.toast-pill-info {
  background-color: var(--color-admin-accent);
  box-shadow: 0 8px 25px rgba(157,78,221,0.4);
}

/* --- Utility for splash backlight --- */
.splash-backlight {
  background-color: rgba(217,4,41,0.2);
  border-radius: 9999px;
  filter: blur(60px);
  width: 200%;
  height: 200%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* --- Flow perimeter (existing) --- */
@keyframes flow-around {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}
.fiery-flow-path {
  fill: none;
  stroke: #E5B80B;
  stroke-linecap: round;
  stroke-dasharray: 96 4;
  animation: flow-around 17s linear infinite;
}

/* --- Marquee (existing) --- */
@keyframes marquee {
  0% { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}
.animate-marquee {
  display: flex;
  width: max-content;
  animation: marquee 25s linear infinite;
}
.marquee-container {
  overflow: hidden;
  width: 100%;
  background-color: var(--color-primary);
  padding: 8px 0;
}

/* --- Table wrap for scroll (existing) --- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}
.table-wrap table {
  width: 100%;
  min-width: max-content;
  table-layout: auto;
  white-space: nowrap;
}
@media (max-width: 640px) {
  html { font-size: 67%; }
  .table-wrap table { font-size: 0.85rem; }
}

/* --- Flatpickr overrides (keep but refine) --- */
.flatpickr-calendar,
.flatpickr-innerContainer,
.flatpickr-rContainer,
.flatpickr-days,
.dayContainer {
  background: var(--color-void) !important;
  border-color: var(--color-void) !important;
}
.flatpickr-calendar {
  border: 1px solid var(--color-primary) !important;
  border-radius: 6px !important;
  box-shadow: var(--shadow-popover) !important;
}
.flatpickr-months .flatpickr-month,
.flatpickr-weekwrapper .flatpickr-weekdays,
.flatpickr-weekdays,
.flatpickr-current-month .flatpickr-monthDropdown-months {
  background: var(--color-void) !important;
}
span.flatpickr-weekday {
  background: var(--color-void) !important;
  color: var(--color-accent) !important;
  font-weight: 900 !important;
}
.flatpickr-day {
  color: var(--color-text-main) !important;
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
  background: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  color: #fff !important;
}
.flatpickr-day:hover {
  background: var(--color-surface) !important;
  border-color: var(--color-surface) !important;
}
.flatpickr-day.today {
  border-color: var(--color-accent) !important;
}

/* ==========================================
   Collapsible Desktop Sidebar
   ========================================== */
#sidebar {
  width: 68px;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
#sidebar.sidebar-expanded {
  width: 256px;
}

#sidebar .sidebar-header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  border-bottom: 1px solid var(--color-glass);
  flex-shrink: 0;
}
#sidebar.sidebar-expanded .sidebar-header-row {
  justify-content: space-between;
  padding: 16px 20px;
}
#sidebar .sidebar-header-text {
  display: none;
  margin: 0;
}
#sidebar.sidebar-expanded .sidebar-header-text {
  display: block;
}
#sidebar .sidebar-toggle-btn {
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}
#sidebar .sidebar-toggle-btn:hover {
  color: var(--color-text-main);
}
#sidebar .sidebar-toggle-btn svg {
  width: 20px;
  height: 20px;
  transform: rotate(180deg);
  transition: transform 0.22s ease;
}
#sidebar.sidebar-expanded .sidebar-toggle-btn svg {
  transform: rotate(0deg);
}

#sidebar nav {
  padding: 8px !important;
  gap: 2px !important;
}

#sidebar .sidebar-link {
  display: flex !important;
  align-items: center;
  gap: 14px;
  padding: 12px 14px !important;
  font-size: 15px !important;
  border-radius: 6px;
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  justify-content: center;
}
#sidebar.sidebar-expanded .sidebar-link {
  justify-content: flex-start;
}
#sidebar .sidebar-link svg {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}
#sidebar .sidebar-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
#sidebar.sidebar-expanded .sidebar-label {
  opacity: 1;
  width: auto;
  pointer-events: auto;
}


.theme-choice-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  background: var(--color-void);
  border: 1px solid var(--color-glass);
  border-radius: 6px;
  color: var(--color-text-main);
  font-family: Aptos, Roboto, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.theme-choice-btn:hover {
  border-color: var(--color-accent);
}
.theme-choice-btn.active {
  background: var(--color-accent);
  color: #000;
  border-color: var(--color-accent);
}
.theme-choice-btn svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 420px) {
  .theme-choice-btn {
    padding: 12px 6px;
    font-size: 10.5px;
    gap: 4px;
    letter-spacing: 0.6px;
  }
  .theme-choice-btn svg {
    width: 14px;
    height: 14px;
  }
}


/* ==========================================
   Week column tints (theme-aware)
   ========================================== */
.week-tint-a { background-color: var(--color-week-tint-a) !important; }
.week-tint-b { background-color: var(--color-week-tint-b) !important; }
.week-tint-a.text-brand-accent,
.week-tint-b.text-brand-accent { color: var(--color-delta-warn) !important; }

/* Table structural backgrounds */
.table-header-bg { background-color: var(--color-table-header-bg) !important; }
.table-departed-bg { background-color: var(--color-table-departed-bg) !important; }
.table-club-total-bg { background-color: var(--color-table-club-total-bg) !important; }

/* Modal overlay */
.modal-overlay { background-color: var(--color-modal-overlay); }

/* Splash backlight */
.splash-backlight { background-color: var(--color-splash-backlight); }

/* Admin pages in light mode: purple tint to match the bottom sheet */
[data-theme="light"] body.admin-page {
  --color-void: var(--color-admin-bg);
  --color-surface: #F6EDFB;
  --color-glass: rgba(91, 33, 182, 0.12);
}

/* ==========================================
   Header banner — light mode fills
   ========================================== */
/* Normal pages: red fill, white text */
[data-theme="light"] body > a.surface-card[href="dashboard.html"] {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}
[data-theme="light"] body > a.surface-card[href="dashboard.html"] h1 {
  color: #FFFFFF !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
[data-theme="light"] body > a.surface-card[href="dashboard.html"]:hover {
  background-color: var(--color-primary);
  filter: brightness(0.92);
}

/* Admin pages: purple fill, white text */
[data-theme="light"] body > a.surface-admin[href="dashboard.html"] {
  background-color: var(--color-admin-accent);
  border-color: var(--color-admin-accent);
}
[data-theme="light"] body > a.surface-admin[href="dashboard.html"] h1 {
  color: #FFFFFF !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
[data-theme="light"] body > a.surface-admin[href="dashboard.html"]:hover {
  background-color: var(--color-admin-accent);
  filter: brightness(0.92);
}

/* ==========================================
   WAVE 1 — Foundation additions
   ========================================== */

/* Shared active-nav accent:
   red on regular pages, purple on admin pages (via body.admin-page). */
:root {
  --nav-active-accent: var(--color-primary);
}
body.admin-page {
  --nav-active-accent: var(--color-admin-accent);
}

/* Unified active link — dark accent fill only.
   No left accent bar, no border treatment. Applies identically to the
   sidebar and the mobile bottom sheet, in both regular (red) and admin
   (purple) contexts. */
#sidebar .sidebar-link.sidebar-link-active,
#mobile-bottom-sheet a.sidebar-link-mobile-active {
  background-color: color-mix(in srgb, var(--nav-active-accent) 15%, transparent);
  color: var(--color-text-main);
}

/* Focus-visible outlines for keyboard navigation */
#sidebar .sidebar-link:focus-visible,
#sidebar .sidebar-toggle-btn:focus-visible,
#mobile-bottom-sheet nav a:focus-visible {
  outline: 2px solid var(--nav-active-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Sidebar group divider (used from Wave 2 onward) */
.sidebar-divider {
  height: 1px;
  background: var(--color-divider);
  margin: 0 4px;
  border-radius: 1px;
}

/* Reduced-motion gating (a11y) */
@media (prefers-reduced-motion: reduce) {
  .animate-marquee,
  .fiery-flow-path {
    animation: none !important;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================
   Sidebar team badge (Wave 2b)
   ========================================== */
.sidebar-team-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin: 8px;
  border-radius: 6px;
  background: var(--color-void);
  border: 1px solid var(--color-glass);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s ease;
  overflow: hidden;
}
.sidebar-team-badge:hover {
  border-color: var(--color-accent);
}
.sidebar-team-badge img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
}
.sidebar-team-badge .badge-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
.sidebar-team-badge .badge-name {
  font-family: 'Aptos', 'Russo One', sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 13px;
  line-height: 1.1;
  color: var(--color-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-team-badge .badge-role {
  font-family: 'Aptos', 'Roboto', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 9px;
  color: var(--color-text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Collapsed sidebar: logo only */
#sidebar:not(.sidebar-expanded) .sidebar-team-badge {
  justify-content: center;
  padding: 8px;
  margin: 8px 4px;
}
#sidebar:not(.sidebar-expanded) .sidebar-team-badge .badge-text {
  display: none;
}

/* Badge pushes nav down; ensure nav can still scroll inside the fixed-height aside */
#sidebar > nav {
  min-height: 0;
}

/* ==========================================
   Mobile sheet grid (Wave 2c)
   ========================================== */

/* Badge inside sheet: no margin, nav gap provides spacing */
#mobile-bottom-sheet .sidebar-team-badge {
  margin: 0 0 4px 0;
}

/* 2x3 grid layout */
.mobile-sheet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Grid link cells: compact, left-aligned, icon + label */
#mobile-bottom-sheet .mobile-sheet-grid > a {
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.2;
  justify-content: flex-start;
  text-align: left;
  min-width: 0;
}
#mobile-bottom-sheet .mobile-sheet-grid > a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
#mobile-bottom-sheet .mobile-sheet-grid > a span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Divider inside sheet: tighter than sidebar version */
#mobile-bottom-sheet .sidebar-divider {
  margin: 4px 0;
}

/* Admin footer: full-width, matches grid cell styling */
#mobile-bottom-sheet #mobile-admin-link {
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.2;
}
#mobile-bottom-sheet #mobile-admin-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ==========================================
   Swipe-to-dismiss drag state (Wave 2d)
   ========================================== */
/* While a finger drag is active, kill the CSS transition so the sheet
   follows the touch 1:1 instead of lagging behind duration-300. */
#mobile-bottom-sheet.is-dragging {
  transition: none !important;
}

/* ==========================================
   Marquee text: force white on red (Wave 3e-1)
   ========================================== */
/* In light mode, text-brand-textMain resolves to a dark color, which
   reads poorly on the --color-primary (red) marquee background. Dark
   mode was already fine (white on red). Force white on both themes so
   the two modes match. */
.marquee-container .animate-marquee {
  color: #FFFFFF;
}

/* ==========================================
   Header auto-fit scaffolding (Wave 3e-3)
   ========================================== */
/* Title: grows to fill available space, allowed to shrink below content */
body > header > h2 {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

/* Player name: capped at 40% of header, ellipsis as last resort */
body > header > a#header-player-name {
  max-width: 40%;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ==========================================
   Header title/name gap (Wave 3e-5)
   ========================================== */
/* Minimum spacing between the page title (left) and player name (right).
   On desktop justify-between spreads them far apart; this protects the
   tight mobile case where a long title nearly touches the name. */
body > header {
  gap: 12px;
}

/* ==========================================
   TEAM VIEW ROUTER & HUB CARDS (Wave 4a)
   ========================================== */

.team-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.team-view-title {
  font-family: 'Aptos', 'Russo One', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 14px;
  color: var(--color-text-main);
}

.team-sub-tabs {
  display: flex;
  border-bottom: 2px solid var(--color-glass);
  margin-bottom: 4px;
}
.team-sub-tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: 'Aptos', 'Russo One', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.team-sub-tab-btn:hover {
  color: var(--color-text-main);
}
.team-sub-tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ==========================================
   PREMIUM HUB REDESIGN
   ========================================== */
.hub-hero {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(145deg, var(--color-surface), var(--color-void));
  border: 1px solid var(--color-glass);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.hub-hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  text-align: center;
}
.hub-stat-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hub-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  font-weight: 700;
}
.hub-stat-value {
  font-family: 'Russo One', sans-serif;
  font-size: 1.25rem;
  color: var(--color-text-main);
  font-weight: 900;
}
.hub-hero-status {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--color-divider);
}
.hub-status-pill {
  background: var(--color-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 10px rgba(217,4,41,0.3);
}
.hub-progress-wrap {
  flex: 1;
  margin-left: 16px;
  height: 8px;
  background: var(--color-void);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--color-glass);
}
.hub-progress-fill {
  height: 100%;
  background: var(--color-accent);
  transition: width 0.4s ease;
}

.hub-card-primary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-glass);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.hub-card-primary:hover {
  transform: translateY(-2px);
  border-color: var(--color-accent);
}
.hub-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--color-void);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  flex-shrink: 0;
}
.hub-card-primary.urgent {
  background: linear-gradient(145deg, var(--color-surface), rgba(217,4,41,0.1));
  border-color: var(--color-primary);
}
.hub-card-primary.urgent .hub-icon-box {
  background: var(--color-primary);
  color: #fff;
}

.hub-card-secondary {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-glass);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.hub-card-secondary:hover {
  transform: translateY(-2px);
  border-color: var(--color-accent);
}
.hub-card-secondary .hub-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.hub-card-secondary .hub-title {
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hub-card-manage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-glass);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.hub-card-manage:hover { background: var(--color-void); }

/* ==========================================
   MEMBERS TOOLBAR REDESIGN
   ========================================== */
.members-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface);
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--color-glass);
  margin-bottom: 12px;
}
.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toolbar-left {
  flex: 1;
  min-width: 150px;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
  max-width: 100%;
}
.toolbar-right::-webkit-scrollbar { display: none; }

.week-pill-container {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
}
.week-pill-container::-webkit-scrollbar { display: none; }
.filter-pill {
  white-space: nowrap;
  flex-shrink: 0; /* Prevents pills from squishing */
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid var(--color-glass);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter-pill.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  cursor: pointer;
}
.toggle-switch input {
  accent-color: var(--color-primary);
  width: 14px;
  height: 14px;
}

/* ==========================================
   Wave 4b - View hidden modifier
   ========================================== */
.team-view--hidden {
  display: none !important;
}
.team-hub-external-grid.team-view--hidden,
.team-hub-card.team-view--hidden {
  display: none !important;
}

/* MVP Specific Toolbar Fixes */
.mvp-toolbar {
  flex-wrap: nowrap !important;
  overflow-x: auto;
  justify-content: flex-start !important;
}
.mvp-toolbar::-webkit-scrollbar { display: none; }
.mvp-toolbar .toolbar-left {
  flex: 0 1 auto !important; /* Stops the 150px min-width rule from creating a massive gap */
  min-width: 0 !important;
}
