:root {
    /* Brand */
    --color-brand: #3d8b5e;
    --color-brand-dark: #2d6b47;
    --color-brand-light: #f0fdf4;
    --color-brand-accent: #ea580c;

    /* Status */
    --color-success: #16a34a;
    --color-danger: #dc2626;
    --color-warn: #d97706;

    /* Text — all foreground colours below pass WCAG AA on white */
    --color-text: #0f172a;
    --color-text-muted: #475569;
    --color-text-subtle: #64748b;
    --color-text-on-brand: #ffffff;
    --color-text-on-brand-soft: #ecfdf5;

    /* Surfaces */
    --color-bg: #f0f4f8;
    --color-surface: #ffffff;
    --color-surface-alt: #f8fafc;
    --color-border: #e2e8f0;
    --color-border-strong: #cbd5e1;
    --color-border-faint: #f1f5f9;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 14px;

    /* Spacing scale (4-px base) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.22), 0 4px 16px rgba(0, 0, 0, 0.10);
}

body { font-family: 'Inter', sans-serif; background-color: var(--color-bg); }
.modal { display: none; position: fixed; z-index: 100; left: 0; top: 0; width: 100%; height: 100%; overflow: hidden; background-color: rgba(0,0,0,0.45); align-items: center; justify-content: center; }
.modal-content { background-color: #fff; border-radius: 14px; width: 92%; max-width: 600px; box-shadow: 0 24px 64px rgba(0,0,0,0.22), 0 4px 16px rgba(0,0,0,0.10); max-height: 90dvh; overflow: hidden; display: flex; flex-direction: column; animation: modalSlideIn 160ms cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes modalSlideIn { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.125rem 1.5rem; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; background: #fff; border-radius: 14px 14px 0 0; z-index: 1; flex-shrink: 0; }
.modal-header h3, .modal-header h4 { margin: 0; line-height: 1.4; }
.modal-body { padding: 1.25rem 1.5rem 1.5rem; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.modal-close-btn { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 2rem; height: 2rem; border-radius: 50%; border: none; background: transparent; color: #94a3b8; cursor: pointer; font-size: 0.95rem; transition: background 0.15s, color 0.15s; }
.modal-close-btn:hover { background: #f1f5f9; color: #475569; }
.google-signin-btn { background: #fff; border: 1px solid #dadce0; color: #3c4043; font-weight: 500; gap: 8px; padding: 10px 16px; }
.google-signin-btn:hover { background: #f8f9fa; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.modal-alert-icon { width: 3.5rem; height: 3.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin: 0 auto 1rem; }
.modal-alert-icon.icon-success { background: #dcfce7; color: #16a34a; }
.modal-alert-icon.icon-error   { background: #fee2e2; color: #dc2626; }
.modal-alert-icon.icon-warning { background: #fef9c3; color: #ca8a04; }
.modal-alert-icon.icon-info    { background: #dbeafe; color: #2563eb; }

/* === Skip navigation (WCAG 2.1 G1) === */
.skip-nav-link {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 9999;
    padding: 0.75rem 1.25rem;
    background: var(--color-brand);
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 0 0 8px 0;
    text-decoration: none;
    transition: top 0.1s;
}
.skip-nav-link:focus { top: 0; }

/* === Shared form field system ===
   .form-control / .form-label are the canonical input + label styles used by
   every form in the app. Modal forms get the same look automatically via the
   .modal-body element selectors below, so dynamically-injected inputs (and the
   member/family modals, which use bare <input>/<label>) stay consistent without
   needing the class. Standalone forms (Settings, manager-email row) opt in with
   the explicit .form-control / .form-label classes. */
.form-label,
.modal-body label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}
.form-control,
.modal-body input:not([type="checkbox"]):not([type="radio"]),
.modal-body select,
.modal-body textarea {
    display: block;
    width: 100%;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    color: var(--color-text);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus,
.modal-body input:not([type="checkbox"]):not([type="radio"]):focus,
.modal-body select:focus,
.modal-body textarea:focus {
    outline: 2px solid var(--color-brand);
    outline-offset: 1px;
    border-color: var(--color-brand);
}
/* Selects: drop the native menulist-button chrome (from the global select
   rule) and draw a consistent caret so they match the other controls.
   Scoped to selects only — leaves date/time inputs' native pickers intact. */
select.form-control,
.modal-body select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
    padding-right: 2rem;
}
.form-control::placeholder,
.modal-body input::placeholder,
.modal-body textarea::placeholder { color: var(--color-text-subtle); }
textarea.form-control,
.modal-body textarea { resize: vertical; }
.modal-section-hr { border: none; border-top: 1px solid #f1f5f9; margin: 1rem 0 1.25rem; }
/* Modal form sections — When / Who / Where / Notes / Result / Cancel.
   First section sits flush; subsequent sections get a divider + uppercase label. */
.modal-section { padding-top: 0; margin-top: 0; border-top: none; }
.modal-section + .modal-section {
    padding-top: 1.1rem;
    margin-top: 1.1rem;
    border-top: 1px solid var(--color-border);
}
.modal-section-head {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--color-text-subtle);
    margin-bottom: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.modal-section-head i {
    color: var(--color-text-subtle);
    opacity: 0.9;
    font-size: 0.85em;
}
.form-label-hint {
    font-weight: 500;
    color: var(--color-text-subtle);
}
.form-help {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}
.modal-cancel-link { display: block; width: 100%; background: none; border: none; color: var(--color-text-subtle); font-size: 0.875rem; cursor: pointer; padding: 0.5rem; text-align: center; transition: color 0.15s; }
.modal-cancel-link:hover { color: var(--color-text-muted); }
.modal-content-sm { max-width: 24rem; }
.modal-content-md { max-width: 480px; }
.modal-alert-body { text-align: center; padding-top: 2rem; padding-bottom: 2rem; }
.modal-form-actions { display: flex; justify-content: flex-end; gap: 0.5rem; padding-top: 0.5rem; border-top: 1px solid #f3f4f6; flex-wrap: wrap; }
.modal-manager-section { border-top: 1px solid #e2e8f0; margin-top: 1.5rem; padding-top: 1.25rem; }
.modal-manager-section-head { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #64748b; margin-bottom: 0.375rem; }
.char-counter { font-size: 0.75rem; color: #9ca3af; text-align: right; margin-top: 0.25rem; }
.char-counter.near-limit { color: #ef4444; }

/* Confirm-style alert with two buttons */
.modal-alert-actions { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; }
.modal-alert-actions .btn { min-width: 6rem; }

/* Member modal: type-picker radio options */
.form-section-label { display: block; font-size: 0.8125rem; font-weight: 600; color: #475569; margin-bottom: 0.5rem; }
.member-type-options { display: flex; flex-direction: column; gap: 0.5rem; }
label.member-type-option {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.75rem; border: 1px solid #cbd5e1; border-radius: 8px;
    cursor: pointer; margin-bottom: 0;
    font-weight: normal; color: inherit; font-size: inherit;
    transition: background 0.15s, border-color 0.15s;
}
label.member-type-option:hover { background: #f8fafc; }
label.member-type-option:has(input:checked) { border-color: #3d8b5e; background: #f0fdf4; }
.member-type-option input[type="radio"] { margin-top: 0.2rem; flex-shrink: 0; }
.member-type-option-text { flex: 1; }
.member-type-option-label { font-weight: 600; font-size: 0.9rem; color: #0f172a; }
.member-type-option-desc { font-size: 0.8rem; color: #64748b; margin-top: 0.1rem; }

/* Member list rows */
.member-row { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9; }
.member-row:last-child { border-bottom: none; }
.member-row-main { display: flex; align-items: center; gap: 0.625rem; flex: 1; min-width: 0; flex-wrap: wrap; }
.member-name { font-weight: 600; color: #0f172a; }
.member-row-actions { display: flex; gap: 0.375rem; flex-shrink: 0; }
.member-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 6px; border: none;
    background: transparent; color: #94a3b8; cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.member-edit-btn:hover { background: #eff6ff; color: #2563eb; }
.member-delete-btn:hover { background: #fef2f2; color: #dc2626; }
.add-player-btn { color: #3d8b5e; }
.add-player-btn:hover { background: #f0fdf4; color: #166534; }

/* Member-type chips */
.member-type-chip {
    display: inline-flex; align-items: center;
    padding: 2px 8px; border-radius: 9999px;
    font-size: 0.7rem; font-weight: 600;
    letter-spacing: 0.04em; text-transform: uppercase;
    white-space: nowrap;
}
.member-type-player     { background: #ffedd5; color: #9a3412; }
.member-type-individual { background: #dbeafe; color: #1e40af; }
.member-family-chip {
    display: inline-flex; align-items: center;
    padding: 2px 8px; border-radius: 9999px;
    font-size: 0.7rem; font-weight: 500;
    background: #f1f5f9; color: #475569;
    white-space: nowrap;
    border: none; cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.member-family-chip:hover { background: #e2e8f0; color: #1e293b; }

/* Member type group headers in the list */
.member-group-head {
    padding: 0.5rem 1rem; font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--color-text-subtle); background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border-faint);
}

/* Family card — nested family + players block in the Members tab */
.family-block { border-bottom: 1px solid #f1f5f9; }
.family-block:last-child { border-bottom: none; }
.family-block-head {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1rem; background: #f8fafc;
}
.family-block-head .family-name {
    font-weight: 600; color: #0f172a; flex: 1; min-width: 0;
}
.family-player-count {
    font-size: 0.7rem; color: var(--color-text-subtle); white-space: nowrap;
}
.family-block-players { padding: 0.25rem 0; }
.family-block-player {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border-top: 1px dashed #f1f5f9;
}
.family-block-player:first-child { border-top: none; }
.family-block-player .member-name { flex: 1; min-width: 0; }
.family-block-empty {
    padding: 0.5rem 1rem 0.75rem 2.25rem;
    font-size: 0.8rem; color: var(--color-text-subtle); font-style: italic;
}

/* Single-player family: flat row, no indentation or group header */
.family-block--flat { }
.family-block-player--flat {
    padding: 0.625rem 1rem;
    border-top: none;
}
.family-block-player--flat .member-name { flex: 1; min-width: 0; }

@media (max-width: 480px) {
    .member-row { gap: 0.5rem; padding: 0.625rem 0.75rem; }
    .family-block-head { padding: 0.625rem 0.75rem; gap: 0.5rem; }
    .family-block-player { padding: 0.4rem 0.75rem 0.4rem 1.5rem; gap: 0.5rem; }
    .family-block-player--flat { padding: 0.4rem 0.75rem; }
    .family-block-empty { padding-left: 1.5rem; padding-right: 0.75rem; }
}

@media (max-width: 768px) {
    #customAlertOkButton { width: 100%; }
    .modal-email-row { flex-direction: column; }
    .modal-email-row .btn { width: 100%; }
}
@media (max-width: 480px) {
    .modal-form-actions { flex-direction: column; }
    .modal-form-actions .btn { width: 100%; justify-content: center; }
    /* Stacked order: primary CTA first, secondary/cancel last */
    .modal-form-actions .btn-primary { order: 1; }
    .modal-form-actions .btn-outline-primary { order: 2; }
    .modal-form-actions .btn-secondary { order: 3; }
    .modal-alert-actions { flex-direction: column; width: 100%; }
    .modal-alert-actions .btn { width: 100%; }
    .modal-alert-actions .btn-primary,
    .modal-alert-actions .btn-danger { order: 1; }
    .modal-alert-actions .btn-secondary { order: 2; }
}

.manager-only, .admin-tab-content { display: none; }
.table-header { background-color: #e2e8f0; }
.btn { padding: 8px 16px; border-radius: 6px; font-weight: 500; transition: all 0.2s; cursor: pointer; border: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn i { margin-right: 0; }
.btn-icon { padding: 6px 8px; }
.btn-primary { background-color: #3d8b5e; color: white; } .btn-primary:hover { background-color: #2d6b47; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.15); }
.btn-secondary { background-color: #6b7280; color: white; } .btn-secondary:hover { background-color: #4b5563; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.segmented-control { display: inline-flex; border: 1px solid #d1d5db; border-radius: 8px; overflow: hidden; }
.seg-btn { padding: 6px 14px; font-size: 0.875rem; font-weight: 500; background: white; color: #6b7280; border: none; border-right: 1px solid #d1d5db; cursor: pointer; white-space: nowrap; transition: background 0.2s, color 0.2s; }
.seg-btn:last-child { border-right: none; }
.seg-btn-active { background: #3d8b5e; color: white; }
.seg-btn:hover:not(.seg-btn-active) { background: #f0f7f4; color: #3d8b5e; }
.filter-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px 5px 10px; border-radius: 9999px; font-size: 0.875rem; font-weight: 500; background: white; color: #6b7280; border: 1px solid #d1d5db; cursor: pointer; transition: background 0.2s, color 0.2s, border-color 0.2s; white-space: nowrap; }
.filter-chip:hover:not(.filter-chip-active) { background: #f0f7f4; color: #3d8b5e; border-color: #3d8b5e; }
.filter-chip .filter-chip-check { display: none; font-size: 0.75rem; }
.filter-chip-active { background: #ecfdf5; color: #3d8b5e; border-color: #3d8b5e; }
.filter-chip-active .filter-chip-check { display: inline; }
.filter-chip-active:hover { background: #d1fae5; }
.btn-danger { background-color: #ef4444; color: white; } .btn-danger:hover { background-color: #dc2626; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.btn-success { background-color: #22c55e; color: white; } .btn-success:hover { background-color: #16a34a; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
::-webkit-scrollbar { width: 8px; } ::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #888; border-radius: 10px; } ::-webkit-scrollbar-thumb:hover { background: #555; }
select { -webkit-appearance: menulist-button; -moz-appearance: menulist-button; appearance: menulist-button; background-color: white; border: 1px solid #ccc; padding: 0.5rem; border-radius: 0.375rem; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.greyed-out-option { color: #9ca3af; background-color: #f3f4f6; }

/* Bar chart styles */
.bar-chart-container { padding: 0.5rem; }
.bar-chart-row { display: flex; align-items: center; margin-bottom: 8px; }
.bar-chart-label { width: 30%; min-width: 100px; font-size: 0.9rem; }
.bar-chart-bar-container { flex-grow: 1; background-color: #f1f5f9; border-radius: 4px; margin: 0 8px; overflow: hidden; }
.bar-chart-bar { height: 24px; background-color: #3d8b5e; border-radius: 4px 0 0 4px; transition: width 0.5s ease; }
.bar-chart-value { width: 40px; text-align: right; font-size: 0.9rem; font-weight: 600; }

/* Status indicator */
.status-indicator { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 16px; font-size: 0.825rem; background-color: #f0f4f8; }
.status-indicator i { margin-right: 0; font-size: 0.75rem; }
.status-indicator.synced { background-color: #dcfce7; color: #166534; }
.status-indicator.error { background-color: #fee2e2; color: #b91c1c; }
.status-indicator.loading { background-color: #dbeafe; color: #1d4ed8; }
.btn-status-retry {
    background: transparent;
    border: 1px solid currentColor;
    color: inherit;
    padding: 2px 8px;
    margin-left: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-status-retry:hover { background: rgba(0, 0, 0, 0.05); }

/* === Skeleton loading placeholders ===
   Shown on first paint of Home / Schedule / Stats while Firestore data is in
   flight, so the page reads as "loading" instead of blank. Driven by
   `body.app-loading`, which is set in the initial HTML and removed once the
   first Firestore snapshot arrives (or replaced with `body.app-error` on
   load failure). */
@keyframes skeleton-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton-line {
    display: block;
    height: 0.9rem;
    border-radius: 4px;
    margin-bottom: 0.45rem;
    background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
.skeleton-line.lg { height: 1.5rem; }
.skeleton-line.sm { height: 0.65rem; }
.skeleton-line.w-25 { width: 25%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-90 { width: 90%; }

.tab-skeleton { display: none; }
.schedule-skeleton-row { display: none; }
body.app-loading .tab-skeleton { display: block; }
body.app-loading .schedule-skeleton-row { display: table-row; }
body.app-loading .schedule-skeleton-row td { padding: 0.75rem 1rem; border-bottom: 1px solid #e5e7eb; }

/* While loading, suppress the gray "No ... yet" empty-state messages so they
   don't flash through the skeleton before real data lands. Everything else
   (Next Up card, table rows, stats lists) is already empty/.hidden on first
   paint, so the skeleton naturally sits in front of it. */
body.app-loading #noNextGameMessage,
body.app-loading #noFullGamesMessage,
body.app-loading #statsContent .stats-empty-msg { display: none !important; }

/* =====================================================
   App shell — top navbar
   ===================================================== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}
.app-header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}
.header-emoji { font-size: 1.875rem; line-height: 1; }
.header-logo { height: 2.5rem; width: 2.5rem; object-fit: cover; border-radius: 50%; }
.header-name { font-size: 1.5rem; font-weight: 700; color: #ea580c; line-height: 1.1; }
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
}

/* Desktop nav links */
#tabsNav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    justify-content: center;
}
.tab-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.8rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.tab-button i { margin-right: 0; }
.tab-button:hover:not(.active) { background: #f3f4f6; color: #374151; }
.tab-button.active { background: #f0fdf4; color: #2d6b47; font-weight: 600; }

/* Main content container */
#mainContent {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.25rem 1rem;
}
@media (min-width: 769px) {
    #mainContent { padding: 1.5rem; }
}

/* Card styles */
/* === Card system ===
   All three card shells (.card, .stats-card, .nu-card) share one chrome —
   surface, faint border, large radius, soft shadow — so every screen reads as
   the same design language. They differ only in their padding model: .card
   pads its own content and uses a divider header; .stats-card and .nu-card are
   edge-to-edge overflow-hidden shells whose children manage their own padding. */
.card,
.stats-card,
.nu-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-faint);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}
.card {
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border-faint);
}
.card.card-collapsed {
    padding: var(--space-3) var(--space-4);
}
.card.card-collapsed .card-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* Table improvements */
table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}
tr:hover td {
    background-color: var(--color-brand-light);
}

/* === Sticky headers + first column (desktop only) ===
   The wide Availability (families × games) and Schedule tables are hard to read
   once scrolled: you lose the column headings and the date column. On desktop we
   let the .sticky-scroll wrapper own the scroll + clip context (the table's own
   `overflow:hidden` is reset so sticky resolves against the wrapper, not the
   table) and pin the header row to the top and the date column to the left.
   Mobile is untouched — those tables switch to card layouts below 769px. */
@media (min-width: 769px) {
    .sticky-scroll {
        max-height: calc(100vh - 220px);
        overflow: auto;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    /* Hand the rounded/clipping chrome to the wrapper so the table is no longer a
       scroll container — otherwise sticky would resolve against the table itself. */
    .sticky-scroll table {
        overflow: visible;
        border-radius: 0;
        box-shadow: none;
    }

    /* Column headers pinned to the top of the scroll box */
    .sticky-scroll thead th {
        position: sticky;
        top: 0;
        z-index: 2;
    }
    #fullGamesTable thead th { background-color: #e2e8f0; }      /* matches .table-header */
    #availabilityTable thead th { background-color: #f9fafb; }   /* matches thead bg-gray-50 */

    /* Date column pinned to the left. Needs an opaque background so scrolled
       content doesn't bleed through; overrides the existing transparent rule. */
    #fullGamesTable tbody td:first-child,
    #availabilityTable tbody td.game-date-header-mobile {
        position: sticky;
        left: 0;
        z-index: 1;
        background-color: var(--color-surface);
    }

    /* Top-left corner sits above both the header row and the date column */
    .sticky-scroll thead th:first-child {
        left: 0;
        z-index: 3;
    }

    /* Keep the row-hover tint on the pinned date cell */
    #fullGamesTable tbody tr:hover td:first-child,
    #availabilityTable tbody tr:hover td.game-date-header-mobile {
        background-color: var(--color-brand-light);
    }
}

/* === Rosters layout (Oranges + Goalkeepers) ===
   Mobile: a single stacked column — Queue (mgr) → Chart → Games — with the
   Duty Tracker chart collapsible (collapsed by default) so the Games list
   ("when am I next?") isn't pushed down by a count chart that's a curiosity
   for most parents.
   Desktop: two columns like the Stats page — the narrow column holds Queue +
   Chart, the wide column holds Games — so chart and games are visible at once
   and the chart never needs collapsing (it's always shown, no chevron). */
.roster-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.roster-col-narrow,
.roster-col-wide {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0; /* let table columns shrink/scroll instead of overflowing the grid */
}

.roster-chart-chevron {
    color: #9ca3af;
    transition: transform 0.2s ease;
    font-size: 0.85rem;
}

/* Mobile: single stacked column, chart is a collapsible card, and the
   (manager-only) rotation queue drops to the very bottom — below Games.
   Collapsing the column wrappers with display:contents promotes the chart,
   games and queue cards to direct flex children of .roster-layout so `order`
   can sequence them across what are separate columns on desktop. */
@media (max-width: 768px) {
    .roster-col-narrow,
    .roster-col-wide { display: contents; }
    .roster-chart-card { order: 1; }
    .roster-area-games { order: 2; }
    .roster-area-queue { order: 3; }

    .roster-chart-head {
        cursor: pointer;
        user-select: none;
    }
    .roster-chart-card.collapsed .roster-chart-body { display: none; }
    .roster-chart-card.collapsed .roster-chart-chevron { transform: rotate(-90deg); }
    .roster-chart-card.collapsed .roster-chart-head {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }
}

/* Desktop: two-column layout; chart always expanded, no chevron / not clickable */
@media (min-width: 769px) {
    .roster-layout {
        display: grid;
        grid-template-columns: minmax(300px, 1fr) 1.9fr;
        align-items: start;
    }
    .roster-chart-chevron { display: none; }
    .roster-chart-head { cursor: default; }
    .roster-chart-body { display: block !important; }
}

/* No Game styling */
.no-game-badge {
    display: inline-block;
    padding: 2px 8px;
    background-color: #f3f4f6;
    color: #6b7280;
    border-radius: 4px;
    font-size: 0.825rem;
    font-style: italic;
}

.btn-sm { padding: 4px 8px; font-size: 0.75rem; }

/* Schedule table inline action buttons */
.edit-game-btn {
    font-size: 0.8rem;
    font-weight: 600;
    color: #3d8b5e;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.edit-game-btn:hover { background: #f0fdf4; color: #166534; }
.delete-game-btn {
    font-size: 0.8rem;
    font-weight: 600;
    color: #ef4444;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.delete-game-btn:hover { background: #fef2f2; color: #b91c1c; }
.duplicate-game-btn {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.duplicate-game-btn:hover { background: #f1f5f9; color: #334155; }
/* Desktop: icon-only action buttons (labels via title tooltip + aria-label).
   The visible text is restored on mobile, where the expanded card has room. */
.schedule-actions-cell .action-label { display: none; }

/* Focus styles for keyboard navigation */
.tab-button:focus-visible {
    outline: 2px solid #3d8b5e;
    outline-offset: -2px;
    border-radius: 6px;
}
.btn:focus-visible {
    outline: 2px solid #3d8b5e;
    outline-offset: 2px;
}

.header-manager-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.header-manager-actions .btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.header-manager-actions .btn-icon { padding: 5px 8px; font-size: 0.9rem; }
.manager-mode-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #166534;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    border-radius: 9999px;
    padding: 2px 8px;
    white-space: nowrap;
}
.header-login-button {
    color: var(--color-text-subtle);
    background: transparent;
    transition: color 0.15s, background 0.15s;
}
.header-login-button:hover {
    color: var(--color-brand);
    background: var(--color-brand-light);
}

/* Outline button styles */
.btn-outline-primary {
    background-color: transparent;
    border: 1px solid #3d8b5e;
    color: #3d8b5e;
}
.btn-outline-primary:hover {
    background-color: #3d8b5e;
    color: white;
}

.btn-outline-secondary {
    background-color: transparent;
    border: 1px solid #6b7280; /* gray-500 */
    color: #6b7280;
}
.btn-outline-secondary:hover {
    background-color: #6b7280;
    color: white;
}


/* --- Desktop Styles for Availability Table (outside media query) --- */
#availabilityTable td.game-date-header-mobile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: default;
    background-color: transparent;
    font-weight: normal;
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

#availabilityTable td.game-date-header-mobile .toggle-icon {
    display: none; /* Hide mobile toggle icon on desktop */
}

#availabilityTable td.availability-details-cell-mobile {
    display: contents; /* Key change: This TD's children treated as TR's children */
    padding: 0; /* Reset padding, as it's now a container */
    border: none; /* Reset border */
}

/* This is the DIV inside availability-details-cell-mobile */
/* It contains the individual family+checkbox DIVs */
.availability-details-mobile {
    display: contents; /* Key change: Its children (family divs) flow as table cells */
    /* This div itself is not styled as a visible block on desktop */
}

/* This is the div for each family (name + checkbox), becomes a table cell on desktop */
/* This rule targets the class "mobile-pseudo-cell" which is applied in the JS to these divs */
#availabilityTable .mobile-pseudo-cell { 
    display: table-cell !important; /* Override mobile's display:flex if it's too specific */
    padding: 0.75rem; /* Standard cell padding */
    text-align: center; 
    border-bottom: 1px solid #e2e8f0; /* Standard cell border */
    vertical-align: middle;
    background-color: transparent; /* Ensure no mobile specific background */
}

#availabilityTable .mobile-pseudo-cell::before {
    content: none !important; /* Hide data-label (family name) on desktop */
    display: none !important;
}

/* Ensure checkboxes are visible and centered */
#availabilityTable .mobile-pseudo-cell input[type="checkbox"] {
    display: inline-block; /* Or block with margin auto for centering */
    margin: 0 auto;
}
/* --- End Desktop Styles for Availability Table --- */

/* --- Field Map Highlight Styles --- */
#fieldMapContainer {
    position: relative; /* Establishes a positioning context for absolute children */
    display: inline-block; /* Or block, depending on layout needs */
}

.field-highlight {
    position: absolute;
    background-color: rgba(255, 255, 0, 0.4); /* Semi-transparent yellow, adjust as needed */
    border: 2px solid yellow; /* Adjust color and thickness */
    border-radius: 4px; /* Optional: rounded corners */
    display: none; /* Hidden by default */
    pointer-events: none; /* Allows clicks to pass through to the map if needed */
}

/* Individual field positions - % coordinates relative to field-map.png */
#highlight-1-north {
    top: 52%; left: 43%; width: 25%; height: 20%; transform: rotate(-13deg);
}
#highlight-1-south {
    top: 32%; left: 49%; width: 25%; height: 20%; transform: rotate(-13deg);
}
#highlight-2-north {
    top: 62%; left: 09%; width: 25%; height: 20%; transform: rotate(-13deg);
}
#highlight-2-south {
    top: 41%; left: 15%; width: 25%; height: 20%; transform: rotate(-13deg);
}
/* --- End Field Map Highlight Styles --- */

/* --- Custom Checkbox Styles --- */
.custom-checkbox-label {
    display: inline-flex; /* Aligns the hidden input and custom UI if they were side-by-side */
    align-items: center;
    position: relative; /* For positioning the hidden input if needed */
    cursor: pointer;
    /* Ensure the label takes up appropriate space in flex layouts */
}

/* Hide the actual checkbox input but keep it functional and accessible */
.custom-checkbox-label input[type="checkbox"].sr-only {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-checkbox-ui {
    display: inline-block;
    width: 22px;  /* Slightly larger for better touch target & visual */
    height: 22px;
    border-radius: 4px;
    position: relative;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    font-family: "Font Awesome 6 Free"; /* Ensure FontAwesome is used */
    font-weight: 900; /* For solid icons */
    font-size: 12px; /* Adjust icon size */
    line-height: 22px; /* Vertically center icon */
    text-align: center;
    color: white; /* Icon color */
}

/* Style for UNCHECKED (Unavailable) state */
.custom-checkbox-label input[type="checkbox"].sr-only + .custom-checkbox-ui {
    background-color: #9ca3af; /* Tailwind gray-400 */
    border: 1px solid #6b7280; /* Tailwind gray-500 for border */
}
.custom-checkbox-label input[type="checkbox"].sr-only + .custom-checkbox-ui::before {
    content: "\f00d"; /* FontAwesome times (X) icon */
}

/* Style for CHECKED (Available) state */
.custom-checkbox-label input[type="checkbox"].sr-only:checked + .custom-checkbox-ui {
    background-color: #22c55e; /* Tailwind green-500 */
    border-color: #16a34a; /* Tailwind green-600 for border */
}
.custom-checkbox-label input[type="checkbox"].sr-only:checked + .custom-checkbox-ui::before {
    content: "\f00c"; /* FontAwesome check icon */
}

/* Focus style for accessibility - apply to the custom UI when the hidden input is focused */
.custom-checkbox-label input[type="checkbox"].sr-only:focus + .custom-checkbox-ui {
    box-shadow: 0 0 0 2px rgba(61, 139, 94, 0.5);
}
/* --- End Custom Checkbox Styles --- */

/* === By Family availability view ===
   One card per family; each card holds a stack of game rows. The row layout is
   "date + opponent on the left, checkbox(es) on the right" and adapts to mobile
   by wrapping the controls beneath the meta. */
.family-card { padding: 0; }
.family-card .card-header {
    margin-bottom: 0;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--color-border-faint);
}
.family-card-header { margin-bottom: 0; }
.family-card-chevron {
    width: 0.9rem;
    margin-right: 0.55rem;
    font-size: 0.85rem;
    transition: transform 0.15s;
    flex-shrink: 0;
}
.family-card-body { padding: 0.25rem 0; }
.family-game-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-top: 1px solid #f1f5f9;
}
.family-game-row:first-child { border-top: none; }
.family-game-row.is-past { opacity: 0.55; }
.family-game-row.is-cancelled .family-game-date,
.family-game-row.is-cancelled .family-game-opponent { text-decoration: line-through; color: #b91c1c; }
.family-game-meta { display: flex; align-items: baseline; gap: 0.75rem; min-width: 0; }
.family-game-date {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}
.family-game-opponent {
    font-size: 0.95rem;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.family-game-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}
.family-game-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
}
.family-game-name {
    font-size: 0.85rem;
    color: #475569;
}

@media (max-width: 480px) {
    .family-game-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
    .family-game-controls { width: 100%; justify-content: flex-end; }
}

/* --- Availability Summary Badge Styles --- */
.availability-summary-mobile {
    font-size: 0.8em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    vertical-align: middle;
}
.summary-count-available,
.summary-count-unavailable {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 9999px;
}
.summary-count-unavailable {
    color: #6b7280;
    background: #f3f4f6;
}
/* --- End Mobile Availability Summary Styles --- */

/* Full Schedule - desktop hides the mobile header rows */
.schedule-card-header-row { display: none; }

/* Mobile expand/collapse chevron */
.schedule-toggle-icon { font-size: 0.7rem; transition: transform 0.2s ease; color: var(--color-text-subtle); flex-shrink: 0; }

/* Event type badges (Full Schedule Opponent column) */
.event-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.event-badge-game     { background: #dcfce7; color: #166534; }
.event-badge-noGame   { background: #fef3c7; color: #92400e; }
.event-badge-training { background: #cffafe; color: #155e75; }
.event-badge-social   { background: #ede9fe; color: #5b21b6; }
.event-badge-other    { background: #e2e8f0; color: #334155; }
.event-badge-cancelled { background: #fee2e2; color: #991b1b; }
.event-badge-bye       { background: #e0f2fe; color: #0369a1; }

/* Result pills (Schedule Result column + Stats lists) */
.result-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.02em;
}
.result-pill-win  { background: #dcfce7; color: #166534; }
.result-pill-loss { background: #fee2e2; color: #991b1b; }
.result-pill-draw { background: #e5e7eb; color: #374151; }

/* ---------- Stats dashboard (V1 redesign) ---------- */

.stats-page {
    color: #1e293b;
    letter-spacing: -0.005em;
}
.stats-title-row {
    padding: 4px 0 14px;
}
.stats-title {
    font-size: 26px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0;
}
.stats-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
/* Past Results + By Opponent — stacked on mobile, side-by-side on desktop */
.stats-pair {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Stats cards — chrome shared via the .card group; only the padding model differs */
.stats-card {
    overflow: hidden;
}
.stats-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--color-border-faint);
}
.stats-card-icon { color: #334155; flex-shrink: 0; }
.stats-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
}
.stats-card-count {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 7px;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}
.stats-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfc;
}
.stats-filter-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}
.stats-filter-select {
    flex: 1;
    font-size: 13px;
    color: #1e293b;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 4px 8px;
    cursor: pointer;
    min-width: 0;
}
.stats-filter-select:focus {
    outline: 2px solid #3d8b5e;
    outline-offset: 1px;
}
.stats-empty-msg {
    color: var(--color-text-subtle);
    text-align: center;
    padding: 18px 16px;
    margin: 0;
    font-size: 14px;
}

/* ----- Record card ----- */
.stats-record-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}
.stats-record-cell {
    padding: 18px 4px 16px;
    text-align: center;
}
.stats-record-cell + .stats-record-cell {
    border-left: 1px solid #f1f5f9;
}
/* Form-as-5th-column variant — hidden on mobile, where the form ribbon below the grid takes over */
.stats-record-cell.form-cell {
    display: none;
}
.stats-record-num {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    color: #1e293b;
}
.stats-record-num.played { color: #1e293b; }
.stats-record-num.wins   { color: #10b981; }
.stats-record-num.draws  { color: #64748b; }
.stats-record-num.losses { color: #ef4444; }
.stats-record-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 8px;
}
.stats-record-hint {
    font-size: 10px;
    color: var(--color-text-subtle);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}

/* Form ribbon */
.stats-form-ribbon {
    border-top: 1px solid #f1f5f9;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.stats-form-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.stats-form-eyebrow {
    font-size: 10.5px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.stats-form-dots {
    display: flex;
    gap: 5px;
}
.stats-form-dot {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    box-sizing: border-box;
}
.stats-form-dot.w { background: #10b981; }
.stats-form-dot.d { background: #94a3b8; }
.stats-form-dot.l { background: #ef4444; }
.stats-form-dot.empty {
    background: transparent;
    border: 1.5px dashed #e2e8f0;
}
.stats-form-recent {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
}
.stats-form-recent-arrow {
    color: #334155;
    font-weight: 600;
}

/* ----- Crest (two-tone jersey) ----- */
.stats-crest {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
}
.stats-crest svg { display: block; }

/* ----- Opponent Colours editor (Manage → Settings) ----- */
.opponent-colors-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.opponent-colors-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}
.opponent-colors-head {
    display: flex;
    align-items: center;
    gap: 10px;
}
.opponent-colors-head .preview {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}
.opponent-colors-head .opp-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.opponent-colors-head .reset-btn {
    font-size: 0.75rem;
    color: #64748b;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
}
.opponent-colors-head .reset-btn:hover { color: #ef4444; }
.opponent-colors-row.is-custom .reset-btn { visibility: visible; }
.opponent-colors-row:not(.is-custom) .reset-btn { visibility: hidden; }
.swatch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.swatch-row-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: 70px;
    flex-shrink: 0;
}
.swatch-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.swatch-tile {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.15);
    border-radius: 5px;
    cursor: pointer;
    box-sizing: border-box;
    position: relative;
    display: inline-block;
    transition: transform 0.08s ease;
}
.swatch-tile:hover { transform: scale(1.1); }
.swatch-tile.selected {
    border-color: #0f172a;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #0f172a;
}
.swatch-tile.custom {
    background: conic-gradient(from 0deg, #ef4444, #f59e0b, #facc15, #16a34a, #38bdf8, #2563eb, #7c3aed, #ec4899, #ef4444);
    overflow: hidden;
}
.swatch-tile.custom input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
    background: transparent;
}
.opponent-colors-empty {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}
@media (max-width: 480px) {
    .swatch-row-label { width: 100%; }
}

/* ----- Shared list reset ----- */
.stats-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ----- Past Results row ----- */
.stats-result-row {
    display: grid;
    grid-template-columns: 52px 28px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    transition: background 0.12s;
}
.stats-result-row[role="button"] { cursor: pointer; }
.stats-result-row + .stats-result-row {
    border-top: 1px solid #f1f5f9;
}
.stats-result-row[role="button"]:hover { background: #f8fafc; }
.stats-result-row:focus { outline: none; }
.stats-result-row:focus-visible { outline: 2px solid #3d8b5e; outline-offset: -2px; }
.stats-result-date {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}
.stats-result-year {
    display: block;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--color-text-subtle);
    margin-top: 1px;
}
.stats-result-opponent {
    font-size: 15px;
    color: #1e293b;
    overflow-wrap: anywhere;
}
.stats-result-opponent .vs {
    color: #94a3b8;
    font-weight: 500;
    margin-right: 4px;
}
.stats-result-opponent .name {
    font-weight: 600;
}
.stats-result-opponent .name.unknown {
    color: #94a3b8;
    font-weight: 500;
    font-style: italic;
}
.stats-result-end {
    display: flex;
    align-items: center;
    gap: 10px;
}
.stats-result-badge {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.stats-result-badge.w { background: #d1fae5; color: #047857; }
.stats-result-badge.d { background: #e2e8f0; color: #334155; }
.stats-result-badge.l { background: #fee2e2; color: #b91c1c; }
.stats-result-badge.record {
    width: auto;
    height: 22px;
    padding: 0 9px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 10.5px;
    letter-spacing: 0.02em;
}
.stats-result-score {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: right;
}
.stats-result-score .dash {
    color: #cbd5e1;
    margin: 0 1px;
    font-weight: 500;
}
.stats-result-score.muted {
    color: #cbd5e1;
    font-weight: 600;
}

/* ----- By Opponent row ----- */
.stats-opp-row {
    padding: 12px 16px;
}
.stats-opp-row + .stats-opp-row {
    border-top: 1px solid #f1f5f9;
}
.stats-opp-line1 {
    display: flex;
    align-items: center;
    gap: 10px;
}
.stats-opp-name {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
    min-width: 0;
}
.stats-opp-name.unknown {
    color: #94a3b8;
    font-weight: 500;
    font-style: italic;
}
.stats-opp-inline-wdl {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-shrink: 0;
}
.stats-opp-inline-pair {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
}
.stats-opp-inline-num {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    color: #cbd5e1;
}
.stats-opp-inline-letter {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #cbd5e1;
}
.stats-opp-inline-pair.active.w .stats-opp-inline-num,
.stats-opp-inline-pair.active.w .stats-opp-inline-letter { color: #10b981; }
.stats-opp-inline-pair.active.d .stats-opp-inline-num,
.stats-opp-inline-pair.active.d .stats-opp-inline-letter { color: #334155; }
.stats-opp-inline-pair.active.l .stats-opp-inline-num,
.stats-opp-inline-pair.active.l .stats-opp-inline-letter { color: #ef4444; }

.stats-opp-line2 {
    margin-top: 9px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.stats-wdl-bar {
    flex: 1;
    display: flex;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #f1f5f9;
}
.stats-wdl-bar-seg.w { background: #10b981; }
.stats-wdl-bar-seg.d { background: #94a3b8; }
.stats-wdl-bar-seg.l { background: #ef4444; }
.stats-gfga {
    font-size: 10.5px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.stats-gfga .num {
    color: #475569;
    font-weight: 700;
}
.stats-gfga .sep { margin: 0 6px; }

/* Form cell (5th column of the record grid on desktop) */
.stats-form-cell-eyebrow {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.stats-form-cell-caption {
    font-size: 10.5px;
    color: var(--color-text-subtle);
    font-weight: 500;
}

/* Desktop layout (≥768px): hero card becomes 5 columns with Form integrated;
   Past Results + By Opponent sit side-by-side */
@media (min-width: 768px) {
    .stats-title-row { padding: 8px 0 16px; }
    .stats-record-grid {
        grid-template-columns: repeat(4, 1fr) 1.7fr;
    }
    .stats-record-cell.form-cell {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 18px 12px 16px;
    }
    .stats-form-ribbon { display: none; }
    .stats-pair {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 14px;
        align-items: start;
    }
}

/* Mobile tweaks */
@media (max-width: 380px) {
    .stats-record-num { font-size: 28px; }
    .stats-opp-inline-wdl { gap: 9px; }
    .stats-opp-inline-num { font-size: 20px; }
    .stats-result-row { gap: 8px; grid-template-columns: 46px 26px 1fr auto; }
    .stats-result-score { font-size: 15px; }
}

/* Player of the Match list (Manage tab) */
.potm-list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
}
.potm-list-row:last-child { border-bottom: none; }
.potm-row-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.potm-name {
    font-weight: 600;
    color: #1f2937;
    overflow-wrap: anywhere;
}
.potm-row-end { flex-shrink: 0; }

/* Strike through only specific text elements inside cancelled rows — not the td
   containers, because text-decoration on a td paints through all descendants
   including pills. cell-date-text / cell-opponent-text target just the text nodes. */
.cancelled-row .cell-date-text,
.cancelled-row .cell-opponent-text,
.cancelled-row .cell-opponent .schedule-date-notes,
.cancelled-row .cell-game-only,
.cancelled-row .cell-has-timeline { text-decoration: line-through; }
/* schedule-date-badge: row of pills under the date on desktop. */
.schedule-date-badge { display: flex; flex-wrap: wrap; gap: 4px; }
/* Roster + availability tables: tint cancelled-row text muted red so it's obvious at a glance.
   ID-scoped so it only hits the date-cell text in availability and the date + assigned-name
   text in rosters — leaves the Schedule tab's "Cancelled" badge to do the talking there. */
#orangeRosterGameTableBody tr.cancelled-row td,
#gkRosterGameTableBody tr.cancelled-row td,
#availabilityTable tr.cancelled-row .avail-date-text { color: #b91c1c; }
#availabilityTable tr.cancelled-row .avail-date-text { text-decoration: line-through; }
.nu-week-row.cancelled .nu-wtitle { text-decoration: line-through; }
.nu-chip-cancelled { background: #fee2e2; color: #991b1b; }

/* Notes + cancel-reason cells: hidden on desktop (content shown inline in Opponent cell);
   shown as dedicated rows in the mobile expanded card. */
.schedule-notes-cell,
.cancel-reason-cell { display: none; }

/* Past games — greyed out */
.past-game-row td { color: #9ca3af; }
.past-game-row { opacity: 0.7; }
/* Hide past rows when toggle is active (applies to any table/container with hide-past) */
.hide-past [data-past="true"] { display: none !important; }
/* Hide non-game rows when games-only filter is active (noGame stays visible) */
.games-only tr[data-event-type="training"],
.games-only tr[data-event-type="social"],
.games-only tr[data-event-type="other"] { display: none !important; }

/* Border above first upcoming game */
.first-upcoming-row { border-top: 2px solid #86efac !important; }
/* Same border when games-only filter is active (first-upcoming-row may be on a hidden non-game row) */
.games-only tr[data-first-upcoming-game="true"] { border-top: 2px solid #86efac !important; }

@media screen and (max-width: 768px) {
    /* Full Schedule - mobile collapsible cards */
    #fullGamesTable {
        box-shadow: none;
        border-radius: 0;
        border: none;
        overflow: visible;
    }
    #fullGamesTable thead { display: none; }
    #fullGamesTable, #fullGamesTable tbody { display: block; width: 100%; }


    .schedule-card-header-row.first-upcoming-row,
    .games-only .schedule-card-header-row[data-first-upcoming-game="true"] {
        position: relative;
        margin-top: 1.75rem;
    }
    .schedule-card-header-row.first-upcoming-row::before,
    .games-only .schedule-card-header-row[data-first-upcoming-game="true"]::before {
        content: '';
        position: absolute;
        top: -10px;
        left: 0;
        right: 0;
        height: 2px;
        background-color: #86efac;
        border-radius: 1px;
    }
    /* No past events visible = nothing to separate from; hide the orphaned line */
    .hide-past .schedule-card-header-row.first-upcoming-row::before { display: none; }
    /* TRs carry no border on mobile: Safari renders <tr> borders unreliably, and the tbody's
       divide-y utility would otherwise draw a flat line across the rounded card tops.
       Card outlines are drawn on the header's inner TD and a body ::after overlay instead. */
    .schedule-card-header-row.first-upcoming-row,
    .games-only .schedule-card-header-row[data-first-upcoming-game="true"] {
        border: none !important;
    }
    .schedule-card-body-row.first-upcoming-row,
    .games-only .schedule-card-body-row[data-first-upcoming-game="true"] {
        border-top: none !important;
    }

    .schedule-card-header-row {
        display: block;
        margin-top: 0.75rem;
        cursor: pointer;
        border: none;
    }
    /* Header card outline on the TD (a real block box) so all four borders render reliably */
    .schedule-card-header-row td {
        display: block;
        padding: 0;
        border: 1px solid #d1d5db;
        border-radius: 6px;
        background-color: #f9fafb;
        overflow: hidden;
    }
    .schedule-card-header-row.body-expanded td {
        border-bottom: none;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }
    .schedule-card-header-row:hover td { background-color: #f0f4f8; }

    .schedule-card-body-row { display: none; border: none; position: relative; }
    .schedule-card-body-row.expanded { display: block; }
    /* Body card outline as an overlay: renders reliably, follows the rounded corners, and is
       independent of which cell is last-visible (Result/Actions are hidden for non-managers) */
    .schedule-card-body-row::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border: 1px solid #d1d5db;
        border-top: none;
        border-radius: 0 0 6px 6px;
        pointer-events: none;
    }
    .schedule-card-body-row td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 1rem;
        border-bottom: 1px solid #f3f4f6;
        font-size: 0.875rem;
        background: none;
    }
    .schedule-card-body-row td:last-child { border-bottom: none; }
    .schedule-card-body-row td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #9ca3af;
        flex-shrink: 0;
        margin-right: 1rem;
    }
    .schedule-card-body-row .schedule-actions-cell { justify-content: flex-end; }

    /* Full schedule header: stack title above controls on mobile */
    #fullScheduleHeader { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    #fullScheduleHeader > div { flex-wrap: wrap; }

    /* Hide inapplicable cells for non-game events */
    .schedule-card-body-row:not([data-event-type="game"]) .cell-game-only { display: none; }
    .schedule-card-body-row[data-event-type="noGame"] .cell-has-timeline { display: none; }
    .schedule-card-body-row:not([data-event-type="game"]) .cell-opponent { display: none; }

    /* Badge shown in collapsed header — hide from expanded body date cell */
    .schedule-card-body-row .schedule-date-badge { display: none; }

    /* Notes + cancel-reason cells: hidden on desktop, shown as rows in expanded card on mobile */
    .schedule-notes-cell,
    .cancel-reason-cell { display: flex; }
    /* Hide the inline snippets inside the Opponent cell — dedicated rows handle them on mobile */
    .schedule-card-body-row .schedule-date-notes,
    .schedule-card-body-row .cancel-reason-snippet { display: none; }
}

@media screen and (max-width: 768px) {
    /* Responsive Table for Availability - Collapsible Mobile View */
    #availabilityTable thead {
        display: none; /* Hide table headers on mobile */
    }
    #availabilityTable,
    #availabilityTable tbody,
    #availabilityTable tr { /* TDs are handled specifically below */
        display: block;
        width: 100%;
    }
    #availabilityTable tr {
        margin-bottom: 1rem; /* Space between game blocks */
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        overflow: hidden; /* Ensures children (like cells) respect border radius */
    }

    /* Common style for all TDs in availabilityTable for mobile to reset */
    #availabilityTable td {
        display: block; /* Override browser default */
        width: 100%;
        border-bottom: none; /* Reset, specific cells will add if needed */
        padding: 0; /* Reset, specific cells will add if needed */
    }
    #availabilityTable td::before { /* Reset generic data-label for TDs */
        content: none;
    }

    /* Style for the game date header cell in mobile */
    #availabilityTable td.game-date-header-mobile {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 4px;
        padding: 0.75rem 1rem;
        font-weight: bold;
        cursor: pointer;
        background-color: #f9fafb;
        border-bottom: 1px solid #e2e8f0;
    }
    /* Ensure toggle icon is visible on mobile, overriding desktop's display:none */
    #availabilityTable td.game-date-header-mobile .toggle-icon {
        display: inline-block !important;
        font-size: 0.9em;
        transition: transform 0.2s ease-in-out;
        justify-self: end;
    }
    /* Center the summary in its grid column */
    #availabilityTable td.game-date-header-mobile .availability-summary-mobile {
        display: inline-flex !important;
        justify-content: center;
        width: 100%;
    }
    
    /* Style for the cell containing the availability details (the one with colSpan) */
    /* On mobile, this cell also becomes a block */
    #availabilityTable td.availability-details-cell-mobile {
        display: block !important; /* Override display:contents from desktop */
        width: 100%;
        padding: 0;
        border-bottom: none; /* Managed by TR border */
    }

    /* The container for family checkboxes, hidden/shown on mobile */
    .availability-details-mobile {
        display: none !important; /* Collapsed by default, override display:contents */
        padding: 0.5rem 1rem 0.25rem 1rem; 
        background-color: #fff; 
    }

    .availability-details-mobile.expanded {
        display: block !important; /* Show when expanded */
    }

    /* Styling for each family row (div) within the details container (mobile-pseudo-cell) */
    /* This must override the desktop table-cell behavior */
    #availabilityTable .mobile-pseudo-cell {
        display: flex !important; /* Override table-cell for mobile */
        justify-content: space-between;
        align-items: center;
        padding: 0.6rem 0 !important; 
        border-bottom: 1px solid #f3f4f6 !important; 
        text-align: left !important; /* Reset text-align from desktop */
    }

    #availabilityTable .mobile-pseudo-cell:last-child {
        border-bottom: none !important;
    }

    /* Apply data-label for family names using ::before on the div for mobile */
    /* This must override the desktop's content:none */
    #availabilityTable .mobile-pseudo-cell::before {
        display: inline-block !important; /* Ensure it's visible */
        content: attr(data-label) !important;
        font-weight: 500; 
        margin-right: 0.5rem;
        flex-shrink: 0; 
    }

    #availabilityTable .mobile-pseudo-cell input[type="checkbox"] {
        /* The input is now hidden. The label (.custom-checkbox-label) is the flex item. */
    }

    /* Ensure the label (which now contains the custom checkbox) is pushed to the right */
    #availabilityTable .mobile-pseudo-cell .custom-checkbox-label {
        margin-left: auto !important; 
        flex-shrink: 0;
    }

}

/* =====================================================
   Mobile: bottom tab bar (≤768px)
   ===================================================== */
@media screen and (max-width: 768px) {
    .app-header-inner {
        height: 52px;
        padding: 0 0.875rem;
    }

    /* Hide text labels in header to prevent horizontal overflow on mobile.
       Overflow breaks position:fixed on the bottom nav bar. */
    .logout-label { display: none; }
    #dataStatus span { display: none; }
    #dataStatus { padding: 4px 6px; }

    #tabsNav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(62px + env(safe-area-inset-bottom));
        flex: none;
        flex-direction: row;
        justify-content: space-around;
        align-items: stretch;
        gap: 0;
        background: #fff;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
        z-index: 50;
        padding: 0 0 env(safe-area-inset-bottom) 0;
    }
    .tab-button {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 2px 8px;
        font-size: 0.75rem;
        font-weight: 500;
        color: var(--color-text-subtle);
        background: transparent;
        border-radius: 0;
        height: 100%;
        white-space: nowrap;
    }
    .tab-button i { font-size: 1.2rem; display: block; margin-right: 0; }
    .tab-button span {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .tab-button:hover:not(.active) { background: #f9fafb; color: var(--color-text-muted); }
    .tab-button.active { color: var(--color-brand); background: transparent; font-weight: 600; }

    #mainContent { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }

    #announcementBanner {
        padding: 0.4rem 0.75rem;
        align-items: center;
        font-size: 0.8rem;
        gap: 0.5rem;
        line-height: 1.2;
    }
    #announcementBanner i { font-size: 0.75rem; }
}

/* Roster sub-navigation (Oranges / Goalkeepers) */
.roster-sub-nav {
    display: flex;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.roster-sub-btn {
    flex: 1;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    background: white;
    color: #6b7280;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.roster-sub-btn:not(:last-child) { border-right: 1px solid #e5e7eb; }
.roster-sub-btn:hover:not(.roster-sub-btn-active) { background: #f9fafb; }
.roster-sub-btn.roster-sub-btn-active { background: #f0fdf4; color: #2d6b47; font-weight: 600; }

/* =====================================================
   Touch-friendly tap targets (≥44px on touch devices)
   Mouse users keep the tighter visual rhythm.
   ===================================================== */
@media (hover: none) and (pointer: coarse) {
    .member-icon-btn {
        min-width: 40px;
        min-height: 40px;
    }
    .modal-close-btn {
        width: 44px;
        height: 44px;
    }
    .filter-chip {
        padding: 8px 14px 8px 12px;
        min-height: 36px;
    }
    .edit-game-btn,
    .duplicate-game-btn,
    .delete-game-btn,
    .record-result-btn {
        padding: 8px 12px;
        min-height: 36px;
    }
    /* Restore the text labels on mobile (no hover tooltips on touch) */
    .schedule-actions-cell .action-label { display: inline; }
    .roster-sub-btn {
        padding: 0.85rem 1rem;
    }
    .custom-checkbox-ui {
        width: 26px;
        height: 26px;
        line-height: 26px;
    }
    /* The clickable label wraps the checkbox; give it real estate */
    .custom-checkbox-label {
        padding: 6px;
        margin: -6px;
    }
    /* Header action buttons (sign-in, preview, logout) */
    .header-manager-actions .btn-sm,
    .header-manager-actions .btn-icon {
        min-width: 40px;
        min-height: 40px;
    }
    /* Member-family chip in flat rows: comfortable tap area */
    .member-family-chip {
        padding: 6px 12px;
    }
}

/* =====================================================
   Next Up redesign — Option A · Stacked hierarchy
   ===================================================== */
.nu-card {
    /* chrome (border/radius/shadow/surface) shared via the .card group above */
    overflow: hidden;
}

/* Hero band */
.nu-hero {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 1.75rem;
    background: linear-gradient(135deg, #3d8b5e 0%, #2d6b47 100%);
    color: #fff;
}
.nu-hero-day {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}
.nu-hero-date {
    font-size: 1rem;
    color: var(--color-text-on-brand-soft);
    margin-top: .25rem;
    font-weight: 500;
}
.nu-countdown {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 14px;
    padding: .65rem 1rem;
    text-align: center;
    min-width: 92px;
}
.nu-countdown-num {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
}
.nu-countdown-label {
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--color-text-on-brand-soft);
    margin-top: .35rem;
    line-height: 1.2;
}
.nu-vs { text-align: right; }
.nu-game-event-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--color-text-on-brand-soft);
    margin-bottom: .15rem;
}
.nu-vs-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--color-text-on-brand-soft);
}
.nu-vs-name {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.1;
    margin-top: .15rem;
}

/* Cancelled-game banner: shown between hero and tiles when next game is cancelled */
.nu-cancelled-banner {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .85rem 1.25rem;
    background: #fef2f2;
    border-bottom: 1px solid #fecaca;
    color: #991b1b;
    font-size: .9rem;
    font-weight: 500;
}
.nu-cancelled-banner i { flex-shrink: 0; }

/* Tiles */
.nu-tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: #e2e8f0;
}
.nu-tile {
    background: #fff;
    padding: 1rem 1.25rem;
}
.nu-tile-label {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--color-text-muted);
    font-weight: 600;
}
.nu-tile-label i {
    margin-right: 0.3em;
    opacity: 0.85;
}
.nu-notes-row i {
    margin-right: 0.35em;
    color: var(--color-text-subtle);
}
.nu-tile-val {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: .25rem;
}
.nu-tile-sub {
    font-size: .78rem;
    color: #64748b;
    margin-top: .1rem;
}
.nu-tile-note {
    margin-top: .55rem;
    padding: .5rem .65rem;
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    border-radius: 3px;
    font-size: .8rem;
    color: #78350f;
    line-height: 1.4;
}
.nu-tile-note i { margin-right: .35rem; color: #b45309; }

/* Notes row — full-width cell below tiles in hero card */
.nu-notes-row {
    padding: .75rem 1.25rem;
    font-size: .82rem;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

/* Field map */
.nu-fieldwrap {
    display: flex;
    justify-content: center;
    padding: 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

/* Embedded address map (Google iframe) */
.nu-mapwrap {
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.nu-mapwrap iframe {
    display: block;
    width: 100%;
    height: 220px;
    border: 0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.nu-map-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: .5rem;
    font-size: .8rem;
    color: #2563eb;
    text-decoration: none;
}
.nu-map-link:hover { text-decoration: underline; }

/* Compact map inside also/before this week rows */
.nu-wmap {
    margin-top: .5rem;
}
.nu-wmap iframe {
    display: block;
    width: 100%;
    height: 160px;
    border: 0;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Map preview inside event modal */
.modal-map-preview {
    margin-top: .75rem;
}
.modal-map-preview iframe {
    display: block;
    width: 100%;
    height: 180px;
    border: 0;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Roles */
.nu-roles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}
.nu-role { display: flex; align-items: center; gap: .75rem; }
.nu-gk-stack { display: flex; }
.nu-avatar-ol { margin-left: -10px; border: 2px solid #fff; }
.nu-role-cap {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--color-text-subtle);
    font-weight: 600;
}
.nu-role-cap i {
    margin-right: 0.35em;
    color: var(--color-text-subtle);
    opacity: 0.9;
}
.nu-role-name { font-size: .92rem; font-weight: 600; color: var(--color-text); }
#nextGameOranges { color: var(--color-brand-accent); font-weight: 700; }
.nu-role .fa-apple-whole { color: var(--color-brand-accent); opacity: 1; }

/* Avatars */
.nu-avatar {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.nu-avatar-family { background: #ffedd5; color: #9a3412; }
.nu-avatar-gk     { background: #dcfce7; color: #166534; width: 32px; height: 32px; font-size: 12px; }
.nu-avatar-adult  { background: #dcfce7; color: #166534; }

/* Availability */
.nu-avail { padding: 1rem 1.25rem; }
.nu-avail-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: .5rem;
}
.nu-avail-count { font-weight: 600; color: #0f172a; }
.nu-link {
    color: #3d8b5e;
    font-size: .85rem;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s;
}
.nu-link:hover { color: #2d6b47; text-decoration: underline; }
.nu-avail-bar { display: flex; gap: 4px; }
.nu-avail-pip { flex: 1; height: 10px; border-radius: 3px; }
.nu-avail-pip.on  { background: #22c55e; }
.nu-avail-pip.off { background: #fecaca; }
.nu-avail-note { font-size: .82rem; color: #dc2626; margin-top: .55rem; }
.nu-avail-note i { margin-right: .35rem; }

/* Event type chips */
.nu-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: .62rem;
    letter-spacing: .12em;
    font-weight: 700;
    text-transform: uppercase;
}
.nu-chip-game     { background: #dcfce7; color: #166534; }
.nu-chip-training { background: #cffafe; color: #155e75; }
.nu-chip-social   { background: #ede9fe; color: #5b21b6; }
.nu-chip-noGame   { background: #fef3c7; color: #92400e; }
.nu-chip-other    { background: #e2e8f0; color: #334155; }
.nu-chip-bye      { background: #e0f2fe; color: #0369a1; }

/* Also this week */
.nu-week-others {
    margin-top: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border-faint);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.nu-week-head {
    padding: .75rem 1.25rem;
    font-size: .72rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.nu-week-list { display: flex; flex-direction: column; }
.nu-week-row {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 1rem;
    align-items: start;
    padding: .9rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
}
.nu-week-row:last-child { border-bottom: none; }
.nu-wdate { text-align: center; }
.nu-wdate-day { font-size: .65rem; letter-spacing: .12em; color: #64748b; font-weight: 700; }
.nu-wdate-num { font-size: 1.5rem; font-weight: 800; color: #0f172a; line-height: 1; }
.nu-wtitle-row { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.nu-wtitle { font-size: 1rem; font-weight: 600; color: #0f172a; }
.nu-wmeta { display: flex; gap: .9rem; flex-wrap: wrap; color: #64748b; font-size: .82rem; margin-top: .3rem; }
.nu-wmeta i { margin-right: .25rem; color: #94a3b8; }
.nu-wnote {
    margin-top: .35rem;
    font-size: .76rem;
    color: #94a3b8;
}
.nu-wnote i { margin-right: .3rem; }

/* =====================================================
   Next Up — MOBILE (≤768px)
   ===================================================== */
@media screen and (max-width: 768px) {
    /* Hero: left col = day+date, right col = countdown; vs spans full row */
    .nu-hero {
        grid-template-columns: 1fr auto;
        gap: 0 1rem;
        padding: 1rem 1.1rem 1rem;
    }
    .nu-hero-day { font-size: 1.5rem; }
    .nu-hero-date { font-size: .85rem; }
    .nu-countdown { min-width: 60px; padding: .4rem .65rem; }
    .nu-countdown-num { font-size: 1.5rem; }
    .nu-countdown-label { font-size: .58rem; margin-top: .2rem; }
    .nu-vs {
        grid-column: 1 / -1;
        text-align: left;
        margin-top: .4rem;
        padding-top: .4rem;
        border-top: 1px solid rgba(255,255,255,.18);
    }

    /* Tiles: 2-up grid, location tile spans full width */
    .nu-tiles { grid-template-columns: 1fr 1fr; }
    .nu-tile { padding: .75rem .9rem; }
    .nu-tile-label { font-size: .62rem; }
    .nu-tile-val { font-size: 1.05rem; }
    .nu-tile-sub { font-size: .72rem; }
    .nu-tile-loc { grid-column: 1 / -1; }

    /* Field map */
    .nu-fieldwrap { padding: .75rem; }

    /* Roles: 2-col grid — flows naturally into 2 rows of 2 */
    .nu-roles { grid-template-columns: 1fr 1fr; padding: .75rem .9rem; gap: .65rem 1rem; }
    .nu-role { gap: .7rem; }
    .nu-role-name { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; }
    .nu-avatar { width: 36px; height: 36px; }
    .nu-avatar-gk { width: 30px; height: 30px; }

    /* Availability */
    .nu-avail { padding: .75rem .9rem; }

    /* Also this week: compact */
    .nu-week-row { grid-template-columns: 48px 1fr; gap: .85rem; padding: .75rem .9rem; }
    .nu-wdate-num { font-size: 1.25rem; }
    .nu-wtitle { font-size: .92rem; }
    .nu-wmeta { font-size: .74rem; gap: .65rem; }
}

/* Next Game card: manager-only quick result action (shown on game day) */
.nu-manager-actions {
    display: flex;
    justify-content: center;
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid #e2e8f0;
}
.nu-record-result-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
