/* ============================================================
   TEAMS PAGE — Epic 0005 Phase 1
   ============================================================ */

/* ── Data Table (shared table style for Teams page) ── */
.data-table { width: 100%; border-collapse: collapse; margin: 0; table-layout: auto; }
.data-table thead th {
  padding: 8px 10px; text-align: left;
  font-size: 0.77rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); font-weight: 700;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.data-table thead th.num { text-align: right; }
.data-table thead th.center { text-align: center; }
.data-table tbody td {
  padding: 7px 10px; border-top: 1px solid var(--line-2);
  vertical-align: middle; font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.data-table tbody td.num { text-align: right; }
.data-table tbody td.center { text-align: center; }
.data-table tbody td.team-name { font-weight: 600; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tfoot td {
  padding: 7px 10px; border-top: 1px solid var(--line-2);
}

/* Sortable header styles */
.data-table thead th.sortable { cursor: pointer; user-select: none; }
.data-table thead th.sortable:hover { color: var(--accent); }
.data-table thead th.sort-active { color: var(--accent); }
.sort-indicator { font-size: 0.6rem; color: var(--ink-4); margin-left: 2px; }
.sort-active .sort-indicator { color: var(--accent); }
.sort-rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%; background: rgba(37,99,235,0.08);
  font-size: 0.55rem; font-weight: 700; color: var(--accent); margin-left: 2px;
}

/* ── Page Layout ── */
.main-container--wide { max-width: none; }

/* ── Page Controls ── */
.teams-controls {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem; flex-wrap: wrap;
}
.teams-controls__filters { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.teams-controls__group { display: flex; align-items: center; gap: 0.5rem; }
.teams-controls__label {
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-3);
}
.teams-controls__select {
  appearance: none; background: var(--surface);
  border: 1px solid var(--input-border); border-radius: var(--r-sm);
  padding: 6px 28px 6px 10px; font: inherit; font-size: var(--text-sm); color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7c93' d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; cursor: pointer;
}

.teams-search__input {
  flex: 1; max-width: 360px;
  padding: 7px 12px 7px 32px; font: inherit; font-size: var(--text-base);
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--input-border); border-radius: var(--r-sm);
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7c93' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center;
}
.teams-search__input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }

/* ── Team Carousel ── */
.team-carousel { margin-bottom: 1.25rem; }
.team-carousel__track-wrap { overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; }
.team-carousel__track { display: flex; gap: 8px; min-width: min-content; }

.tc-card {
  flex-shrink: 0; width: 152px; padding: 10px 12px;
  background: var(--card-bg); border: 1.5px solid var(--card-border);
  border-radius: var(--r-md); cursor: pointer;
  transition: all 0.15s; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 3px;
}
.tc-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.tc-card.is-active {
  border-color: var(--accent); background: var(--accent-light);
  box-shadow: 0 0 0 2px var(--accent-subtle), var(--shadow);
}

.tc-card--all {
  background: var(--navbar-bg); border-color: rgba(255,255,255,0.12); color: var(--white);
  position: sticky; left: 0; z-index: 2;
}
.tc-card--all:hover { border-color: var(--blue-400); }
.tc-card--all.is-active {
  border-color: var(--blue-400); background: #1c2432;
  box-shadow: 0 0 0 2px rgba(96,165,250,0.3);
}
.tc-card--all .tc-card__name { color: var(--white); }

.tc-card__name {
  font-size: var(--text-sm); font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tc-card__row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--text-xs); color: var(--ink-3); gap: 4px;
}
.tc-card__rank { font-weight: 800; color: var(--ink); font-size: var(--text-sm); }
.tc-card__elo { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tc-card__record { font-weight: 600; font-variant-numeric: tabular-nums; }
.tc-card__winrate { font-weight: 700; font-variant-numeric: tabular-nums; }
.tc-card__stat-row { display: flex; gap: 4px; align-items: baseline; }
.tc-card__stat-label { font-size: 0.643rem; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(255,255,255,0.5); font-weight: 600; }
.tc-card__stat-value { font-size: var(--text-xs); font-weight: 700; color: rgba(255,255,255,0.9); font-variant-numeric: tabular-nums; }

/* ── Summary Tiles ── */
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem; margin-bottom: 1.25rem; }
.summary-tile {
  padding: 0.75rem; background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.summary-tile::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: var(--grad-primary);
}
.summary-tile__label {
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-3);
}
.summary-tile__value {
  font-size: var(--text-2xl); font-weight: 800; margin-top: 4px;
  font-variant-numeric: tabular-nums;
  background: var(--grad-primary);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.summary-tile__sub { font-size: var(--text-xs); color: var(--ink-3); margin-top: 2px; }

/* ── Filter Bar ── */
.filter-bar { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.filter-bar__group { display: flex; align-items: center; gap: 0.35rem; }
.filter-bar__label {
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-3);
}
.filter-bar__select {
  appearance: none; background: var(--surface);
  border: 1px solid var(--input-border); border-radius: var(--r-sm);
  padding: 5px 26px 5px 8px; font: inherit; font-size: var(--text-sm); color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7c93' d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
}
.filter-bar__spacer { flex: 1; }

/* ── Team Icon Sizes ── */
.team-icon-xs {
  width: 15px; height: 15px; border-radius: 3px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Graduate', serif; font-size: 0.5rem; font-weight: 400;
  color: white; -webkit-text-stroke: 0.5px white; paint-order: stroke fill;
  vertical-align: middle;
}
.team-icon-sm {
  width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Graduate', serif; font-size: 0.55rem; font-weight: 400;
  color: white; -webkit-text-stroke: 0.5px white; paint-order: stroke fill;
}
.team-icon-md {
  width: 22px; height: 22px; border-radius: 5px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Graduate', serif; font-size: 0.65rem; font-weight: 400;
  color: white; -webkit-text-stroke: 0.5px white; paint-order: stroke fill;
}
.team-icon-lg {
  width: 48px; height: 48px; border-radius: var(--r-md); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Graduate', serif; font-size: 1.3rem; font-weight: 400;
  color: white; -webkit-text-stroke: 1px white; paint-order: stroke fill;
}
.team-inline { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }

/* ── Team Identity Header ── */
.team-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 0.75rem; padding: 0.75rem 1rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 10;
}
.team-header__info { flex: 1; }
.team-header__name { font-size: var(--text-xl); font-weight: 800; }
.team-header__meta {
  display: flex; align-items: center; gap: 0.75rem; margin-top: 2px;
  font-size: var(--text-sm); color: var(--ink-3);
}
.team-header__stats {
  display: flex; align-items: center; gap: 1.5rem; margin-left: auto; text-align: center;
}
.team-header__stat-value {
  font-size: var(--text-lg); font-weight: 800; font-variant-numeric: tabular-nums;
}
.team-header__stat-label {
  font-size: var(--text-xs); color: var(--ink-3); text-transform: uppercase;
  letter-spacing: 0.06em; font-weight: 600;
}

/* ── Team Tabs ── */
.team-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem;
}
.team-tab {
  padding: 0.5rem 1rem; font-size: var(--text-sm); font-weight: 600;
  color: var(--ink-3); text-decoration: none; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition: color 0.15s;
}
.team-tab:hover { color: var(--ink); }
.team-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Stat Tiles (Overview) ── */
/* ── Stat Tiles (Teams Overview) ── */
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem; margin-bottom: 1.25rem; }
.stat-grid .stat-tile,
.opponents-layout .stat-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.stat-tile--accent { position: relative; overflow: hidden; }
.stat-tile--accent::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: var(--grad-primary);
}
.stat-tile__badge {
  display: inline-block; padding: 1px 6px; border-radius: var(--r-sm);
  font-size: var(--text-sm); font-weight: 700; margin-left: 6px; vertical-align: middle;
}
.stat-tile__badge--pos { background: var(--success-soft); color: var(--green); }
.stat-tile__badge--neg { background: var(--danger-soft); color: var(--red); }
.stat-tile__badge--neutral { background: var(--bg-2); color: var(--ink-3); }
.stat-tile__sub { font-size: var(--text-xs); color: var(--ink-3); margin-top: 2px; }

/* ── Histogram ── */
.histogram { display: flex; align-items: flex-end; gap: 1px; padding-top: 14px; }
.histogram__bar { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.histogram__bar-fill { width: 70%; max-width: 18px; border-radius: 2px 2px 0 0; }
.histogram__bar-fill--pos { background: var(--success); }
.histogram__bar-fill--neg { background: var(--danger); }
.histogram__bar-fill--zero { background: var(--ink-4); }
.histogram__count {
  font-size: 0.55rem; font-weight: 700; color: var(--ink-2); margin-bottom: 1px;
}
.histogram__label {
  font-size: 0.55rem; color: var(--ink-4); font-weight: 600;
  margin-top: 2px; font-variant-numeric: tabular-nums;
}

/* ── Opponents Split Layout ── */
.opponents-layout { display: grid; grid-template-columns: 320px 1fr; gap: 1rem; }
.opponents-layout > *:last-child { min-width: 0; overflow: hidden; }
.opponent-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: var(--r-sm); cursor: pointer; transition: background 0.1s;
  border: 1px solid transparent;
}
.opponent-row:hover { background: var(--bg); }
.opponent-row.is-active { background: var(--accent-light); border-color: var(--accent); }
.opponent-row__name { font-size: var(--text-sm); font-weight: 600; }
.opponent-row__record { font-size: var(--text-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.opponent-row__winrate { font-size: var(--text-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ── Roster Cards ── */
.roster-card {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem;
  border-bottom: 1px solid var(--border-2);
}
.roster-card:last-child { border-bottom: none; }
.roster-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-3); display: flex; align-items: center; justify-content: center;
  font-size: var(--text-xs); font-weight: 700; color: var(--ink-2); flex-shrink: 0;
}
.roster-name { font-size: var(--text-sm); font-weight: 600; }
.roster-email { font-size: var(--text-xs); color: var(--ink-3); }
.roster-badge--captain { background: #FFFBEB; color: var(--amber-600); padding: 1px 6px; border-radius: var(--r-sm); font-size: var(--text-xs); font-weight: 700; }
.roster-badge--player { background: var(--bg-2); color: var(--ink-3); padding: 1px 6px; border-radius: var(--r-sm); font-size: var(--text-xs); font-weight: 600; }

/* ── Compact Form (card-embedded mini-forms) ── */
.compact-form .form-label {
  font-size: var(--text-xs); margin-bottom: 4px;
}
.compact-form .form-input,
.compact-form .form-textarea {
  padding: 0.5rem 0.75rem; font-size: var(--text-sm);
}
.compact-form select.form-input {
  padding-right: 2rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M1.41.59 6 5.17 10.59.59 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 10px;
}

/* ── Configuration Tab ── */
.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.config-field { margin-bottom: 0.25rem; }
.config-label {
  font-size: var(--text-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: 2px;
}
.config-value { font-size: var(--text-base); color: var(--ink); font-weight: 500; }
.config-value--aligned {
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm);
  border: 1px solid transparent;
  color: var(--ink-3);
}
.config-status-select[data-status="confirmed"] { background-color: var(--success-soft); color: var(--green); font-weight: 600; }
.config-status-select[data-status="pending"]   { background-color: var(--warning-soft); color: var(--amber); font-weight: 600; }
.config-status-select[data-status="withdrawn"] { background-color: var(--bg-2); color: var(--ink-3); font-weight: 600; }
.config-status-select[data-status="cancelled"] { background-color: var(--bg-2); color: var(--ink-3); font-weight: 600; }
.config-separator {
  border: none; border-top: 1px solid var(--line);
  margin: 0.75rem 0;
}
.config-actions {
  display: flex; gap: 0.5rem; justify-content: flex-end;
  margin-bottom: 0.75rem;
}
.config-form-actions {
  display: flex; gap: 0.5rem; justify-content: flex-end;
  margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--line);
}

/* ── Icon Builder Placeholder ── */
.icon-builder-placeholder {
  border: 2px dashed var(--border); border-radius: var(--r-lg);
  padding: 2rem; text-align: center; background: var(--surface);
}

/* ── Column Selector Dropdown ── */
.col-selector { position: relative; display: inline-block; }
.col-selector__btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; font-size: var(--text-sm); font-weight: 600;
  color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer;
}
.col-selector__btn:hover { background: var(--surface-2); }
.col-selector__dropdown {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 50;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow); min-width: 240px;
  padding: 0.5rem; display: none; max-height: 400px; overflow-y: auto;
}
.col-selector__dropdown.is-open { display: block; }
.col-selector__pills {
  display: flex; gap: 4px; margin-bottom: 0.5rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line-2);
}
.col-selector__pill {
  padding: 3px 10px; font-size: var(--text-xs); font-weight: 600;
  border-radius: var(--r-pill); cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-3);
}
.col-selector__pill:hover { background: var(--accent-subtle); color: var(--accent); border-color: var(--accent); }
.col-selector__item {
  display: flex; align-items: center; gap: 6px; padding: 3px 6px;
  font-size: var(--text-sm); color: var(--ink); cursor: pointer; border-radius: 3px;
}
.col-selector__item:hover { background: var(--surface-2); }
.col-selector__check { width: 14px; height: 14px; accent-color: var(--accent); }

/* ── Status Badges ── */
.badge--status {
  display: inline-block; padding: 2px 8px;
  font-size: var(--text-sm); font-weight: 600;
  border-radius: var(--r-pill); white-space: nowrap;
}
.badge--w { background: var(--success); color: white; }
.badge--l { background: var(--danger); color: white; }
.badge--t { background: var(--ink-4); color: white; }
.badge--confirmed { background: var(--success-soft); color: var(--green); }
.badge--pending { background: var(--warning-soft); color: var(--amber); }
.badge--withdrawn { background: var(--bg-2); color: var(--ink-3); }
.badge--cancelled { background: var(--bg-2); color: var(--ink-3); }

/* ── Tier Pill Override (smaller in table context) ── */
.data-table .tier-pill { font-size: var(--text-sm); }

/* ── Action Dropdown ── */
.action-dropdown { position: relative; display: inline-block; }
.action-trigger {
  width: 28px; height: 28px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: var(--text-base); color: var(--ink-3); transition: all 0.1s;
}
.action-trigger:hover { background: var(--bg); color: var(--ink); }
.action-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 50;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow); min-width: 140px;
  padding: 4px 0; display: none;
}
.action-menu.is-open { display: block; }
.action-menu__item {
  padding: 6px 14px; font-size: var(--text-sm); font-weight: 500;
  color: var(--ink); cursor: pointer; display: block; width: 100%;
  text-align: left; background: none; border: none; text-decoration: none;
  font-family: inherit;
}
.action-menu__item:hover { background: var(--accent-subtle); }
.action-menu__divider { height: 1px; background: var(--border); margin: 4px 0; }
.action-menu__item--danger { color: var(--danger); }
.action-menu__item--danger:hover { background: var(--danger-soft); }

/* ── Withdrawn Row ── */
.registration-row--withdrawn { opacity: 0.5; }

/* ── Chart Container ── */
.chart-container {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 1rem; margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm); min-width: 0; overflow: hidden;
}
.chart-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem;
}
.chart-title {
  font-size: var(--text-sm); font-weight: 700; color: var(--ink);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.chart-area { width: 100%; overflow: hidden; }

/* ── Toggle Switch ── */
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--ink-2); font-weight: 500; }
.toggle__track {
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--ink-4); position: relative; cursor: pointer;
  transition: background 0.15s;
}
.toggle__track.is-on { background: var(--accent); }
.toggle__thumb {
  width: 16px; height: 16px; border-radius: 50%; background: white;
  position: absolute; top: 2px; left: 2px;
  transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle__track.is-on .toggle__thumb { transform: translateX(16px); }

