/* SONNE Radl-Challenge – mobile-first styles.
   Colors and font follow www.sonne-international.org (Enfold theme): brand yellow #FCC437, text #222/#525252, Open Sans.
   Deviation for readability: dark text on yellow buttons and darker gold links (the website's white-on-yellow has ~1.7:1 contrast). */

@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/open-sans-latin-400.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/open-sans-latin-600.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/open-sans-latin-700.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/open-sans-latin-800.woff2") format("woff2"); }

:root {
    --brand: #FCC437;            /* SONNE yellow (website primary) */
    --brand-hover: #FABA23;      /* website button hover */
    --brand-border: #DAA215;     /* website button border */
    --on-brand: #222222;         /* text on yellow */
    --link: #8A6508;             /* readable dark gold for links on white (≈5.6:1) */
    --brand-soft: #FFF8E3;
    --brand-soft-border: #F6DE9C;
    --text: #222222;
    --text-muted: #525252;
    --bg: #FFFFFF;
    --bg-page: #F0F0F0;
    --border: #E1E1E1;
    --green: #2E6B4F;
    --green-soft: #EEF4F0;
    --red: #B3261E;
    --red-soft: #FDECEA;
    --yellow-soft: #FFF4D6;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 2px 10px rgba(34, 34, 34, .06);
    --font: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-page);
}

img { max-width: 100%; height: auto; vertical-align: middle; }

a { color: var(--link); }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2, .h2 { font-size: 1.25rem; font-weight: 700; }

.center { text-align: center; }

/* ---------- Layout ---------- */

.app {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    max-width: 960px;
    margin: 0 auto;
    background: var(--bg);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand { display: flex; align-items: center; flex: none; }
.brand img { height: 52px; width: auto; }

/* Blazor's FocusOnNavigate moves focus to the h1 for screen readers – no visible outline needed there */
h1:focus, h1:focus-visible { outline: none; }

.topbar-user { display: flex; align-items: center; gap: 10px; }
.hello { font-size: .95rem; color: var(--text-muted); }
.hello strong { color: var(--text); }

.menu { position: relative; }
.menu summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: var(--brand-soft); }
.menu-icon { font-size: 1.3rem; color: var(--text); }

.menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(34, 34, 34, .12);
    padding: 6px;
    display: flex;
    flex-direction: column;
}
.menu-panel a, .menu-panel .link-button {
    display: block;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    font: inherit;
    text-align: left;
}
.menu-panel a:hover, .menu-panel .link-button:hover { background: var(--brand-soft); }
.menu-panel form { margin: 0; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }

.link-button { background: none; border: 0; width: 100%; cursor: pointer; }

.content {
    flex: 1;
    padding: 20px 16px 32px;
}

.narrow { max-width: 480px; margin: 0 auto; }

.footer {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    font-size: .95rem;
}
.footer a { color: var(--text); text-decoration: none; }
.footer span { color: var(--border); }

/* ---------- Components ---------- */

.hero-illustration { text-align: center; margin: 4px 0 8px; }
.hero-illustration img { width: 280px; }
.hero-illustration.small img { width: 200px; }

.lead { font-size: 1.05rem; color: var(--text-muted); margin: 0 0 20px; }
.hint { font-size: .9rem; color: var(--text-muted); margin: 6px 0 0; }
.hint img { margin-top: -2px; }

.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.card-title { font-size: 1.1rem; margin-bottom: 8px; }
.card p { margin: 4px 0; }

.card-hero {
    background: linear-gradient(180deg, var(--brand-soft), #FFFDF5);
    border-color: var(--brand-soft-border);
    position: relative;
    overflow: hidden;
}
.card-hero .hero-text { position: relative; z-index: 1; }
.hero-bike { position: absolute; right: 8px; top: 12px; width: 150px; opacity: .95; }
.big-number { font-size: 3rem; font-weight: 800; margin: 0 0 16px !important; letter-spacing: -.02em; }
.big-number span { font-size: 1.6rem; font-weight: 700; }

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

.section { margin-top: 8px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head a { font-weight: 600; text-decoration: none; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

.totals { display: flex; gap: 24px; }
.totals .label { display: block; font-size: .85rem; color: var(--text-muted); }
.totals .value { font-size: 1.5rem; font-weight: 800; }

.challenge-status { display: flex; gap: 8px; align-items: flex-start; color: var(--text-muted); font-size: .95rem; }
.challenge-status img { margin-top: 3px; }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.optional { font-weight: 400; color: var(--text-muted); }

.input {
    width: 100%;
    font: inherit;
    font-size: 1.05rem;   /* ≥16px prevents iOS zoom */
    padding: 13px 14px;
    border: 1.5px solid #BFC3C8;
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    min-height: 50px;
}
textarea.input { min-height: 72px; resize: vertical; }

/* iOS Safari: native date inputs have an intrinsic min-width (overflows the card) and centered text */
input[type="date"].input {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    min-width: 0;
    max-width: 100%;
    text-align: left;
    line-height: 1.4;
}
input[type="date"].input::-webkit-date-and-time-value { text-align: left; margin: 0; }
input[type="date"].input::-webkit-calendar-picker-indicator { opacity: .7; cursor: pointer; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(252, 196, 55, .35); }
.input-invalid { border-color: var(--red); }

/* Ride photo: file picker + stored/pending/new photo */
.input-file { padding: 10px; font-size: .95rem; }
.input-file::file-selector-button {
    font: inherit; font-weight: 600; margin-right: 12px; padding: 8px 14px; cursor: pointer;
    border: 1px solid var(--brand-soft-border); border-radius: var(--radius-sm);
    background: var(--brand-soft); color: var(--text);
}
.ride-photo { display: block; max-width: 100%; max-height: 320px; width: auto; height: auto; margin: 0 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.ride-photo-current { margin-bottom: 10px; }
.ride-photo-current .checkbox { margin-top: 4px; }
.ride-photo[hidden], .ride-photo-current[hidden] { display: none; }
.photo-picker { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.photo-pick { flex: 1 1 180px; font-weight: 600; }
/* The file inputs stay focusable/clickable via their labels but are visually hidden. */
.photo-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; opacity: 0; }
.photo-input:focus-visible + .photo-pick { outline: 3px solid var(--brand-border); outline-offset: 2px; }
/* "Take photo" only where a camera can be opened directly (phones/tablets); desktop browsers ignore capture. */
.photo-camera { display: none; }
@media (pointer: coarse) { .photo-camera { display: inline-flex; } }
.photo-name { margin: 0 0 10px; overflow-wrap: anywhere; }
.photo-name[hidden] { display: none; }

.input-with-icon { position: relative; }
.input-with-icon img { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.input-with-icon .input { padding-left: 54px; padding-right: 48px; }
.input-with-icon .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

.field-error { color: var(--red); font-size: .92rem; margin: 6px 0 0; }

.checkbox { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.checkbox input { width: 22px; height: 22px; accent-color: var(--brand); }

.email-chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 14px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    word-break: break-all;
}
.email-chip a { font-size: .9rem; white-space: nowrap; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font: inherit;
    font-weight: 700;
    padding: 12px 20px;
    min-height: 48px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.btn-block { display: flex; width: 100%; }
.btn-lg { font-size: 1.15rem; min-height: 56px; }
.btn-primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand-border); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: var(--brand-soft); color: var(--text); border-color: var(--brand-soft-border); }
.btn-link { background: none; color: var(--link); text-decoration: underline; font-weight: 600; }
.btn-danger-outline { background: #fff; color: var(--red); border-color: #E8B4B0; }
.btn-danger-outline:hover { background: var(--red-soft); }

.delete-form { margin-top: 8px; }

/* ---------- Alerts ---------- */

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; }
.alert ul { margin: 0; padding-left: 20px; }
.alert-error { background: var(--red-soft); border-color: #F2C3BF; color: var(--red); }
.alert-success { background: var(--green-soft); border-color: #CFE0D5; color: var(--green); font-weight: 600; }
.alert-info { background: var(--brand-soft); border-color: var(--brand-soft-border); }
.alert-warning { background: var(--yellow-soft); border-color: #F2D98C; }

.success-banner { display: flex; align-items: center; gap: 12px; }

.notice {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: .95rem;
}
.notice-secure { background: var(--green-soft); color: var(--green); border: 1px solid #D5E3DA; }

/* ---------- Ride list ---------- */

.ride-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.ride-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    min-height: 64px;
}
a.ride-item:hover { border-color: var(--brand-soft-border); background: #FFFCF6; }
.ride-icon { flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; }
.ride-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ride-date { font-weight: 600; }
.ride-has-photo { vertical-align: -2px; margin-left: 4px; opacity: .8; }
.ride-comment { font-size: .9rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ride-km { font-weight: 800; font-size: 1.15rem; white-space: nowrap; }
.ride-km small { font-weight: 600; font-size: .85rem; color: var(--text-muted); }
.chevron { color: var(--text-muted); font-size: 1.5rem; }

.empty { padding: 24px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---------- Larger screens ---------- */

@media (max-width: 420px) {
    .hello { display: none; }
    .brand img { height: 42px; }
    .hero-bike { width: 110px; top: 18px; opacity: .6; }
    .big-number { font-size: 2.6rem; }
}

@media (min-width: 720px) {
    body { font-size: 17px; }
    .app { margin: 24px auto; min-height: calc(100vh - 48px); border-radius: 20px; box-shadow: 0 4px 30px rgba(34, 34, 34, .08); overflow: clip; }
    .topbar { padding: 16px 28px; border-radius: 20px 20px 0 0; }
    .content { padding: 32px 28px 40px; }
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .hero-bike { width: 220px; right: 24px; }
    .big-number { font-size: 3.6rem; }
    .card-hero .btn-lg { max-width: 420px; }
    h1 { font-size: 2rem; }
}

/* Visible keyboard focus (buttons, links, menu) */
a:focus-visible, .btn:focus-visible, .link-button:focus-visible, summary:focus-visible, .checkbox input:focus-visible {
    outline: 3px solid var(--brand-border);
    outline-offset: 2px;
}

/* =====================================================================
   Admin area
   ===================================================================== */

.menu-panel .menu-admin { font-weight: 700; border-top: 1px solid var(--border); margin-top: 4px; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

.admin-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: -8px -16px 20px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav a {
    flex: none;
    padding: 12px 14px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.admin-nav a:hover { color: var(--text); }
.admin-nav a.active { color: var(--text); border-bottom-color: var(--brand); }

.breadcrumb { margin: 0 0 8px; font-size: .95rem; }
.breadcrumb a { text-decoration: none; font-weight: 600; }
.row-sub { display: block; font-size: .88rem; color: var(--text-muted); margin: 0; word-break: break-all; }
.row-title { font-weight: 700; text-decoration: none; color: var(--text); }
a.row-title:hover { text-decoration: underline; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
.stats .card { margin: 0; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: .9rem; color: var(--text-muted); font-weight: 600; }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1.15; }
.stat-value small { font-size: 1rem; font-weight: 700; color: var(--text-muted); }
.stat-value-sm { font-size: 1.1rem; }
.stat-sub { font-size: .88rem; color: var(--text-muted); }
.stat-link { margin-top: 6px; font-weight: 600; text-decoration: none; font-size: .95rem; }
.stat-warn { border-color: var(--brand-border); background: var(--brand-soft); }
.progress { height: 10px; border-radius: 99px; background: var(--brand-soft); border: 1px solid var(--brand-soft-border); overflow: hidden; margin: 6px 0 2px; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-actions .btn { flex: 1 1 auto; }

/* Filters */
.filters { display: flex; flex-direction: column; gap: 12px; }
.filter-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
.input-with-suffix { position: relative; }
.input-with-suffix .input { padding-right: 48px; }
.input-with-suffix .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }

.list-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; color: var(--text-muted); }
.list-head a { font-weight: 600; text-decoration: none; }

/* Badges */
.badges { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .8rem; font-weight: 700; background: var(--bg-page); border: 1px solid var(--border); color: var(--text-muted); white-space: nowrap; }
.badge-brand { background: var(--brand); border-color: var(--brand-border); color: var(--on-brand); }
.badge-muted { background: #E9E9E9; color: #555; }
.badge-danger { background: var(--red-soft); border-color: #F2C3BF; color: var(--red); }
.badge-info { background: var(--brand-soft); border-color: var(--brand-soft-border); color: var(--link); }
.badge-warn { background: var(--yellow-soft); border-color: #F2D98C; color: var(--link); margin-right: 4px; }

/* Tables → cards on phones */
.table { width: 100%; border-collapse: collapse; background: var(--bg); }
.table th { text-align: left; font-size: .85rem; color: var(--text-muted); font-weight: 700; padding: 10px 12px; border-bottom: 2px solid var(--border); }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table .num { text-align: right; white-space: nowrap; }
.table tr.row-inactive td { color: var(--text-muted); }
.table tr.row-inactive .row-title { color: var(--text-muted); text-decoration: line-through; }

@media (max-width: 719px) {
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; padding: 8px 14px; }
    .table td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border: 0; padding: 4px 0; text-align: right; }
    .table td::before { content: attr(data-label); font-weight: 600; font-size: .85rem; color: var(--text-muted); text-align: left; flex: none; }
    .table td:first-child { display: block; text-align: left; padding-bottom: 6px; }
    .table td:first-child::before { display: none; }
    .table td[data-label=""]::before { display: none; }
    .table td:empty { display: none; }
}

.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.pager-info { color: var(--text-muted); }

/* Detail pages */
.admin-detail h2 { margin-top: 8px; }
.action-list { display: flex; flex-direction: column; gap: 0; padding: 4px 18px; }
.action { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); margin: 0; }
.action:last-child { border-bottom: 0; }
.action .hint { margin: 2px 0 0; }
.action .btn { flex: none; }
.danger-zone { border-color: #F2C3BF; }
.danger-zone summary { cursor: pointer; font-weight: 700; color: var(--red); }
.danger-zone[open] summary { margin-bottom: 8px; }
.meta p { margin: 2px 0; }

/* Activity log */
.audit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.audit-list > li { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; }
.audit-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .85rem; color: var(--text-muted); }
.audit-actor { word-break: break-all; }
.audit-action { margin-top: 2px; }
.audit-action a { word-break: break-all; }
.audit-details { list-style: none; margin: 6px 0 0; padding: 6px 0 0; border-top: 1px dashed var(--border); font-size: .9rem; }
.audit-field { color: var(--text-muted); margin-right: .35em; }
.audit-old { text-decoration: line-through; color: var(--text-muted); }
.audit-new { font-weight: 600; }

@media (min-width: 720px) {
    .admin-nav { margin: -16px -28px 24px; padding: 0 28px; }
    .stats { grid-template-columns: repeat(4, 1fr); }
    .stats-small { grid-template-columns: repeat(3, 1fr); }
    .field-row { grid-template-columns: 1fr 1fr; }
    .filters { display: grid; grid-template-columns: 1fr 1fr; align-items: end; }
    .filters .filter-actions, .filters .checkbox { grid-column: 1 / -1; }
}

/* =====================================================================
   Step 3: dashboard tiles, ranking, route, donation, profile, teams
   ===================================================================== */

.tiles { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
.tiles .card { margin: 0; }
.tile { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); }
a.tile:hover { border-color: var(--brand-soft-border); background: #FFFCF4; }
.tile-head { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.tile-head .chevron { margin-left: auto; }
.tile-head img { flex: none; }
.tile-label { color: var(--text-muted); font-size: .95rem; }
.tile-value { font-size: 2.1rem; font-weight: 800; line-height: 1.15; }
.tile-value small { font-size: 1rem; color: var(--text-muted); font-weight: 700; }
.tile-value-sm { font-size: 1.35rem; }
.tile-sub { color: var(--text-muted); font-size: .92rem; }
.tile .progress { margin: 6px 0 2px; }

.progress-lg { height: 16px; }

/* Donation banner */
.donation { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: linear-gradient(135deg, var(--brand-soft), #FFFDF5); border-color: var(--brand-soft-border); }
.donation-icon { flex: none; }
.donation-text { flex: 1 1 200px; display: flex; flex-direction: column; }
.donation-text span { color: var(--text-muted); font-size: .95rem; }
.donation .btn { flex: none; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 16px; text-decoration: none; color: var(--text-muted); font-weight: 700; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-bottom-color: var(--brand); }
@media (max-width: 400px) { .tabs a { padding: 10px 10px; } }

/* Own team header above the team member ranking */
.team-head { margin-bottom: 12px; }
.team-head h2 { margin: 0 0 2px; }
.team-head .sub { margin: 0; font-size: .9rem; color: var(--text-muted); }

/* Ranking list */
.ranking { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ranking li { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.ranking .rank { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--bg-page); }
.ranking .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ranking .who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking .sub { font-size: .85rem; color: var(--text-muted); }
.ranking .km { font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.ranking .km small { font-size: .8rem; color: var(--text-muted); }
.ranking li.gold .rank { background: var(--brand); color: var(--on-brand); }
.ranking li.silver .rank { background: #E3E3E3; }
.ranking li.bronze .rank { background: #F0D5B8; }
.ranking li.me { border: 2px solid var(--brand-border); background: var(--brand-soft); }

/* Route */
.route-ends { display: flex; justify-content: space-between; font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.route-now { margin: 8px 0 0; font-size: .98rem; }
.route-laps { margin: 0 0 8px; font-weight: 700; }
.route-compact .route-now { font-size: .92rem; color: var(--text-muted); }
.route-stations { list-style: none; margin: 18px 0 8px; padding: 0 0 0 6px; }
.route-stations li { position: relative; display: flex; align-items: center; gap: 10px; padding: 6px 0 6px 22px; color: var(--text-muted); }
.route-stations li::before { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.route-stations li:first-child::before { top: 50%; }
.route-stations li:last-child::before { bottom: 50%; }
.route-stations li.reached::before { background: var(--brand); }
.route-stations .station-dot { position: absolute; left: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--border); }
.route-stations li.reached { color: var(--text); }
.route-stations li.reached .station-dot { background: var(--brand); border-color: var(--brand-border); }
.route-stations li.current .station-dot { width: 16px; height: 16px; left: -2px; box-shadow: 0 0 0 4px rgba(252, 196, 55, .35); }
.route-stations .station-name { font-weight: 600; }
.route-stations .station-km { margin-left: auto; font-size: .88rem; }
.route-stations .station-here { font-size: .8rem; font-weight: 700; color: var(--on-brand); background: var(--brand); padding: 2px 8px; border-radius: 99px; }

/* Profile / forms */
.checkbox-top { align-items: flex-start; }
.checkbox-top input { margin-top: 3px; flex: none; }
.hint.block { display: block; font-weight: 400; }
.form-section { font-size: 1.1rem; margin: 12px 0 0; padding-top: 14px; border-top: 1px solid var(--border); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .95rem; }
.summary-btn { cursor: pointer; margin: 0; }
details[open] > .summary-btn { margin-bottom: 12px; }

/* Team members (admin) */
.member-list { list-style: none; margin: 0 0 16px; padding: 4px 16px; }
.member-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.member-list li:last-child { border-bottom: 0; }
.member-list .who { flex: 1; min-width: 0; }
.member-list .km { font-weight: 700; white-space: nowrap; }
.btn-small { min-height: 36px; padding: 6px 10px; font-size: .9rem; }

@media (min-width: 720px) {
    .tiles { grid-template-columns: 1fr 1fr; }
    .tile-wide { grid-column: 1 / -1; }
}

/* =====================================================================
   Step 4: email confirmation pages, invite links
   ===================================================================== */
.email-sent { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.email-sent .h2 { margin: 6px 0 0; }
.email-sent p { margin: 0; }

.invite-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.invite-list .card { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.invite-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.invite-url { font-size: .9rem; background: var(--bg-page); }
.invite-list .btn { align-self: flex-start; }
