* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg:        #0f0f0f;
    --surface:   #1a1a1a;
    --border:    #2a2a2a;
    --accent:    #22c55e;
    --accent-hover: #16a34a;
    --text:      #f1f1f1;
    --text-muted:#9a9a9a;
    --danger:    #ef4444;
    --success:   #22c55e;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background 0.2s, opacity 0.2s;
    display: inline-block;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-danger {
    background: #ef4444;
    color: #fff;
    border: none;
}
.btn-danger:hover {
    background: #dc2626;
}

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

.btn-secondary:hover {
    background: #333;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 4rem;
    padding: 2.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
}

.page-header p {
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    transition: border-color 0.2s;
}

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

.card h3 {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

.card .meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
}

.card .badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--border);
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.table-wrap {
    overflow-x: auto;
}

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

thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

tbody tr:hover {
    background: var(--surface);
}

tbody td {
    padding: 0.85rem 1rem;
}

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2rem;
    max-width: 560px;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

.loading {
    color: var(--text-muted);
    padding: 2rem 0;
    text-align: center;
}

.empty {
    color: var(--text-muted);
    padding: 3rem 0;
    text-align: center;
    font-size: 0.95rem;
}

/* TERRAIN PICKER */
.terrain-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.terrain-option {
    padding: 0.6rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.terrain-option:hover {
    border-color: var(--accent);
    color: var(--text);
}

.terrain-option.selected {
    border-color: var(--accent);
    background: var(--accent);
    color: #000;
    font-weight: 600;
}

/* TIME INPUTS */
.time-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.time-inputs input {
    width: 70px;
    text-align: center;
}

.time-inputs span {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* FORM ROW */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* EFFORT GRID */
.effort-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.effort-option {
    padding: 0.6rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.effort-option:hover {
    border-color: var(--accent);
    color: var(--text);
}

.effort-option.selected {
    border-color: var(--accent);
    background: var(--accent);
    color: #000;
    font-weight: 600;
}

/* RACE TOGGLE */
.race-toggle {
    margin: 1.5rem 0;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.95rem;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-track {
    width: 42px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.2s;
}

.toggle-label input:checked ~ .toggle-track {
    background: var(--accent);
}

.toggle-label input:checked ~ .toggle-track .toggle-thumb {
    left: 21px;
    background: #000;
}

/* RACE FIELDS */
.race-fields {
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
    margin-bottom: 1.25rem;
}

.race-fields.hidden {
    display: none;
}

/* EFFORT SLIDER */
.effort-value {
    color: var(--accent);
    font-weight: 700;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
    margin: 0.5rem 0;
    cursor: pointer;
}

.effort-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* NEW RACE FIELDS */
.new-race-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* TERRAIN / SURFACE PICKER */
.terrain-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.surface-option,
.env-option {
    padding: 0.6rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.surface-option:hover,
.env-option:hover {
    border-color: var(--accent);
    color: var(--text);
}

.surface-option.selected,
.env-option.selected {
    border-color: var(--accent);
    background: var(--accent);
    color: #000;
    font-weight: 600;
}

/* HIDE SPINNERS ON TIME INPUTS */
.time-inputs input[type="number"]::-webkit-inner-spin-button,
.time-inputs input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.time-inputs input[type="number"] {
    -moz-appearance: textfield;
    text-align: center;
}

/* TIME INPUTS */
.time-inputs {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
}

.time-inputs input[type="number"] {
    width: 56px;
    text-align: center;
    padding: 0.65rem 0.25rem;
}

.time-sep {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* RACES PAGE */
.races-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
}
.search-input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
}
.races-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}
.race-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    transition: border-color 0.2s;
}
.race-card:hover {
    border-color: var(--accent);
}
.race-card-type {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}
.race-card-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}
.race-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* MODAL */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.modal.hidden {
    display: none;
}
.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 480px;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
}
.modal-close:hover {
    color: var(--text);
}
.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}
.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text);
}
.loading-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* RACES PAGE */
.races-map-container {
    position: relative;
    width: 100%;
    height: 320px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.races-map {
    width: 100%;
    height: 100%;
    border: none;
    filter: grayscale(40%) brightness(0.85);
}
.map-overlay {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(0,0,0,0.7);
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    backdrop-filter: blur(4px);
}
.races-filter-bar {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.filter-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.filter-select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    cursor: pointer;
}
.filter-select:focus {
    outline: none;
    border-color: var(--accent);
}
.search-input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    min-width: 220px;
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
}
.distance-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.chip {
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.chip:hover {
    border-color: var(--accent);
    color: var(--text);
}
.chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 600;
}
.races-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.races-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.race-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s;
    gap: 1rem;
}
.race-row:hover {
    border-color: var(--accent);
}
.race-row-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.race-type-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 0.2rem 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.race-row-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.race-row-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.race-row-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    white-space: nowrap;
}
.race-row-date {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}
.btn-link {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s;
}
.btn-link:hover {
    opacity: 0.75;
}
.empty-state {
    color: var(--text-muted);
    font-size: 0.95rem;
    padding: 2rem 0;
}

/* MODAL */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.modal.hidden { display: none; }
.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 480px;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.modal-header h2 { font-size: 1.2rem; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}
.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

/* AUTH */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.btn-ghost {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0.4rem 0.5rem;
}
.btn-ghost:hover {
    color: var(--text);
}
.btn-full {
    width: 100%;
    margin-top: 0.5rem;
}
.auth-switch {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1rem;
}
.auth-switch a {
    color: var(--accent);
    cursor: pointer;
}
.auth-switch a:hover {
    text-decoration: underline;
}
.form-msg {
    font-size: 0.85rem;
    color: var(--danger);
    margin-top: 0.5rem;
    min-height: 1.2rem;
}
.nav-user {
    font-size: 0.9rem;
    color: var(--text);
}

/* HAMBURGER & DRAWER */
.nav-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 4px;
}
.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: background 0.2s;
}
.hamburger:hover span {
    background: var(--accent);
}
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
}
.drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: #111;
    z-index: 400;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.drawer.hidden { display: none; }
.drawer-overlay.hidden { display: none; }
.drawer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    align-self: flex-start;
    margin-bottom: 1rem;
    padding: 0;
}
.drawer-close:hover { color: var(--text); }
.drawer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
}
.drawer-links li a {
    display: block;
    padding: 1rem 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: color 0.2s;
}
.drawer-links li a:hover { color: var(--accent); }
.drawer-auth {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
}
.drawer-login {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.9rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}
.drawer-login:hover { border-color: var(--accent); color: var(--accent); }
.drawer-signup {
    background: var(--accent);
    border: none;
    color: #000;
    padding: 0.9rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}
.drawer-signup:hover { background: var(--accent-hover); }
.drawer-user {
    font-size: 1rem;
    color: var(--text);
    padding: 0.5rem 0;
}
.drawer-logout {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.9rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

/* HERO */
.hero {
    position: relative;
    height: 100vh;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    padding: 0 3rem;
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.45) 40%, rgba(0,0,0,0.0));
}
.hero-content {
    position: relative;
    z-index: 1;
    max-width: 540px;
}
.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}
.hero-content p {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 2rem;
    line-height: 1.6;
    text-shadow: 0 1px 8px rgba(0,0,0,0.6);
}
.hero-cta {
    font-size: 1.1rem;
    padding: 0.9rem 2rem;
    border: none;
    cursor: pointer;
}
.hero-cta-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.hero-content p {
    text-shadow: 0 1px 6px rgba(0,0,0,0.95), 0 0 20px rgba(0,0,0,0.8);
    font-size: 1.1rem;
    max-width: 520px;
    color: #ffffff;
    font-weight: 500;
}
.hero-content h1 {
    text-shadow: 0 2px 6px rgba(0,0,0,0.9);
}
.hero-cta-group .btn-ghost {
    background: rgba(0,0,0,0.4);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.6);
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.hero-cta-group .btn-ghost:hover {
    background: rgba(0,0,0,0.6);
    border-color: #ffffff;
}
.run-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.run-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.run-card-name {
    font-weight: 600;
    font-size: 1.05rem;
}

.run-card-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.run-card-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.run-stat {
    display: flex;
    flex-direction: column;
}

.run-stat-value {
    font-weight: 600;
    font-size: 1rem;
}

.run-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.run-card-notes {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.race-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.run-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}
.btn-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.loading-state, .empty-state, .error-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.profile-view {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.profile-view-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
}
.profile-view-row:last-of-type {
    border-bottom: none;
}
.profile-view-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.profile-view-value {
    font-weight: 600;
    font-size: 0.95rem;
}

.field-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
}
.feeling-option {
    padding: 0.6rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    user-select: none;
}

.feeling-option:hover {
    border-color: var(--accent);
}

.feeling-option.selected {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}
.nutrition-report {
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.nutrition-header {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.nutrition-grid {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.nutrition-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.nutrition-label {
    color: var(--text-muted);
}

.nutrition-value {
    font-weight: 600;
}

.nutrition-notes {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(34, 197, 94, 0.08);
    border-left: 3px solid var(--primary);
    border-radius: 0 6px 6px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.nutrition-notes p {
    margin: 0;
    padding: 0;
}

/* ── Pre-Run Plan Card ── */
.pre-run-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.plan-header {
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.plan-section-title {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 1rem 0 0.5rem;
}

.plan-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.plan-label {
    font-weight: 600;
    min-width: 70px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.intra-schedule {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.intra-stop {
    display: grid;
    grid-template-columns: 60px 45px 1fr;
    gap: 0.75rem;
    font-size: 0.88rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
}

.stop-time {
    font-weight: 600;
    color: var(--accent);
}

.stop-carbs {
    font-weight: 600;
}

.stop-note {
    color: var(--text-muted);
}

.plan-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    line-height: 1.5;
}

.form-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.25rem 0;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--accent);
    color: #fff;
}

/* ── Mode Toggle ── */
.mode-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
    width: fit-content;
    background: var(--surface);
}

.mode-btn {
    padding: 0.55rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 999px;
    transition: background 0.2s, color 0.2s;
}

.mode-btn.active {
    background: var(--accent);
    color: #fff;
}

.mode-btn:hover:not(.active) {
    color: var(--text);
}

/* ── Pre-Run Plan Card ── */
.pre-run-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.plan-header {
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.plan-section-title {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 1rem 0 0.5rem;
}

.plan-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.plan-label {
    font-weight: 600;
    min-width: 70px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.intra-schedule {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.intra-stop {
    display: grid;
    grid-template-columns: 60px 45px 1fr;
    gap: 0.75rem;
    font-size: 0.88rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
}

.stop-time {
    font-weight: 600;
    color: var(--accent);
}

.stop-carbs {
    font-weight: 600;
}

.stop-note {
    color: var(--text-muted);
}

.plan-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    line-height: 1.5;
}

.form-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.25rem 0;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--accent);
    color: #fff;
}

/* ── Plan mode picker options use same style as terrain-grid items ── */
.plan-surface-option,
.plan-env-option,
.timing-option {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    text-align: center;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    background: var(--surface);
    color: var(--text);
}

.plan-surface-option:hover,
.plan-env-option:hover,
.timing-option:hover {
    border-color: var(--accent);
}

.plan-surface-option.selected,
.plan-env-option.selected,
.timing-option.selected {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

/* ── Wide page layout ── */
.page-wide {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.form-card-wide {
    max-width: 100%;
}

/* ── Section headers ── */
.section-header {
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.section-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.section-header-secondary {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

/* ── Pre-Run Plan Card ── */
.pre-run-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.plan-header {
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.plan-section-title {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 1rem 0 0.5rem;
}

.plan-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.plan-label {
    font-weight: 600;
    min-width: 70px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.intra-schedule {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.intra-stop {
    display: grid;
    grid-template-columns: 60px 45px 1fr;
    gap: 0.75rem;
    font-size: 0.88rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
}

.stop-time {
    font-weight: 600;
    color: var(--accent);
}

.stop-carbs {
    font-weight: 600;
}

.stop-note {
    color: var(--text-muted);
}

.plan-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    line-height: 1.5;
}

/* ── Plan mode picker options ── */
.plan-surface-option,
.plan-env-option,
.timing-option {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    text-align: center;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    background: var(--surface);
    color: var(--text);
}

.plan-surface-option:hover,
.plan-env-option:hover,
.timing-option:hover {
    border-color: var(--accent);
}

.plan-surface-option.selected,
.plan-env-option.selected,
.timing-option.selected {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.pre-run-card.hidden {
    display: none;
}

.rating-option {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    text-align: center;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    background: var(--surface);
    color: var(--text);
}

.rating-option:hover {
    border-color: var(--accent);
}

.rating-option.selected {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.fueling-badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
}

.fueling-on_target {
    color: var(--accent);
}

.fueling-close_enough {
    color: #f59e0b;
}

.fueling-fell_short {
    color: #ef4444;
}

.filter-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.filter-bar select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    padding-right: 2rem;
}

.filter-bar select:focus {
    outline: none;
    border-color: var(--accent);
}

.plan-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.plan-section:last-of-type {
    border-bottom: none;
}

.plan-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.intra-schedule {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.intra-stop {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.intra-time {
    font-weight: 600;
    min-width: 4rem;
    color: var(--accent);
}

.intra-action {
    flex: 1;
    color: var(--text);
}

.intra-carbs {
    color: var(--text-muted);
    font-size: 0.85rem;
}