:root {
    --bg: #eef3f7;
    --panel: #ffffff;
    --panel-soft: #f6f9fb;
    --line: #d8e3ec;
    --text: #163140;
    --muted: #5f7887;
    --primary: #0f6f91;
    --primary-dark: #0a5772;
    --accent: #f59e0b;
    --danger: #c2410c;
    --success: #0f766e;
    --shadow: 0 18px 45px rgba(21, 56, 74, 0.1);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top right, rgba(15, 111, 145, 0.15), transparent 32%),
        linear-gradient(180deg, #f4f8fb 0%, #edf3f7 100%);
    color: var(--text);
}

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

button,
input,
select,
textarea {
    font: inherit;
}

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

.admin-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, #102d3d 0%, #0d2431 100%);
    color: #e8f2f7;
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: sticky;
    top: 0;
    height: 100vh;
}

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

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #0f6f91, #21a3b5);
}

.brand-logo {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.sidebar__brand span,
.sidebar__foot span {
    display: block;
    color: rgba(232, 242, 247, 0.72);
    font-size: 0.92rem;
}

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

.sidebar__nav a {
    padding: 13px 15px;
    border-radius: 14px;
    color: rgba(232, 242, 247, 0.85);
    transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar__nav a:hover,
.sidebar__nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateX(2px);
}

.sidebar__foot {
    margin-top: auto;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__foot a {
    display: inline-flex;
    margin-top: 8px;
    color: #8ee0ef;
}

.main-panel {
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.topbar h1 {
    margin: 6px 0 0;
    font-size: 2rem;
    line-height: 1.1;
}

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

.eyebrow {
    margin: 0;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    font-weight: 700;
}

.user-pill {
    padding: 10px 14px;
    background: rgba(15, 111, 145, 0.08);
    color: var(--primary-dark);
    border-radius: 999px;
    font-size: 0.95rem;
}

.toolbar,
.stats-grid,
.panel-grid,
.pagination,
.flash-stack {
    margin-bottom: 22px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.toolbar__actions,
.bulk-toolbar,
.hero__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filters-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

label,
fieldset {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--muted);
    font-size: 0.92rem;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 14px;
    padding: 13px 14px;
    color: var(--text);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(15, 111, 145, 0.65);
    box-shadow: 0 0 0 4px rgba(15, 111, 145, 0.08);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--primary), #1a90aa);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.button:hover {
    background: linear-gradient(135deg, var(--primary-dark), #15758b);
}

.button--ghost {
    background: transparent;
    color: var(--primary-dark);
    border-color: rgba(15, 111, 145, 0.18);
}

.button--sm {
    padding: 9px 12px;
    font-size: 0.88rem;
}

.button--block {
    width: 100%;
}

.panel,
.stat-card,
.login-card {
    background: var(--panel);
    border: 1px solid rgba(216, 227, 236, 0.8);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel {
    padding: 22px;
}

.panel__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.panel__header--space {
    align-items: center;
}

.panel__header h2,
.subpanel h3 {
    margin: 6px 0 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.stat-card {
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: auto -35px -35px auto;
    width: 110px;
    height: 110px;
    border-radius: 999px;
    background: rgba(15, 111, 145, 0.08);
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 2rem;
}

.panel-grid {
    display: grid;
    gap: 20px;
}

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

.panel-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

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

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

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.muted {
    color: var(--muted);
}

.badge {
    display: inline-flex;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.badge--blue { background: rgba(14, 116, 144, 0.12); color: #0e7490; }
.badge--amber { background: rgba(217, 119, 6, 0.12); color: #b45309; }
.badge--purple { background: rgba(109, 40, 217, 0.12); color: #7c3aed; }
.badge--green { background: rgba(5, 150, 105, 0.12); color: #047857; }
.badge--red { background: rgba(220, 38, 38, 0.12); color: #b91c1c; }
.badge--teal { background: rgba(13, 148, 136, 0.12); color: #0f766e; }
.badge--orange { background: rgba(234, 88, 12, 0.12); color: #c2410c; }
.badge--slate { background: rgba(71, 85, 105, 0.12); color: #475569; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.full-width {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

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

.detail-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--panel-soft);
}

.detail-list strong {
    color: var(--text);
}

.status-row,
.inline-form,
.stack-md,
.stack-lg {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stack-md,
.stack-lg {
    flex-direction: column;
}

.subpanel {
    margin-top: 20px;
    padding: 18px;
    border-radius: 18px;
    background: var(--panel-soft);
}

.simple-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.simple-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.chart {
    display: grid;
    gap: 12px;
}

.chart-row {
    display: grid;
    gap: 6px;
}

.chart-row__top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.92rem;
}

.chart-row__bar {
    height: 12px;
    border-radius: 999px;
    background: rgba(15, 111, 145, 0.08);
    overflow: hidden;
}

.chart-row__fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0f6f91, #2bb3be);
}

.pagination {
    display: flex;
    gap: 10px;
}

.pagination a {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
}

.pagination a.active {
    background: var(--primary);
    color: #fff;
}

.flash-stack {
    display: grid;
    gap: 10px;
}

.flash {
    padding: 14px 16px;
    border-radius: 16px;
    font-weight: 700;
}

.flash--success {
    background: rgba(5, 150, 105, 0.12);
    color: #047857;
}

.flash--error {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(520px, 100%);
    padding: 34px;
    display: grid;
    gap: 22px;
}

.login-card h1 {
    margin: 8px 0;
    font-size: 2.3rem;
}

.login-foot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.92rem;
}

.checkbox-group {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    gap: 12px;
}

.checkbox-group label {
    flex-direction: row;
    align-items: center;
}

.checkbox-group input {
    width: auto;
}

.question-builder {
    display: grid;
    gap: 16px;
}

.result-profile-builder,
.option-builder {
    display: grid;
    gap: 16px;
}

.question-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-soft);
    display: grid;
    gap: 14px;
}

.question-card__top,
.option-card__top,
.result-profile-card__top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.option-card,
.result-profile-card {
    padding: 18px;
    border: 1px solid rgba(15, 111, 145, 0.14);
    border-radius: 18px;
    background: #fff;
    display: grid;
    gap: 14px;
}

.option-card + .option-card,
.result-profile-card + .result-profile-card {
    margin-top: 12px;
}

@media (max-width: 1100px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
    }

    .panel-grid--two,
    .panel-grid--three,
    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .main-panel {
        padding: 18px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .toolbar,
    .filters-inline,
    .table-actions,
    .form-actions,
    .bulk-toolbar,
    .inline-form {
        width: 100%;
        flex-direction: column;
    }

    .login-card {
        padding: 24px;
    }
}
