:root {
    --ink: #1c1b19;
    --muted: #6d675f;
    --line: #ebe4d8;
    --canvas: #f4f1eb;
    --white: #fffcf8;
    --black: #111111;
    --gold: #e2a425;
    --gold-deep: #c48a12;
    --danger: #8d2f2f;
    --ok: #1f6b45;
    --shadow: 0 24px 60px rgba(28, 23, 16, 0.12);
    --sans: "Outfit", "Segoe UI", sans-serif;
    --serif: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    color: var(--ink);
    font-family: var(--sans);
    background: var(--canvas);
    overflow-x: clip;
}
input, select, textarea { font-size: 16px; }
a { color: var(--gold-deep); }
img { max-width: 100%; }
button, input { font: inherit; }
h1, h2 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.03em; }

.auth-body {
    background: #0b0b0b;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}
.auth {
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
}
.hero {
    position: relative;
    isolation: isolate;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    color: #f7f1e6;
    display: flex;
    align-items: center;
}
.hero-media {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(100deg, rgba(8, 8, 8, 0.92) 0%, rgba(8, 8, 8, 0.78) 36%, rgba(8, 8, 8, 0.35) 62%, rgba(8, 8, 8, 0.18) 100%),
        url("../assets/hero-clean.jpg?v=7") 55% center / cover no-repeat;
    background-color: #080808;
}
.hero-content {
    width: min(540px, 100%);
    padding: clamp(28px, 5vw, 64px);
}
.hero-logo {
    width: clamp(140px, 16vw, 172px);
    display: block;
    margin: 0 0 32px;
    filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.35));
}
.hero-kicker {
    margin: 0 0 14px;
    color: #f0c45b;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.hero-title {
    margin: 0;
    max-width: 14ch;
    color: #fff;
    font-family: var(--serif);
    font-size: clamp(2.1rem, 3.6vw, 3.35rem);
    font-weight: 560;
    line-height: 1.08;
    letter-spacing: -0.035em;
}
.hero-title em {
    color: #f0c45b;
    font-style: normal;
}
.hero-copy {
    margin: 18px 0 0;
    max-width: 34ch;
    color: rgba(247, 241, 230, 0.78);
    font-size: 1.02rem;
    line-height: 1.55;
}
.auth-panel {
    display: grid;
    place-items: center;
    align-content: center;
    min-height: 0;
    padding: clamp(20px, 3vw, 40px);
    overflow-x: hidden;
    overflow-y: auto;
    background:
        radial-gradient(circle at 70% 18%, rgba(226, 164, 37, 0.14), transparent 42%),
        linear-gradient(180deg, #f6f1e8, #efe8dc);
    box-shadow: -28px 0 60px rgba(0, 0, 0, 0.18);
}
.auth-stack {
    width: min(440px, 100%);
    display: grid;
    justify-items: center;
    gap: 18px;
}
.auth-logo {
    display: none;
    width: 112px;
    height: auto;
}
.card-login {
    width: 100%;
    background: rgba(255, 252, 248, 0.96);
    border: 1px solid rgba(28, 23, 16, 0.06);
    border-radius: 24px;
    padding: 36px 32px 28px;
    box-shadow: 0 22px 55px rgba(28, 23, 16, 0.12);
    backdrop-filter: blur(8px);
}
.card-login h1 {
    margin: 0 0 8px;
    font-size: clamp(1.75rem, 2.4vw, 2rem);
    line-height: 1.15;
}
.page-head h1, .banner h1 { margin: 0 0 8px; font-size: 2rem; line-height: 1.15; }
.lede, .page-head p, .banner p { color: var(--muted); line-height: 1.55; }
.card-login .lede {
    margin: 0;
    font-size: 0.98rem;
}
.form { display: grid; gap: 8px; margin-top: 22px; }
.form label { font-size: 0.9rem; font-weight: 600; }
.field {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e6dfd2;
    background: #fff;
    border-radius: 14px;
    padding: 0 12px;
    margin-bottom: 2px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field:focus-within {
    border-color: #d7b15a;
    box-shadow: 0 0 0 4px rgba(226, 164, 37, 0.14);
}
.field svg { width: 18px; height: 18px; color: #9a9286; flex: none; }
.field input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    padding: 13px 0;
    color: var(--ink);
}
.ghost {
    border: 0;
    background: transparent;
    color: #9a9286;
    padding: 0;
    cursor: pointer;
}
.ghost svg { width: 18px; height: 18px; }
.row, .switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row { margin: 4px 0 2px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--muted); }
.row a { font-weight: 600; text-decoration: none; }
.row a:hover { text-decoration: underline; }
.switch { justify-content: center; margin-top: 18px; color: var(--muted); font-size: 0.95rem; }
.switch a { font-weight: 700; text-decoration: none; }
.switch a:hover { text-decoration: underline; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 14px 18px;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}
.card-login .btn { width: 100%; margin-top: 8px; }
.btn svg { width: 18px; height: 18px; }
.btn-gold {
    color: #1a1408;
    background: linear-gradient(180deg, #f3c15b, var(--gold) 48%, var(--gold-deep));
    box-shadow: 0 10px 24px rgba(196, 138, 18, 0.28);
}
.btn-gold:hover { filter: brightness(1.03); }
.btn-dark { color: white; background: var(--black); }
.btn-light { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.flash { border-radius: 12px; padding: 12px 14px; line-height: 1.45; margin: 0 0 12px; }
.flash-error { background: #fdecec; color: var(--danger); }
.flash-success { background: #e8f6ee; color: var(--ok); }
.reset-link { word-break: break-all; }

.app { min-height: 100vh; display: grid; grid-template-columns: 272px 1fr; }
.sidebar {
    background: var(--black);
    color: #f4efe6;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
}
.brand {
    display: flex;
    justify-content: center;
    align-items: center;
}
.brand img {
    width: 168px;
    display: block;
    margin: 0 auto;
}
.menu { display: grid; gap: 4px; }
.menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d9d1c5;
    text-decoration: none;
    border-radius: 12px;
    padding: 11px 12px;
}
.menu a svg { width: 18px; height: 18px; flex: none; }
.menu a.is-active { color: #1a1408; background: linear-gradient(90deg, #f3c15b, #c48a12); }
.help {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.help a {
    display: inline-flex;
    color: var(--gold);
    text-decoration: none;
    border: 1px solid rgba(226, 164, 37, 0.5);
    border-radius: 999px;
    padding: 8px 14px;
}
.main { min-width: 0; }
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 22px;
    background: rgba(255, 252, 248, 0.92);
    position: sticky;
    top: 0;
    z-index: 5;
    min-width: 0;
}
.search {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 14px;
}
.search svg { width: 18px; height: 18px; color: #9a9286; }
.search input { width: 100%; border: 0; outline: 0; background: transparent; padding: 12px 0; }
.who {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--ink);
}
.who span {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--black);
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 700;
}
.logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--ink);
    background: white;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 600;
    white-space: nowrap;
}
.logout svg { width: 18px; height: 18px; }
.icon-button {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    background: white;
    border-radius: 12px;
    padding: 0;
    cursor: pointer;
    flex: none;
}
.icon-button svg { width: 22px; height: 22px; }
.content { padding: 8px 22px 40px; display: grid; gap: 16px; }
.phase {
    min-height: calc(100vh - 96px);
    min-height: calc(100dvh - 96px);
    display: grid;
    align-content: center;
    gap: 24px;
    padding: 8px 0 24px;
}
.phase-head {
    display: grid;
    gap: 8px;
    max-width: 42rem;
}
.phase-head h1 {
    margin: 0;
    color: var(--ink);
    font-family: var(--serif);
    font-size: clamp(2rem, 3.2vw, 2.7rem);
    font-weight: 560;
    letter-spacing: -0.03em;
    line-height: 1.12;
    text-transform: none;
}
.phase-head p {
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.5;
}
.phase-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.phase-card {
    background: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 22px;
    padding: 26px 22px 22px;
    box-shadow: 0 10px 30px rgba(28, 23, 16, 0.04);
    display: grid;
    align-content: start;
    gap: 12px;
}
.phase-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--black);
    color: var(--gold);
}
.phase-icon svg {
    width: 22px;
    height: 22px;
}
.phase-card h2 {
    margin: 0;
    font-family: var(--serif);
    font-size: 1.35rem;
    font-weight: 560;
    letter-spacing: -0.02em;
    text-transform: none;
}
.phase-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}
.phase-card .btn {
    margin-top: 8px;
    width: 100%;
    justify-self: stretch;
}
.banner {
    color: white;
    border-radius: 24px;
    padding: 36px 32px;
    background:
        linear-gradient(90deg, rgba(8, 8, 8, 0.78), rgba(8, 8, 8, 0.28)),
        url("../assets/banner.jpg") center/cover;
}
.banner h1 { font-size: clamp(2rem, 4vw, 3.1rem); max-width: 16ch; }
.banner p { max-width: 62ch; }
.eyebrow {
    margin: 0 0 8px;
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.banner .eyebrow { color: #f3c15b; }
.modules, .split, .guides { display: grid; gap: 16px; }
.modules { grid-template-columns: repeat(3, 1fr); }
.split { grid-template-columns: 1.2fr 1fr 1fr; }
.split-2, .guides { grid-template-columns: 1fr 1fr; }
.module, .panel {
    background: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 10px 30px rgba(28, 23, 16, 0.04);
}
.module h2, .panel h2 { margin: 0 0 8px; font-size: 1.35rem; }
.module p, .panel p { color: var(--muted); line-height: 1.5; }
.module .btn { width: 100%; margin-top: 18px; }
.empty { margin-bottom: 0; }
.actions { margin: 20px 0 0; }
.panel code {
    font-size: 0.92em;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: #efe8dc;
}
.text-link { font-weight: 700; text-decoration: none; }
.prepare { margin: 0 0 16px; padding-left: 18px; color: var(--ink); line-height: 1.5; }
.form-panel { max-width: 560px; }
.hint { color: var(--muted); }
.backdrop { display: none; }

@media (max-width: 1180px) {
    .modules, .guides { grid-template-columns: 1fr 1fr; }
    .phase-grid { grid-template-columns: 1fr; max-width: 420px; margin: 0 auto; width: 100%; }
    .phase { align-content: start; padding-top: 8px; }
    .split { grid-template-columns: 1fr 1fr; }
    .split > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 1100px) {
    .auth { grid-template-columns: minmax(0, 1fr) minmax(320px, 0.95fr); }
    .hero-title { max-width: 16ch; }
}

@media (max-width: 860px) {
    .auth-body {
        background: #f3eee5;
    }
    .auth {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }
    .hero { display: none; }
    .auth-panel {
        padding: 20px 16px;
        box-shadow: none;
        min-height: 100%;
    }
    .auth-logo { display: block; }
    .auth-stack { gap: 14px; }
    .card-login { padding: 28px 22px 22px; }
    .modules, .split, .split-2, .guides, .phase-grid { grid-template-columns: 1fr; }
    .split > :first-child { grid-column: auto; }
    .app { grid-template-columns: 1fr; }
    .phase { min-height: auto; }
    .icon-button { display: inline-flex; }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(300px, 88vw);
        z-index: 20;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
        padding-bottom: calc(22px + env(safe-area-inset-bottom));
    }
    .sidebar.is-open { transform: none; }
    .backdrop.is-open {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 15;
    }
    .who strong { display: none; }
    .content { padding: 8px 16px 32px; }
    .topbar { padding: 12px 16px; }
    .banner { padding: 28px 20px; }
}

@media (max-width: 520px) {
    .auth-panel { padding: 16px 14px; }
    .auth-logo { width: 96px; }
    .auth-stack { gap: 12px; }
    .card-login { padding: 24px 18px 18px; border-radius: 20px; }
    .card-login h1, .page-head h1 { font-size: 1.65rem; }
    .card-login .lede { font-size: 0.95rem; }
    .form { margin-top: 18px; }
    .row { flex-wrap: wrap; gap: 8px 12px; }
    .banner { padding: 22px 16px; border-radius: 18px; }
    .banner h1 { font-size: 1.85rem; }
    .module, .panel { padding: 18px; border-radius: 18px; }
    .topbar { gap: 8px; padding: 10px 12px; }
    .logout { padding: 8px 10px; }
    .logout span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}
