:root {
    --app-bg: #f4f7fb;
    --app-bg-2: #eef3ff;
    --app-surface: rgba(255,255,255,.9);
    --app-border: rgba(138, 157, 191, .18);
    --app-shadow: 0 18px 45px rgba(28, 46, 87, .08);
    --app-shadow-soft: 0 10px 30px rgba(30, 41, 59, .06);
    --app-primary: #335cff;
    --app-primary-2: #5b7cff;
    --app-primary-soft: #eef2ff;
    --app-success-soft: #e8fbf3;
    --app-warning-soft: #fff5df;
    --app-danger-soft: #ffe8ea;
    --app-text: #182230;
    --app-muted: #6d7a8b;
    --app-radius: 1.35rem;
}

html, body {
    min-height: 100%;
}

body.app-body {
    background:
        radial-gradient(circle at top left, rgba(91, 124, 255, .12), transparent 30%),
        radial-gradient(circle at top right, rgba(53, 208, 186, .12), transparent 28%),
        linear-gradient(180deg, #f7faff 0%, var(--app-bg) 38%, #f7f8fc 100%);
    color: var(--app-text);
}

body, .btn, .form-control, .form-select, .dropdown-item, .nav-link {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-navbar {
    background: rgba(12, 21, 39, .86);
    backdrop-filter: blur(18px);
    box-shadow: 0 12px 35px rgba(8, 15, 32, .22);
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.app-brand {
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: .85rem;
    text-decoration: none;
}

.app-brand:hover,
.app-brand:focus {
    color: #fff;
}

.brand-mark {
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--app-primary), #7b91ff);
    color: #fff;
    box-shadow: 0 12px 24px rgba(51, 92, 255, .28);
}

.app-brand strong {
    display: block;
    font-size: 1rem;
    line-height: 1.05;
}

.app-brand small {
    display: block;
    font-size: .72rem;
    color: rgba(255,255,255,.72);
    text-transform: lowercase;
}

.app-nav-links .nav-link {
    color: rgba(255,255,255,.82);
    font-weight: 500;
    border-radius: 999px;
    padding: .6rem .95rem;
}

.app-nav-links .nav-link:hover,
.app-nav-links .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.1);
}

.app-user-chip,
.app-level-chip {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .6rem .9rem;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-size: .9rem;
}

.app-level-chip {
    background: rgba(91, 124, 255, .18);
}

.app-logout-btn {
    border-radius: 999px;
    font-weight: 600;
    padding-inline: 1rem;
}

.hero-card,
.dashboard-card,
.auth-card,
.admin-card,
.glass-card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
    background: var(--app-surface);
    backdrop-filter: blur(12px);
}

.dashboard-card .card-body,
.hero-card .card-body,
.auth-card .card-body,
.admin-card .card-body {
    padding: 1.45rem;
}

.dashboard-card:hover,
.glass-card:hover {
    transform: translateY(-2px);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    box-shadow: 0 24px 50px rgba(29, 43, 76, .1);
}

.section-title {
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: 1rem;
}

.section-subtitle,
.text-secondary,
.form-help,
.small.text-secondary {
    color: var(--app-muted) !important;
}

.stat-value {
    font-size: 2rem;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -.04em;
}

.badge-soft,
.app-pill {
    background: var(--app-primary-soft);
    color: var(--app-primary);
    border-radius: 999px;
    padding: .42rem .78rem;
    font-size: .82rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.metric-tile {
    position: relative;
    overflow: hidden;
}

.metric-tile::after {
    content: "";
    position: absolute;
    inset: auto -30px -30px auto;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(51,92,255,.14), transparent 70%);
}

.progress-thick {
    height: 14px;
    border-radius: 999px;
    background: #e9eef9;
}

.progress-thin {
    height: 9px;
    border-radius: 999px;
    background: #ecf1f7;
}

.progress-bar {
    border-radius: 999px;
    background: linear-gradient(90deg, var(--app-primary), var(--app-primary-2));
}

.topic-card {
    border-left: 5px solid var(--app-primary);
}

.question-card {
    overflow: hidden;
}

.question-body {
    line-height: 1.8;
    font-size: 1.03rem;
}

.option-tile {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    border: 1px solid rgba(95, 123, 201, .18);
    border-radius: 1.1rem;
    background: rgba(255,255,255,.95);
    padding: 1rem;
    cursor: pointer;
    transition: .22s ease;
    min-height: 100%;
}

.option-tile:hover {
    border-color: rgba(51, 92, 255, .34);
    box-shadow: 0 15px 32px rgba(51, 92, 255, .08);
    transform: translateY(-1px);
}

.option-tile input {
    margin-top: .35rem;
}

.option-letter {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--app-primary-soft);
    color: var(--app-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
}

.table {
    --bs-table-bg: transparent;
}

.table thead th {
    white-space: nowrap;
    border-bottom-width: 1px;
    color: #64748b;
    text-transform: uppercase;
    font-size: .75rem;
    letter-spacing: .06em;
}

.table > :not(caption) > * > * {
    border-color: rgba(148, 163, 184, .16);
    padding-top: .85rem;
    padding-bottom: .85rem;
}

.form-control,
.form-select,
textarea.form-control {
    border-radius: 1rem;
    border-color: rgba(148, 163, 184, .22);
    padding: .8rem .95rem;
    box-shadow: none !important;
    background: rgba(255,255,255,.98);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(51, 92, 255, .36);
    box-shadow: 0 0 0 .28rem rgba(51, 92, 255, .12) !important;
}

.btn {
    border-radius: 999px;
    font-weight: 700;
    padding: .7rem 1.1rem;
    box-shadow: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-2));
    border-color: transparent;
}

.btn-primary:hover,
.btn-primary:focus {
    filter: brightness(1.03);
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-light {
    border-width: 1px;
}

.list-group-item {
    background: transparent;
    border-color: rgba(148, 163, 184, .14);
}

pre.import-sample {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 1rem;
    padding: 1rem;
    overflow: auto;
    font-size: .85rem;
}

.chart-card canvas {
    max-height: 290px;
}

.plan-step {
    display: flex;
    align-items: flex-start;
    gap: .95rem;
    padding: 1rem;
    border-radius: 1.15rem;
    background: rgba(255,255,255,.82);
    border: 1px solid rgba(148, 163, 184, .14);
}

.plan-step-icon {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: .95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.plan-step-icon.primary { background: var(--app-primary-soft); color: var(--app-primary); }
.plan-step-icon.success { background: var(--app-success-soft); color: #0f9f6e; }
.plan-step-icon.warning { background: var(--app-warning-soft); color: #ad7a00; }
.plan-step-icon.danger { background: var(--app-danger-soft); color: #d1435b; }
.plan-step-icon.info { background: #e7f5ff; color: #0a7cc8; }

.goal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
}

.goal-card {
    padding: 1.1rem;
    border-radius: 1.2rem;
    background: rgba(255,255,255,.82);
    border: 1px solid rgba(148, 163, 184, .16);
}

.goal-card.is-done {
    background: linear-gradient(180deg, rgba(232,251,243,.92), rgba(255,255,255,.96));
    border-color: rgba(16, 185, 129, .18);
}

.goal-meta {
    color: var(--app-muted);
    font-size: .86rem;
}

.app-footer {
    padding-bottom: 2.5rem;
}

.footer-shell {
    border: 1px solid var(--app-border);
    background: rgba(255,255,255,.76);
    border-radius: calc(var(--app-radius) + .1rem);
    padding: 1.2rem 1.4rem;
    box-shadow: var(--app-shadow-soft);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.auth-shell {
    max-width: 1100px;
    margin-inline: auto;
}

@media (max-width: 991.98px) {
    .app-navbar .navbar-collapse {
        padding-top: 1rem;
    }

    .app-user-chip,
    .app-level-chip {
        font-size: .82rem;
    }
}

@media (max-width: 767.98px) {
    .dashboard-card .card-body,
    .hero-card .card-body,
    .auth-card .card-body,
    .admin-card .card-body {
        padding: 1.15rem;
    }

    .stat-value {
        font-size: 1.7rem;
    }

    .footer-shell {
        padding: 1rem 1.1rem;
    }
}


.hero-card.mini-test-hero {
    background:
        radial-gradient(circle at top right, rgba(91,124,255,.18), transparent 32%),
        radial-gradient(circle at bottom left, rgba(16,185,129,.12), transparent 28%),
        rgba(255,255,255,.94);
}

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

.mini-score-card {
    border: 1px solid rgba(95, 123, 201, .16);
    border-radius: 1.2rem;
    background: rgba(255,255,255,.92);
    padding: 1rem;
    box-shadow: var(--app-shadow-soft);
}

.mini-score-label,
.signal-meta,
.preset-meta,
.preset-summary,
.goal-meta,
.empty-state {
    color: var(--app-muted);
}

.mini-score-value {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -.04em;
}

.preset-card {
    display: block;
    cursor: pointer;
    text-decoration: none;
}

.preset-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.preset-visual {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    border-radius: 1.2rem;
    border: 1px solid rgba(95, 123, 201, .16);
    background: rgba(255,255,255,.92);
    padding: 1rem 1.1rem;
    transition: .2s ease;
    box-shadow: var(--app-shadow-soft);
}

.preset-card.is-active .preset-visual,
.preset-card:hover .preset-visual {
    transform: translateY(-1px);
    border-color: rgba(51, 92, 255, .35);
    box-shadow: 0 18px 38px rgba(51, 92, 255, .12);
}

.preset-visual.primary { border-left: 5px solid var(--app-primary); }
.preset-visual.success { border-left: 5px solid #10b981; }
.preset-visual.warning { border-left: 5px solid #f59e0b; }
.preset-visual.danger { border-left: 5px solid #ef4444; }

.preset-title {
    font-weight: 700;
    color: var(--app-text);
}

.signal-card,
.empty-state {
    border: 1px dashed rgba(95, 123, 201, .22);
    border-radius: 1.1rem;
    background: rgba(255,255,255,.7);
    padding: 1rem 1.1rem;
}

.signal-title {
    font-weight: 700;
    margin-bottom: .2rem;
}

.test-card-personal {
    position: relative;
}

.test-card-personal::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    border-radius: 1.2rem 0 0 1.2rem;
    background: linear-gradient(180deg, var(--app-primary), #10b981);
}

.empty-state {
    text-align: center;
    padding: 2rem;
}

@media (max-width: 767.98px) {
    .mini-score-grid {
        grid-template-columns: 1fr;
    }
}


.adaptive-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .5rem .8rem;
    border-radius: 999px;
    background: rgba(51, 92, 255, .08);
    color: var(--app-primary);
    font-weight: 700;
    border: 1px solid rgba(51, 92, 255, .12);
}

.adaptive-chip.is-match {
    background: rgba(52, 211, 153, .14);
    color: #16794f;
    border-color: rgba(22, 121, 79, .12);
}

.adaptive-profile-card {
    background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(239,244,255,.92));
}

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

.mix-box {
    border-radius: 1rem;
    padding: 1rem;
    border: 1px solid rgba(92, 114, 176, .12);
    box-shadow: var(--app-shadow-soft);
    background: rgba(255,255,255,.86);
}

.mix-box span {
    display: block;
    font-size: .86rem;
    color: var(--app-muted);
    margin-bottom: .35rem;
}

.mix-box strong {
    font-size: 1.4rem;
    font-weight: 800;
}

.mix-box.easy { background: linear-gradient(180deg, rgba(236, 253, 245, .95), rgba(248, 250, 252, .95)); }
.mix-box.medium { background: linear-gradient(180deg, rgba(238, 242, 255, .95), rgba(248, 250, 252, .95)); }
.mix-box.hard { background: linear-gradient(180deg, rgba(255, 237, 213, .95), rgba(248, 250, 252, .95)); }

.adaptive-score-stack {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.adaptive-score-row {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    gap: .8rem;
    align-items: center;
    font-size: .92rem;
}

.adaptive-tests-banner,
.mini-test-hero {
    background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(236,242,255,.92));
}

@media (max-width: 767.98px) {
    .adaptive-mix-grid {
        grid-template-columns: 1fr;
    }
    .adaptive-score-row {
        grid-template-columns: 1fr;
    }
}
