:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --ink: #16202c;
    --muted: #667385;
    --line: #dbe3ea;
    --primary: #1769aa;
    --primary-dark: #115282;
    --green: #16845b;
    --green-soft: #e9f8f0;
    --amber: #a96f19;
    --amber-soft: #fff3df;
    --red: #c43d3d;
    --red-soft: #fdecec;
    --shadow: 0 18px 50px rgba(22, 32, 44, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

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

button,
input,
select {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 14px clamp(16px, 3vw, 34px);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    margin-top: 2px;
    color: var(--muted);
}

.topnav {
    display: flex;
    gap: 8px;
    align-items: center;
}

.topnav a {
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 800;
}

.topnav a:hover {
    background: #edf2f7;
    color: var(--ink);
}

.app-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: clamp(18px, 3vw, 34px);
}

.hero-panel,
.lead-panel,
.result-panel,
.admin-header,
.admin-panel,
.empty-state {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
    gap: clamp(24px, 5vw, 62px);
    align-items: center;
    min-height: 620px;
    padding: clamp(26px, 5vw, 58px);
    background:
        linear-gradient(120deg, rgba(22, 32, 44, 0.92), rgba(22, 32, 44, 0.72)),
        linear-gradient(135deg, #1d374f, #27625d);
    color: #fff;
}

.eyebrow {
    display: inline-flex;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero-panel .eyebrow,
.result-card .eyebrow {
    color: #9bd5eb;
}

.hero-panel h1,
.admin-header h1,
.empty-state h1 {
    max-width: 780px;
    margin: 10px 0 14px;
    font-size: 4.6rem;
    line-height: 1;
    letter-spacing: 0;
}

.hero-panel p,
.admin-header p,
.empty-state p {
    max-width: 720px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 1.08rem;
    line-height: 1.7;
}

.admin-header p,
.empty-state p {
    color: var(--muted);
}

.hero-actions,
.quiz-actions,
.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 11px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 850;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.button-primary {
    background: var(--primary);
    color: #fff;
}

.button-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.button-secondary {
    border-color: rgba(255, 255, 255, 0.54);
    color: #fff;
}

.button-secondary.dark {
    border-color: var(--line);
    background: #fff;
    color: var(--ink);
}

.wide {
    width: 100%;
}

.hero-visual {
    display: grid;
    gap: 14px;
}

.score-orbit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 92px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
}

.score-orbit span {
    color: #b7d8e8;
    font-weight: 900;
}

.score-orbit strong {
    font-size: 1.15rem;
}

.quiz-layout,
.lead-panel,
.result-panel {
    max-width: 900px;
    margin: 0 auto;
}

.quiz-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.quiz-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: clamp(22px, 4vw, 34px);
}

.quiz-header h2 {
    margin: 8px 0 0;
    font-size: 2.25rem;
    line-height: 1.15;
}

.step-pill,
.segment-badge,
.category-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #edf2f7;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 900;
    white-space: nowrap;
}

.progress-track {
    height: 10px;
    margin: 0 clamp(22px, 4vw, 34px);
    overflow: hidden;
    border-radius: 999px;
    background: #e7edf3;
}

.progress-bar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width 0.25s ease;
}

.option-list {
    display: grid;
    gap: 12px;
    padding: clamp(22px, 4vw, 34px);
}

.option-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.option-card:hover,
.option-card.is-selected {
    border-color: var(--primary);
    background: #f0f7fb;
}

.option-card input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.quiz-actions {
    justify-content: space-between;
    margin: 0;
    padding: 0 clamp(22px, 4vw, 34px) clamp(22px, 4vw, 34px);
}

.lead-panel {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(300px, 1fr);
    gap: 28px;
    padding: clamp(24px, 5vw, 46px);
}

.lead-copy h2,
.result-card h2,
.admin-panel h2 {
    margin: 8px 0 12px;
    font-size: 2.65rem;
    line-height: 1.05;
}

.lead-copy p {
    color: var(--muted);
    line-height: 1.7;
}

.lead-form {
    display: grid;
    gap: 14px;
}

.lead-form label,
.filter-control {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 850;
}

.lead-form input,
.filter-control select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

.lead-form input:focus,
.filter-control select:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(23, 105, 170, 0.14);
}

.lead-form label.has-error input {
    border-color: var(--red);
}

.field-error {
    min-height: 18px;
    color: var(--red);
    font-size: 0.82rem;
}

.form-note {
    min-height: 22px;
    margin: 0;
    color: var(--muted);
    font-weight: 800;
}

.result-card {
    padding: clamp(24px, 5vw, 46px);
    border-radius: 8px;
    background: linear-gradient(135deg, #172333, #21485f);
    color: #fff;
    box-shadow: var(--shadow);
}

.result-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.result-card p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
}

.score-ring {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 150px;
    height: 150px;
    border: 10px solid rgba(255, 255, 255, 0.18);
    border-top-color: #9bd5eb;
    border-radius: 50%;
}

.score-ring strong {
    font-size: 3rem;
    line-height: 1;
}

.score-ring span {
    color: #c8dbe8;
    font-size: 0.82rem;
    font-weight: 900;
}

.segment-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin: 26px 0;
}

.segment-badge {
    color: #10202b;
    background: #9bd5eb;
}

.recommendation-box {
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
}

.recommendation-box h3 {
    margin: 0 0 12px;
}

.recommendation-box ul {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 20px;
    color: rgba(255, 255, 255, 0.86);
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: clamp(22px, 4vw, 38px);
    margin-bottom: 18px;
}

.admin-header h1 {
    font-size: 3.4rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card {
    min-height: 126px;
    padding: 18px;
    border: 1px solid var(--line);
    border-top: 4px solid var(--primary);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.metric-card.beginner {
    border-top-color: var(--red);
}

.metric-card.intermediate {
    border-top-color: var(--amber);
}

.metric-card.advanced {
    border-top-color: var(--green);
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-weight: 850;
}

.metric-card strong {
    display: block;
    margin-top: 16px;
    font-size: 2.4rem;
    line-height: 1;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    border-bottom: 1px solid var(--line);
}

.panel-header h2 {
    margin: 4px 0 0;
    font-size: 1.2rem;
}

.filter-control {
    grid-template-columns: auto 170px;
    align-items: center;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.muted {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.84rem;
}

.category-badge.beginner {
    color: var(--red);
    background: var(--red-soft);
}

.category-badge.intermediate {
    color: var(--amber);
    background: var(--amber-soft);
}

.category-badge.advanced {
    color: var(--green);
    background: var(--green-soft);
}

.empty-state {
    display: grid;
    justify-items: start;
    gap: 12px;
    padding: clamp(28px, 5vw, 60px);
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 60;
    display: none;
    max-width: min(420px, calc(100vw - 40px));
    padding: 14px 16px;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    box-shadow: var(--shadow);
    font-weight: 800;
}

.toast.is-visible {
    display: block;
}

.toast.is-error {
    background: var(--red);
}

.is-hidden {
    display: none !important;
}

@media (max-width: 1040px) {
    .hero-panel,
    .lead-panel {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-panel h1,
    .admin-header h1,
    .empty-state h1 {
        font-size: 3.4rem;
    }

    .quiz-header h2,
    .lead-copy h2,
    .result-card h2 {
        font-size: 2.1rem;
    }
}

@media (max-width: 740px) {
    .topbar,
    .admin-header,
    .panel-header,
    .result-topline {
        align-items: flex-start;
        flex-direction: column;
    }

    .topnav {
        width: 100%;
        overflow-x: auto;
    }

    .app-shell {
        padding-inline: 12px;
    }

    .hero-panel {
        min-height: auto;
    }

    .hero-actions,
    .quiz-actions,
    .result-actions {
        flex-direction: column;
    }

    .button,
    .filter-control,
    .filter-control select {
        width: 100%;
    }

    .filter-control {
        grid-template-columns: 1fr;
    }

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

    .score-ring {
        width: 128px;
        height: 128px;
    }

    .hero-panel h1,
    .admin-header h1,
    .empty-state h1 {
        font-size: 2.5rem;
    }

    .quiz-header h2,
    .lead-copy h2,
    .result-card h2 {
        font-size: 1.75rem;
    }
}
