/* ==========================================================
   LEIKTÍMINN — DESIGN SYSTEM
   "Matchday": charcoal surfaces, a restrained sage accent,
   gold reserved for favourites, scoreboard-style numerals.

   Shared by leiktiminn.html and leiktiminn-match.html.
   Sections:
     1. Tokens & base
     2. Icons, buttons, form controls
     3. App shell: header, desktop nav, footer
     4. Mobile bottom nav & create menu
     5. Views & headings
     6. Match cards
     7. Filter toolbar & date-range picker
     8. Tölfræði
     9. Profile & Garmin
    10. Auth
    11. Create / edit match modal & date-time picker
    12. Slide-out menu & info overlays
    13. Notifications, pull-to-refresh, misc
    14. Responsive
   ========================================================== */


/* ==========================================================
   1. TOKENS & BASE
   ========================================================== */

:root {
    color-scheme: dark;

    --bg: #101214;
    --bg-elev: #14171a;
    --surface: #191c20;
    --surface-2: #1f2327;
    --surface-3: #272c31;

    --line: rgba(255, 255, 255, 0.07);
    --line-2: rgba(255, 255, 255, 0.11);
    --line-3: rgba(255, 255, 255, 0.18);

    --text: #eceeec;
    --text-2: #b3b9b5;
    --text-3: #868e8a;

    --accent: #8ec79c;
    --accent-hover: #a2d4ae;
    --accent-ink: #0d1a11;
    --accent-soft: rgba(142, 199, 156, 0.12);
    --accent-line: rgba(142, 199, 156, 0.36);

    --gold: #dcb45f;
    --gold-soft: rgba(220, 180, 95, 0.13);
    --gold-line: rgba(220, 180, 95, 0.4);

    --info: #8fb2d6;
    --danger: #e98a7f;
    --danger-soft: rgba(233, 138, 127, 0.1);
    --danger-line: rgba(233, 138, 127, 0.34);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --shadow-pop:
        0 16px 40px rgba(0, 0, 0, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.32);

    --font:
        -apple-system, BlinkMacSystemFont, "SF Pro Text",
        "Segoe UI Variable Text", "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;

    --font-mono:
        ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

    --header-h: 56px;
    --toolbar-h: 46px;
    --nav-h: 62px;
    --page-max: 1040px;
    --list-max: 800px;

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

img,
svg {
    display: block;
    max-width: 100%;
}

h1,
h2,
h3,
h4,
p {
    margin: 0;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: default;
}

:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

::selection {
    background: rgba(142, 199, 156, 0.3);
}

.panel-eyebrow {
    color: var(--text-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.visually-hidden,
.stats-filter-copy small,
.date-range.is-enhanced > label,
.date-range.is-enhanced > .played-date-range-separator,
.date-range.is-enhanced > .stats-date-separator {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}


/* ==========================================================
   2. ICONS, BUTTONS, FORM CONTROLS
   ========================================================== */

.lt-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Shared button shapes */

.primary-button,
.profile-button-primary,
.create-match-button,
#authSubmitButton,
.match-datetime-confirm,
#saveCompetitionButton,
#saveCompetitionColorButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 14px;
    font-weight: 650;
    letter-spacing: 0.005em;
    white-space: nowrap;
    transition:
        background-color 150ms var(--ease),
        transform 150ms var(--ease);
}

.primary-button:hover,
.profile-button-primary:hover,
.create-match-button:hover,
#authSubmitButton:hover,
.match-datetime-confirm:hover,
#saveCompetitionButton:hover,
#saveCompetitionColorButton:hover {
    background: var(--accent-hover);
}

.primary-button:active,
.profile-button-primary:active,
.create-match-button:active,
#authSubmitButton:active,
.match-datetime-confirm:active {
    transform: translateY(1px);
}

.primary-button:disabled,
.profile-button-primary:disabled,
#authSubmitButton:disabled,
#saveCompetitionButton:disabled {
    opacity: 0.55;
    transform: none;
}

.secondary-button,
.profile-button-secondary,
.match-datetime-cancel,
.profile-text-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line-3);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition:
        background-color 150ms var(--ease),
        border-color 150ms var(--ease);
}

.secondary-button:hover,
.profile-button-secondary:hover,
.match-datetime-cancel:hover,
.profile-text-button:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.26);
}

.profile-button-secondary:disabled {
    opacity: 0.55;
}

/* Icon-only round button */

.menu-button,
.played-notification-button,
.match-modal-close,
.match-datetime-close,
.menu-close,
.about-close {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text-2);
    transition:
        background-color 150ms var(--ease),
        color 150ms var(--ease);
}

.menu-button:hover,
.played-notification-button:hover,
.match-modal-close:hover,
.match-datetime-close:hover,
.menu-close:hover,
.about-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

/* Form controls */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input:not([type]),
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
    transition:
        border-color 150ms var(--ease),
        box-shadow 150ms var(--ease),
        background-color 150ms var(--ease);
}

textarea {
    min-height: 120px;
    padding: 12px;
    line-height: 1.5;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: #6f7773;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--line-3);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-line);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

input[readonly] {
    color: var(--text-2);
}

select {
    padding-right: 34px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa29e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    cursor: pointer;
    text-overflow: ellipsis;
}

select option {
    background: var(--surface-2);
    color: var(--text);
}

input[type="color"] {
    width: 44px;
    height: 44px;
    padding: 4px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 0;
    border-radius: 7px;
}


/* ==========================================================
   3. APP SHELL
   ========================================================== */

body.auth-locked #leiktiminnApp,
body.auth-locked .mobile-bottom-nav,
body.auth-locked .mobile-create-menu {
    display: none;
}

body:not(.auth-locked) #authGate {
    display: none;
}

.leiktiminn-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Header */

.leiktiminn-header,
.auth-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: calc(var(--header-h) + var(--safe-top));
    padding:
        var(--safe-top)
        max(20px, env(safe-area-inset-right, 0px))
        0
        max(20px, env(safe-area-inset-left, 0px));
}

.leiktiminn-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(16, 18, 20, 0.88);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.leiktiminn-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
}

.leiktiminn-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: cover;
}

.leiktiminn-wordmark {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1;
    white-space: nowrap;
}

.leiktiminn-header-actions {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
}

.menu-button span {
    position: absolute;
    left: 50%;
    width: 16px;
    height: 1.6px;
    margin-left: -8px;
    border-radius: 2px;
    background: currentColor;
}

.menu-button span:nth-child(1) {
    top: 13px;
}

.menu-button span:nth-child(2) {
    top: 18px;
}

.menu-button span:nth-child(3) {
    top: 23px;
}

.profile-button {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line-2);
    border-radius: 50%;
    background-color: var(--surface-3);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition: border-color 150ms var(--ease);
}

.profile-button:hover {
    border-color: var(--line-3);
}

.profile-button.has-profile-image {
    color: transparent;
}

/* Desktop toolbar (tabs + create) */

.leiktiminn-toolbar {
    position: sticky;
    top: calc(var(--header-h) + var(--safe-top));
    z-index: 39;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: var(--toolbar-h);
    padding: 0 20px;
    border-bottom: 1px solid var(--line);
    background: rgba(16, 18, 20, 0.88);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.desktop-view-tabs {
    display: flex;
    align-items: stretch;
    align-self: stretch;
    gap: 4px;
}

.desktop-view-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    border: 0;
    background: transparent;
    color: var(--text-3);
    font-size: 14px;
    font-weight: 600;
    transition: color 150ms var(--ease);
}

.desktop-view-tab:hover {
    color: var(--text);
}

.desktop-view-tab::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform 200ms var(--ease);
}

.desktop-view-tab.active {
    color: var(--text);
}

.desktop-view-tab.active::after {
    transform: scaleX(1);
}

.desktop-view-tab:focus-visible {
    outline-offset: -4px;
    border-radius: 8px;
}

.create-match-button {
    min-height: 32px;
    padding: 0 12px 0 10px;
    font-size: 13px;
}

.create-match-button .lt-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2.2;
}

.played-unread-count {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 10.5px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

/* Footer */

.leiktiminn-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
    padding: 32px 20px 40px;
    color: var(--text-3);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.leiktiminn-footer img {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    opacity: 0.8;
}


/* ==========================================================
   4. MOBILE BOTTOM NAV & CREATE MENU
   ========================================================== */

.mobile-bottom-nav {
    display: none;
}

.mobile-create-menu {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
    z-index: 60;
    min-width: 200px;
    padding: 6px;
    border: 1px solid var(--line-2);
    border-radius: 14px;
    background: var(--surface-3);
    box-shadow: var(--shadow-pop);
    transform: translateX(-50%);
    animation: lt-pop-up 160ms var(--ease);
}

.mobile-create-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 0 16px 0 8px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    text-align: left;
}

.mobile-create-menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mobile-create-menu-item > span {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent);
}

@keyframes lt-pop-up {
    from {
        opacity: 0;
        transform: translate(-50%, 6px);
    }
}


/* ==========================================================
   5. VIEWS & HEADINGS
   ========================================================== */

.leiktiminn-view-stack,
.match-page-main {
    width: 100%;
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 28px 24px 24px;
}

.leiktiminn-view[data-view="upcoming"],
.leiktiminn-view[data-view="played"] {
    max-width: var(--list-max);
    margin: 0 auto;
}

.leiktiminn-view[data-view="profile"] {
    max-width: 720px;
    margin: 0 auto;
}

/* Boot view (?view=): show the requested section from the first paint.
   The inline <head> script sets data-boot-view; switchView() clears it. */
:root[data-boot-view] .leiktiminn-view[data-view="upcoming"] {
    display: none !important;
}

:root[data-boot-view="played"] .leiktiminn-view[data-view="played"][hidden],
:root[data-boot-view="stats"] .leiktiminn-view[data-view="stats"][hidden],
:root[data-boot-view="profile"] .leiktiminn-view[data-view="profile"][hidden] {
    display: block !important;
}

/* Opacity only: a transform here would become the containing block
   for fixed-position children (date-range bottom sheet) while it runs. */
.leiktiminn-view.active {
    animation: lt-fade 200ms var(--ease);
}

@keyframes lt-fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
}

/* Panels are flat: cards sit directly on the page */

.leiktiminn-panel,
.stats-overview-panel {
    padding: 0;
    border: 0;
    background: none;
}

.view-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.view-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.view-count {
    display: inline-grid;
    place-items: center;
    min-width: 26px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.view-count:empty {
    display: none;
}

.empty-state,
.stats-dashboard-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 40px 20px;
    border: 1px dashed var(--line-2);
    border-radius: var(--radius-lg);
    color: var(--text-3);
    font-size: 13.5px;
    text-align: center;
}

.empty-state strong,
.stats-dashboard-empty strong {
    color: var(--text);
    font-size: 15px;
    font-weight: 650;
}


/* ==========================================================
   6. MATCH TICKETS (v3)
   Stub   = kickoff block: weekday, day, month + kickoff time,
            with the competition colour as a rail.
   Body   = competition eyebrow, stacked teams (scoreboard),
            role · venue, status chips.
   Side   = favourite + actions.
   Upcoming and played share the same ticket; only the
   month accent and chips differ.
   ========================================================== */

.matches-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.match-month-heading {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 14px 2px 0;
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.match-month-heading:first-child {
    margin-top: 0;
}

.match-month-heading span {
    color: var(--text-3);
    font-weight: 600;
}

.match-item {
    position: relative;
    display: grid;
    grid-template-columns: 66px minmax(0, 1fr) auto;
    grid-template-areas: "stub body side";
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    cursor: pointer;
    transition:
        background-color 150ms var(--ease),
        border-color 150ms var(--ease);
}

.match-item:hover {
    border-color: var(--line-2);
    background: #1c2024;
}

.match-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.match-item.is-next {
    border-color: var(--line-3);
}

/* Perforation notches between stub and body */
.match-item::before,
.match-item::after {
    content: "";
    position: absolute;
    left: 60px;
    width: 12px;
    height: 12px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--bg);
}

.match-item::before {
    top: -7px;
    clip-path: inset(50% 0 0 0);
}

.match-item::after {
    bottom: -7px;
    clip-path: inset(0 0 50% 0);
}

.match-item.is-next::before,
.match-item.is-next::after {
    border-color: var(--line-3);
}

/* Stub: date + kickoff together */

.ticket-stub {
    grid-area: stub;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 0;
    border-right: 1px dashed var(--line-2);
    text-align: center;
}

/* Competition rail on the ticket edge */
.ticket-stub::before {
    content: "";
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: -1px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--competition-color, var(--text-3));
}

.match-item[style*="#63d96a" i] {
    --competition-color: var(--accent) !important;
}

.ticket-weekday {
    color: var(--text-3);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1;
}

.ticket-stub strong {
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.ticket-month {
    color: var(--text-2);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1;
}

.ticket-time {
    width: 44px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--line-2);
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.is-played .ticket-time {
    color: var(--text-2);
}

.match-item.match-favorite .ticket-month {
    color: var(--gold);
}

.match-item.match-unread {
    border-color: var(--accent-line);
}

/* Body */

.ticket-body {
    grid-area: body;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 11px 4px 12px 14px;
}

.ticket-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 18px;
}

.match-competition-inline {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    overflow: hidden;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.match-competition-inline::before {
    content: "";
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: var(--competition-color, var(--text-3));
}

.ticket-countdown {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 14px;
    white-space: nowrap;
}

.match-new-badge {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: 5px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

/* Teams: stacked like a scoreboard */

.ticket-teams {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 1px 0 2px;
    font-weight: inherit;
}

.ticket-team {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.ticket-team-name {
    min-width: 0;
    color: var(--text);
    font-size: 15.5px;
    font-weight: 650;
    letter-spacing: 0.005em;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.ticket-score {
    flex: 0 0 auto;
    min-width: 22px;
    padding: 0 6px;
    border-radius: 5px;
    background: var(--surface-3);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    text-align: center;
}

/* Meta: role · venue */

.ticket-meta {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    color: var(--text-3);
    font-size: 12.5px;
    line-height: 1.35;
}

.match-role-badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}

.match-role-badge::before {
    content: "";
    width: 12px;
    height: 12px;
    background: currentColor;
    opacity: 0.8;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='3.6'/%3E%3Cpath d='M5 20v-1c0-3.2 3.1-5.6 7-5.6s7 2.4 7 5.6v1'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='3.6'/%3E%3Cpath d='M5 20v-1c0-3.2 3.1-5.6 7-5.6s7 2.4 7 5.6v1'/%3E%3C/svg%3E") center / contain no-repeat;
}

.match-venue-inline {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.match-role-badge + .match-venue-inline::before {
    content: "·";
    margin-right: 6px;
}

/* Chips: sync, Garmin distance, self-assessment */

.ticket-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
}

.match-garmin-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 22px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.match-garmin-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-3);
}

.match-garmin-status.sent .match-garmin-dot {
    background: var(--info);
}

.match-garmin-status.synced,
.match-garmin-status.activity-received {
    border-color: var(--accent-line);
    color: var(--text);
}

.match-garmin-status.synced .match-garmin-dot,
.match-garmin-status.activity-received .match-garmin-dot {
    background: var(--accent);
}

.self-score-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    padding: 0 9px 0 7px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    color: var(--text);
    font-size: 11.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.self-score-chip::before {
    content: "";
    width: 12px;
    height: 12px;
    background: var(--accent);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19h16'/%3E%3Cpath d='M7 15v-3M12 15V7M17 15v-6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19h16'/%3E%3Cpath d='M7 15v-3M12 15V7M17 15v-6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.self-score-chip small {
    margin-left: -3px;
    color: var(--text-3);
    font-size: 10px;
    font-weight: 600;
}

.self-score-chip.is-empty {
    border-style: dashed;
    border-color: var(--line-3);
    color: var(--text-2);
    font-weight: 600;
}

.self-score-chip.is-empty::before {
    background: var(--text-3);
}

/* Side: favourite + actions */

.ticket-side {
    grid-area: side;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 6px 6px 0;
}

.is-played .ticket-side {
    justify-content: space-between;
}

.match-favorite-button,
.match-more-button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-3);
    font-size: 0;
    transition:
        background-color 150ms var(--ease),
        color 150ms var(--ease);
}

.match-favorite-button > span {
    display: none;
}

.match-favorite-button::before,
.played-favorite-filter::before,
.match-more-button::before {
    content: "";
    width: 19px;
    height: 19px;
    background: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
}

.match-favorite-button,
.played-favorite-filter {
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M12 3.6l2.55 5.2 5.75.84-4.16 4.05.98 5.72L12 16.7l-5.12 2.7.98-5.72L3.7 9.64l5.75-.84z'/%3E%3C/svg%3E");
}

.match-favorite-button[aria-pressed="true"],
.played-favorite-filter[aria-pressed="true"] {
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black' stroke='black' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M12 3.6l2.55 5.2 5.75.84-4.16 4.05.98 5.72L12 16.7l-5.12 2.7.98-5.72L3.7 9.64l5.75-.84z'/%3E%3C/svg%3E");
}

.match-more-button {
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Ccircle cx='12' cy='5.5' r='1.7'/%3E%3Ccircle cx='12' cy='12' r='1.7'/%3E%3Ccircle cx='12' cy='18.5' r='1.7'/%3E%3C/svg%3E");
}

/* Star: 20px icon in a 40 x 40px target (V3.1) */
.match-favorite-button::before {
    width: 20px;
    height: 20px;
    transition: transform 150ms var(--ease);
}

.match-favorite-button:focus-visible {
    color: var(--gold);
}

@media (hover: hover) {
    .match-favorite-button:hover {
        background: var(--gold-soft);
        color: var(--gold);
    }

    .match-favorite-button:hover::before {
        transform: scale(1.08);
    }
}

.match-favorite-button[aria-pressed="true"] {
    color: var(--gold);
}

.match-more-button:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

/* Context menu */

.match-action-menu {
    position: absolute;
    top: calc(50% + 22px);
    right: 6px;
    z-index: 30;
    min-width: 190px;
    padding: 6px;
    border: 1px solid var(--line-2);
    border-radius: 12px;
    background: var(--surface-3);
    box-shadow: var(--shadow-pop);
    cursor: default;
}

.match-action-menu.open-up {
    top: auto;
    bottom: calc(50% + 22px);
}

.match-menu-action {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
}

.match-menu-action:hover {
    background: rgba(255, 255, 255, 0.06);
}

.match-menu-action.delete-match-button {
    position: relative;
    margin-top: 7px;
    color: var(--danger);
}

.match-menu-action.delete-match-button::before {
    content: "";
    position: absolute;
    top: -4px;
    right: 6px;
    left: 6px;
    height: 1px;
    background: var(--line);
}

.match-menu-action.delete-match-button:hover {
    background: var(--danger-soft);
}

/* Desktop & tablet: chips move beside the teams */

@media (min-width: 761px) {
    .match-item {
        grid-template-columns: 76px minmax(0, 1fr) auto;
    }

    .match-item::before,
    .match-item::after {
        left: 70px;
    }

    .ticket-body {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "eyebrow eyebrow"
            "teams   chips"
            "meta    chips";
        column-gap: 16px;
        row-gap: 3px;
        padding: 12px 8px 13px 18px;
    }

    .ticket-eyebrow {
        grid-area: eyebrow;
    }

    .ticket-teams {
        grid-area: teams;
        max-width: 380px;
    }

    .ticket-meta {
        grid-area: meta;
    }

    .ticket-chips {
        grid-area: chips;
        flex-direction: column;
        align-items: flex-end;
        justify-content: center;
        margin-top: 0;
    }

    .ticket-stub strong {
        font-size: 26px;
    }

    .ticket-team-name {
        font-size: 16px;
    }
}

/* Narrow phones */

@media (max-width: 380px) {
    .match-item {
        grid-template-columns: 58px minmax(0, 1fr) auto;
    }

    .match-item::before,
    .match-item::after {
        left: 52px;
    }

    .ticket-stub strong {
        font-size: 22px;
    }

    .ticket-body {
        padding-left: 12px;
    }

    .ticket-team-name {
        font-size: 14.5px;
    }

    .match-garmin-status {
        gap: 5px;
        padding: 0 7px;
    }

    .match-favorite-button,
    .match-more-button {
        width: 40px;
    }
}

/* ==========================================================
   7. FILTER TOOLBAR & DATE-RANGE PICKER
   ========================================================== */

.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

/* One joined, segmented control for favourites / period / competition
   (Spilaðir) and period / competition / GPS (Tölfræði). */

.filter-group,
.stats-filter-bar {
    display: flex;
    align-items: stretch;
    width: fit-content;
    max-width: 100%;
    height: 36px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: var(--surface);
}

.filter-group > *,
.stats-filter-bar > * {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    border-left: 1px solid var(--line);
    color: var(--text);
    transition:
        background-color 150ms var(--ease),
        color 150ms var(--ease);
}

.filter-group > :first-child,
.stats-filter-bar > :first-child {
    border-left: 0;
    border-radius: 9px 0 0 9px;
}

.filter-group > :last-child,
.stats-filter-bar > :last-child {
    border-radius: 0 9px 9px 0;
}

.filter-group > :hover,
.stats-filter-bar > :hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Keyboard focus drawn inside the segment */
.filter-select:has(select:focus-visible),
.stats-filter-control:has(select:focus-visible) {
    box-shadow: inset 0 0 0 2px var(--accent);
}

.filter-chip-icon:focus-visible {
    outline-offset: -3px;
}

/* Favourites (gold) */

.filter-chip-icon {
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    padding: 0;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    background: transparent;
    color: var(--text-2);
}

.played-favorite-filter::before {
    width: 17px;
    height: 17px;
}

.played-favorite-filter > span {
    display: none;
}

.played-favorite-filter:hover {
    color: var(--gold);
}

.played-favorite-filter[aria-pressed="true"],
.played-favorite-filter[aria-pressed="true"]:hover {
    background: var(--gold-soft);
    color: var(--gold);
}

/* Selects: the select fills the whole segment, so every pixel is clickable */

.filter-select {
    flex: 0 1 190px;
}

.stats-filter-control {
    flex: 0 1 200px;
    cursor: pointer;
}

.filter-select > .lt-icon,
.stats-filter-icon {
    position: absolute;
    top: 50%;
    left: 10px;
    width: 15px;
    height: 15px;
    color: var(--text-3);
    pointer-events: none;
    transform: translateY(-50%);
}

.stats-filter-icon svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.filter-select select,
.stats-filter-control select {
    width: 100%;
    min-height: 0;
    height: 100%;
    padding: 0 28px 0 32px;
    border: 0;
    border-radius: inherit;
    background-color: transparent;
    background-position: right 8px center;
    background-size: 15px;
    color: inherit;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
}

.filter-select select:focus,
.stats-filter-control select:focus {
    box-shadow: none;
}

.stats-filter-copy {
    display: contents;
}

/* Active (non-default) selection: light tint + accent icon */

.filter-select:has(option:checked:not([value="all"])),
.stats-filter-control:has(option:checked:not([value="all"])) {
    background: rgba(142, 199, 156, 0.09);
}

.filter-select:has(option:checked:not([value="all"])) > .lt-icon,
.stats-filter-control:has(option:checked:not([value="all"])) .stats-filter-icon {
    color: var(--accent);
}

/* Date-range chip: same height and shape as the group */

.date-range-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 36px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    transition:
        background-color 150ms var(--ease),
        border-color 150ms var(--ease);
}

.date-range-trigger:hover {
    border-color: var(--line-3);
    background: var(--surface-2);
}

.date-range-trigger.has-value {
    border-color: var(--accent-line);
    background: rgba(142, 199, 156, 0.09);
}

/* Hreinsa (only rendered when a filter is active) */

.filter-clear {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 36px;
    padding: 0 10px 0 8px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
}

.filter-clear:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.filter-clear .lt-icon {
    width: 15px;
    height: 15px;
}

/* Date range */

.date-range {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Fallback (no JS): compact native inputs */
.date-range:not(.is-enhanced) label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-3);
    font-size: 12.5px;
    font-weight: 600;
}

.date-range:not(.is-enhanced) input[type="date"] {
    width: auto;
    min-height: 38px;
    font-size: 13.5px;
}

.date-range-trigger {
    gap: 8px;
    padding: 0 12px 0 10px;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
}

.date-range-trigger .lt-icon {
    width: 16px;
    height: 16px;
    color: var(--text-3);
}

.date-range-trigger.has-value .lt-icon {
    color: var(--accent);
}

.date-range-trigger[aria-expanded="true"] {
    border-color: var(--accent-line);
}

.date-range-scrim {
    display: none;
}

.date-range-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 70;
    width: 312px;
    padding: 12px;
    border: 1px solid var(--line-2);
    border-radius: 16px;
    background: var(--surface-3);
    box-shadow: var(--shadow-pop);
    animation: lt-fade-in 160ms var(--ease);
}

.date-range-ends {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.date-range-end {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.14);
    text-align: left;
}

.date-range-end small {
    color: var(--text-3);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.date-range-end strong {
    font-size: 13.5px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.date-range-end.is-active {
    border-color: var(--accent-line);
    background: var(--accent-soft);
}

.date-range-ends-arrow {
    color: var(--text-3);
}

.date-range-ends-arrow .lt-icon {
    width: 16px;
    height: 16px;
}

.date-range-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.date-range-month {
    font-size: 14px;
    font-weight: 650;
}

.date-range-nav {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-2);
}

.date-range-nav:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.date-range-weekdays,
.date-range-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.date-range-weekdays span {
    padding: 4px 0 6px;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 650;
    text-align: center;
}

.date-range-day {
    position: relative;
    height: 38px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
    isolation: isolate;
}

.date-range-day::before {
    content: "";
    position: absolute;
    inset: 2px;
    z-index: -1;
    border-radius: 9px;
    transition: background-color 120ms var(--ease);
}

.date-range-day:hover::before {
    background: rgba(255, 255, 255, 0.07);
}

.date-range-day.is-outside {
    color: #5f6763;
}

.date-range-day.is-today::before {
    box-shadow: inset 0 0 0 1px var(--line-3);
}

.date-range-day.is-in-range {
    background: var(--accent-soft);
}

.date-range-day.is-start,
.date-range-day.is-end {
    color: var(--accent-ink);
    font-weight: 700;
}

.date-range-day.is-start::before,
.date-range-day.is-end::before {
    background: var(--accent);
}

.has-range .date-range-day.is-start:not(.is-end) {
    background: linear-gradient(90deg, transparent 50%, var(--accent-soft) 50%);
}

.has-range .date-range-day.is-end:not(.is-start) {
    background: linear-gradient(90deg, var(--accent-soft) 50%, transparent 50%);
}

.date-range-day.is-preview.is-end::before {
    background: var(--accent-line);
}

.date-range-day.is-preview.is-end {
    color: var(--text);
}

.date-range-day:focus-visible {
    outline-offset: -2px;
    border-radius: 9px;
}

.date-range-foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.date-range-clear,
.date-range-done {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 650;
}

.date-range-clear {
    border: 0;
    background: transparent;
    color: var(--text-2);
}

.date-range-clear:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.date-range-done {
    border: 0;
    background: var(--accent);
    color: var(--accent-ink);
}

.date-range-done:hover {
    background: var(--accent-hover);
}


/* ==========================================================
   8. TÖLFRÆÐI
   ========================================================== */

.stats-overview-panel .view-heading {
    margin-bottom: 12px;
}

.stats-custom-date-range {
    margin-top: 6px;
}

.stats-future {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.stats-future > * {
    min-width: 0;
}

.stats-dashboard-header,
.stats-dashboard-hero,
.stats-dashboard-empty,
.stats-dashboard-loading {
    grid-column: 1 / -1;
}

.stats-dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.stats-dashboard-header > div {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.stats-dashboard-header .panel-eyebrow {
    color: var(--accent);
}

.stats-dashboard-header h3 {
    font-size: 16px;
    font-weight: 650;
}

.stats-garmin-count {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.stats-dashboard-loading {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text-3);
    font-size: 13.5px;
}

.stats-dashboard-loading h3 {
    color: var(--text);
    font-size: 15px;
}

/* Shared stat card surface */

.stats-dashboard-hero,
.stats-record-card,
.stats-average-card,
.stats-half-dashboard,
.stats-leaderboard {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

/* Garmin overview (V3.1): compact metric tiles that replace the
   distance-only hero. Two columns on phones, five on desktop. */

.stats-overview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--line);
}

.stats-overview-tile {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 14px 16px;
    background: var(--surface);
}

.stats-overview-tile.is-primary {
    grid-column: 1 / -1;
}

.stats-overview-label {
    color: var(--text-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.stats-overview-value {
    display: flex;
    align-items: baseline;
    gap: 5px;
    min-width: 0;
}

.stats-overview-value strong {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.stats-overview-tile.is-primary .stats-overview-value strong {
    font-size: 34px;
}

.stats-overview-value small {
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 600;
}

.stats-overview-note {
    overflow: hidden;
    color: var(--text-3);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (min-width: 761px) {
    .stats-overview {
        grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr));
    }

    .stats-overview-tile.is-primary {
        grid-column: auto;
    }

    .stats-overview-tile {
        padding: 16px 18px;
    }
}

/* Switch used by the heatmap "Leið" toggle */

.match-heatmap-route-toggle-knob {
    position: relative;
    flex: 0 0 auto;
    width: 30px;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    transition: background-color 160ms var(--ease);
}

.match-heatmap-route-toggle-knob::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d4d8d6;
    transition: transform 160ms var(--ease);
}

/* Records */

.stats-record-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.stats-record-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    padding: 14px;
}

.stats-record-card > div {
    min-width: 0;
}

.stats-record-icon {
    display: grid;
    place-items: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 15px;
    line-height: 1;
}

.stats-record-label {
    display: block;
    color: var(--text-3);
    font-size: 12px;
    font-weight: 600;
}

.stats-record-value {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin: 3px 0 2px;
}

.stats-record-value strong {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.stats-record-value span {
    color: var(--text-3);
    font-size: 12px;
    font-weight: 600;
}

.stats-record-card small {
    display: block;
    overflow: hidden;
    color: var(--text-2);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Averages */

.stats-average-card {
    padding: 14px 16px;
}

.stats-average-card h4,
.stats-leaderboard-heading strong {
    margin-bottom: 10px;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.stats-average-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.stats-average-item {
    min-width: 0;
}

.stats-average-item strong {
    font-size: 21px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.stats-average-unit {
    margin-left: 3px;
    color: var(--text-3);
    font-size: 11.5px;
    font-weight: 600;
}

.stats-average-item small {
    display: block;
    color: var(--text-3);
    font-size: 11.5px;
}

/* Halves */

.stats-half-dashboard {
    display: grid;
    gap: 14px;
    padding: 14px 16px;
}

.stats-half-dashboard-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 12px;
}

.stats-half-dashboard-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    grid-column: 1 / -1;
}

.stats-half-dashboard-heading span {
    padding: 2px 7px;
    border-radius: 6px;
    background: var(--surface-3);
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
}

.stats-half-dashboard-heading strong {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stats-half-dashboard-heading small {
    color: var(--text-3);
    font-size: 11.5px;
    font-weight: 600;
}

.stats-half-progress {
    height: 6px;
    overflow: hidden;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
}

.stats-half-progress span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
}

.stats-half-dashboard-item:nth-child(2) .stats-half-progress span {
    background: rgba(142, 199, 156, 0.55);
}

.stats-half-dashboard-item > small {
    color: var(--text-3);
    font-size: 11.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Leaderboard */

.stats-leaderboard {
    padding: 14px 16px 6px;
}

.stats-leaderboard-heading {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.stats-leaderboard-heading > span {
    display: none;
}

.stats-leaderboard-heading > div {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.stats-leaderboard-heading small {
    color: var(--text-3);
    font-size: 11.5px;
}

.stats-leaderboard-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 6px;
    margin: 0 -6px;
    border-top: 1px solid var(--line);
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 150ms var(--ease);
}

.stats-leaderboard-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.stats-leaderboard-rank {
    color: var(--text-3);
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.stats-leaderboard-row:first-child .stats-leaderboard-rank {
    color: var(--accent);
}

.stats-leaderboard-match {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stats-leaderboard-match strong,
.stats-leaderboard-match small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-leaderboard-match strong {
    font-size: 13.5px;
    font-weight: 600;
}

.stats-leaderboard-match small {
    color: var(--text-3);
    font-size: 11.5px;
}

.stats-leaderboard-distance strong {
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stats-leaderboard-distance small {
    margin-left: 2px;
    color: var(--text-3);
    font-size: 11px;
}


/* ==========================================================
   9. PROFILE & GARMIN
   ========================================================== */

.profile-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-divider {
    display: none;
}

.profile-identity,
.profile-edit-panel,
.profile-section {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.profile-identity {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
}

.profile-avatar {
    position: relative;
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    overflow: hidden;
    border: 1px solid var(--line-2);
    border-radius: 50%;
    background: var(--surface-3);
    font-size: 21px;
    font-weight: 700;
}

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

.profile-identity-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.profile-identity-copy strong {
    max-width: 100%;
    overflow: hidden;
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#profileDisplayEmail {
    max-width: 100%;
    overflow: hidden;
    color: var(--text-3);
    font-size: 13.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-role-badge {
    margin-top: 6px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11.5px;
    font-weight: 650;
}

.profile-text-button {
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
}

.profile-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.profile-field > span,
.profile-avatar-field-label,
.form-field > span,
.form-field-label,
.auth-form label {
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 600;
}

.profile-avatar-field {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.profile-avatar-field-label {
    margin-bottom: 10px;
}

.profile-avatar-field-actions,
.profile-edit-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.profile-edit-actions {
    justify-content: flex-end;
    margin-top: 18px;
}

.profile-feedback {
    margin-top: 10px;
    color: var(--text-2);
    font-size: 13px;
}

.profile-feedback:empty {
    display: none;
}

.profile-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}

.profile-section > * {
    max-width: 100%;
}

.profile-section-heading {
    width: 100%;
}

.profile-section-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.profile-section-heading h4 {
    font-size: 15px;
    font-weight: 650;
}

.profile-section-description {
    max-width: 52ch;
    margin-top: 4px;
    color: var(--text-3);
    font-size: 13.5px;
    line-height: 1.45;
}

.profile-info-list {
    width: 100%;
}

.profile-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 44px;
    border-top: 1px solid var(--line);
}

.profile-info-row:first-child {
    border-top: 0;
}

.profile-info-row span {
    color: var(--text-3);
    font-size: 13.5px;
}

.profile-info-row strong {
    min-width: 0;
    overflow: hidden;
    font-size: 14px;
    font-weight: 550;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Garmin connection state */

.profile-garmin-status {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    height: 30px;
    padding: 0 12px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 12.5px;
    white-space: nowrap;
}

.profile-garmin-status strong {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
}

.profile-status-dot {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-3);
}

/* Connected: the script shows #forgetGarminButton only when a device exists */
.profile-garmin-section:has(#forgetGarminButton:not([hidden])) .profile-garmin-status {
    border-color: var(--accent-line);
    color: var(--text);
}

.profile-garmin-section:has(#forgetGarminButton:not([hidden])) .profile-status-dot {
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Once connected, "Tengja annað úr" becomes a secondary action */
.profile-garmin-section:has(#forgetGarminButton:not([hidden])) #connectGarminButton {
    border-color: var(--line-3);
    background: transparent;
    color: var(--text);
}

.profile-garmin-section:has(#forgetGarminButton:not([hidden])) #connectGarminButton:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Pairing in progress */
.profile-garmin-section:has(#garminPairingBox:not([hidden])) .profile-status-dot {
    background: var(--info);
}

#forgetGarminButton {
    border-color: var(--danger-line);
    color: var(--danger);
}

#forgetGarminButton:hover {
    background: var(--danger-soft);
}

.garmin-pairing-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 20px 16px;
    border: 1px solid var(--line-2);
    border-radius: 14px;
    background: var(--bg-elev);
    text-align: center;
}

.garmin-pairing-label {
    color: var(--text-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.garmin-pairing-code {
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0.28em;
    line-height: 1.1;
    padding-left: 0.28em;
}

.garmin-pairing-help {
    max-width: 40ch;
    color: var(--text-3);
    font-size: 13px;
}

/* Security row */

.profile-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 14px;
    font-weight: 550;
    text-align: left;
    transition: border-color 150ms var(--ease);
}

.profile-action-row:hover {
    border-color: var(--line-3);
}

.profile-action-row span:last-child {
    color: var(--text-3);
    font-size: 20px;
    line-height: 1;
}

.profile-password-panel {
    width: 100%;
}

/* Stillingar: language + Sjálfsmat categories */

.settings-group {
    display: grid;
    gap: 8px;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.settings-group legend {
    margin-bottom: 8px;
    padding: 0;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 650;
}

.settings-help {
    max-width: 56ch;
    margin-top: -4px;
    color: var(--text-3);
    font-size: 12.5px;
    line-height: 1.45;
}

/* Segmented switch, same look as the login/signup toggle */
.settings-segmented {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    width: min(320px, 100%);
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
}

.settings-segment {
    position: relative;
    cursor: pointer;
}

.settings-segment input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.settings-segment span {
    display: grid;
    place-items: center;
    min-height: 36px;
    border-radius: 9px;
    color: var(--text-3);
    font-size: 14px;
    font-weight: 600;
    transition:
        background-color 150ms var(--ease),
        color 150ms var(--ease);
}

.settings-segment:hover span {
    color: var(--text);
}

.settings-segment input:checked + span {
    background: var(--surface-3);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.settings-segment input:focus-visible + span {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.settings-checklist {
    display: grid;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
}

.settings-check {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 0 14px;
    border-top: 1px solid var(--line);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
}

.settings-check:first-child {
    border-top: 0;
}

.settings-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Logout: an understated, centred pill. Neutral at rest with only the
   icon carrying a muted red cue; fully red on hover/focus. */

.profile-footer-actions {
    display: flex;
    justify-content: center;
    padding: 14px 0 4px;
}

.profile-logout-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 168px;
    min-height: 44px;
    padding: 0 20px 0 16px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: transparent;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.005em;
    transition:
        background-color 150ms var(--ease),
        border-color 150ms var(--ease),
        color 150ms var(--ease);
}

.profile-logout-button::before {
    content: "";
    width: 17px;
    height: 17px;
    background: var(--danger);
    opacity: 0.85;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-4'/%3E%3Cpath d='M10 8l-4 4 4 4M6 12h10'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-4'/%3E%3Cpath d='M10 8l-4 4 4 4M6 12h10'/%3E%3C/svg%3E") center / contain no-repeat;
}

.profile-logout-button:hover,
.profile-logout-button:focus-visible {
    border-color: var(--danger-line);
    background: var(--danger-soft);
    color: var(--danger);
}

.profile-logout-button:hover::before {
    opacity: 1;
}

.profile-logout-button:disabled {
    opacity: 0.6;
}

/* ==========================================================
   10. AUTH
   ========================================================== */

.auth-gate {
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background:
        radial-gradient(900px 420px at 50% -8%, rgba(142, 199, 156, 0.07), transparent 70%),
        var(--bg);
}

.auth-card {
    width: min(420px, calc(100% - 32px));
    margin: auto;
    padding: 30px 26px 26px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

#authTitle {
    font-size: 25px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-text {
    margin-top: 6px;
    color: var(--text-2);
    font-size: 14px;
}

.auth-mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin: 22px 0 6px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
}

.auth-mode-switch:has(> [hidden]) {
    display: none;
}

/* supabase-client.js writes inline colours; the active one contains 88,199,91 */
.auth-mode-button {
    min-height: 38px;
    padding: 0 10px;
    border: 0 !important;
    border-radius: 9px;
    background: transparent !important;
    color: var(--text-3);
    font-size: 14px;
    font-weight: 600;
    transition:
        background-color 150ms var(--ease),
        color 150ms var(--ease);
}

.auth-mode-button:hover {
    color: var(--text);
}

.auth-mode-button[style*="88, 199, 91"],
.auth-mode-button[style*="88,199,91"] {
    background: var(--surface-3) !important;
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-form label {
    display: block;
    margin: 14px 0 6px;
}

.auth-form input {
    min-height: 46px;
}

#authSubmitButton {
    width: 100%;
    min-height: 46px;
    margin-top: 22px;
    font-size: 15px;
}

.auth-forgot-password {
    align-self: center;
    min-height: 40px;
    margin-top: 8px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 550;
}

.auth-forgot-password:hover {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-message {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 13.5px;
    text-align: center;
}

.auth-message:empty {
    display: none;
}


/* ==========================================================
   11. CREATE / EDIT MATCH MODAL
   ========================================================== */

.match-modal {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.match-modal.open {
    display: flex;
}

.match-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 6, 7, 0.66);
    animation: lt-fade 180ms var(--ease);
}

@keyframes lt-fade {
    from {
        opacity: 0;
    }
}

.match-modal-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(680px, 100%);
    max-height: calc(100dvh - 48px);
    overflow: hidden;
    border: 1px solid var(--line-2);
    border-radius: 20px;
    background: var(--bg-elev);
    box-shadow: var(--shadow-pop);
    animation: lt-fade-in 200ms var(--ease);
}

.match-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 14px 24px;
    border-bottom: 1px solid var(--line);
}

.match-modal-header .panel-eyebrow {
    color: var(--accent);
}

.match-modal-header h2 {
    margin-top: 2px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.match-modal-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.match-form-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 24px;
}

.match-form-section + .match-form-section {
    border-top: 1px solid var(--line);
}

.match-form-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.match-form-section-heading h3 {
    font-size: 15px;
    font-weight: 650;
}

.match-form-section-heading p {
    margin-top: 2px;
    color: var(--text-3);
    font-size: 12.5px;
}

.required-label,
.optional-label {
    flex: 0 0 auto;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
}

.required-label {
    background: var(--accent-soft);
    color: var(--accent);
}

.optional-label {
    background: var(--surface-2);
    color: var(--text-3);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-row.date-time-row {
    grid-template-columns: 1fr;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

#home-team,
#away-team {
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Competition helpers */

.competition-field-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 4px;
    margin: -2px 0 0 -8px;
}

.competition-field-action {
    min-height: 32px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
}

.competition-field-action:hover {
    background: var(--accent-soft);
}

.competition-field-action-delete {
    color: var(--danger);
}

.competition-field-action-delete:hover {
    background: var(--danger-soft);
}

.competition-field-action:disabled {
    color: var(--text-3);
    background: transparent;
    opacity: 0.6;
}

.competition-create-row,
.competition-color-edit-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.competition-create-row input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
}

.competition-color-edit-row {
    justify-content: flex-start;
}

#saveCompetitionButton,
#saveCompetitionColorButton {
    min-height: 44px;
}

/* Date-time field */

.custom-datetime-wrap {
    position: relative;
}

.custom-datetime-wrap input {
    padding-right: 52px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.custom-datetime-button {
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: var(--surface-3);
    color: var(--text-2);
}

.custom-datetime-button:hover {
    color: var(--text);
}

/* Disclosure (Dómarateymið, Sjálfsmat details) */

.officials-form-section,
.self-details {
    display: block;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.officials-form-section > summary,
.self-details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 46px;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: none;
    list-style: none;
    cursor: pointer;
}

.officials-form-section > summary::-webkit-details-marker,
.self-details > summary::-webkit-details-marker {
    display: none;
}

.officials-form-section > summary::after,
.self-details > summary::after {
    content: "";
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    background: var(--text-3);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: transform 200ms var(--ease);
}

.officials-form-section[open] > summary::after,
.self-details[open] > summary::after {
    transform: rotate(180deg);
}

.officials-form-section > summary > span:first-child {
    margin-right: auto;
}

.self-details > summary > span {
    margin-left: auto;
}

.officials-count,
.self-details > summary > span {
    color: var(--text-3);
    font-size: 12px;
    font-weight: 600;
}

.officials-form-section[open],
.self-details[open] {
    padding-bottom: 14px;
}

.officials-form-section .form-row + .form-row {
    margin-top: 12px;
}

.match-modal-actions {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: auto;
    padding: 14px 24px calc(14px + var(--safe-bottom));
    border-top: 1px solid var(--line);
    background: var(--bg-elev);
}

.match-modal-actions .primary-button {
    min-width: 128px;
}

/* Date & time picker */

.match-datetime-picker {
    position: fixed;
    inset: 0;
    z-index: 170;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(5, 6, 7, 0.6);
    animation: lt-fade 160ms var(--ease);
}

.match-datetime-picker-card {
    display: flex;
    flex-direction: column;
    width: min(600px, 100%);
    max-height: calc(100dvh - 32px);
    overflow: hidden;
    border: 1px solid var(--line-2);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-pop);
}

.match-datetime-picker-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 14px 12px 20px;
    border-bottom: 1px solid var(--line);
}

.match-datetime-picker-title {
    font-size: 16px;
    font-weight: 650;
}

.match-datetime-picker-summary {
    margin-top: 2px;
    color: var(--accent);
    font-size: 13.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.match-datetime-picker-body {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 20px;
    padding: 16px 20px;
    overflow-y: auto;
}

.match-picker-section-label {
    margin-bottom: 8px;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.match-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.match-calendar-month {
    font-size: 14px;
    font-weight: 650;
}

.match-calendar-nav {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-2);
    font-size: 20px;
    line-height: 1;
}

.match-calendar-nav:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.match-calendar-weekdays,
.match-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.match-calendar-weekdays span {
    padding: 4px 0;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 650;
    text-align: center;
}

.match-calendar-days button {
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    font-size: 13.5px;
    font-variant-numeric: tabular-nums;
}

.match-calendar-days button:hover {
    background: rgba(255, 255, 255, 0.07);
}

.match-calendar-days button.is-outside-month {
    color: #5f6763;
}

.match-calendar-days button.is-today {
    box-shadow: inset 0 0 0 1px var(--line-3);
}

.match-calendar-days button.is-selected {
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
}

.match-time-manual {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    margin-bottom: 14px;
}

.match-time-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.match-time-input-group > span {
    color: var(--text-3);
    font-size: 11px;
    font-weight: 650;
}

.match-time-stepper {
    display: flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--line-2);
    border-radius: 11px;
    background: var(--bg-elev);
}

.match-time-stepper-button {
    display: grid;
    place-items: center;
    width: 34px;
    height: 44px;
    border: 0;
    background: transparent;
    color: var(--text-2);
    font-size: 18px;
}

.match-time-stepper-button:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.match-time-number {
    min-width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.match-time-colon {
    padding-bottom: 8px;
    color: var(--text-3);
    font-size: 22px;
    font-weight: 700;
}

.match-time-quick-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.match-time-quick-list button {
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 13.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.match-time-quick-list button:hover {
    border-color: var(--line-3);
    color: var(--text);
}

.match-time-quick-list button.is-selected {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent);
}

.match-datetime-picker-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--line);
}

.match-datetime-confirm {
    min-width: 100px;
}


/* ==========================================================
   12. SLIDE-OUT MENU & INFO OVERLAYS
   ========================================================== */

.menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    visibility: hidden;
    background: rgba(5, 6, 7, 0);
    transition:
        background-color 220ms var(--ease),
        visibility 0s linear 220ms;
}

.menu-overlay.open {
    visibility: visible;
    background: rgba(5, 6, 7, 0.6);
    transition:
        background-color 220ms var(--ease),
        visibility 0s;
}

.menu-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    width: min(340px, 88vw);
    padding: calc(14px + var(--safe-top)) 14px calc(16px + var(--safe-bottom));
    border-left: 1px solid var(--line-2);
    background: var(--bg-elev);
    box-shadow: -24px 0 60px rgba(0, 0, 0, 0.4);
    transform: translateX(100%);
    transition: transform 260ms var(--ease);
}

.menu-overlay.open .menu-panel {
    transform: translateX(0);
}

.menu-close {
    position: absolute;
    top: calc(12px + var(--safe-top));
    right: 12px;
}

.menu-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 48px 22px 6px;
    border-bottom: 1px solid var(--line);
}

.menu-logo {
    width: 40px;
    height: 40px;
    border-radius: 11px;
}

.menu-header h2 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.menu-header p {
    margin-top: 1px;
    color: var(--text-3);
    font-size: 12.5px;
}

.menu-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 16px;
}

.menu-section-title {
    padding: 0 10px 8px;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.menu-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 46px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-2);
    font-size: 14.5px;
    font-weight: 550;
    text-align: left;
    text-decoration: none;
    transition:
        background-color 150ms var(--ease),
        color 150ms var(--ease);
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
}

.menu-item.active::before {
    content: "";
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 0;
    width: 2px;
    border-radius: 2px;
    background: var(--accent);
}

.menu-item-leiktiminn {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "main arrow"
        "sub arrow";
    row-gap: 0;
    padding-block: 8px;
}

.menu-item-main {
    grid-area: main;
}

.menu-item-sub {
    grid-area: sub;
    color: var(--text-3);
    font-size: 12px;
    font-weight: 500;
}

.menu-item-leiktiminn .menu-arrow {
    grid-area: arrow;
}

.menu-arrow {
    color: var(--text-3);
    font-size: 18px;
    line-height: 1;
}

.beta-hidden {
    display: none !important;
}

.menu-version {
    margin-top: auto;
    padding: 18px 10px 0;
    color: #5f6763;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
}

/* About / privacy */

.about-overlay {
    position: fixed;
    inset: 0;
    z-index: 210;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(5, 6, 7, 0.66);
}

.about-overlay.open {
    display: flex;
    animation: lt-fade 180ms var(--ease);
}

.about-card {
    position: relative;
    width: min(620px, 100%);
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    border: 1px solid var(--line-2);
    border-radius: 20px;
    background: var(--bg-elev);
    box-shadow: var(--shadow-pop);
}

.about-close {
    position: sticky;
    top: 12px;
    float: right;
    margin: 12px 12px 0 0;
}

.about-content {
    padding: 28px 30px 30px;
    color: var(--text-2);
    font-size: 14.5px;
    line-height: 1.6;
}

.about-content .panel-eyebrow {
    color: var(--accent);
}

.about-content h2 {
    margin: 4px 0 14px;
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.about-content h3 {
    margin: 22px 0 6px;
    color: var(--text);
    font-size: 15px;
    font-weight: 650;
}

.about-content p + p {
    margin-top: 10px;
}

.about-content strong {
    color: var(--text);
}

.about-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.about-content li + li {
    margin-top: 3px;
}


/* ==========================================================
   13. NOTIFICATIONS, PULL-TO-REFRESH, MISC
   ========================================================== */

.played-notification-button {
    color: var(--text);
}

.played-notification-button .lt-icon {
    width: 20px;
    height: 20px;
}

#playedNotificationNumber {
    position: absolute;
    top: 3px;
    right: 2px;
    display: grid;
    place-items: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border: 2px solid var(--bg);
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 9.5px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    box-sizing: content-box;
}

.played-notification-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 60;
    width: min(320px, calc(100vw - 24px));
    padding: 10px;
    border: 1px solid var(--line-2);
    border-radius: 14px;
    background: var(--surface-3);
    box-shadow: var(--shadow-pop);
    animation: lt-fade-in 160ms var(--ease);
}

.played-notification-panel > strong {
    display: block;
    padding: 4px 8px 8px;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.played-notification-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    width: 100%;
    padding: 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    text-align: left;
}

.played-notification-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.played-notification-label {
    color: var(--accent);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.played-notification-item strong {
    font-size: 14px;
    font-weight: 600;
}

.played-notification-item small {
    color: var(--text-3);
    font-size: 12px;
}

/* Pull-to-refresh bubble (inline-styled by leiktiminn.js) */
body > div[aria-hidden="true"]:has(> .leiktiminn-pull-refresh-spinner) {
    border-color: var(--line-2) !important;
    background: var(--surface-3) !important;
}

.leiktiminn-pull-refresh-spinner {
    border-color: rgba(255, 255, 255, 0.18) !important;
    border-top-color: var(--accent) !important;
}

body.modal-open {
    overflow: hidden;
}


/* ==========================================================
   14. RESPONSIVE
   ========================================================== */

/* Tablet & phone: switch to the bottom navigation */
@media (max-width: 760px) {
    :root {
        --header-h: 54px;
    }

    .leiktiminn-header,
    .auth-header {
        padding-left: max(14px, env(safe-area-inset-left, 0px));
        padding-right: max(10px, env(safe-area-inset-right, 0px));
    }

    .leiktiminn-header {
        border-bottom: 1px solid var(--line);
    }

    .leiktiminn-toolbar,
    .leiktiminn-footer {
        display: none;
    }

    .leiktiminn-view-stack,
    .match-page-main {
        padding: 18px 16px calc(var(--nav-h) + var(--safe-bottom) + 28px);
    }

    .view-title {
        font-size: 22px;
    }

    .view-heading {
        margin-bottom: 14px;
    }

    /* Bottom nav */

    .mobile-bottom-nav {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 50;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: center;
        height: calc(var(--nav-h) + var(--safe-bottom));
        padding:
            0
            max(4px, env(safe-area-inset-right, 0px))
            var(--safe-bottom)
            max(4px, env(safe-area-inset-left, 0px));
        border-top: 1px solid var(--line-2);
        background: rgba(20, 23, 26, 0.92);
        backdrop-filter: blur(18px) saturate(150%);
        -webkit-backdrop-filter: blur(18px) saturate(150%);
    }

    .mobile-nav-item {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-width: 0;
        height: var(--nav-h);
        padding: 0 2px;
        border: 0;
        background: transparent;
        color: var(--text-3);
        font-size: 10.5px;
        font-weight: 600;
        letter-spacing: 0.01em;
        transition: color 150ms var(--ease);
    }

    .mobile-nav-item > span:not(.mobile-nav-icon):not(.played-unread-count) {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-nav-icon svg {
        width: 23px;
        height: 23px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .mobile-nav-item::before {
        content: "";
        position: absolute;
        top: -1px;
        left: 50%;
        width: 22px;
        height: 2px;
        margin-left: -11px;
        border-radius: 0 0 2px 2px;
        background: var(--accent);
        opacity: 0;
        transform: scaleX(0.4);
        transition:
            opacity 180ms var(--ease),
            transform 180ms var(--ease);
    }

    .mobile-nav-item.active {
        color: var(--text);
    }

    .mobile-nav-item.active .mobile-nav-icon {
        color: var(--accent);
    }

    .mobile-nav-item.active::before {
        opacity: 1;
        transform: scaleX(1);
    }

    .mobile-nav-item:focus-visible {
        outline-offset: -6px;
        border-radius: 12px;
    }

    .mobile-nav-item .played-unread-count {
        position: absolute;
        top: 7px;
        left: calc(50% + 6px);
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border: 2px solid #15181b;
        font-size: 9.5px;
        box-sizing: content-box;
    }

    /* Create: a raised, rounded square with a geometrically centred plus */
    .mobile-nav-create {
        justify-self: center;
        display: grid;
        place-items: center;
        width: 50px;
        height: 42px;
        padding: 0;
        border: 0;
        border-radius: 14px;
        background: var(--accent);
        color: var(--accent-ink);
        box-shadow:
            0 6px 16px rgba(0, 0, 0, 0.35),
            inset 0 1px 0 rgba(255, 255, 255, 0.28);
        transition:
            background-color 150ms var(--ease),
            transform 150ms var(--ease);
    }

    .mobile-nav-create:hover {
        background: var(--accent-hover);
    }

    .mobile-nav-create:active {
        transform: scale(0.96);
    }

    .mobile-nav-create-icon {
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.3;
        stroke-linecap: round;
        transition: transform 200ms var(--ease);
    }

    .mobile-nav-create[aria-expanded="true"] .mobile-nav-create-icon {
        transform: rotate(45deg);
    }

    .mobile-nav-create:focus-visible {
        outline-offset: 3px;
    }

    /* Stats */

    .stats-future {
        grid-template-columns: minmax(0, 1fr);
    }

    .stats-filter-bar {
        width: 100%;
    }

    .stats-filter-control {
        flex: 1 1 0;
    }

    /* Date range picker becomes a bottom sheet */

    .date-range-scrim:not([hidden]) {
        position: fixed;
        inset: 0;
        z-index: 69;
        display: block;
        background: rgba(5, 6, 7, 0.55);
        animation: lt-fade 160ms var(--ease);
    }

    .date-range-popover {
        position: fixed;
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        padding: 16px 16px calc(16px + var(--safe-bottom));
        border-width: 1px 0 0;
        border-radius: 20px 20px 0 0;
        animation: lt-sheet-up 220ms var(--ease);
    }

    .date-range-day {
        height: 42px;
    }

    /* Modal becomes a bottom sheet */

    .match-modal {
        align-items: flex-end;
        padding: 0;
    }

    .match-modal-card {
        width: 100%;
        max-height: calc(100dvh - var(--safe-top) - 16px);
        border-width: 1px 0 0;
        border-radius: 20px 20px 0 0;
        animation: lt-sheet-up 240ms var(--ease);
    }

    .match-modal-header {
        padding: 14px 12px 12px 18px;
    }

    .match-form-section {
        padding: 18px;
    }

    .match-modal-actions {
        padding: 12px 18px calc(12px + var(--safe-bottom));
    }

    .match-modal-actions > button {
        flex: 1 1 0;
    }

    /* Avoid iOS zoom on focus */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input:not([type]),
    select,
    textarea {
        font-size: 16px;
    }

    .filter-select select,
    .stats-filter-control select {
        font-size: 16px;
    }

    .match-datetime-picker {
        align-items: flex-end;
        padding: 0;
    }

    .match-datetime-picker-card {
        width: 100%;
        max-height: calc(100dvh - var(--safe-top) - 16px);
        border-width: 1px 0 0;
        border-radius: 20px 20px 0 0;
        animation: lt-sheet-up 220ms var(--ease);
    }

    .match-datetime-picker-body {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .match-datetime-picker-footer {
        padding-bottom: calc(12px + var(--safe-bottom));
    }

    .match-datetime-picker-footer > button {
        flex: 1 1 0;
    }

    .about-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .about-card {
        max-height: calc(100dvh - var(--safe-top) - 16px);
        border-radius: 20px 20px 0 0;
        animation: lt-sheet-up 240ms var(--ease);
    }

    .about-content {
        padding: 22px 20px calc(28px + var(--safe-bottom));
    }
}

@keyframes lt-sheet-up {
    from {
        transform: translateY(24px);
        opacity: 0;
    }
}

/* Phones */
@media (max-width: 560px) {
    /* Filters: one full-width row; Hreinsa becomes an icon button */

    .filter-toolbar {
        gap: 6px;
    }

    .filter-toolbar .filter-group {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
    }

    .filter-toolbar .filter-select {
        flex: 1 1 0;
    }

    .filter-toolbar .date-range {
        order: 5;
        flex: 1 1 100%;
    }

    .filter-toolbar .date-range-trigger {
        flex: 1 1 auto;
    }

    .filter-clear {
        flex: 0 0 36px;
        justify-content: center;
        width: 36px;
        padding: 0;
        border: 1px solid var(--line-2);
    }

    .filter-clear .lt-icon {
        width: 16px;
        height: 16px;
    }

    .filter-clear-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    /* Icons give way to text on phones */

    .stats-filter-icon,
    .filter-select > .lt-icon {
        display: none;
    }

    .filter-select select,
    .stats-filter-control select {
        padding: 0 22px 0 10px;
        background-position: right 6px center;
        background-size: 14px;
    }

    .stats-record-grid {
        gap: 8px;
    }

    .stats-record-card {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }

    .stats-average-card,
    .stats-half-dashboard,
    .stats-leaderboard {
        padding-left: 14px;
        padding-right: 14px;
    }

    /* Profile */

    .profile-identity {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 14px;
        padding: 16px;
    }

    .profile-identity .profile-text-button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .profile-avatar {
        width: 56px;
        height: 56px;
        font-size: 19px;
    }

    .profile-edit-panel,
    .profile-section {
        padding: 16px;
    }

    .profile-edit-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .profile-section-heading-row {
        flex-direction: column;
        gap: 10px;
    }

    .profile-edit-actions > button {
        flex: 1 1 0;
    }

    /* Forms */

    .form-row {
        gap: 10px;
    }

    .auth-card {
        padding: 24px 18px 20px;
        border-radius: 18px;
    }
}

/* Narrow phones (≈320px) */
@media (max-width: 380px) {
    .leiktiminn-view-stack,
    .match-page-main {
        padding-left: 12px;
        padding-right: 12px;
    }

    .leiktiminn-wordmark {
        font-size: 16px;
    }

    .leiktiminn-header-actions {
        gap: 2px;
    }

    .stats-average-grid {
        gap: 6px;
    }

    .stats-average-item strong {
        font-size: 18px;
    }

    .form-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .mobile-nav-item {
        font-size: 10px;
    }

    .mobile-nav-create {
        width: 46px;
    }

    .date-range-popover {
        padding-left: 10px;
        padding-right: 10px;
    }

    .date-range-ends {
        grid-template-columns: 1fr 1fr;
    }

    .date-range-ends-arrow {
        display: none;
    }
}

/* Stats filters: four segments become a joined 2x2 grid on phones */
@media (max-width: 560px) {
    .stats-filter-bar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        height: auto;
    }

    .stats-filter-control {
        height: 36px;
    }

    .stats-filter-bar > :nth-child(odd) {
        border-left: 0;
    }

    .stats-filter-bar > :nth-child(-n + 2) {
        border-bottom: 1px solid var(--line);
    }

    .stats-filter-bar > :nth-child(1) { border-radius: 9px 0 0 0; }
    .stats-filter-bar > :nth-child(2) { border-radius: 0 9px 0 0; }
    .stats-filter-bar > :nth-child(3) { border-radius: 0 0 0 9px; }
    .stats-filter-bar > :nth-child(4) { border-radius: 0 0 9px 0; }
}

/* ==========================================================
   15. DESKTOP SIDEBAR (≥1024px)
   The tab row becomes a fixed left sidebar: brand, primary
   action, then sections with icons and a slim active bar.
   ========================================================== */

.sidebar-brand,
.tab-icon {
    display: none;
}

@media (min-width: 1024px) {
    :root {
        --sidebar-w: 232px;
    }

    .leiktiminn-page {
        padding-left: var(--sidebar-w);
    }

    .leiktiminn-header .leiktiminn-brand {
        visibility: hidden;
    }

    .leiktiminn-toolbar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 45;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        width: var(--sidebar-w);
        height: auto;
        padding: calc(14px + var(--safe-top)) 14px 20px;
        border-right: 1px solid var(--line);
        border-bottom: 0;
        background: var(--bg-elev);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .sidebar-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 44px;
        margin-bottom: 18px;
        padding: 0 8px;
        border-radius: 10px;
        color: var(--text);
        text-decoration: none;
    }

    .leiktiminn-toolbar .create-match-button {
        order: 1;
        width: 100%;
        min-height: 40px;
        margin-bottom: 18px;
        font-size: 14px;
        text-decoration: none;
    }

    .desktop-view-tabs {
        order: 2;
        flex-direction: column;
        align-self: stretch;
        gap: 2px;
    }

    .desktop-view-tab {
        justify-content: flex-start;
        gap: 12px;
        min-height: 42px;
        padding: 0 12px;
        border-radius: 10px;
        color: var(--text-2);
        font-size: 14.5px;
        text-decoration: none;
    }

    .desktop-view-tab:hover {
        background: rgba(255, 255, 255, 0.04);
    }

    .tab-icon {
        display: block;
        width: 19px;
        height: 19px;
        color: var(--text-3);
    }

    .desktop-view-tab::after {
        top: 11px;
        right: auto;
        bottom: 11px;
        left: 0;
        width: 2px;
        height: auto;
        border-radius: 0 2px 2px 0;
        transform: scaleY(0);
    }

    .desktop-view-tab.active {
        background: rgba(255, 255, 255, 0.05);
    }

    .desktop-view-tab.active::after {
        transform: scaleY(1);
    }

    .desktop-view-tab.active .tab-icon {
        color: var(--accent);
    }

    .desktop-view-tab .played-unread-count {
        margin-left: auto;
    }

    .desktop-view-tab:focus-visible {
        outline-offset: -2px;
    }
}


/* ==========================================================
   16. TÖLFRÆÐI INSIGHTS (leiktiminn-insights.js)
   Single-series charts in the accent: columns <=24px with a
   4px rounded data-end, 2px line, 8px dots with a surface
   ring, solid hairline grid, values-first tooltip.
   ========================================================== */

.insights-card {
    position: relative;
    grid-column: 1 / -1;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.insights-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 10px;
}

.insights-head h4 {
    font-size: 15px;
    font-weight: 650;
}

.insights-head p {
    margin-top: 2px;
    color: var(--text-3);
    font-size: 12.5px;
}

.insights-latest {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.insights-latest strong {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.insights-latest span {
    color: var(--text-3);
    font-size: 12px;
}

.insights-chart {
    position: relative;
    width: 100%;
    min-width: 0;
}

.insights-svg {
    display: block;
    max-width: 100%;
    overflow: visible;
}

.insights-grid {
    stroke: rgba(255, 255, 255, 0.07);
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.insights-axis {
    fill: var(--text-3);
    font-family: var(--font);
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
}

.insights-column {
    fill: var(--accent);
    transition: fill 120ms var(--ease);
}

.insights-hit {
    fill: transparent;
}

.insights-bar,
.insights-point {
    outline: none;
}

.insights-bar:hover .insights-column,
.insights-bar:focus-visible .insights-column {
    fill: var(--accent-hover);
}

.insights-bar:focus-visible .insights-hit,
.insights-point:focus-visible .insights-hit {
    fill: rgba(255, 255, 255, 0.06);
}

.insights-reference {
    stroke: var(--text-2);
    stroke-width: 1;
    shape-rendering: crispEdges;
    opacity: 0.6;
}

.insights-reference-label,
.insights-end-label {
    fill: var(--text-2);
    font-family: var(--font);
    font-size: 11px;
    font-weight: 650;
}

.insights-end-label {
    fill: var(--text);
}

.insights-reference-name {
    fill: var(--text-3);
    font-weight: 600;
}

.insights-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.insights-dot {
    fill: var(--accent);
    stroke: var(--surface);
    stroke-width: 2;
}

.insights-point:hover .insights-dot,
.insights-point:focus-visible .insights-dot {
    fill: var(--accent-hover);
}

.insights-tooltip {
    position: absolute;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-width: 240px;
    padding: 8px 10px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: var(--surface-3);
    box-shadow: var(--shadow-pop);
    pointer-events: none;
}

.insights-tooltip strong {
    font-size: 14px;
    font-weight: 700;
}

.insights-tooltip span {
    color: var(--text-2);
    font-size: 12px;
}

.insights-tooltip small {
    color: var(--text-3);
    font-size: 11px;
}

.insights-table {
    margin-top: 10px;
    border-top: 1px solid var(--line);
}

.insights-table > summary {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    color: var(--text-3);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.insights-table > summary:hover {
    color: var(--text);
}

.insights-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.insights-table th,
.insights-table td {
    padding: 7px 6px;
    border-top: 1px solid var(--line);
    text-align: left;
}

.insights-table th {
    color: var(--text-3);
    font-weight: 600;
}

.insights-table td:last-child,
.insights-table th:last-child {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.insights-empty {
    color: var(--text-3);
    font-size: 13.5px;
    line-height: 1.5;
}

/* Self-assessment */

.insights-self-summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 14px 24px;
}

.insights-self-figure {
    display: flex;
    flex-direction: column;
    min-width: 110px;
}

.insights-self-figure strong {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
}

.insights-self-figure span {
    margin-top: 4px;
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 600;
}

.insights-self-figure small {
    color: var(--text-3);
    font-size: 11.5px;
}

.insights-categories {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.insights-category {
    display: grid;
    grid-template-columns: minmax(0, 170px) minmax(0, 1fr) 30px;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
}

.insights-category > span:first-child {
    overflow: hidden;
    color: var(--text-2);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.insights-category strong {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.insights-meter {
    height: 6px;
    overflow: hidden;
    border-radius: 3px;
    background: rgba(142, 199, 156, 0.14);
}

.insights-meter span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
}

.insights-self-insight {
    grid-column: 1 / -1;
    color: var(--text-3);
    font-size: 12.5px;
}

.insights-self-insight strong {
    color: var(--text);
    font-weight: 600;
}

.insights-subhead {
    margin: 16px 0 6px;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

@media (max-width: 560px) {
    .insights-card {
        padding: 14px;
    }

    .insights-self-summary {
        grid-template-columns: minmax(0, 1fr);
    }

    .insights-category {
        grid-template-columns: minmax(0, 1fr) 70px 26px;
    }

    .insights-latest {
        align-items: flex-start;
        text-align: left;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
        scroll-behavior: auto !important;
    }
}
