/* =========================================================
   FootyStats UK
   Black ground, warm gold accent, light reading surface.
   Type: Outfit. Radii 12–16px. One elevation system.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap');

/* ---------------------------------------------------------
   Tokens
   --------------------------------------------------------- */
:root {
    /* Surfaces */
    --canvas:      #F7F7F6;
    --surface:     #FFFFFF;
    --surface-sunk:#F1F1EF;
    --white:       #FFFFFF;

    /* Ink. --steel meets 4.5:1 on both --canvas and --surface. */
    --ink:         #17171A;
    --ink-soft:    #3F3F46;
    --steel:       #5E5E68;
    --text-muted:  #5E5E68;

    /* Structure */
    --border:      #E4E4E1;
    --border-hard: #D3D3CE;

    /* Warm gold. --gold is a surface colour; --gold-ink is the text-safe one. */
    --gold:        #F0A500;
    --gold-bright: #FFB81C;
    --gold-ink:    #8A5A00;
    --gold-soft:   #FDF3DD;
    --gold-line:   #EBCB8B;

    /* Dark ground */
    --dark:        #131316;
    --dark-mid:    #202024;
    --dark-line:   #33333A;
    --dark-text:   #A8A8B0;

    /* Result states. Chosen so win/draw/loss stay clearly distinct by hue
       (green/amber/red, not a muddy olive draw sitting between green and
       red) as well as by the letter each form badge already carries, and
       each still holds 4.5:1 against both white and its own *-soft tint. */
    --win:         #087A40;
    --win-soft:    #E3F3EA;
    --draw:        #985F08;
    --draw-soft:   #F6EFDC;
    --loss:        #C62828;
    --loss-soft:   #FBE9E7;
    --live:        #C2410C;
    --live-soft:   #FDEBDE;

    /* Elevation: one system. Cards use a border; overlays use a shadow. */
    --shadow-pop:  0 12px 32px -12px rgba(20, 18, 12, 0.28);
    --shadow-drawer: 0 24px 60px -20px rgba(0, 0, 0, 0.55);

    --radius:      14px;
    --radius-sm:   8px;
    --radius-pill: 999px;

    --font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --num:  'Outfit', ui-monospace, monospace;
}

/* ---------------------------------------------------------
   Reset and browser surfaces
   --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    color-scheme: light;
    accent-color: var(--gold-ink);
    caret-color: var(--gold-ink);
    scrollbar-color: var(--border-hard) transparent;
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--canvas);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}
body.nav-open, body.drawer-open { overflow: hidden; }

::selection { background: var(--gold-bright); color: var(--dark); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-hard);
    border-radius: var(--radius-pill);
    border: 3px solid var(--canvas);
}
::-webkit-scrollbar-thumb:hover { background: #B9B9B2; }

img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

a {
    color: var(--gold-ink);
    text-decoration-color: var(--gold-line);
    text-underline-offset: 0.18em;
    text-decoration-thickness: from-font;
}
a:hover { text-decoration: underline; }

/* One focus ring everywhere, visible on light and dark ground. */
:focus-visible {
    outline: 2.5px solid var(--gold-ink);
    outline-offset: 2px;
    border-radius: 3px;
}
.site-header :focus-visible,
.hero :focus-visible,
.page-head :focus-visible,
.admin-sidebar :focus-visible,
.site-footer :focus-visible {
    outline-color: var(--gold-bright);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }

.fs-icon { flex-shrink: 0; display: block; }

/* Numbers in data always align and share one width. */
.num, .num-cell, table td, table th, .stat-value, .score-value, time {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1;
}

/* ---------------------------------------------------------
   Utilities
   --------------------------------------------------------- */
.container { width: 100%; max-width: 1360px; margin: 0 auto; padding: 0 1rem; }
.container-narrow { max-width: 880px; }

.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: 1rem; top: -100px; z-index: 300;
    background: var(--gold); color: var(--dark);
    padding: 12px 20px; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-weight: 700;
}
.skip-link:focus { top: 0; text-decoration: none; }

.text-muted  { color: var(--steel); }
.col-end     { text-align: right; }
.col-start   { text-align: left; }
.stack-sm > * + * { margin-top: 8px; }

/* A value the provider never supplied. Never confusable with a zero. */
.is-unknown { color: var(--steel); opacity: 0.75; cursor: help; }

abbr[title] { text-decoration: none; border-bottom: 1px dotted var(--border-hard); cursor: help; }

/* ---------------------------------------------------------
   Header
   --------------------------------------------------------- */
.site-header {
    background: var(--dark);
    position: sticky; top: 0; z-index: 100;
    border-bottom: 1px solid var(--dark-line);
}
.header-inner {
    display: flex; align-items: center; gap: 12px;
    min-height: 60px; padding: 8px 0;
}
.site-logo {
    display: flex; align-items: center; gap: 9px;
    color: var(--white); font-weight: 800; font-size: 1.0625rem;
    letter-spacing: -0.025em; margin-right: auto;
}
.site-logo:hover { text-decoration: none; }
.site-logo .fs-icon { color: var(--gold); }
.logo-text em { color: var(--gold); font-style: normal; }

.site-nav { display: none; }
.site-nav.open { display: block; }
.site-nav ul {
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--dark-mid);
    border-bottom: 1px solid var(--dark-line);
    padding: 8px; z-index: 120;
    display: flex; flex-direction: column; gap: 2px;
}
.site-nav a {
    display: flex; align-items: center;
    padding: 12px 14px; min-height: 44px;
    color: var(--dark-text); font-weight: 600; font-size: 0.9375rem;
    border-radius: var(--radius-sm);
}
.site-nav a:hover { background: #2A2A30; color: var(--white); text-decoration: none; }
.site-nav a[aria-current="page"] { background: #2A2A30; color: var(--white); }

/* Search + account menu: a single utility cluster, always at the header's
   trailing edge so it reads as one secondary group, not more items competing
   with primary navigation. */
.header-utility { display: flex; align-items: center; gap: 8px; }

.header-search { display: none; align-items: center; }
.header-search .field {
    display: flex; align-items: center; gap: 8px;
    background: var(--dark-mid); border: 1px solid var(--dark-line);
    border-radius: var(--radius-pill); padding: 0 4px 0 14px;
}
.header-search .field:focus-within { border-color: var(--gold); }
.header-search .fs-icon { color: var(--dark-text); }
.header-search input {
    background: none; border: none; outline: none;
    color: var(--white); width: 170px; padding: 9px 0; font-size: 0.9rem;
}
.header-search input::placeholder { color: #7C7C87; }
.header-search button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; margin: 4px 0; flex-shrink: 0;
    background: var(--gold); color: var(--dark); border-radius: 50%;
}
.header-search button:hover { background: var(--gold-bright); }
.header-search button .fs-icon { color: inherit; }

.nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: var(--radius-sm);
    color: var(--white); background: var(--dark-mid);
    border: 1px solid var(--dark-line);
}
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }
.nav-toggle[aria-expanded="true"] .icon-menu  { display: none; }

/* Account menu — Admin + Sign out live here instead of in the primary nav
   list, so signed-in actions read as one compact, secondary control rather
   than two more full-width links competing for the same row. */
.account-menu { position: relative; }
.account-trigger {
    display: inline-flex; align-items: center; gap: 5px;
    height: 44px; padding: 0 11px; border-radius: var(--radius-sm);
    color: var(--white); background: var(--dark-mid);
    border: 1px solid var(--dark-line);
}
.account-trigger:hover { background: #2A2A30; }
.account-trigger .account-chevron { color: var(--dark-text); transition: transform 0.15s ease; }
.account-trigger[aria-expanded="true"] .account-chevron { transform: rotate(180deg); }
.account-trigger[aria-expanded="true"] { background: #2A2A30; border-color: var(--gold); }

.account-panel {
    position: absolute; right: 0; top: calc(100% + 8px);
    min-width: 200px; z-index: 130;
    background: var(--dark-mid); border: 1px solid var(--dark-line);
    border-radius: var(--radius-sm); padding: 6px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
}
.account-panel[hidden] { display: none; }
.account-panel-signed-in {
    margin: 0 0 4px; padding: 8px 12px 10px;
    font-size: 0.75rem; color: var(--dark-text);
    border-bottom: 1px solid var(--dark-line);
}
.account-panel-signed-in strong { color: var(--white); }
.account-panel a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; min-height: 40px;
    color: var(--dark-text); font-weight: 600; font-size: 0.875rem;
    border-radius: var(--radius-sm);
}
.account-panel a:hover { background: #2A2A30; color: var(--white); text-decoration: none; }

.site-main { flex: 1; }

/* ---------------------------------------------------------
   Page head — dark band carrying title, season and breadcrumbs
   --------------------------------------------------------- */
.page-head { background: var(--dark); color: var(--white); padding: 18px 0 22px; }
.page-head-top {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
}
.page-head h1 {
    font-size: clamp(1.5rem, 3.4vw, 2.125rem);
    font-weight: 800; letter-spacing: -0.03em; line-height: 1.1;
}
.page-head .page-sub {
    color: var(--dark-text); font-size: 0.9375rem; margin-top: 6px;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.page-head .page-sub .fs-icon { color: var(--gold); }

.breadcrumbs { margin-bottom: 10px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.breadcrumbs li { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; }
.breadcrumbs li + li::before {
    content: ''; width: 5px; height: 5px; border-right: 1.5px solid #5C5C66;
    border-top: 1.5px solid #5C5C66; transform: rotate(45deg);
}
.breadcrumbs a { color: var(--dark-text); }
.breadcrumbs a:hover { color: var(--white); }
.breadcrumbs [aria-current="page"] { color: var(--white); font-weight: 600; }

/* Season chip: names the competition and season this page is showing. */
.season-chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--gold-soft); color: #5E3D00;
    border: 1px solid var(--gold-line);
    padding: 5px 12px; border-radius: var(--radius-pill);
    font-size: 0.8125rem; font-weight: 700; white-space: nowrap;
}
.season-chip .fs-icon { color: var(--gold-ink); }

/* ---------------------------------------------------------
   Controls
   --------------------------------------------------------- */
.control-bar {
    display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
    padding: 14px 0;
}
.control-bar.on-dark { padding: 0; }

.field-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-group > label {
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em;
    text-transform: uppercase; color: var(--steel);
}
.on-dark .field-group > label { color: var(--dark-text); }

.form-control {
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--border-hard); border-radius: var(--radius-sm);
    padding: 9px 12px; min-height: 42px; font-size: 0.9375rem;
    max-width: 100%;
}
select.form-control {
    appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235E5E68' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
}
.form-control:focus { outline: 2.5px solid var(--gold-ink); outline-offset: 1px; border-color: var(--gold-ink); }
.on-dark .form-control {
    /* background-color, not the `background` shorthand: the shorthand resets
       background-repeat/-position/-image to their initial values, which wiped
       out select.form-control's chevron sizing and tiled it across the field. */
    background-color: var(--dark-mid); color: var(--white); border-color: var(--dark-line);
}
.on-dark select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23A8A8B0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E");
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; min-height: 42px;
    border-radius: var(--radius-sm); font-weight: 700; font-size: 0.9375rem;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--gold); color: #241900; }
.btn-primary:hover { background: var(--gold-bright); }
.btn-secondary {
    background: var(--surface); color: var(--ink); border: 1px solid var(--border-hard);
}
.btn-secondary:hover { background: var(--surface-sunk); }
.on-dark .btn-secondary { background: var(--dark-mid); color: var(--white); border-color: var(--dark-line); }
.on-dark .btn-secondary:hover { background: #2A2A30; }
.btn-ghost { color: var(--gold-ink); padding: 8px 12px; }
.btn-ghost:hover { background: var(--gold-soft); }
.btn-sm { padding: 6px 12px; min-height: 36px; font-size: 0.8125rem; }
.btn[disabled], .btn[aria-disabled="true"] {
    opacity: 0.5; cursor: not-allowed; pointer-events: none;
}

/* Segmented league switch */
.seg {
    display: inline-flex; background: var(--surface-sunk);
    border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 3px;
    max-width: 100%; overflow-x: auto;
}
.on-dark .seg { background: var(--dark-mid); border-color: var(--dark-line); }
.seg a {
    padding: 8px 16px; min-height: 38px; display: inline-flex; align-items: center;
    border-radius: var(--radius-pill); font-size: 0.875rem; font-weight: 700;
    color: var(--steel); white-space: nowrap;
}
.on-dark .seg a { color: var(--dark-text); }
.seg a:hover { color: var(--ink); text-decoration: none; }
.on-dark .seg a:hover { color: var(--white); }
.seg a[aria-current] { background: var(--gold); color: #241900; }
.on-dark .seg a[aria-current] { background: var(--gold); color: #241900; }

/* Tabs */
.tabs {
    display: flex; gap: 2px; overflow-x: auto;
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-link {
    padding: 12px 16px; min-height: 46px; display: inline-flex; align-items: center;
    font-weight: 600; font-size: 0.9375rem; color: var(--steel);
    border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab-link:hover { color: var(--ink); text-decoration: none; }
.tab-link[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold); }

/* ---------------------------------------------------------
   Sections and cards
   --------------------------------------------------------- */
.section { padding: 22px 0; }
.section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.section-head h2, .section-head h1 {
    font-size: 1.0625rem; font-weight: 800; letter-spacing: -0.015em; color: var(--ink);
}
.section-head .section-meta {
    font-size: 0.8125rem; color: var(--steel); font-weight: 500; margin-top: 2px;
}
.section-head .section-link { font-size: 0.875rem; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-header {
    padding: 13px 18px; border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: 0.9375rem; background: var(--surface);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-body { padding: 18px; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* Empty and error states explain themselves. */
.empty-state {
    background: var(--surface); border: 1px dashed var(--border-hard);
    border-radius: var(--radius); padding: 28px 22px; text-align: center;
}
.empty-state-icon { display: inline-flex; color: var(--steel); margin-bottom: 8px; }
.empty-state-heading { font-weight: 700; color: var(--ink); }
.empty-state-body { font-size: 0.875rem; color: var(--steel); margin-top: 4px; }

/* ---------------------------------------------------------
   Tables
   --------------------------------------------------------- */
.table-frame {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
.table-scroll:focus-visible { outline-offset: -3px; }

/* A fading edge that appears only when there is more table to reach. */
.table-scroll.can-scroll:not(.at-end)::after,
.table-scroll.can-scroll:not(.at-start)::before {
    content: ''; position: sticky; top: 0; height: 100%;
    width: 26px; pointer-events: none; display: block;
}
.table-scroll.can-scroll:not(.at-end)::after {
    float: right; margin-left: -26px;
    background: linear-gradient(to left, rgba(255,255,255,0.96), rgba(255,255,255,0));
}

table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }

thead th {
    background: var(--surface-sunk);
    color: var(--steel);
    font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0; white-space: nowrap;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
thead th:not([data-sort]) { padding: 11px 10px; }
thead th abbr { border-bottom-color: #B9B9B2; }

.th-sort {
    display: inline-flex; align-items: center; gap: 5px;
    width: 100%; padding: 11px 10px; min-height: 42px;
    font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit;
}
.col-end .th-sort { justify-content: flex-end; }
.th-sort:hover { color: var(--ink); background: rgba(0,0,0,0.035); }
.th-sort:focus-visible { outline-offset: -3px; }

.sort-indicator { display: inline-flex; color: #A6A6A0; }
.sort-indicator .up, .sort-indicator .down { opacity: 0.55; }
th[aria-sort="ascending"]  { color: var(--ink); background: var(--gold-soft); }
th[aria-sort="descending"] { color: var(--ink); background: var(--gold-soft); }
th[aria-sort="ascending"]  .sort-indicator { color: var(--gold-ink); }
th[aria-sort="descending"] .sort-indicator { color: var(--gold-ink); }
th[aria-sort="ascending"]  .down { opacity: 0.15; }
th[aria-sort="ascending"]  .up   { opacity: 1; }
th[aria-sort="descending"] .up   { opacity: 0.15; }
th[aria-sort="descending"] .down { opacity: 1; }

tbody td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFAF8; }
td.is-strong { font-weight: 800; color: var(--ink); }
td.num-cell, th.col-end { text-align: right; }

/* Official league position stays in its own column and never re-sorts. */
.col-pos {
    width: 44px; text-align: center; color: var(--steel);
    font-weight: 700; font-size: 0.875rem;
}
.league-table tbody tr { position: relative; }

/* Qualification bands: a 3px marker inside the position cell, not a row tint,
   so the row stays readable and the marker sits next to the number it explains. */
.col-pos { position: relative; }
tr[data-band] .col-pos::before {
    content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
    border-radius: 2px;
}
tr[data-band="champions"] .col-pos::before { background: var(--win); }
tr[data-band="europa"]    .col-pos::before { background: #1E5FA8; }
tr[data-band="promotion"] .col-pos::before { background: var(--win); }
tr[data-band="playoff"]   .col-pos::before { background: var(--gold); }
tr[data-band="relegation"] .col-pos::before { background: var(--loss); }

.table-key {
    display: flex; flex-wrap: wrap; gap: 14px;
    padding: 11px 14px; border-top: 1px solid var(--border);
    font-size: 0.8125rem; color: var(--steel); background: var(--surface);
}
.table-key span { display: inline-flex; align-items: center; gap: 7px; }
.table-key i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.table-note {
    padding: 10px 14px; font-size: 0.8125rem; color: var(--steel);
    border-top: 1px solid var(--border); background: var(--surface);
}

/* Club identity column stays put while the numbers scroll. */
.club-cell {
    display: flex; align-items: center; gap: 9px;
    min-width: 0; font-weight: 600;
}
.club-cell a { color: var(--ink); text-decoration: none; }
.club-cell a:hover { color: var(--gold-ink); text-decoration: underline; }
.club-name-full { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.club-name-short { display: none; }

.team-badge {
    width: var(--badge-size, 24px); height: var(--badge-size, 24px);
    border-radius: 50%; object-fit: contain; flex-shrink: 0;
    background: var(--surface-sunk);
}
.badge-placeholder {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--dark); color: var(--gold);
    font-size: 0.5625rem; font-weight: 800; letter-spacing: 0.02em;
}

/* Form */
.form-badges { display: inline-flex; gap: 3px; }
.form-badge {
    width: 21px; height: 21px; border-radius: 5px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.6875rem; font-weight: 800; color: var(--white);
}
/* A lighter, brighter green than --win specifically for this badge — --win
   itself stays dark because it also serves as accessible text-on-light
   elsewhere (result tiles, status badges). Dark text here instead of the
   shared white, since this background is too light for white to read on. */
.form-badge.is-w { background: #2ECC71; color: var(--ink); }
.form-badge.is-d { background: var(--draw); }
.form-badge.is-l { background: var(--loss); }

.pos-tag {
    display: inline-block; padding: 2px 7px; border-radius: 5px;
    background: var(--surface-sunk); color: var(--steel);
    font-size: 0.6875rem; font-weight: 800; letter-spacing: 0.03em;
    border-bottom: none;
}

/* ---------------------------------------------------------
   Fixtures and results
   --------------------------------------------------------- */
.day-group + .day-group { margin-top: 18px; }
.day-heading {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    padding: 0 2px 8px;
    font-size: 0.8125rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.06em; color: var(--steel);
}
.day-heading .comp { color: var(--gold-ink); }

.fixture-list {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.fixture-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center; gap: 10px;
    padding: 12px 14px; min-height: 60px;
    border-bottom: 1px solid var(--border);
    color: var(--ink);
}
.fixture-row:last-child { border-bottom: none; }
.fixture-row:hover { background: #FAFAF8; text-decoration: none; }

.fixture-team {
    display: flex; align-items: center; gap: 9px;
    font-weight: 600; font-size: 0.9375rem; min-width: 0;
}
.fixture-team .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fixture-team.away { flex-direction: row-reverse; text-align: right; }

.fixture-mid { text-align: center; min-width: 92px; }
.score-value {
    font-size: 1.0625rem; font-weight: 800; letter-spacing: -0.01em;
    white-space: nowrap;
}
.score-value.is-pending { font-size: 0.9375rem; font-weight: 700; color: var(--ink); }
.fixture-meta {
    font-size: 0.75rem; color: var(--steel); margin-top: 3px;
    display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
}
.fixture-meta .tz { font-size: 0.6875rem; color: var(--steel); }

.status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px; border-radius: var(--radius-pill);
    font-size: 0.6875rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.status-badge.is-finished  { background: var(--surface-sunk); color: var(--steel); }
.status-badge.is-scheduled { background: var(--gold-soft);    color: #5E3D00; }
.status-badge.is-live      { background: var(--live-soft);    color: var(--live); }
.status-badge.is-postponed { background: var(--draw-soft);    color: var(--draw); }
.status-badge.is-cancelled { background: var(--loss-soft);    color: var(--loss); }
.status-badge.is-live::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
    animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------------------------------------------------------
   Scorer list
   --------------------------------------------------------- */
.scorer-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.scorer-row {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-bottom: 1px solid var(--border);
}
.scorer-row:last-child { border-bottom: none; }
.scorer-rank {
    width: 22px; text-align: center; font-weight: 800;
    color: var(--steel); font-size: 0.8125rem;
}
.scorer-row.is-top .scorer-rank { color: var(--gold-ink); }
.scorer-info { flex: 1; min-width: 0; }
.scorer-name { font-weight: 700; font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scorer-name a { color: var(--ink); }
.scorer-name a:hover { color: var(--gold-ink); }
.scorer-team { font-size: 0.75rem; color: var(--steel); display: flex; align-items: center; gap: 5px; }
.scorer-stats { display: flex; gap: 14px; flex-shrink: 0; text-align: right; }
.scorer-stat strong { display: block; font-size: 1rem; font-weight: 800; line-height: 1.1; }
.scorer-stat small { font-size: 0.625rem; color: var(--steel); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------------------------------------------------------
   Stat rows
   --------------------------------------------------------- */
.stat-strip {
    display: grid; grid-template-columns: repeat(2, 1fr);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.stat-cell {
    padding: 13px 16px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.stat-value { font-size: 1.375rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.stat-label { font-size: 0.6875rem; color: var(--steel); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

/* ---------------------------------------------------------
   Match centre
   --------------------------------------------------------- */
.match-hero { background: var(--dark); color: var(--white); padding: 22px 0 26px; }
.match-teams {
    display: grid; grid-template-columns: 1fr auto 1fr;
    align-items: center; gap: 14px;
}
.match-team { display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center; }
.match-team-name { font-size: 0.9375rem; font-weight: 700; }
.match-team-name a { color: var(--white); }
.match-scoreline { font-size: clamp(1.9rem, 7vw, 2.75rem); font-weight: 800; letter-spacing: -0.03em; white-space: nowrap; }
.match-meta {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    flex-wrap: wrap; margin-top: 14px; font-size: 0.8125rem; color: var(--dark-text);
}
.match-meta .fs-icon { color: #6E6E78; }

.event-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.event-row { display: flex; gap: 12px; padding: 11px 15px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.event-row:last-child { border-bottom: none; }
.event-minute { width: 40px; flex-shrink: 0; font-weight: 800; font-size: 0.8125rem; color: var(--steel); }
.event-body { flex: 1; min-width: 0; font-size: 0.9375rem; }
.event-player { font-weight: 700; }
.event-note { color: var(--steel); font-size: 0.8125rem; }
.event-side { font-size: 0.75rem; font-weight: 800; color: var(--steel); letter-spacing: 0.03em; }
.event-mark { width: 16px; flex-shrink: 0; display: inline-flex; align-items: center; }
.card-mark { width: 10px; height: 14px; border-radius: 2px; display: inline-block; }
.card-mark.yellow { background: #D9A400; }
.card-mark.red    { background: var(--loss); }

/* ---------------------------------------------------------
   Alerts
   --------------------------------------------------------- */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 15px; border-radius: var(--radius-sm);
    border: 1px solid; font-size: 0.9rem; margin-bottom: 16px;
    position: relative;
}
.alert .fs-icon { margin-top: 2px; flex-shrink: 0; }
.alert-success { background: var(--win-soft);  border-color: #A9D6BF; color: #105434; }
.alert-error   { background: var(--loss-soft); border-color: #E9B4B0; color: #8C1D18; }
.alert-warning { background: var(--draw-soft); border-color: var(--gold-line); color: #6B5316; }
.alert-info    { background: #E7EEF6;          border-color: #B6CBE2; color: #1B4571; }
.alert a { color: inherit; text-decoration: underline; font-weight: 700; }
.alert-dismiss {
    margin-left: auto; color: inherit; opacity: 0.6;
    display: inline-flex; padding: 4px; border-radius: 4px;
}
.alert-dismiss:hover { opacity: 1; }

/* Data coverage / freshness strip */
.data-note {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 0.8125rem; color: var(--steel);
    padding: 10px 0;
}
.data-note .fs-icon { color: var(--steel); }
.data-note strong { color: var(--ink-soft); font-weight: 700; }

/* ---------------------------------------------------------
   Footer
   --------------------------------------------------------- */
.site-footer { background: var(--dark); color: var(--dark-text); padding: 30px 0; margin-top: 32px; }
.footer-inner { display: flex; flex-direction: column; gap: 16px; align-items: center; text-align: center; }
.footer-brand { color: var(--white); font-weight: 800; display: flex; align-items: center; gap: 8px; }
.footer-brand .fs-icon { color: var(--gold); }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
.footer-nav a { color: var(--dark-text); font-size: 0.875rem; }
.footer-nav a:hover { color: var(--white); }
.footer-note { font-size: 0.8125rem; color: #8B8B94; max-width: 62ch; }

/* ---------------------------------------------------------
   Sign in
   --------------------------------------------------------- */
.auth-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100dvh; background: var(--dark); padding: 24px 16px;
}
.auth-card {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    padding: 32px 30px; width: 100%; max-width: 400px;
}
.auth-brand {
    display: flex; align-items: center; justify-content: center; gap: 9px;
    font-weight: 800; font-size: 1.25rem; letter-spacing: -0.025em; color: var(--ink);
}
.auth-brand .fs-icon { color: var(--gold-ink); }
.auth-brand em { color: var(--gold-ink); font-style: normal; }
.auth-sub { text-align: center; font-size: 0.875rem; color: var(--steel); margin: 6px 0 24px; }
.auth-card .form-group { margin-bottom: 15px; }
.auth-card label { display: block; font-weight: 700; font-size: 0.875rem; margin-bottom: 5px; }
.auth-card .form-control { width: 100%; }
.auth-card .btn { width: 100%; margin-top: 6px; }
.auth-back { text-align: center; margin-top: 18px; font-size: 0.875rem; }

/* ---------------------------------------------------------
   Admin
   --------------------------------------------------------- */
.admin-wrap { display: flex; min-height: 100dvh; background: var(--canvas); }

.admin-topbar {
    display: flex; align-items: center; gap: 12px;
    background: var(--dark); color: var(--white);
    padding: 10px 14px; position: sticky; top: 0; z-index: 90;
}
.admin-topbar .brand { font-weight: 800; display: flex; align-items: center; gap: 8px; }
.admin-topbar .brand .fs-icon { color: var(--gold); }
.admin-nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: var(--radius-sm);
    background: var(--dark-mid); border: 1px solid var(--dark-line); color: var(--white);
}

.admin-veil {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 130; border: none;
}

.admin-sidebar {
    position: fixed; inset: 0 auto 0 0; width: 264px; max-width: 84vw;
    background: var(--dark); z-index: 140;
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex; flex-direction: column; overflow-y: auto;
    box-shadow: var(--shadow-drawer);
}
.admin-sidebar.open { transform: translateX(0); }
.admin-sidebar .sidebar-brand {
    padding: 16px 18px; color: var(--white); font-weight: 800;
    display: flex; align-items: center; gap: 9px;
    border-bottom: 1px solid var(--dark-line);
}
.admin-sidebar .sidebar-brand .fs-icon { color: var(--gold); }
.admin-sidebar .sidebar-section {
    padding: 16px 18px 6px; font-size: 0.6875rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.08em; color: #77777F;
}
.admin-sidebar a {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 18px; min-height: 44px;
    color: var(--dark-text); font-size: 0.9375rem; font-weight: 600;
}
.admin-sidebar a:hover { background: var(--dark-mid); color: var(--white); text-decoration: none; }
.admin-sidebar a[aria-current="page"] { background: var(--dark-mid); color: var(--white); }
.admin-sidebar a[aria-current="page"] .fs-icon { color: var(--gold); }
.admin-sidebar .sidebar-foot { margin-top: auto; border-top: 1px solid var(--dark-line); padding: 6px 0 10px; }

.admin-content { flex: 1; padding: 18px 16px 48px; min-width: 0; }
.admin-title { font-size: 1.375rem; font-weight: 800; letter-spacing: -0.025em; margin-bottom: 4px; }
.admin-lede { color: var(--steel); font-size: 0.9375rem; margin-bottom: 20px; }

.admin-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 22px; }
.admin-stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px;
}
.admin-stat .stat-value { font-size: 1.5rem; }

.form-group { margin-bottom: 16px; }
.form-group > label { display: block; font-weight: 700; font-size: 0.875rem; margin-bottom: 5px; }
.form-group .form-control { width: 100%; }
.form-hint { font-size: 0.8125rem; color: var(--steel); margin-top: 5px; }

/* Import result breakdown */
.result-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px;
    background: var(--border); border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden; margin-top: 12px;
}
.result-cell { background: var(--surface); padding: 10px 13px; }
.result-cell .n { font-size: 1.125rem; font-weight: 800; line-height: 1.1; }
.result-cell .k { font-size: 0.6875rem; color: var(--steel); text-transform: uppercase; letter-spacing: 0.06em; }
.result-cell.is-bad .n { color: var(--loss); }
.result-cell.is-warn .n { color: var(--draw); }
.result-cell.is-good .n { color: var(--win); }

/* Stack data tables into labelled rows on small screens. */
@media (max-width: 639px) {
    .stack-table thead { display: none; }
    .stack-table tbody tr {
        display: grid; grid-template-columns: 1fr 1fr;
        gap: 2px 10px; padding: 12px 14px; border-bottom: 1px solid var(--border);
    }
    .stack-table tbody td { border: none; padding: 2px 0; }
    .stack-table tbody td[data-label]::before {
        content: attr(data-label) ': ';
        font-size: 0.75rem; color: var(--steel); font-weight: 700;
    }
    .stack-table tbody td.is-wide { grid-column: 1 / -1; }
    .stack-table tbody td.col-end { text-align: left; }
}

/* ---------------------------------------------------------
   Home
   --------------------------------------------------------- */
.home-hero { background: var(--dark); color: var(--white); padding: 22px 0 24px; }
.home-hero h1 {
    font-size: clamp(1.5rem, 4vw, 2.125rem); font-weight: 800;
    letter-spacing: -0.03em; line-height: 1.08; max-width: 20ch;
}
.home-hero h1 em { color: var(--gold); font-style: normal; }
.home-hero .lede { color: var(--dark-text); font-size: 0.9375rem; margin-top: 8px; max-width: 58ch; }
.home-search { margin-top: 16px; display: flex; gap: 8px; max-width: 460px; }
.home-search .field {
    flex: 1; display: flex; align-items: center; gap: 9px;
    background: var(--dark-mid); border: 1px solid var(--dark-line);
    border-radius: var(--radius-sm); padding: 0 14px;
}
.home-search .field:focus-within { border-color: var(--gold); }
.home-search .field .fs-icon { color: #7C7C87; }
.home-search input {
    flex: 1; background: none; border: none; outline: none;
    color: var(--white); padding: 12px 0; min-width: 0;
}
.home-search input::placeholder { color: #7C7C87; }

.home-grid { display: grid; grid-template-columns: 1fr; gap: 22px; padding: 22px 0; }
.home-col { min-width: 0; }

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (min-width: 480px) {
    .stat-strip { grid-template-columns: repeat(4, 1fr); }
    .admin-stats { grid-template-columns: repeat(4, 1fr); }
    .result-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (min-width: 640px) {
    .container { padding: 0 1.75rem; }
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .fixture-mid { min-width: 120px; }
    .admin-content { padding: 24px 28px 56px; }
}

@media (min-width: 900px) {
    .home-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
}

@media (min-width: 1000px) {
    .container { padding: 0 2.5rem; }
    .site-nav { display: flex; align-items: center; }
    .site-nav ul {
        position: static; flex-direction: row; background: none;
        border: none; padding: 0; gap: 2px;
    }
    .site-nav a { padding: 8px 12px; min-height: 38px; font-size: 0.875rem; }
    .nav-toggle { display: none; }
    .header-search { display: flex; }

    /* The sidebar becomes permanent furniture on a wide screen. */
    .admin-topbar { display: none; }
    .admin-sidebar {
        position: sticky; top: 0; height: 100dvh; transform: none;
        box-shadow: none; border-right: 1px solid var(--dark-line); max-width: none;
    }
    .admin-veil { display: none; }
    .admin-content { padding: 28px 36px 60px; }
}

/* Narrow screens: shorten club names and drop the columns a table can spare,
   keeping position, club, played, goal difference and points. */
@media (max-width: 719px) {
    .club-name-full  { display: none; }
    .club-name-short { display: inline; }
    .hide-sm { display: none; }
}

@media (max-width: 419px) {
    .hide-xs { display: none; }
    .fixture-row { padding: 11px 10px; }
    .fixture-team { font-size: 0.875rem; gap: 7px; }
}

@media print {
    .site-header, .site-footer, .tabs, .control-bar, .admin-sidebar, .admin-topbar { display: none; }
    body { background: #fff; }
    .table-frame, .card { border-color: #999; }
}
