:root {
    --ink: #221f20;
    --navy: #2d3192;
    --navy-2: #2d328c;
    --navy-3: #373785;
    --green: #07673a;
    --green-2: #1a6543;
    --paper: #f7f8f8;
    --mist: #dde3e1;
    --white: #ffffff;
    --shadow: 0 24px 60px rgba(34, 31, 32, 0.12);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(45, 49, 146, 0.16), transparent 55%),
        radial-gradient(900px 420px at 100% 0%, rgba(7, 103, 58, 0.14), transparent 50%),
        var(--paper);
    color: var(--ink);
    font-family: Manrope, "Segoe UI", sans-serif;
}

h1, h2, h3 {
    font-family: Fraunces, Georgia, serif;
    font-weight: 650;
    letter-spacing: -0.02em;
    margin: 0 0 0.4em;
}

h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); line-height: 1.15; }
h2 { font-size: 1.35rem; }
p { margin: 0 0 1rem; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 6vw;
    background: var(--ink);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand { display: flex; align-items: center; }
.brand-logo {
    height: 48px;
    width: auto;
    display: block;
    object-fit: contain;
    mix-blend-mode: screen;
}
.brand-text {
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.18em;
    font-size: 1.15rem;
}

.admin-nav { display: flex; gap: 1.2rem; }
.admin-nav a {
    color: var(--mist);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
}
.admin-nav a:hover { color: white; }

.page {
    width: min(1120px, calc(100% - 8vw));
    margin: 2.5rem auto 4rem;
}

.site-footer {
    text-align: center;
    color: #6b726f;
    font-size: 0.85rem;
    padding: 0 0 2.5rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.65rem;
}

.lead { font-size: 1.05rem; color: #444; max-width: 42rem; }
.lead.subtle { color: #66716d; }

.hero-card, .auth-card, .panel, .score-panel, .result-hero {
    background: rgba(255,255,255,0.86);
    border: 1px solid rgba(221, 227, 225, 0.9);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: clamp(1.4rem, 3vw, 2.4rem);
}

.step { display: none; }
.step.is-active { display: block; animation: rise 0.35s ease; }

@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

.style-pills { display: flex; flex-wrap: wrap; gap: 0.55rem; margin: 1.4rem 0 1.8rem; }
.pill {
    border: 1px solid color-mix(in srgb, var(--pill) 35%, var(--mist));
    color: var(--pill);
    background: color-mix(in srgb, var(--pill) 8%, white);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.field { display: grid; gap: 0.4rem; margin: 1.2rem 0; font-weight: 600; }
.field input {
    border: 1px solid var(--mist);
    border-radius: 16px;
    padding: 0.95rem 1rem;
    font: inherit;
    background: white;
}
.field input:focus {
    outline: 2px solid var(--navy);
    border-color: transparent;
}

.instruction {
    background: #eef3f1;
    border-left: 4px solid var(--green);
    padding: 0.9rem 1rem;
    border-radius: 12px;
    color: #2c3331;
}

.progress-wrap { margin-bottom: 1.4rem; }
.progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--navy-3);
    margin-bottom: 0.45rem;
}
.progress-bar {
    height: 8px;
    background: var(--mist);
    border-radius: 99px;
    overflow: hidden;
}
.progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--navy), var(--green));
    transition: width 0.3s ease;
}

.options { display: grid; gap: 0.8rem; margin: 1.5rem 0 1.6rem; }
.option {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
    border: 1.5px solid var(--mist);
    background: white;
    border-radius: 18px;
    padding: 1rem 1.1rem;
    cursor: pointer;
    font: inherit;
    transition: 0.18s ease;
}
.option:hover { border-color: var(--navy); transform: translateY(-1px); }
.option.is-selected {
    border-color: var(--green);
    background: #f3faf6;
    box-shadow: 0 0 0 4px rgba(7, 103, 58, 0.12);
}
.option-score {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--ink);
    color: white;
    font-weight: 800;
}
.option-label { font-weight: 700; font-size: 1.05rem; }

.actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.btn {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 0.9rem 1.4rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(135deg, var(--navy), var(--navy-2));
    color: white;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--mist);
}

.flash-stack { margin-bottom: 1rem; }
.flash {
    background: #fdecec;
    color: #8a1f1f;
    border-radius: 12px;
    padding: 0.8rem 1rem;
    font-weight: 600;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.2rem 0 1.4rem;
}
.profile-card {
    background: white;
    border-radius: 24px;
    padding: 1.3rem;
    border: 1px solid var(--mist);
    box-shadow: var(--shadow);
}
.profile-card h2 { font-size: 1.2rem; }
.rank {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
}
.is-dominant { border-top: 5px solid var(--navy); }
.is-secondary { border-top: 5px solid var(--green); }
.is-low { border-top: 5px solid var(--navy-3); }

.score-list { display: grid; gap: 1rem; margin: 1.2rem 0 1.6rem; }
.score-row {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr) auto;
    gap: 0.8rem;
    align-items: center;
}
.score-copy em {
    display: block;
    font-style: normal;
    color: var(--green-2);
    font-size: 0.8rem;
    font-weight: 700;
}
.score-meter {
    height: 12px;
    background: var(--mist);
    border-radius: 99px;
    overflow: hidden;
}
.score-meter span { display: block; height: 100%; }
.score-value { font-weight: 800; color: var(--navy); }

.stat-grid, .chart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}
.stat-grid { grid-template-columns: repeat(3, 1fr); }
.stat-card, .panel {
    background: white;
    border-radius: 22px;
    padding: 1.2rem;
    border: 1px solid var(--mist);
    box-shadow: var(--shadow);
}
.stat-card span { color: #66716d; font-size: 0.85rem; font-weight: 600; }
.stat-card strong { display: block; font-size: 1.7rem; margin-top: 0.35rem; }
.stat-text { font-size: 1.05rem !important; }

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

.qchart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}
.qchart {
    border: 1px solid var(--mist);
    border-radius: 16px;
    padding: 0.9rem;
    background: var(--paper);
}
.qchart h3 { font-size: 0.95rem; font-family: Manrope, sans-serif; }
.qchart p { font-size: 0.8rem; color: #66716d; margin-bottom: 0.5rem; }

.table-wrap { overflow: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.data-table th, .data-table td {
    text-align: left;
    padding: 0.8rem 0.6rem;
    border-bottom: 1px solid var(--mist);
    vertical-align: top;
}
.data-table th { color: var(--navy); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
.row-actions { display: flex; gap: 0.7rem; white-space: nowrap; }
.row-actions a { color: var(--navy); font-weight: 700; text-decoration: none; }

.answer-list { display: grid; gap: 0.7rem; }
.answer-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.9rem;
    align-items: center;
    padding: 0.85rem;
    border: 1px solid var(--mist);
    border-radius: 16px;
}
.qnum {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--ink);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 800;
}
.qstyle { font-size: 0.78rem; color: var(--navy); font-weight: 700; margin-bottom: 0.2rem; }
.abox {
    background: var(--paper);
    border-radius: 999px;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    color: var(--green-2);
}

.auth-card { max-width: 460px; margin: 3rem auto; }
.auth-form { margin-top: 0.5rem; }

@media (max-width: 900px) {
    .profile-grid, .stat-grid, .chart-grid, .qchart-grid, .score-row {
        grid-template-columns: 1fr;
    }
    .dash-head, .topbar { flex-direction: column; align-items: flex-start; }
    .page { width: min(1120px, calc(100% - 1.4rem)); }
}
