[hidden] { display: none !important; }

:root {
    --bg: #fbf7f1;
    --bg-alt: #f3ece1;
    --surface: #ffffff;
    --surface-2: #faf5ec;
    --text: #1a120b;
    --text-soft: #5a4a3a;
    --muted: #8a7860;
    --border: #e6dccb;
    --primary: #7b3f2a;
    --primary-hover: #5f2f20;
    --accent: #d4a24c;
    --accent-soft: #f4dba0;
    --danger: #b3261e;
    --success: #2e7d32;
    --warning: #b07000;
    --shadow: 0 4px 16px rgba(40, 25, 10, 0.08);
    --shadow-strong: 0 18px 48px rgba(25, 12, 5, 0.22);
    --radius: 10px;
    --radius-sm: 6px;
    --font: "Helvetica Neue", Arial, system-ui, sans-serif;
    --font-display: Georgia, "Times New Roman", serif;
}

[data-theme="dark"] {
    --bg: #17120d;
    --bg-alt: #211912;
    --surface: #251d15;
    --surface-2: #302519;
    --text: #f8ecdc;
    --text-soft: #dac9b4;
    --muted: #aa9478;
    --border: #4a3928;
    --primary: #c4874f;
    --primary-hover: #d99b62;
    --accent: #f0c15e;
    --accent-soft: #6f5224;
    --danger: #ff8a80;
    --success: #89d18a;
    --warning: #f7c46c;
    --shadow: 0 4px 18px rgba(0, 0, 0, 0.32);
    --shadow-strong: 0 18px 54px rgba(0, 0, 0, 0.52);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 86px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.55;
}

body.modal-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    color: var(--primary);
}

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

button {
    cursor: pointer;
}

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

h1,
h2,
h3 {
    font-family: var(--font-display);
    line-height: 1.12;
    margin: 0 0 0.75rem;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
}

h2 {
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
}

h3 {
    font-size: 1.25rem;
}

p {
    margin: 0 0 1rem;
}

.container {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 0 1.25rem;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -100px;
    z-index: 200;
    background: var(--accent);
    color: #1a120b;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
}

.skip-link:focus {
    top: 1rem;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 90;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(140%) blur(8px);
}

.header-inner {
    min-height: 72px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
}

.brand {
    display: inline-flex;
    gap: 0.75rem;
    align-items: center;
}

.brand strong {
    display: block;
    font-family: var(--font-display);
    font-size: 1.15rem;
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.1;
}

.brand-mark {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #ffffff;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 1px;
}

.site-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.site-nav a {
    color: var(--text-soft);
    font-size: 0.92rem;
    font-weight: 700;
}

.site-nav a:hover {
    color: var(--primary);
}

.header-actions,
.section-actions,
.hero-actions,
.form-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.nav-toggle {
    display: none;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
}

.btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.72rem 1rem;
    font-weight: 800;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    color: #ffffff;
}

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

.btn-ghost:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-sm {
    min-height: 36px;
    padding: 0.5rem 0.75rem;
    font-size: 0.88rem;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text);
    font-size: 1.6rem;
    line-height: 1;
}

.hero {
    position: relative;
    overflow: hidden;
    color: #fff8ed;
    background:
        linear-gradient(rgba(20, 17, 13, 0.65), rgba(20, 17, 13, 0.86)),
        radial-gradient(circle at 30% 30%, #8b4b2e, #11100d 72%);
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(45deg, rgba(212, 162, 76, 0.14) 0, rgba(212, 162, 76, 0.14) 1px, transparent 1px, transparent 14px);
    opacity: 0.28;
    pointer-events: none;
}

.hero-inner {
    position: relative;
    min-height: 560px;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
    gap: 2rem;
    align-items: center;
    padding-top: 4rem;
    padding-bottom: 4rem;
}

.eyebrow {
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.78rem;
    font-weight: 900;
    margin-bottom: 0.8rem;
}

.lead {
    max-width: 700px;
    color: rgba(255, 248, 237, 0.84);
    font-size: 1.12rem;
}

.hero-ghost {
    color: #fff8ed;
    border-color: rgba(255, 248, 237, 0.34);
}

.hero-panel {
    display: grid;
    gap: 1rem;
}

.stats-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    overflow: hidden;
    border: 1px solid rgba(255, 248, 237, 0.18);
    border-radius: var(--radius);
    background: rgba(255, 248, 237, 0.12);
    box-shadow: var(--shadow-strong);
}

.stats-strip div {
    padding: 1.25rem;
    background: rgba(12, 10, 8, 0.44);
}

.stats-strip strong {
    display: block;
    font-family: var(--font-display);
    font-size: 2rem;
    color: #ffffff;
}

.stats-strip span {
    display: block;
    color: rgba(255, 248, 237, 0.7);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 0.68rem;
    font-weight: 800;
}

.hero-quote {
    margin: 0;
    padding: 1.25rem;
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    background: rgba(12, 10, 8, 0.36);
    font-family: var(--font-display);
    font-style: italic;
}

.hero-quote cite {
    display: block;
    margin-top: 0.75rem;
    color: rgba(255, 248, 237, 0.7);
    font-family: var(--font);
    font-size: 0.76rem;
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.section {
    padding: 4rem 0;
    background: var(--bg);
}

.section.alt {
    background: var(--bg-alt);
}

.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.section-title::after {
    content: "";
    display: block;
    width: 50px;
    height: 3px;
    background: var(--accent);
    margin-top: 0.5rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.card-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.dashboard-grid,
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.plans-grid,
.recovery-grid,
.gear-grid,
.route-grid,
.community-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.span-2 {
    grid-column: span 2;
}

.feature-panel {
    display: grid;
    gap: 0.75rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0.22rem 0.62rem;
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.badge.pending,
.badge.planned {
    color: #805300;
    background: #fff0c6;
}

.badge.confirmed,
.badge.done {
    color: #1f6b23;
    background: #dff2df;
}

.badge.cancelled,
.badge.skipped {
    color: #8b1b16;
    background: #ffe0dc;
}

.badge.approved {
    color: #654100;
    background: #f7df9a;
}

[data-theme="dark"] .badge.pending,
[data-theme="dark"] .badge.planned {
    color: #f7d387;
    background: #4a3615;
}

[data-theme="dark"] .badge.confirmed,
[data-theme="dark"] .badge.done {
    color: #b6efb8;
    background: #1e3d20;
}

[data-theme="dark"] .badge.cancelled,
[data-theme="dark"] .badge.skipped {
    color: #ffb3ab;
    background: #4d1b18;
}

[data-theme="dark"] .badge.approved {
    color: #f4d17a;
    background: #4c3818;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.quick-action {
    min-height: 78px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    font-weight: 900;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.quick-action:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.progress {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.progress > span {
    display: block;
    height: 100%;
    width: var(--w, 0%);
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.metric-list,
.insight-list,
.timeline,
.donut-list {
    display: grid;
    gap: 0.75rem;
}

.metric {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
}

.metric:last-child {
    border-bottom: 0;
}

.metric span {
    color: var(--muted);
}

.metric strong {
    text-align: right;
}

.calendar-list,
.activity-list {
    display: grid;
    gap: 0.9rem;
}

.workout-card,
.activity-card,
.route-card,
.gear-card,
.community-card {
    display: grid;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.workout-card {
    grid-template-columns: minmax(90px, 0.22fr) minmax(0, 1fr) auto;
    align-items: center;
}

.date-pill {
    display: grid;
    place-items: center;
    min-height: 70px;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border);
    text-align: center;
}

.date-pill strong {
    font-family: var(--font-display);
    font-size: 1.8rem;
}

.date-pill span {
    color: var(--muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 800;
}

.activity-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
}

.activity-icon,
.route-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #ffffff;
    font-size: 1.5rem;
}

.activity-meta,
.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.chip {
    min-height: 36px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    padding: 0.45rem 0.85rem;
    font-weight: 800;
}

.chip.active,
.chip:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.bar-chart {
    display: grid;
    gap: 0.7rem;
}

.bar-row {
    display: grid;
    grid-template-columns: 72px 1fr 72px;
    gap: 0.75rem;
    align-items: center;
}

.bar-track {
    height: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.bar-fill {
    height: 100%;
    width: var(--w, 0%);
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.donut-item {
    display: grid;
    grid-template-columns: 90px 1fr 44px;
    gap: 0.6rem;
    align-items: center;
}

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

.field {
    display: grid;
    gap: 0.35rem;
}

.field.full,
.full {
    grid-column: 1 / -1;
}

label {
    color: var(--text);
    font-weight: 900;
    font-size: 0.9rem;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    padding: 0.72rem 0.8rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

input.error,
select.error,
textarea.error {
    border-color: var(--danger);
}

input.valid,
select.valid,
textarea.valid {
    border-color: var(--success);
}

.field-msg {
    min-height: 1.2em;
    color: var(--muted);
    font-size: 0.78rem;
}

.field-msg.error {
    color: var(--danger);
}

.field-msg.valid {
    color: var(--success);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    overflow: auto;
    padding: 1rem;
    background: rgba(18, 11, 6, 0.68);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.modal.is-visible {
    opacity: 1;
}

.modal-shell {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-card {
    width: min(760px, 100%);
    max-height: calc(100vh - 2rem);
    overflow: auto;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow-strong);
    padding: 1.25rem;
    transform: translateY(16px);
    transition: transform 0.15s ease;
}

.modal.is-visible .modal-card {
    transform: translateY(0);
}

.modal-card.wide {
    width: min(940px, 100%);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stepper {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.stepper li {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.5rem 0.75rem;
    color: var(--muted);
    background: var(--surface-2);
    text-align: center;
    font-size: 0.86rem;
    font-weight: 900;
}

.stepper li.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.stepper li.done {
    background: var(--accent);
    border-color: var(--accent);
    color: #1a120b;
}

.plan-review {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.plan-review ul {
    margin: 0;
    padding-left: 1.2rem;
}

.plan-review li + li {
    margin-top: 0.5rem;
}

.toast-region {
    position: fixed;
    z-index: 200;
    right: 1rem;
    bottom: 1rem;
    display: grid;
    gap: 0.75rem;
    width: min(380px, calc(100vw - 2rem));
}

.toast {
    display: grid;
    gap: 0.2rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-strong);
    opacity: 0;
    transform: translateY(20px);
    animation: toast-in 0.18s ease forwards;
}

.toast.success {
    border-left: 5px solid var(--success);
}

.toast.error {
    border-left: 5px solid var(--danger);
}

.toast.neutral {
    border-left: 5px solid var(--accent);
}

.toast strong {
    font-family: var(--font-display);
}

@keyframes toast-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.muted {
    color: var(--muted);
}

.admin-login {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: end;
}

.admin-login .muted {
    grid-column: 1 / -1;
}

.admin-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.admin-summary .metric-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.admin-summary strong {
    display: block;
    font-family: var(--font-display);
    font-size: 1.7rem;
}

.site-footer {
    background: #15100b;
    color: #f8ecdc;
    padding: 3rem 0 1rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
}

.footer-grid h3 {
    color: #ffffff;
}

.footer-grid a,
.footer-grid span {
    display: block;
    color: rgba(248, 236, 220, 0.78);
    margin-bottom: 0.45rem;
}

.footer-brand {
    margin-bottom: 1rem;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(248, 236, 220, 0.18);
    color: rgba(248, 236, 220, 0.7);
}

.socials {
    display: flex;
    gap: 0.5rem;
}

.socials a {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(248, 236, 220, 0.08);
    color: #ffffff;
    font-weight: 900;
}

@media (max-width: 1024px) {
    .dashboard-grid,
    .analytics-grid,
    .plans-grid,
    .recovery-grid,
    .gear-grid,
    .route-grid,
    .community-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-inner {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }
}

@media (max-width: 880px) {
    .header-inner {
        grid-template-columns: auto auto 1fr;
    }

    .nav-toggle {
        display: inline-grid;
        place-items: center;
    }

    .site-nav {
        position: absolute;
        left: 0;
        right: 0;
        top: 72px;
        display: grid;
        justify-content: stretch;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        transition: max-height 0.18s ease;
    }

    .site-nav.open {
        max-height: 520px;
    }

    .site-nav a {
        padding: 0.85rem 1.25rem;
        border-top: 1px solid var(--border);
    }

    .header-actions {
        justify-content: end;
    }
}

@media (max-width: 768px) {
    .section {
        padding: 3rem 0;
    }

    .section-head {
        display: grid;
        align-items: start;
    }

    .dashboard-grid,
    .analytics-grid,
    .plans-grid,
    .recovery-grid,
    .gear-grid,
    .route-grid,
    .community-grid,
    .form-grid,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .workout-card,
    .activity-card {
        grid-template-columns: 1fr;
    }

    .activity-icon {
        width: 48px;
        height: 48px;
    }

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

@media (max-width: 540px) {
    .header-inner {
        grid-template-columns: 1fr auto;
    }

    .nav-toggle {
        grid-column: 2;
        grid-row: 1;
    }

    .header-actions {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .header-actions .btn {
        flex: 1;
    }

    .stats-strip {
        grid-template-columns: 1fr;
    }

    .stepper {
        grid-template-columns: 1fr;
    }

    .admin-login {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        display: grid;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .hero-inner {
        min-height: auto;
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    .bar-row,
    .donut-item {
        grid-template-columns: 1fr;
    }
}
