/* Self-hosted fonts — no Google dependency, no FOUC */
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 600;
    font-display: block;
    src: url("/static/tracker/fonts/barlow-condensed-600.42184046a2d8.woff2") format('woff2');
}
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 700;
    font-display: block;
    src: url("/static/tracker/fonts/barlow-condensed-700.fa94d176af2c.woff2") format('woff2');
}
@font-face {
    font-family: 'Barlow Condensed';
    font-style: normal;
    font-weight: 800;
    font-display: block;
    src: url("/static/tracker/fonts/barlow-condensed-800.bbf8cdf81abf.woff2") format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: block;
    src: url("/static/tracker/fonts/inter-latin.4f2d3cb4ac0e.woff2") format('woff2');
}
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 500 600;
    font-display: block;
    src: url("/static/tracker/fonts/jetbrains-mono-latin.e6b53aaa79da.woff2") format('woff2');
}

:root {
    --ink: #0c111b;
    --muted: #6b7486;
    --ice: #f4f7fb;
    --blue: #1E5FCC;
    --blue-dark: #0A1628;
    --surface: #ffffff;
    --shadow: 0 22px 40px rgba(10, 18, 32, 0.12);
    --radius: 22px;
    --accent: #D32030;
    --accent-dark: #b51c2a;
    --line: #e3e9f3;
    /* TendyIQ brand tokens */
    --navy: #0A1628;
    --navy-deep: #060D18;
    --navy-panel: #0F2038;
    --ice-bright: #3D7DFF;
    --red: #D32030;
    --brand-white: #F7F9FC;
    --brand-grey: #92A2BD;
    --brand-line: rgba(247,249,252,0.10);
    --font-display: 'Barlow Condensed', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-body), "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--navy-deep);
}

h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.02em;
    margin: 0 0 0.5em;
    text-transform: uppercase;
}

.panel h2, .manage-card h2, .content-area > section h2 {
    color: var(--ice-bright);
}

.panel h3, .manage-card h3 {
    color: var(--brand-white);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    background: rgba(6,13,24,0.96);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--brand-line);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.topbar h1 em {
    font-style: normal;
    color: var(--red);
}

.sub {
    margin: 4px 0 0;
    color: var(--muted);
}

.topbar .sub {
    color: rgba(255, 255, 255, 0.8);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
}

.brand img {
    border-radius: 8px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.button {
    padding: 10px 16px;
    border-radius: 999px;
    border: none;
    background: var(--red);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-block;
    transition: background 0.15s, box-shadow 0.15s;
}

.button:hover {
    background: var(--accent-dark);
}

a.button.primary, .button.primary {
    background: var(--red);
    color: #fff;
}

a.button.primary:hover, .button.primary:hover {
    background: var(--accent-dark);
}

.button.ghost {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: none;
}

.button.danger {
    background: rgba(211, 32, 48, 0.18);
    color: #ff4a58;
    border: 1px solid rgba(211, 32, 48, 0.5);
    box-shadow: none;
}

/* ── Light mode (default) ─────────────────────────────── */
.app {
    min-height: 100vh;
    background: #eef1f7;
    --ink: #1a2840;
    --muted: #64748b;
    --line: #d5dce8;
    --surface: #ffffff;
    --shadow: 0 2px 12px rgba(30, 45, 80, 0.10);
    --ice: #e8eef8;
    --ice-bright: #3a6ab8;
    --blue: #3a6ab8;
    color: var(--ink);
}

.app:not(.dark) .topbar {
    background: rgba(255, 255, 255, 0.97);
    border-bottom-color: #d5dce8;
    color: #1a2840;
}

.app:not(.dark) .brand { color: #1a2840; }
.app:not(.dark) .topbar .sub { color: #64748b; }

.app:not(.dark) .button.ghost {
    background: rgba(26, 40, 64, 0.07);
    color: #1a2840;
    border-color: rgba(26, 40, 64, 0.22);
}

.app:not(.dark) .sidebar {
    background: #f4f6fb;
    border-right-color: #d5dce8;
}

.app:not(.dark) .nav-section + .nav-section { border-top-color: #d5dce8; }
.app:not(.dark) .nav-title { color: #7a8fa8; }
.app:not(.dark) .nav-link { color: #334560; }
.app:not(.dark) .nav-icon { background: rgba(58, 106, 184, 0.10); color: #3a6ab8; }
.app:not(.dark) .nav-link:hover { background: rgba(58, 106, 184, 0.08); border-color: rgba(58, 106, 184, 0.18); }
.app:not(.dark) .nav-link.active { background: rgba(211, 32, 48, 0.10); border-color: rgba(211, 32, 48, 0.25); color: #b51c2a; }
.app:not(.dark) .nav-link.active .nav-icon { background: rgba(211, 32, 48, 0.12); color: #c8202e; }

.app:not(.dark) .content-area,
.app:not(.dark) .manage-body { background: #eef1f7; }

.app:not(.dark) .panel,
.app:not(.dark) .manage-card {
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(30, 45, 80, 0.08);
    border: 1px solid #d8e0ec;
    border-top: 3px solid #3a6ab8;
    overflow: hidden;
}

.app:not(.dark) .tab {
    background: #f4f6fb;
    border-color: #d0d8e8;
    color: #334560;
}

.app:not(.dark) .tab.active {
    background: #3a6ab8;
    color: #fff;
    border-color: transparent;
}

.app:not(.dark) .icon-btn {
    background: #ffffff;
    border-color: #cdd5e0;
    color: #334560;
}

.app:not(.dark) .modal-divider { background: #d5dce8; }

.app:not(.dark) .manage-list li {
    background: #f4f6fb;
    border-color: #d0d8e8;
}

.app:not(.dark) .goalie-control .button.ghost,
.app:not(.dark) .rink-flip .button.ghost {
    background: rgba(58, 106, 184, 0.08);
    color: #3a6ab8;
    border-color: rgba(58, 106, 184, 0.22);
    box-shadow: none;
}

.app:not(.dark) .period-controls button {
    background: #ffffff;
    border-color: #c5d3e8;
    color: #334560;
}

.app:not(.dark) .sync-actions .button.ghost {
    background: rgba(58, 106, 184, 0.08);
    color: #3a6ab8;
    border-color: rgba(58, 106, 184, 0.22);
}

.app:not(.dark) .net-panel {
    background: #ffffff;
    border-color: #d5dce8;
}

.app:not(.dark) .net-panel > summary {
    background: #f0f4fb;
    border-bottom-color: #d5dce8;
}

.app:not(.dark) .net-panel-title { color: #1a2840; }
.app:not(.dark) .net-panel.inactive > summary { background: #f7f9fd; }
.app:not(.dark) .net-panel .surface-frame.net-frame { border-top-color: #d5dce8; }
.app:not(.dark) .surface-frame { border-color: #d0dae8; }

.app:not(.dark) .scoring-debug-output {
    background: #f4f6fb;
    color: #1a2840;
    border-color: #cdd5e0;
    box-shadow: none;
}

/* Scoring page containers — light mode */
.app:not(.dark) .goalie-control,
.app:not(.dark) .rink-flip {
    background: #f0f4fb;
    border-color: #c4d0e6;
    color: #1a2840;
}
.app:not(.dark) .goalie-control h3,
.app:not(.dark) .goalie-control label,
.app:not(.dark) .rink-flip h3,
.app:not(.dark) .rink-flip label {
    color: #1a2840;
}
.app:not(.dark) .sync-card {
    background: #f0f4fb;
    border-color: #c4d0e6;
    color: #1a2840;
}
.app:not(.dark) .sync-card h3,
.app:not(.dark) .sync-card label,
.app:not(.dark) .sync-card p {
    color: #1a2840;
}
.app:not(.dark) .game-actions button {
    background: #e8edf8;
    color: #1a2840;
    border: 1px solid #c4d0e6;
}
.app:not(.dark) .game-actions button:hover {
    background: #d8e1f3;
    border-color: #3a6ab8;
}
.app:not(.dark) .modal-card {
    background: #ffffff;
    border: 1px solid #d0d8e8;
    color: #1a2840;
}
.app:not(.dark) .modal-card h3,
.app:not(.dark) .modal-card label {
    color: #1a2840;
}

/* Panel header — light-blue band, both modes */
.app .panel > .panel-header:first-child,
.app .manage-card > .panel-header:first-child {
    background: #3a6ab8;
    margin: -20px -20px 16px;
    padding: 14px 20px;
}
.app .manage-card > .panel-header:first-child {
    margin: -24px -24px 16px;
    padding: 14px 24px;
}
.app .panel > .panel-header:first-child h2,
.app .panel > .panel-header:first-child h3,
.app .manage-card > .panel-header:first-child h2,
.app .manage-card > .panel-header:first-child h3 {
    color: #fff;
    margin-bottom: 0;
}
.app .panel > .panel-header:first-child .sub,
.app .panel > .panel-header:first-child p,
.app .manage-card > .panel-header:first-child .sub {
    color: rgba(255, 255, 255, 0.75);
}
.app .panel > .panel-header:first-child code {
    color: rgba(220, 235, 255, 0.95);
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 1px 4px;
}
.app .panel > .panel-header:first-child .inline-label,
.app .panel > .panel-header:first-child label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}
.app .panel > .panel-header:first-child select {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.85rem;
}

/* Panel body headings — light mode */
.app:not(.dark) .panel h2,
.app:not(.dark) .manage-card h2 {
    color: #3a6ab8;
}
.app:not(.dark) .panel h3,
.app:not(.dark) .manage-card h3 {
    color: #1a2840;
}
.app:not(.dark) .panel h4,
.app:not(.dark) .manage-card h4,
.app:not(.dark) .content-area h4 {
    color: #1a2840;
}
.app:not(.dark) .panel h5,
.app:not(.dark) .manage-card h5,
.app:not(.dark) .content-area h5 {
    color: #334560;
}

/* Filter collapsible — blue summary bar in light mode */
.app:not(.dark) .collapsible {
    background: #f0f4fb;
    border-color: #c4d0e6;
}
.app:not(.dark) .collapsible > summary {
    background: #1a2840;
    color: #fff;
}
.app:not(.dark) .collapsible > summary::after {
    color: rgba(255, 255, 255, 0.75);
}
.app:not(.dark) .collapsible-content {
    border-top-color: rgba(58, 106, 184, 0.2);
}
.app:not(.dark) .collapsible-content label {
    color: #334560;
}

/* Data table — darker, readable text in light mode */
.app:not(.dark) .data-table th {
    color: #1a2840;
    background: rgba(26, 40, 64, 0.05);
    border-bottom-color: #d0d8e8;
}
.app:not(.dark) .data-table td {
    color: #334560;
    border-bottom-color: #e4e9f4;
}
.app:not(.dark) .data-table tbody tr:nth-child(odd) {
    background: rgba(58, 106, 184, 0.03);
}
.app:not(.dark) .data-table tr:hover {
    background: rgba(58, 106, 184, 0.08);
}
.app:not(.dark) .heatmap-preview-row td {
    background: rgba(58, 106, 184, 0.05) !important;
}

/* Rink zone overlay labels — theme-aware via currentColor */
.app:not(.dark) .rink-zone-overlay { color: #1a2840; }
.app.dark .rink-zone-overlay { color: #e2eaf5; }

/* Inputs/selects/textareas — readable in light mode */
.app:not(.dark) input,
.app:not(.dark) select,
.app:not(.dark) textarea {
    background: #ffffff;
    color: #1a2840;
    border-color: #c4d0e6;
}
.app:not(.dark) input::placeholder,
.app:not(.dark) textarea::placeholder {
    color: #92a2bd;
}

.app:not(.dark) .auth-card {
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(30, 45, 80, 0.10);
    border: 1px solid #d8e0ec;
    border-top: 3px solid #3a6ab8;
}
.app:not(.dark) .auth-card h2 { color: #1a2840; }
.app:not(.dark) .auth-card .sub { color: #64748b; }
.app:not(.dark) .auth-card .subtle { color: #7a8fa8; }

/* Dashboard hub cards/hero — light mode */
.app:not(.dark) .dashboard-hero {
    background: #f0f4fb;
    border-color: #c4d0e6;
    border-top-color: #3a6ab8;
}
.app:not(.dark) .eyebrow { color: #64748b; }
.app:not(.dark) .dashboard-card {
    background: #ffffff;
    color: #1a2840;
    border: 1px solid #d0d8e8;
    border-top: 2px solid rgba(58, 106, 184, 0.4);
}
.app:not(.dark) .dashboard-card h3 { color: #1a2840; }
.app:not(.dark) .dashboard-card p { color: #334560; }
.app:not(.dark) .dashboard-card:hover {
    background: #f5f8ff;
    box-shadow: 0 4px 16px rgba(26, 40, 64, 0.12);
}

/* Ghost pill — readable in light mode */
.app:not(.dark) .pill.ghost {
    background: transparent;
    border-color: rgba(26, 40, 64, 0.3);
    color: #334560;
}
.app:not(.dark) .pill.ghost:hover {
    background: rgba(26, 40, 64, 0.06);
}

/* Theme toggle button */
.theme-toggle {
    padding: 7px 9px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    display: block;
}

/* ── Profile / badge / trend — light mode fixes ──────── */
.app:not(.dark) .badge {
    color: #1a2840;
    background: rgba(58, 106, 184, 0.10);
    border-color: rgba(58, 106, 184, 0.22);
}
.app:not(.dark) .badge-icon {
    color: #1a2840;
    border-color: rgba(58, 106, 184, 0.28);
}
.app:not(.dark) .avatar {
    border-color: rgba(26, 40, 64, 0.18);
}
.app:not(.dark) .avatar-fallback {
    color: #1a2840;
}
.app:not(.dark) .trend-summary-pill {
    color: #1a2840;
    background: rgba(58, 106, 184, 0.09);
    border-color: rgba(58, 106, 184, 0.22);
}
.app:not(.dark) .trend-line,
.app:not(.dark) .trend-plot,
.app:not(.dark) .trend-plot-sv,
.app:not(.dark) .trend-plot-gaa,
.app:not(.dark) .trend-plot-gqa {
    background: rgba(26, 40, 64, 0.03);
    border-color: #d5dce8;
}
.app:not(.dark) .trend-gridline-svg {
    stroke: rgba(26, 40, 64, 0.09);
}
/* Trend chart dots — use series color as fill so they're visible on light bg */
.app:not(.dark) .trend-plot-sv .trend-dot {
    fill: #d08a34;
    stroke: #fff;
}
.app:not(.dark) .trend-plot-gaa .trend-dot {
    fill: #2b54d6;
    stroke: #fff;
}
.app:not(.dark) .trend-plot-gqa .trend-dot {
    fill: #1e9d65;
    stroke: #fff;
}

/* ── Dark mode ────────────────────────────────────────── */
.app.dark {
    background: var(--navy-deep);
    --ink: var(--brand-white);
    --muted: var(--brand-grey);
    --line: var(--brand-line);
    --surface: var(--navy-panel);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    --ice: #0c1e3d;
    --ice-bright: #3D7DFF;
    --blue: #3D7DFF;
    color: var(--brand-white);
}

.app.dark .tab {
    background: var(--navy-panel);
    border-color: rgba(61, 125, 255, 0.2);
    color: var(--brand-white);
}

.app.dark .icon-btn {
    background: var(--navy-panel);
    border-color: rgba(61, 125, 255, 0.2);
    color: var(--brand-white);
}

.app.dark .modal-divider {
    background: var(--brand-line);
}

.app.dark .manage-list li {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(61, 125, 255, 0.15);
}

.app.dark .goalie-control .button.ghost,
.app.dark .rink-flip .button.ghost {
    background: rgba(61, 125, 255, 0.12);
    color: var(--ice-bright);
    border-color: rgba(61, 125, 255, 0.25);
    box-shadow: none;
}

.app.dark .period-controls button {
    background: var(--navy-panel);
    border-color: rgba(61, 125, 255, 0.2);
    color: var(--brand-white);
}

.app.dark .sync-actions .button.ghost {
    background: rgba(61, 125, 255, 0.12);
    color: var(--ice-bright);
    border-color: rgba(61, 125, 255, 0.25);
}

.app.dark .net-panel {
    background: var(--navy-panel);
    border-color: rgba(61, 125, 255, 0.2);
}

.app.dark .net-panel > summary {
    background: rgba(61, 125, 255, 0.08);
    border-bottom-color: rgba(61, 125, 255, 0.15);
}

.app.dark .net-panel-title {
    color: var(--brand-white);
}

.app.dark .net-panel-status.active {
    color: #2dd4bf;
}

.app.dark .net-panel.inactive > summary {
    background: rgba(61, 125, 255, 0.04);
}

.app.dark .net-panel .surface-frame.net-frame {
    border-top-color: rgba(61, 125, 255, 0.15);
}

.app.dark .surface-frame {
    border-color: rgba(61, 125, 255, 0.18);
}

.app.dark .scoring-debug-output {
    background: rgba(15, 32, 56, 0.95);
    color: var(--brand-white);
    border-color: rgba(61, 125, 255, 0.18);
    box-shadow: none;
}

/* Filter collapsible — blue summary bar in dark mode (matches sort buttons) */
.app.dark .heatmap-preview-row td {
    background: rgba(0, 0, 0, 0.2) !important;
}
.app.dark .collapsible > summary {
    background: rgba(61, 125, 255, 0.22);
    color: var(--brand-white);
    border-bottom: 1px solid rgba(61, 125, 255, 0.15);
}
.app.dark .collapsible > summary::after {
    color: rgba(255, 255, 255, 0.6);
}

.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 72px);
}

.sidebar {
    background: var(--navy-deep);
    border-right: 1px solid var(--brand-line);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.nav-section {
    display: grid;
    gap: 4px;
}

.nav-section + .nav-section {
    padding-top: 16px;
    border-top: 1px solid var(--brand-line);
}

.nav-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--brand-grey);
    margin: 6px 8px 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--brand-white);
    font-weight: 600;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.nav-icon {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(61, 125, 255, 0.15);
    color: var(--ice-bright);
    flex: 0 0 auto;
}

.nav-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.nav-link:hover {
    background: rgba(61, 125, 255, 0.12);
    border-color: rgba(61, 125, 255, 0.25);
}

.nav-link.active {
    background: rgba(211, 32, 48, 0.18);
    border-color: rgba(211, 32, 48, 0.4);
    color: #fff;
}

.nav-link.active .nav-icon {
    background: rgba(211, 32, 48, 0.2);
    color: #f26370;
}

.content-area {
    padding: 24px clamp(20px, 4vw, 40px) 60px;
    overflow-x: hidden;
    background: var(--navy-deep);
}

.manage-body {
    padding: 20px clamp(20px, 4vw, 48px) 60px;
    display: grid;
    gap: 20px;
    background: var(--navy-deep);
}

.manage-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.manage-filter {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.manage-card {
    background: var(--navy-panel);
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(61, 125, 255, 0.12);
    border: 1px solid rgba(61, 125, 255, 0.18);
    border-top: 3px solid var(--ice-bright);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.page-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 20px;
    align-items: start;
}

.clubs-panel {
    grid-column: 1 / -1;
}

.panel {
    background: var(--navy-panel);
    border-radius: 20px;
    padding: 20px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(61, 125, 255, 0.12);
    border: 1px solid rgba(61, 125, 255, 0.18);
    border-top: 3px solid var(--ice-bright);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.panel-header .title-stack {
    display: flex;
    align-items: center;
    gap: 10px;
}

.season-badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.panel-stack {
    display: grid;
    gap: 20px;
}

.collapsible {
    border: 1px solid rgba(61, 125, 255, 0.25);
    border-radius: 16px;
    padding: 0;
    background: var(--navy-panel);
}

.collapsible > summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px;
    background: rgba(255,255,255,0.05);
    color: var(--brand-white);
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.collapsible > summary::-webkit-details-marker {
    display: none;
}

.collapsible > summary::after {
    content: "Open";
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.collapsible[open] > summary::after {
    content: "Close";
}

.collapsible-content {
    padding: 16px;
    border-top: 1px solid var(--brand-line);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table-scroll {
    overflow-x: auto;
}

.table-scroll .data-table {
    min-width: 900px;
}

.data-table th {
    text-align: left;
    color: var(--brand-grey);
    font-weight: 800;
    padding: 8px 10px;
    border-bottom: 1px solid var(--brand-line);
    background: rgba(0, 0, 0, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    font-family: var(--font-display);
}

.data-table td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--brand-line);
    color: var(--brand-grey);
}

.drag-handle-cell {
    width: 28px;
    text-align: center;
    color: #9aa7bf;
    cursor: grab;
}

.drag-handle {
    display: inline-block;
    font-size: 1rem;
    letter-spacing: -2px;
    user-select: none;
}

.data-table tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, 0.03);
}

.data-table tbody tr:nth-child(odd) td {
    background: transparent;
}

.data-table tr:hover {
    background: rgba(61, 125, 255, 0.12);
}

.data-table tr:hover td {
    background: transparent;
}

.data-table tbody tr.zone-child-row {
    background: rgba(0, 0, 0, 0.15);
}

.data-table tbody tr.zone-child-row td {
    color: var(--brand-grey);
    font-size: 0.86rem;
    padding-top: 7px;
    padding-bottom: 7px;
}

.zone-child-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-left: 14px;
}

.zone-child-label-save {
    padding-left: 12px;
}

.zone-child-label-goal {
    padding-left: 30px;
}

.data-table tbody tr.zone-child-row-save td {
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.zone-kind-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.68rem;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.zone-kind-pill-save {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
}

.zone-kind-pill-goal {
    background: rgba(211, 32, 48, 0.18);
    color: #ff6b7a;
}

.data-table tbody tr.row-clickable {
    cursor: pointer;
}

.data-table tbody tr.row-clickable td:last-child,
.data-table tbody tr.row-clickable .table-actions {
    cursor: default;
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.scheduled-load-actions {
    flex-wrap: wrap;
}

.scheduled-load-actions form {
    margin: 0;
}

.associated-cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.associated-display {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    min-height: 32px;
    gap: 8px;
}

.associated-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.associated-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.associated-club-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    cursor: pointer;
}

.associated-club-text {
    cursor: pointer;
    padding-right: 16px;
}

.associated-remove-form {
    position: absolute;
    top: -6px;
    right: -6px;
}

.associated-remove-btn {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(215, 38, 56, 0.3);
    background: rgba(215, 38, 56, 0.08);
    color: #b3192a;
    font-size: 0;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.associated-remove-btn svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.associated-add-btn {
    padding: 2px 8px;
    min-height: 24px;
    font-size: 0.75rem;
}

.inline-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(80px, 1fr));
    gap: 6px;
}

.color-form input[type="color"] {
    width: 44px;
    height: 36px;
    padding: 0;
    border: 1px solid #d7dde8;
    border-radius: 10px;
    background: #fff;
}

.color-form input[type="file"] {
    max-width: 200px;
}

.color-form input[type="text"] {
    min-width: 200px;
}

.color-select {
    min-width: 140px;
}

.roster-table td.name-cell {
    min-width: 220px;
    white-space: nowrap;
}

.name-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

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

.color-preview {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.team-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--swatch-color, #d72638);
    margin-right: 6px;
    border: 1px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.15);
    vertical-align: middle;
}

.palette-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.subtle {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 6px;
}

.metric-abbr {
    text-decoration: underline dotted rgba(71, 85, 105, 0.65);
    text-underline-offset: 2px;
    cursor: help;
    border-bottom: none;
}

.metric-abbr-tooltip {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 11000;
    display: none;
    max-width: 280px;
    background: rgba(15, 23, 42, 0.96);
    color: #f8fafc;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.75rem;
    line-height: 1.35;
    white-space: normal;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.28);
    pointer-events: none;
}

.icon-preview {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.icon-preview img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #d7dde8;
    background: #fff;
}

.icon-preview img.hidden {
    display: none;
}

.modal-divider {
    height: 1px;
    background: #e3e9f3;
    margin: 16px 0;
}

.icon-btn {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #d7dde8;
    background: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.panel-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.inline-form {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.inline-label input[type="url"] {
    min-width: 260px;
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--muted);
}

.icon-btn.danger {
    border-color: rgba(215, 38, 56, 0.3);
    background: rgba(215, 38, 56, 0.08);
    color: #b3192a;
}

.icon-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

button.pill {
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.pill.sort-btn {
    background: var(--ice-bright);
    color: #fff;
    border-color: var(--ice-bright);
}

.pill.sort-btn:hover {
    opacity: 0.88;
}

.pill.sort-btn.active {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45), 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sort-indicator {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.9);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.filter-actions .pill {
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 1rem;
}

.pill.ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--brand-grey);
}

.quick-toggle {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.quick-toggle button {
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.07);
    color: var(--brand-white);
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
}

.quick-toggle button.active {
    background: #1f4ad5;
    color: #fff;
    border-color: #1f4ad5;
    box-shadow: 0 8px 16px rgba(31, 74, 213, 0.18);
}

.toast {
    background: #111827;
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    font-weight: 700;
}

.toast-stack {
    position: fixed;
    top: 90px;
    right: 28px;
    display: grid;
    gap: 12px;
    z-index: 40;
}

.toast.success {
    background: #0f766e;
}

.toast.warning {
    background: #b45309;
}

.toast.error {
    background: #b91c1c;
}

.player-avatar {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: visible;
    background: rgba(61, 125, 255, 0.18);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: var(--brand-white);
    --badge-color: #d72638;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.player-avatar-xl {
    width: 220px;
    height: 220px;
}

.player-card {
    display: grid;
    grid-template-columns: 260px 1fr;
    align-items: center;
    gap: 24px;
}

.profile-name,
.profile-position {
    display: none;
}

.player-card-info h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 40px);
    letter-spacing: 0.08em;
}

.player-card-info {
    position: relative;
    padding-right: 320px;
}

.player-card-crest {
    position: absolute;
    top: 50%;
    right: 0;
    width: 280px;
    height: 280px;
    transform: translateY(-50%);
    display: block;
}

.player-card-crest img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.player-card-info h2 {
    margin: 0 0 6px;
    font-size: clamp(18px, 3vw, 26px);
    letter-spacing: 0.2em;
    color: var(--muted);
}

.player-position {
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin: 12px 0;
    font-size: 1.25rem;
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.player-avatar .avatar-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #eef2fb;
}

.badge-number {
    position: absolute;
    right: -6px;
    bottom: -6px;
    background: var(--badge-color);
    color: #fff;
    font-weight: 800;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 0.75rem;
    border: 2px solid #fff;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.25);
}

.player-avatar-xl .badge-number {
    right: -10px;
    bottom: -14px;
    padding: 14px 18px;
    font-size: 1.35rem;
    border-width: 4px;
}

.upload-avatar {
    cursor: pointer;
}

.upload-avatar:hover {
    box-shadow: 0 0 0 4px rgba(31, 74, 213, 0.2);
    transform: translateY(-1px);
}

.avatar-stack {
    display: grid;
    justify-items: center;
    gap: 6px;
}

.avatar-meta {
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #2a2f45;
}

.avatar-edit {
    display: flex;
    justify-content: center;
}

.avatar-upload-trigger {
    border: none;
    cursor: pointer;
}

.auth-shell {
    min-height: calc(100vh - 72px);
    display: grid;
    place-items: center;
}

.auth-card {
    background: var(--navy-panel);
    padding: 32px;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(61, 125, 255, 0.12);
    width: min(420px, 92vw);
    border: 1px solid rgba(61, 125, 255, 0.18);
    border-top: 3px solid var(--ice-bright);
}

.auth-card h2 {
    margin: 0 0 8px;
}

.auth-card form {
    margin-top: 16px;
    display: grid;
    gap: 16px;
}

.auth-local-form {
    margin-top: 14px;
    display: grid;
    gap: 12px;
}

.auth-trust-toggle {
    display: flex;
    gap: 8px;
    align-items: center;
    font-weight: 600;
    color: var(--brand-white);
}

.auth-trusted-list {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.auth-trusted-form {
    margin: 0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.auth-trusted-btn {
    width: 100%;
}

.auth-trusted-untrust-btn {
    white-space: nowrap;
    border-color: rgba(211, 32, 48, 0.4);
    color: #ff4a58;
    background: rgba(211, 32, 48, 0.12);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    background: var(--navy-panel);
    border-radius: 24px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(61, 125, 255, 0.18);
    border-top: 3px solid var(--ice-bright);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.7rem;
    color: var(--muted);
    margin: 0 0 6px;
}

.dashboard-card {
    text-decoration: none;
    color: var(--brand-white);
    background: var(--navy-panel);
    border-radius: 18px;
    padding: 18px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(61, 125, 255, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.15);
}

.dashboard-card h3 {
    margin: 0 0 8px;
}

.dashboard-card p {
    margin: 0;
    color: var(--muted);
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.team-card {
    background: var(--navy-panel);
    border-radius: 18px;
    padding: 16px;
    border: 1px solid rgba(61, 125, 255, 0.25);
    box-shadow: var(--shadow);
    display: grid;
    gap: 8px;
}

.team-title {
    font-weight: 700;
}

.team-sub {
    color: var(--muted);
    font-size: 0.9rem;
}

.team-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pill {
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(61, 125, 255, 0.12);
    color: var(--ice-bright);
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid rgba(61, 125, 255, 0.2);
    display: inline-block;
}

.pill.danger {
    background: var(--red);
    color: #fff;
    border-color: transparent;
}

.result-badge {
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.8rem;
    background: rgba(61, 125, 255, 0.18);
    color: var(--ice-bright);
}

.result-badge.w,
.result-badge.otw,
.result-badge.sow {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
}

.result-badge.l,
.result-badge.otl,
.result-badge.sol {
    background: rgba(211, 32, 48, 0.18);
    color: #ff6b7a;
}

.result-badge.ott,
.result-badge.sot {
    background: rgba(251, 191, 36, 0.18);
    color: #fbbf24;
}

.profile-hero {
    display: flex;
    gap: 20px;
    align-items: center;
}

.avatar {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(61, 125, 255, 0.18);
    display: grid;
    place-items: center;
    border: 3px solid rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-fallback {
    font-weight: 700;
    color: var(--brand-white);
}

.stat-badges {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.badge-group {
    display: inline-flex;
}

.badge {
    background: rgba(61, 125, 255, 0.15);
    color: var(--brand-white);
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(61, 125, 255, 0.2);
}

.badge-action {
    margin-left: 4px;
}

.badge-icon {
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(61, 125, 255, 0.3);
    background: transparent;
    color: var(--brand-white);
    display: grid;
    place-items: center;
}

.badge-icon.danger {
    border-color: rgba(215, 38, 56, 0.35);
    background: rgba(215, 38, 56, 0.14);
    color: #b3192a;
}

.badge-icon svg {
    width: 12px;
    height: 12px;
}

.badge-icon-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: contain;
}

.tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tooltip-text {
    padding-right: 4px;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(6px);
    background: #101a3a;
    color: #eef2ff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.18);
    z-index: 20;
}

.tooltip::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    transform: translateX(-50%) translateY(6px);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #101a3a transparent transparent transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 19;
}

.tooltip:hover::after,
.tooltip:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.player-card .stat-badges {
    margin-top: 16px;
    gap: 10px;
}

.leader-row {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.leader-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    flex: 0 0 44px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(61, 125, 255, 0.18);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: var(--brand-white);
}

.leader-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.stat-avatar {
    position: relative;
    width: 72px;
    height: 72px;
    min-width: 72px;
    min-height: 72px;
    flex: 0 0 72px;
    overflow: visible;
}

.stat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.stat-avatar-number {
    right: -5px;
    bottom: -5px;
    font-size: 0.62rem;
    padding: 2px 6px;
    line-height: 1;
    z-index: 2;
}

.stat-avatar .avatar-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(61, 125, 255, 0.18);
}

.leader-name {
    font-weight: 700;
}

.leader-team {
    color: var(--muted);
}

.leader-stat {
    font-weight: 600;
    text-align: right;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.tab {
    border: 1px solid #dfe6f2;
    background: #fff;
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
}

.tab.active {
    background: var(--blue);
    color: #fff;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 12px;
    border: 1px solid var(--brand-line);
}

.stat-card h4 {
    margin: 0 0 6px;
    color: var(--brand-grey);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-family: var(--font-display);
}

.stat-card p {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ice-bright);
}

.trend-line {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    height: 140px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--brand-line);
}

.trend-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.trend-header h3 {
    margin: 0;
}

.trend-summary {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.trend-summary-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid rgba(61, 125, 255, 0.3);
    background: rgba(61, 125, 255, 0.12);
    color: var(--brand-white);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 4px 10px;
}

.trend-summary-pill-above {
    background: #e6f7ed;
    border-color: #99d6ad;
    color: #0f6d33;
}

.trend-summary-pill-average {
    background: #fff9e6;
    border-color: #e9d18c;
    color: #7a661a;
}

.trend-summary-pill-below {
    background: #ffecef;
    border-color: #efb4be;
    color: #9a1f2e;
}

.trend-summary-pill-neutral {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #64748b;
}

.trend-chart-wrap {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
}

.trend-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 6px 0;
}

.trend-plot {
    position: relative;
    aspect-ratio: 2 / 1;
    height: auto;
    min-height: 300px;
    max-height: 500px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--brand-line);
    overflow: hidden;
}

.trend-plot-line {
    padding: 12px;
    width: min(100%, 1080px);
    justify-self: center;
}

.trend-plot-sv {
    background: rgba(0, 0, 0, 0.3);
}

.trend-plot-gaa {
    background: rgba(0, 0, 0, 0.3);
}

.trend-plot-gqa {
    background: rgba(0, 0, 0, 0.3);
}

.trend-line-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.trend-gridline-svg {
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 0.5;
}

.trend-peer-baseline-svg {
    stroke: #6d5ce8;
    stroke-width: 0.8;
    stroke-dasharray: 2.8 2.0;
}

.trend-series {
    fill: none;
    stroke-width: 0.95;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.trend-area {
    stroke: none;
    opacity: 0.16;
}

.trend-dot {
    stroke-width: 0.5;
    vector-effect: non-scaling-stroke;
}

.trend-dot-latest {
    stroke-width: 0.8;
}

.trend-plot-sv .trend-series {
    stroke: #d08a34;
}

.trend-plot-sv .trend-area {
    fill: #f4c184;
}

.trend-plot-sv .trend-dot {
    fill: #fff6e7;
    stroke: #d08a34;
}

.trend-plot-sv .trend-dot-latest {
    fill: #b87422;
    stroke: #ffffff;
}

.trend-plot-gaa .trend-series {
    stroke: #2b54d6;
}

.trend-plot-gaa .trend-area {
    fill: #a6bfff;
}

.trend-plot-gaa .trend-dot {
    fill: #eef3ff;
    stroke: #2b54d6;
}

.trend-plot-gaa .trend-dot-latest {
    fill: #2447b2;
    stroke: #ffffff;
}

.trend-plot-gqa .trend-series {
    stroke: #1e9d65;
}

.trend-plot-gqa .trend-area {
    fill: #9be4c1;
}

.trend-plot-gqa .trend-dot {
    fill: #ebfbf3;
    stroke: #1e9d65;
}

.trend-plot-gqa .trend-dot-latest {
    fill: #177a4f;
    stroke: #ffffff;
}

.trend-footnote {
    margin-top: 8px;
}

@media (max-width: 780px) {
    .trend-chart-wrap {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .trend-plot {
        aspect-ratio: 1.7 / 1;
        min-height: 220px;
        max-height: 340px;
    }

    .trend-plot-line {
        width: 100%;
    }
}

.trend-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.trend-icon {
    line-height: 1;
    font-weight: 800;
}

.trend-chip-up {
    color: #34d399;
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}

.trend-chip-up .trend-icon {
    color: #34d399;
}

.trend-chip-flat {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.3);
}

.trend-chip-down {
    color: #ff6b7a;
    background: rgba(211, 32, 48, 0.15);
    border-color: rgba(211, 32, 48, 0.3);
}

.trend-chip-down .trend-icon {
    color: #ff6b7a;
}

.peers-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.peers-chip-above {
    color: #34d399;
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
}

.peers-chip-average {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.3);
}

.peers-chip-below {
    color: #ff6b7a;
    background: rgba(211, 32, 48, 0.15);
    border-color: rgba(211, 32, 48, 0.3);
}

.peers-chip-neutral {
    color: var(--brand-grey);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
}

.compare-card {
    margin-top: 12px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: var(--brand-white);
}
.manage-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.manage-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #f8f9fc;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #e3e7f1;
}
.game-card {
    margin: 0;
    padding: 20px 24px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(219, 228, 244, 0.8);
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: stretch;
}

.game-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    flex: 1 1 100%;
}

.goalie-mode-fields {
    display: grid;
    gap: 8px;
}

.two-goalie-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 12px;
    grid-column: 1 / -1;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

input, select, textarea {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.10);
    color: var(--brand-white);
    box-shadow: none;
}

input::placeholder, textarea::placeholder {
    color: var(--brand-grey);
}

select[multiple] {
    min-height: 140px;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(31, 74, 213, 0.2);
    border-color: rgba(31, 74, 213, 0.5);
}

.game-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.game-actions button {
    border-radius: 10px;
    padding: 10px 16px;
    border: none;
    background: #111;
    color: #fff;
    cursor: pointer;
}

.game-actions .status {
    flex: 1 1 100%;
    order: -1;
}

.game-actions .ghost {
    background: #eef2ff;
    color: #1c2b6e;
    border: 1px solid #c9d6f8;
}

#startGameBtn {
    background: #1f4ad5;
    color: #fff;
}

#startGameBtn:disabled {
    background: #9fb3ef;
    color: #f4f7ff;
    cursor: not-allowed;
}

.game-badge {
    background: #0f766e;
    color: #fff;
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.7rem;
}

.game-badge.is-actionable {
    cursor: pointer;
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
}

.game-badge.is-actionable:focus {
    outline: 2px solid rgba(255, 255, 255, 0.9);
    outline-offset: 2px;
}

.hidden {
    display: none !important;
}

.game-complete {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    width: 100%;
}

.status {
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.4;
}

.toolbar {
    margin: 24px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.goalie-control {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--navy-panel);
    border-radius: 999px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(61, 125, 255, 0.2);
}

#twoGoalieToolbar {
    align-items: flex-start;
    flex-direction: column;
    border-radius: 20px;
}

.rink-flip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--navy-panel);
    border-radius: 999px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(61, 125, 255, 0.2);
}

.rink-flip .label {
    font-weight: 600;
    color: var(--muted);
}

.goalie-control .label {
    font-weight: 600;
    color: var(--muted);
}

.goalie-control .inline-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.goalie-badge-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 6px 8px;
    width: 100%;
}

.goalie-control .button.ghost,
.rink-flip .button.ghost {
    background: #eef2ff;
    color: #1c2b6e;
    border: 1px solid #c9d6f8;
    box-shadow: none;
}

.period-controls button {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #c7d6ff;
    background: #fff;
    cursor: pointer;
}

.legend {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 0.9rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    display: inline-block;
}

.dot.rink { background: #ff7d00; }
.dot.net { background: #2c6bed; }
.dot.miss { background: #d72638; }
.dot.trap { background: #2e7d32; }
.dot.control { background: #7bc96f; }
.dot.lost { background: #f6c343; }
.dot.goal { background: #d72638; }

#periods {
    display: grid;
    gap: 24px;
    padding: 24px 0 60px;
}

.period-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
}

.sync-card {
    margin: 16px 0 0;
    background: var(--navy-panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    display: grid;
    gap: 10px;
}

.sync-meta {
    font-weight: 600;
}

.sync-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sync-actions .button.ghost {
    background: #eef2ff;
    color: #1f4ad5;
    border: 1px solid rgba(31, 74, 213, 0.16);
}

.scoring-debug-panel {
    gap: 16px;
}

.scoring-debug-output {
    margin: 0;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid rgba(31, 74, 213, 0.18);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 247, 251, 0.94) 100%);
    color: #102244;
    font-size: 0.84rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.period-card header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.period-header-main {
    display: grid;
    gap: 6px;
}

.period-card h2 {
    margin: 0;
}

.period-meta-row {
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}

.period-meta {
    margin: 0;
    color: var(--muted);
}

.period-summary {
    display: flex;
    gap: 12px;
    font-weight: 600;
    align-items: center;
    flex-wrap: wrap;
}

.period-penalty-btn {
    padding: 8px 13px;
    font-size: 0.82rem;
    background: var(--blue);
    color: #fff;
    border: 1px solid var(--blue);
    box-shadow: none;
    margin-left: 18px;
    transform: translateY(-4px);
}

.period-body {
    display: grid;
    grid-template-columns: minmax(320px, 1.2fr) minmax(260px, 1fr);
    grid-auto-rows: auto;
    gap: 20px;
    align-items: start;
}

.surface {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.period-body .surface:nth-of-type(1) {
    grid-column: 1;
}

.period-body .surface:nth-of-type(2) {
    grid-column: 2;
}

.period-body .shot-list {
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: stretch;
}

.surface-title {
    font-weight: 600;
}

.dual-net-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.dual-rink-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.period-card.two-goalie-mode .dual-net-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
}

.period-card.two-goalie-mode .dual-rink-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
}

.period-card:not(.two-goalie-mode) .period-body {
    grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
    gap: 12px;
}

.period-card:not(.two-goalie-mode) .period-body .surface:nth-of-type(1),
.period-card:not(.two-goalie-mode) .period-body .surface:nth-of-type(2) {
    grid-row: 1;
}

.period-card:not(.two-goalie-mode) .period-body .surface:nth-of-type(1) {
    grid-column: 1;
}

.period-card:not(.two-goalie-mode) .period-body .surface:nth-of-type(2) {
    grid-column: 2;
}

.period-card:not(.two-goalie-mode) .period-body .shot-list {
    grid-column: 1 / -1;
    grid-row: 2;
}

.period-card:not(.two-goalie-mode) .period-body .surface {
    align-items: stretch;
}

.period-card:not(.two-goalie-mode) .dual-net-grid {
    width: 100%;
    max-width: none;
    margin-inline: 0;
}

.period-card:not(.two-goalie-mode) .dual-rink-grid {
    width: 100%;
    max-width: none;
    margin-inline: 0;
}

.net-lane {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rink-lane {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.net-panel-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rink-panel-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}


.net-panel {
    border: 1px solid rgba(61, 125, 255, 0.2);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.net-panel > summary {
    list-style: none;
    cursor: pointer;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #eef3ff;
    border-bottom: 1px solid #dce5ff;
}

.net-panel > summary::-webkit-details-marker {
    display: none;
}

.net-panel-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: #1f2f57;
}

.net-panel-status {
    font-size: 0.67rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 700;
}

.net-panel-status.active {
    color: #0f766e;
}

.net-panel-status.inactive {
    color: var(--muted);
}

.net-panel.inactive > summary {
    background: #f7f9ff;
}

.net-panel .surface-frame.net-frame {
    border: 0;
    border-top: 1px solid #dce5ff;
    border-radius: 0;
    min-height: 190px;
    height: 190px;
    margin: 0;
}

.net-panel.inactive .surface-frame.net-frame {
    pointer-events: none;
    opacity: 0.66;
    filter: saturate(0.9);
}

.net-lane-label {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--muted);
}

.rink-lane-label {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--muted);
}

.surface-frame {
    background: var(--ice);
    border-radius: 16px;
    border: 1px solid #dce5ff;
    min-height: 380px;
    height: 380px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    --surface-scale: 1;
    --surface-shift-x: 0%;
    --surface-shift-y: 0%;
}

.surface-frame .surface-svg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.surface-frame svg {
    width: 100%;
    height: 100%;
    display: block;
    transform: translate(var(--surface-shift-x), var(--surface-shift-y)) scale(var(--surface-scale));
    transform-origin: center;
}

.surface-frame svg text,
.surface-frame svg tspan {
    pointer-events: none;
    user-select: none;
}

.surface-frame.is-flipped svg {
    transform: translate(var(--surface-shift-x), var(--surface-shift-y)) scale(var(--surface-scale)) scaleY(-1);
}

.surface-frame.is-flipped svg text {
    transform-box: fill-box;
    transform-origin: center;
    transform: scaleY(-1);
}

.surface-frame[data-surface="rink"],
.surface-frame[data-surface="rink-away"] {
    --surface-scale: 1.12;
}

.surface-frame.single-half-scoring {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 300px;
    aspect-ratio: 170 / 176.45;
    margin-inline: 0;
    --surface-scale: 1.01;
}

.surface-frame.single-half-scoring svg {
    transform: translate(var(--surface-shift-x), var(--surface-shift-y)) scale(var(--surface-scale)) rotate(-90deg);
}

.surface-frame.single-half-scoring.is-flipped svg {
    transform: translate(var(--surface-shift-x), var(--surface-shift-y)) scale(var(--surface-scale)) scaleX(-1) rotate(-90deg);
}

.surface-frame.single-half-scoring.is-flipped svg text {
    transform-box: fill-box;
    transform-origin: center;
    transform: scaleX(-1);
}

.surface-frame[data-surface="net"] {
    --surface-scale: 1.2;
    --surface-shift-y: 4%;
}

.surface-frame.net-frame {
    min-height: 260px;
    height: 260px;
    --surface-scale: 1.2;
    --surface-shift-y: 4%;
}

.period-card:not(.two-goalie-mode) .net-lane-label {
    display: none;
}

.period-card:not(.two-goalie-mode) .rink-lane-label {
    display: none;
}

.period-card:not(.two-goalie-mode) .surface-frame.net-frame {
    width: 100%;
    max-width: 100%;
    min-height: 300px;
    height: auto;
    aspect-ratio: 11 / 9;
    background: var(--ice);
    border-color: #dce5ff;
    --surface-scale: 1.3;
    --surface-shift-y: 1%;
    margin-inline: 0;
}

.period-card:not(.two-goalie-mode) .net-panel .surface-frame.net-frame,
.period-card:not(.two-goalie-mode) .rink-panel .surface-frame {
    width: 100%;
    max-width: 100%;
    min-height: 320px;
    height: auto;
    aspect-ratio: 11 / 9;
    margin-inline: 0;
}

.period-card:not(.two-goalie-mode) .net-panel .surface-frame.net-frame {
    --surface-scale: 1.3;
    --surface-shift-y: 1%;
}

.period-card:not(.two-goalie-mode) .rink-panel .surface-frame {
    --surface-scale: 0.92;
    --surface-shift-y: 0%;
    --surface-shift-x: 0%;
}

.profile-heatmap-grid {
    grid-template-columns: minmax(340px, 1fr) minmax(340px, 1fr);
    gap: 14px;
}

.profile-heatmap-grid .surface {
    min-width: 0;
}

.profile-heatmap-frame {
    width: 100%;
    min-height: 500px;
    height: 500px;
    max-height: 500px;
    margin-inline: 0;
}

.profile-heatmap-frame.profile-heatmap-rink.single-half-scoring {
    min-height: 500px;
    height: 500px;
    max-height: 500px;
    aspect-ratio: auto;
    --surface-scale: 1.02;
    --surface-shift-x: 0%;
    --surface-shift-y: 4.2%;
}

.profile-heatmap-frame.profile-heatmap-net {
    --surface-scale: 1.46;
    --surface-shift-y: 3.4%;
}

.period-card.two-goalie-mode .surface-frame.net-frame {
    min-height: 205px;
    height: 205px;
}

.period-card.two-goalie-mode .rink-panel .surface-frame {
    min-height: 205px;
    height: 205px;
    --surface-scale: 0.96;
    --surface-shift-x: 0%;
    --surface-shift-y: 0%;
}

.period-card.two-goalie-mode [data-surface="net-home"],
.period-card.two-goalie-mode [data-surface="net-away"] {
    display: none;
}

.goalie-net-label {
    position: absolute;
    background: rgba(31, 74, 213, 0.92);
    color: #fff;
    border-radius: 999px;
    padding: 4px 9px;
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 6px 14px rgba(9, 18, 43, 0.18);
    pointer-events: none;
    z-index: 8;
}

.goalie-net-label.left {
    left: 14px;
    top: 50%;
    transform: translate(-50%, -50%);
}

.goalie-net-label.right {
    right: 14px;
    top: 50%;
    transform: translate(50%, -50%);
}

.goalie-net-label.single-half {
    left: 50%;
    top: 5.5%;
    transform: translate(-50%, -50%);
}

.surface-frame.single-half-scoring.is-flipped .goalie-net-label.single-half {
    top: auto;
    bottom: 5.5%;
    transform: translate(-50%, 50%);
}

.marker {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    transform: translate(-50%, -50%);
    border: 2px solid #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.marker.rink { background: #ff7d00; }
.marker.net { background: #2c6bed; }
.marker.miss { border-color: #d72638; }
.marker.outcome-TRAP { background: #2e7d32; }
.marker.outcome-CONTROL { background: #7bc96f; }
.marker.outcome-LOST { background: #f6c343; }
.marker.outcome-GOAL { background: #d72638; }

.shot-list {
    background: var(--ice);
    border-radius: 16px;
    padding: 12px;
    border: 1px solid #dce5ff;
    min-height: 380px;
    margin-top: 0;
}

.shot-list h3 {
    margin: 0 0 8px;
}

.shots {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
    max-height: 320px;
    overflow: auto;
}

.pending-shots {
    max-height: 220px;
    margin-top: 8px;
}

.sync-card .pending-shots li {
    border: 1px solid #e3e9f3;
}

.shots li {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.penalties {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
    max-height: 220px;
    overflow: auto;
}

.penalties li {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 8px;
    border: 1px solid var(--brand-line);
    cursor: pointer;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-card {
    background: var(--navy-panel);
    border-radius: 20px;
    padding: 20px;
    width: min(680px, 90vw);
    box-shadow: var(--shadow);
}

.manage-users-filter-form {
    margin: 10px 0 18px;
}

.manage-users-filter-form .filter-actions .primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.manage-users-clear-btn {
    background: #fff;
    color: var(--ink);
    border: 1px solid #d7dde8;
    box-shadow: none;
}

.manage-users-revoke-btn {
    background: #fff;
    color: var(--ink);
    border: 1px solid #d7dde8;
    box-shadow: none;
    padding: 8px 12px;
    border-radius: 10px;
}

.manage-users-panel .table-actions {
    white-space: nowrap;
}

.manage-users-panel .table-actions form {
    display: inline-flex;
}

.manage-users-panel .table-actions .icon-btn {
    text-decoration: none;
    color: inherit;
}

.manage-users-panel .data-table td {
    vertical-align: middle;
}

.manage-users-panel .data-table td[title] {
    max-width: 260px;
    overflow-wrap: anywhere;
}

.manage-users-modal-card {
    width: min(1400px, 96vw);
    max-height: 92vh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.manage-users-modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    border-bottom: 1px solid #e6e9f2;
    padding: 18px 24px;
}

.manage-users-modal-body {
    overflow: auto;
    padding: 18px 24px 20px;
    display: grid;
    gap: 16px;
}

.manage-users-section {
    border: 1px solid #e6e9f2;
    border-radius: 12px;
    padding: 14px;
    background: #fbfcff;
}

.manage-users-section h4 {
    margin: 0 0 10px;
}

.manage-users-edit-form {
    display: grid;
    gap: 14px;
}

.manage-users-team-filters {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    padding: 8px 10px;
    background: #f3f5fb;
    border-radius: 8px;
    border: 1px solid #e0e4f0;
}

.manage-users-team-filters label {
    font-size: 0.82rem;
    gap: 4px;
}

.manage-users-team-filters select {
    font-size: 0.82rem;
    padding: 5px 8px;
}

.manage-users-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.manage-users-modal-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 12px 0 2px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #e6e9f2;
}

.manage-users-inline-form {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.manage-users-inline-actions {
    display: flex;
    justify-content: flex-end;
}

.manage-users-invite-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    align-items: center;
}

.manage-users-invite-actions .primary {
    width: auto;
    min-width: 168px;
}

.manage-users-parent-picker {
    grid-column: 1 / -1;
    display: grid;
    gap: 8px;
    border: 1px solid #e6e9f2;
    border-radius: 12px;
    padding: 12px;
    background: #ffffff;
}

.manage-users-parent-picker h4 {
    margin: 0;
}

.manage-users-parent-search-row {
    display: flex;
    gap: 8px;
}

.manage-users-parent-results {
    display: grid;
    gap: 6px;
    max-height: 220px;
    overflow: auto;
    padding: 8px;
    border: 1px solid #d7dde8;
    border-radius: 10px;
    background: #f9fbff;
}

.manage-users-parent-result {
    width: 100%;
    text-align: left;
    border: 1px solid #d7dde8;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
    cursor: pointer;
}

.manage-users-parent-result.create {
    border-style: dashed;
    color: #1e3b94;
}

.manage-users-parent-selected {
    display: grid;
    gap: 6px;
}

.manage-users-parent-chip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    border: 1px solid #d7dde8;
    border-radius: 10px;
    padding: 8px 10px;
    background: #fff;
}

.manage-users-parent-chip .icon-btn {
    margin-left: auto;
}

#penaltyShotModal .penalty-shot-modal-card {
    width: min(980px, 94vw);
}

#reboundCaptureModal .rebound-capture-modal-card {
    width: min(980px, 94vw);
}

.penalty-shot-surfaces {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.rebound-capture-surfaces {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.penalty-shot-rink-frame {
    min-height: 320px;
    height: 320px;
    --surface-scale: 1.12;
}

.penalty-shot-rink-frame.single-half-scoring {
    height: auto;
    min-height: 320px;
}

.penalty-shot-net-frame {
    min-height: 320px;
    height: 320px;
    --surface-scale: 1.2;
    --surface-shift-y: 4%;
}

.rebound-capture-rink-frame {
    min-height: 320px;
    height: 320px;
    --surface-scale: 1.12;
}

.rebound-capture-rink-frame.single-half-scoring {
    height: auto;
    min-height: 320px;
}

.rebound-capture-net-frame {
    min-height: 320px;
    height: 320px;
    --surface-scale: 1.2;
    --surface-shift-y: 4%;
}

.rebound-capture-marker {
    z-index: 4;
}

.rebound-capture-marker.reference {
    background: rgba(31, 74, 167, 0.28);
    border-color: #1f4aa7;
    width: 16px;
    height: 16px;
}

.shots li.rebound-shot-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shots li.rebound-shot-row.rebound-depth-1,
.shots li.rebound-shot-row.rebound-depth-2,
.shots li.rebound-shot-row.rebound-depth-3,
.shots li.rebound-shot-row.rebound-depth-4 {
    padding-left: 12px;
}

.shots .rebound-shot-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid #d4def6;
    background: #eef4ff;
    color: #1f4aa7;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.shots .rebound-shot-text {
    flex: 1;
    min-width: 0;
}

.shots li.rebound-parent-lock {
    opacity: 0.9;
}

.shots li.rebound-chain-root .rebound-shot-text::after {
    content: " (chain root)";
    color: var(--muted);
    font-size: 0.8em;
}

.modal-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-card header button {
    border: none;
    background: transparent;
    font-weight: 600;
    cursor: pointer;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.form-section-heading {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 10px 0 2px;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
}

.form-grid .checkbox-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.form-grid .checkbox-row input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.form-grid .situation-fieldset {
    border: 0;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.form-grid .situation-fieldset legend {
    width: 100%;
    font-weight: 800;
    padding: 0;
    margin-bottom: 2px;
}

.form-grid .situation-option {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid #d7dde8;
    background: #ffffff;
    font-weight: 700;
    font-family: "IBM Plex Mono", "Menlo", "Consolas", monospace;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
    box-shadow: 0 10px 24px rgba(10, 18, 32, 0.06);
}

.form-grid .situation-option input[type="radio"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.form-grid .situation-option span {
    position: relative;
    z-index: 1;
}

.form-grid .situation-option:has(input[type="radio"]:checked) {
    border-color: #2f5bdf;
    background: #eef2ff;
    color: #2f5bdf;
}

.form-grid .situation-option:has(input[type="radio"]:focus-visible) {
    outline: 2px solid rgba(47, 91, 223, 0.28);
    outline-offset: 2px;
}

.form-grid .situation-option.is-disabled {
    opacity: 0.55;
}

.form-grid input,
.form-grid select {
    width: 100%;
}

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

.clock-adjust-btn,
.clock-quick-btn {
    border: 1px solid #d7dde8;
    border-radius: 999px;
    background: #fff;
    color: #1f2937;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 6px 12px;
    cursor: pointer;
}

.clock-adjust-btn:hover,
.clock-quick-btn:hover {
    border-color: #2f5bdf;
    color: #2f5bdf;
}

.clock-quick-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hidden-opponent-select {
    display: none;
}

.time-spinner-wrap {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #d6deea;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.time-spinner-select {
    flex: 1;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    padding: 12px 8px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.time-spinner-select:focus {
    outline: none;
    background: rgba(31, 74, 213, 0.05);
}

.time-spinner-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.time-spinner-sep {
    font-size: 1.2rem;
    font-weight: 800;
    color: #1f2937;
    padding: 0 2px;
    pointer-events: none;
    user-select: none;
}

.form-grid .time-spinner-wrap {
    width: 100%;
}

#loadScheduledModal .load-scheduled-modal-card {
    width: min(840px, 92vw);
}

#scheduleGameModal .modal-card {
    width: min(980px, 94vw);
}

#scheduleGameModal .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

#scheduleGameModal .form-grid .modal-actions,
#scheduleGameModal .form-grid .form-section-heading,
#scheduleGameModal .form-grid .schedule-full-width {
    grid-column: 1 / -1;
}

#loadScheduledModal .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    column-gap: 18px;
}

#loadScheduledModal .load-scheduled-game-field {
    grid-column: 1;
}

#loadScheduledModal .load-scheduled-team-field {
    grid-column: 2;
}

#loadScheduledModal .load-scheduled-game-field select,
#loadScheduledModal .load-scheduled-team-field select {
    min-width: 0;
    width: 100%;
}

#loadScheduledModal .load-scheduled-team-field .sub {
    margin-top: 6px;
    min-height: 2.6em;
    line-height: 1.2;
}

#loadScheduledModal #scheduledGameMeta {
    font-size: 0.98rem;
}

@media (max-width: 880px) {
    .player-card-info {
        padding-right: 0;
    }

    .player-card-crest {
        position: static;
        margin: 0 0 8px auto;
        width: 150px;
        height: 150px;
        transform: none;
    }

    #loadScheduledModal .form-grid {
        grid-template-columns: 1fr;
    }

    #loadScheduledModal .load-scheduled-game-field,
    #loadScheduledModal .load-scheduled-team-field {
        grid-column: 1;
    }

    .penalty-shot-surfaces {
        grid-template-columns: 1fr;
    }

    .penalty-shot-rink-frame,
    .penalty-shot-net-frame {
        min-height: 260px;
        height: 260px;
    }

    .manage-users-form-grid {
        grid-template-columns: 1fr;
    }

    .manage-users-inline-form {
        grid-template-columns: 1fr;
    }

    .manage-users-modal-actions {
        flex-direction: column;
    }
}

.color-input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid #d7dde8;
    background: var(--swatch-color, transparent);
    padding: 0;
    cursor: pointer;
}

.color-swatch.is-empty {
    background: transparent;
}

.native-color-picker {
    display: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

.primary {
    display: inline-block;
    background: var(--red);
    color: #fff;
    text-decoration: none;
    border: none;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-family: var(--font-body);
    box-shadow: 0 8px 20px rgba(211, 32, 48, 0.25);
    transition: background 0.15s;
}

.primary:hover {
    background: var(--accent-dark);
}

.auth-google-btn {
    margin-top: 12px;
}

.danger {
    background: #d72638;
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
}

.secondary {
    background: #ffffff;
    color: var(--blue-dark);
    border: 1px solid #d7dde8;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
}

.stacked-form {
    display: grid;
    gap: 18px;
}

.form-section {
    padding: 16px;
    border-radius: 16px;
    background: #f9fbff;
    border: 1px solid #e2e8f4;
}

.form-section h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.stacked-form p {
    margin: 0 0 12px;
}

.stacked-form p label {
    font-weight: 600;
}

.form-actions {
    display: flex;
    justify-content: flex-start;
}

.manage-list li {
    background: #f8f9fc;
    border: 1px solid #e3e7f1;
}

@media (max-width: 980px) {
    .period-body {
        grid-template-columns: 1fr;
    }

    .period-body .surface:nth-of-type(1) {
        grid-column: 1;
    }

    .period-body .surface:nth-of-type(2) {
        grid-column: 1;
    }

    .period-body .shot-list {
        grid-column: 1;
        grid-row: auto;
    }

    .profile-heatmap-frame,
    .profile-heatmap-frame.profile-heatmap-rink.single-half-scoring {
        min-height: 380px;
        height: 380px;
        max-height: 380px;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: sticky;
        top: 72px;
        z-index: 10;
        border-right: none;
        border-bottom: 1px solid var(--brand-line);
        flex-direction: row;
        overflow-x: auto;
    }

    .nav-section {
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        gap: 10px;
    }

    .page-grid {
        grid-template-columns: 1fr;
    }
}
