:root {
    --bg: #f8f7f4;
    --surface: #ffffff;
    --border: #e8e5df;
    --border-soft: #f0ede8;
    --text: #1a1a1a;
    --text-soft: #666666;
    --text-muted: #999999;

    --teal: #1d9e75;
    --teal-light: #e1f5ee;
    --teal-dark: #085041;
    --blue: #378add;
    --blue-light: #e6f1fb;
    --blue-dark: #0c447c;
    --amber: #ba7517;
    --amber-light: #faeeda;
    --amber-dark: #633806;
    --red: #e24b4a;
    --red-light: #fcebeb;

    --accent: var(--teal);
    --accent-light: var(--teal-light);
    --radius: 12px;
    --radius-lg: 16px;
}

* { box-sizing: border-box; }

html, body {
    min-height: 100%;
    background: var(--bg);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
    padding-top: env(safe-area-inset-top);
    -webkit-font-smoothing: antialiased;
}

/* ── Topbar ── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar__main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    max-width: 640px;
    margin: 0 auto;
}

.topbar__logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
}

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

.topbar__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--teal-light);
    color: var(--teal-dark);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.notif-button {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.notif-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sport tabs */
.sport-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    padding: 0 16px;
    max-width: 640px;
    margin: 0 auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.sport-tabs::-webkit-scrollbar { display: none; }

.sport-tab {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.sport-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ── Page wrapper ── */
.app-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card + .card { margin-top: 10px; }

.card__body { padding: 14px 16px; }
.card__body + .card__body { border-top: 1px solid var(--border-soft); }

/* ── Stat grid ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}

.stat-card--teal { background: var(--teal-light); border-color: transparent; }
.stat-card--blue { background: var(--blue-light); border-color: transparent; }
.stat-card--amber { background: var(--amber-light); border-color: transparent; }

.stat-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-soft);
    margin-bottom: 4px;
}
.stat-card--teal .stat-label { color: var(--teal); }
.stat-card--blue .stat-label { color: var(--blue-dark); }

.stat-value {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.1;
    color: var(--text);
    letter-spacing: -0.03em;
}
.stat-card--teal .stat-value { color: var(--teal-dark); }
.stat-card--blue .stat-value { color: var(--blue-dark); }

.stat-meta {
    font-size: 11px;
    margin-top: 3px;
    color: var(--text-muted);
}
.stat-card--teal .stat-meta { color: var(--teal); }

/* ── Section header ── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}

.section-link {
    font-size: 13px;
    color: var(--blue);
    text-decoration: none;
}

/* ── Feed items ── */
.feed-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    overflow: hidden;
}

.feed-item__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
}

.feed-item__body { padding: 10px 14px; }

.feed-item__footer {
    padding: 8px 14px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    gap: 8px;
    align-items: center;
}

.feed-sport-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.feed-sport-icon--bowling { background: var(--teal-light); }
.feed-sport-icon--padel   { background: var(--blue-light); }
.feed-sport-icon--squash  { background: var(--amber-light); }

.feed-item__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.feed-item__meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.score-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.score-pill {
    background: var(--bg);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}

.score-pill__label {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.score-pill__value {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.score-pill__value--accent { color: var(--teal); }

/* ── Avatars ── */
.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}
.avatar--teal  { background: var(--teal-light);  color: var(--teal-dark); }
.avatar--blue  { background: var(--blue-light);  color: var(--blue-dark); }
.avatar--amber { background: var(--amber-light); color: var(--amber-dark); }
.avatar--red   { background: var(--red-light);   color: #791f1f; }

/* ── List rows ── */
.list-rows { display: flex; flex-direction: column; gap: 8px; }

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s;
}

.list-row:hover { border-color: var(--accent); }

.list-row__main { min-width: 0; }

.list-row__title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.list-row__meta {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted);
}

.list-row__side {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.list-row__arrow { color: var(--border); font-size: 16px; }

/* ── Bottom nav ── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    transition: color 0.15s;
}

.bottom-nav__item:hover,
.bottom-nav__item.active {
    color: var(--accent);
}

.bottom-nav__item svg { width: 22px; height: 22px; }

.bottom-nav__fab {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 6px 0;
}

.fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(29, 158, 117, 0.35);
    margin-top: -16px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.fab:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 18px rgba(29, 158, 117, 0.4);
}

.fab svg { width: 24px; height: 24px; }

/* ── Buttons ── */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--teal);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-primary:hover { opacity: 0.9; color: #fff; }

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 13px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
    border: 1px solid var(--border);
    cursor: pointer;
    text-decoration: none;
}

.btn-secondary:hover { border-color: var(--text-soft); color: var(--text); }

/* ── Forms ── */
.form-field { margin-bottom: 12px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 15px;
}

.form-input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(29, 158, 117, 0.12);
}

.form-input::placeholder { color: var(--text-muted); }

/* ── Alerts ── */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    background: var(--bg);
}

.alert--error  { background: var(--red-light);   border-color: rgba(226,75,74,0.2); color: #791f1f; }
.alert--success { background: var(--teal-light); border-color: rgba(29,158,117,0.2); color: var(--teal-dark); }
.alert--info   { background: var(--amber-light);  border-color: rgba(186,117,23,0.2); color: var(--amber-dark); }

/* ── Auth pages ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--bg);
}

.auth-container { width: 100%; max-width: 380px; }

.auth-header { text-align: center; margin-bottom: 28px; }

.auth-logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.04em;
    margin-bottom: 6px;
}

.auth-logo span { color: var(--teal); }

.auth-subtitle { font-size: 14px; color: var(--text-muted); }

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

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

.auth-input {
    width: 100%;
    height: 50px;
    padding: 0 14px;
    border-radius: var(--radius);
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 15px;
}

.auth-input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(29,158,117,0.12);
    background: var(--surface);
}

.auth-input::placeholder { color: var(--text-muted); }

.auth-footer { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-muted); }

.auth-link { color: var(--teal); text-decoration: none; font-weight: 500; }
.auth-link:hover { text-decoration: underline; }

/* ── Back link ── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-soft);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}

.back-link:hover { color: var(--text); }

/* ── Page title ── */
.page-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0 0 16px;
    color: var(--text);
}

/* ── Score inputs ── */
.score-input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--bg);
    border: 1px solid var(--border-soft);
    margin-bottom: 8px;
}

.score-input-row__name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.score-input-row input {
    width: 80px;
    height: 46px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.score-input-row input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(29,158,117,0.12);
}

/* ── Winner card ── */
.winner-card {
    background: var(--teal-light);
    border: 1px solid rgba(29,158,117,0.2);
    border-radius: var(--radius);
    padding: 14px 16px;
    font-weight: 600;
    color: var(--teal-dark);
    font-size: 16px;
    margin-bottom: 12px;
}

/* ── Player chips (session create) ── */
.player-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.player-chip input { display: none; }

.player-chip:has(input:checked) {
    background: var(--teal-light);
    border-color: var(--teal);
    color: var(--teal-dark);
    font-weight: 600;
}

.player-select { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Notification overlay ── */
.notif-overlay {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 64px);
    right: 12px;
    left: 12px;
    z-index: 300;
    max-width: 400px;
    margin-left: auto;
    padding: 14px;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.notif-overlay__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.notif-overlay__link { font-size: 12px; color: var(--blue); text-decoration: none; }

.notif-item {
    display: block;
    padding: 10px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    background: var(--bg);
    border: 1px solid transparent;
    margin-bottom: 6px;
}

.notif-item:hover { border-color: var(--border); }
.notif-item--unread { border-color: rgba(29,158,117,0.3); background: var(--teal-light); }

.notif-item__title { font-size: 13px; font-weight: 600; }
.notif-item__text  { font-size: 12px; color: var(--text-soft); margin-top: 2px; }

/* ── Misc ── */
.empty-text { color: var(--text-muted); font-size: 14px; margin: 0; }

.action-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 10px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

button.action-pill { appearance: none; }
.action-pill:hover { border-color: var(--text-soft); color: var(--text); }
.action-pill--danger { color: var(--red); border-color: rgba(226,75,74,0.25); }
.action-pill--danger:hover { background: var(--red-light); }

.inline-profile-link {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px dashed var(--border);
}
.inline-profile-link:hover { color: var(--teal); border-bottom-color: var(--teal); }

.stat-link { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--border); }
.stat-link:hover { color: var(--teal); }

.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-3 { margin-top: 12px; }

.text-muted { color: var(--text-muted) !important; }

/* ── Side nav + right sidebar (desktop only) ── */
.side-nav { display: none; }
.right-sidebar { display: none; }
/* deploy-test */

/* ── Desktop layout ── */
@media (min-width: 768px) {
    body {
        padding-bottom: 0;
        background: var(--bg);
    }

    /* Topbar: full width, logo links uitlijnen met sidebar */
    .topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 200;
    }

    .topbar__main {
        max-width: none;
        padding: 14px 32px;
        margin-left: 220px;
    }

    .sport-tabs {
        max-width: none;
        padding: 0 32px;
        margin-left: 220px;
    }

    /* Side nav */
    .side-nav {
        display: flex;
        flex-direction: column;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 220px;
        background: var(--surface);
        border-right: 1px solid var(--border);
        padding: 0 12px 24px;
        z-index: 300;
        gap: 2px;
    }

    .side-nav__logo {
        font-size: 18px;
        font-weight: 700;
        color: var(--text);
        letter-spacing: -0.03em;
        padding: 18px 12px 16px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 12px;
        display: block;
        text-decoration: none;
    }

    .side-nav__item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 11px 14px;
        border-radius: 10px;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 14px;
        font-weight: 500;
        transition: background 0.12s, color 0.12s;
    }

    .side-nav__item:hover {
        background: var(--bg);
        color: var(--text);
    }

    .side-nav__item.active {
        background: var(--teal-light);
        color: var(--teal-dark);
        font-weight: 600;
    }

    .side-nav__item svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .side-nav__fab {
        display: flex;
        align-items: center;
        gap: 12px;
        margin: 12px 0 4px;
        padding: 12px 14px;
        border-radius: 10px;
        background: var(--teal);
        color: #fff;
        text-decoration: none;
        font-size: 14px;
        font-weight: 600;
        transition: opacity 0.12s;
    }

    .side-nav__fab:hover { opacity: 0.88; color: #fff; }

    .side-nav__fab svg {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }

    /* Hoofd-content: vult ruimte tussen beide sidebars */
    .app-page {
        max-width: none;
        margin-left: 220px;
        margin-right: 0;
        margin-top: 65px;
        padding: 28px 40px 48px;
        display: block;
    }

    /* Logo verborgen in topbar op desktop (zit in sidebar) */
    .topbar__logo { display: none; }

    /* Rechter sidebar */
    .right-sidebar {
        position: fixed;
        top: 65px;
        right: 0;
        width: 300px;
        padding: 28px 24px;
        display: flex;
        flex-direction: column;
        gap: 16px;
        overflow-y: auto;
        bottom: 0;
        border-left: 1px solid var(--border);
    }

    .right-sidebar__card {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 16px;
    }

    .right-sidebar__title {
        font-size: 11px;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 12px;
    }

    .bottom-nav { display: none; }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .feed-item {
        transition: border-color 0.15s;
    }

    .feed-item:hover {
        border-color: var(--teal);
    }
}

@media (min-width: 1100px) {
    .right-sidebar { display: flex; }

    /* Content vult ruimte tot aan rechter sidebar */
    .app-page {
        margin-right: 300px;
    }
}

.back-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: var(--text);
}
.back-btn:hover { background: var(--border); }

/* PWA install card */
.pwa-install-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 16px;
    max-width: 400px;
    width: 100%;
}
.pwa-install-card__icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    background: linear-gradient(135deg, #00897b, #004d40);
    color: white;
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pwa-install-card__body {
    flex: 1;
    min-width: 0;
}
.pwa-install-card__title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}
.pwa-install-card__text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}
.pwa-install-card__button {
    background: var(--teal);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
