:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #111827;
    --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
    --radius: 18px;
    --sidebar-width: 280px;
    --chart-1: #6f42c1;
    --chart-2: #e83e8c;
    --chart-3: #20c997;
    --chart-4: #0d6efd;
    --chart-5: #8b5cf6;
    --chart-6: #f97316;
    --chart-7: #facc15;
    --chart-8: #dc2626;
    --chart-9: #64748b;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
}

body {
    min-height: 100vh;
}

.auth-body {
    background:
        radial-gradient(circle at top left, rgba(17, 24, 39, 0.05), transparent 30%),
        radial-gradient(circle at bottom right, rgba(17, 24, 39, 0.08), transparent 30%),
        var(--bg);
}

.login-shell {
    min-height: 100vh;
}

.login-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 24px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.login-logo,
.brand-mark,
.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
}

.login-note {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    color: var(--muted);
    font-size: 0.93rem;
}

.otp-boxes {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

.otp-input {
    width: 100%;
    height: 60px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    outline: none;
}

.otp-input:focus {
    border-color: #9ca3af;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.otp-timer {
    font-size: 0.95rem;
}

.topbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    z-index: 1030;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 12px;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: #fff;
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 1040;
    overflow-y: auto;
}

.app-sidebar.show {
    transform: translateX(0);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 1035;
}

.sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-link {
    text-decoration: none;
    color: var(--text);
    padding: 12px 14px;
    border-radius: 14px;
    transition: all .2s ease;
    border: 1px solid transparent;
    display: block;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--surface-2);
    border-color: var(--border);
}

.sidebar-section-title {
    font-size: .78rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-top: 10px;
    margin-bottom: 4px;
    padding: 0 4px;
}

.app-layout {
    min-height: 100vh;
}

.app-main {
    padding: 20px 0 28px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.stat-card,
.content-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.stat-label {
    color: var(--muted);
    font-size: .88rem;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.25;
}

.stat-value-sm,
.session-key {
    font-size: .95rem;
    word-break: break-word;
}

.card-title-row {
    margin-bottom: 16px;
}

.quick-links {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.stack-lg {
    display: grid;
    gap: 1rem;
}

.quick-link {
    text-decoration: none;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    font-weight: 500;
    display: block;
}

.mini-bars {
    display: grid;
    gap: 12px;
}

.mini-bar {
    display: grid;
    gap: 8px;
}

.mini-bar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.92rem;
}

.mini-bar__track {
    height: 10px;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
}

.mini-bar__fill {
    height: 100%;
    border-radius: inherit;
}

.result-list {
    display: grid;
    gap: 12px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.tests-search {
    min-width: 260px;
}

.admin-table {
    --bs-table-bg: transparent;
    margin-bottom: 0;
}

.admin-table thead th {
    color: var(--muted);
    font-size: .79rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom-color: var(--border);
}

.admin-table tbody td {
    border-bottom-color: var(--border);
    vertical-align: top;
}

.admin-table tbody tr:hover {
    background: rgba(249, 250, 251, 0.75);
}

.compare-submit {
    position: sticky;
    bottom: 12px;
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
}

.table-action {
    position: relative;
}

.table-action summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    padding: 7px 12px;
    border: 1px solid #0d6efd;
    border-radius: 8px;
    color: #0d6efd;
    background: #fff;
    font-size: 0.92rem;
}

.table-action summary::-webkit-details-marker {
    display: none;
}

.table-action[open] summary {
    background: #f0f6ff;
}

.table-action__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 4;
    min-width: 210px;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.table-action__menu a {
    display: block;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.92rem;
}

.table-action__menu a:hover {
    background: var(--surface-2);
}

.table-action__hint {
    display: block;
    padding: 9px 10px;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.empty-state {
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: 14px;
    padding: 20px;
}

.empty-state strong {
    display: block;
    margin-bottom: 8px;
}

.helper-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

.helper-list li + li {
    margin-top: 12px;
}

.panel-grid,
.trait-grid,
.compare-grid,
.dynamic-grid,
.contact-grid {
    display: grid;
    gap: 16px;
}

.panel-grid,
.trait-grid,
.compare-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.feature-card,
.trait-card,
.compare-card,
.contact-card,
.dynamic-card,
.share-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.feature-card,
.contact-card {
    padding: 20px;
}

.feature-card {
    display: block;
    text-decoration: none;
    color: var(--text);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
    color: var(--text);
}

.feature-card__eyebrow,
.section-eyebrow {
    color: var(--muted);
    font-size: .78rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.feature-card__title {
    margin-top: 10px;
    font-size: 1.05rem;
    font-weight: 700;
}

.feature-card__text,
.section-copy {
    margin-top: 8px;
    color: var(--muted);
    line-height: 1.55;
}

.feature-card__meta {
    margin-top: 16px;
    font-size: .9rem;
    color: #334155;
}

.profile-hero,
.share-layout {
    display: grid;
    gap: 18px;
}

.profile-hero {
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
}

.profile-card,
.share-card,
.chat-shell {
    padding: 22px;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    margin-bottom: 16px;
}

.score-list {
    display: grid;
    gap: 14px;
}

.score-row {
    display: grid;
    grid-template-columns: minmax(0, 180px) minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.score-row__label {
    font-size: .95rem;
    font-weight: 600;
}

.score-row__bar {
    height: 12px;
    background: #e9eef5;
    border-radius: 999px;
    overflow: hidden;
}

.score-row__fill {
    height: 100%;
    border-radius: inherit;
}

.score-row__value {
    font-size: .92rem;
    font-weight: 700;
    color: #334155;
}

.trait-card {
    padding: 22px;
}

.trait-card__summary {
    margin-top: 6px;
    color: var(--muted);
    font-size: .9rem;
}

.trait-card__body {
    margin-top: 12px;
    color: #334155;
    line-height: 1.6;
}

.share-code {
    margin-top: 14px;
    padding: 18px 20px;
    border-radius: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: .04em;
    word-break: break-word;
}

.share-note {
    margin-top: 12px;
    color: var(--muted);
    line-height: 1.55;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.dynamic-card {
    padding: 20px;
}

.dynamic-card__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.dynamic-card__badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: #334155;
    font-size: .85rem;
    font-weight: 600;
}

.dynamic-card__meter {
    height: 12px;
    background: #e9eef5;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 16px;
}

.dynamic-card__meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #0f172a, #475569);
}

.dynamic-card__section + .dynamic-card__section {
    margin-top: 14px;
}

.dynamic-card__label {
    font-size: .78rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.dynamic-card__body {
    line-height: 1.6;
    color: #334155;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 14px;
}

.contact-avatar {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: #0f172a;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

.contact-card__body {
    min-width: 0;
    flex: 1;
}

.contact-card__name {
    font-weight: 700;
}

.contact-card__meta {
    color: var(--muted);
    font-size: .9rem;
    margin-top: 4px;
    word-break: break-word;
}

.contact-search {
    max-width: 420px;
}

.chat-shell {
    display: grid;
    gap: 18px;
}

.chat-thread {
    min-height: 360px;
    max-height: 56vh;
    overflow-y: auto;
    padding: 18px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: grid;
    gap: 12px;
}

.chat-row {
    display: flex;
}

.chat-row--self {
    justify-content: flex-end;
}

.chat-bubble {
    max-width: min(82%, 520px);
    padding: 12px 14px;
    border-radius: 16px;
    background: #e5e7eb;
    color: var(--text);
}

.chat-bubble--self {
    background: #0f172a;
    color: #fff;
}

.chat-bubble__time {
    display: block;
    margin-top: 8px;
    font-size: .75rem;
    opacity: .78;
}

.chat-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.compare-card {
    padding: 20px;
}

.compare-card__meta {
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.55;
    margin-top: 6px;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.compare-table th,
.compare-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.compare-table th {
    font-size: .8rem;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--muted);
}

.compare-table td strong {
    display: block;
    margin-bottom: 6px;
}

.compare-table__metric {
    min-width: 180px;
}

.compare-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: .78rem;
    font-weight: 700;
    color: #334155;
}

.mini-score {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.mini-score__row {
    display: grid;
    gap: 6px;
}

.mini-score__label {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: .84rem;
    color: #334155;
}

.mini-score__bar {
    height: 8px;
    background: #e9eef5;
    border-radius: 999px;
    overflow: hidden;
}

.mini-score__fill {
    height: 100%;
    border-radius: inherit;
}

@media (max-width: 575.98px) {
    .otp-boxes {
        gap: 8px;
    }

    .otp-input {
        height: 54px;
        font-size: 1.2rem;
    }

    .result-item,
    .page-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .tests-search {
        min-width: 100%;
    }

    .chat-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991.98px) {
    .profile-hero {
        grid-template-columns: 1fr;
    }

    .score-row {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 992px) {
    .app-sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: none;
    }

    .app-main,
    .topbar .container-fluid {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }

    .app-main {
        padding: 24px 0 32px;
    }

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