:root {
    --sidebar-width: 264px;
    --sidebar-bg: #1e1b4b;
    --sidebar-bg-deep: #17143d;
    --sidebar-text: #c7d2fe;
    --sidebar-muted: #a5b4fc;
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-soft: #eef2ff;
    --page-bg: #f6f7fb;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --text: #172033;
    --muted: #64748b;
    --border: #e2e8f0;
    --success: #15803d;
    --success-soft: #dcfce7;
    --warning: #b45309;
    --warning-soft: #fef3c7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-card: 0 10px 30px rgba(30, 41, 59, .06);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--page-bg);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    min-height: 100vh;
    margin: 0;
    background: var(--page-bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.sidebar-open { overflow: hidden; }

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

button,
a { -webkit-tap-highlight-color: transparent; }

a {
    color: var(--primary-dark);
    text-decoration: none;
}

a:hover { color: #3730a3; }

:focus-visible {
    outline: 3px solid rgba(99, 102, 241, .3);
    outline-offset: 2px;
}

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

.sidebar {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-deep) 100%);
    color: white;
    box-shadow: 12px 0 32px rgba(30, 27, 75, .12);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 84px;
    padding: 18px 20px;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, .09);
}

.sidebar-brand-link { display: flex; flex: 1; align-items: center; gap: 12px; min-width: 0; overflow: hidden; color: white; }
.sidebar-brand-link:hover { color: white; }

.brand-logo {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    object-fit: contain;
    border-radius: 13px;
    background: white;
    box-shadow: 0 7px 20px rgba(0, 0, 0, .18);
}

.brand-copy { min-width: 0; }
.brand-title { display: block; overflow: hidden; font-size: 15px; font-weight: 800; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.brand-subtitle { display: block; margin-top: 1px; color: var(--sidebar-muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

.sidebar-section-label {
    padding: 22px 22px 8px;
    color: #818cf8;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.sidebar-nav {
    display: grid;
    gap: 5px;
    padding: 0 12px;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 10px 13px;
    border-radius: 11px;
    color: var(--sidebar-text);
    font-weight: 650;
    transition: color .16s ease, background .16s ease, transform .16s ease;
}

.nav-item:hover {
    color: white;
    background: rgba(255, 255, 255, .08);
}

.nav-item.is-active {
    color: white;
    background: linear-gradient(135deg, rgba(129, 140, 248, .28), rgba(99, 102, 241, .2));
    box-shadow: inset 0 0 0 1px rgba(165, 180, 252, .16);
}

.nav-item.is-active::before {
    content: "";
    position: absolute;
    left: -12px;
    width: 3px;
    height: 24px;
    border-radius: 0 999px 999px 0;
    background: #a5b4fc;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, .09);
}

.admin-profile {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.admin-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(165, 180, 252, .18);
    color: white;
    font-weight: 800;
}

.admin-name,
.admin-email {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-name { color: white; font-size: 13px; font-weight: 750; }
.admin-email { color: var(--sidebar-muted); font-size: 11px; }

.logout-button {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 10px;
    background: rgba(255, 255, 255, .05);
    color: var(--sidebar-text);
    cursor: pointer;
    font-weight: 700;
}

.logout-button:hover { background: rgba(255, 255, 255, .1); color: white; }

.mobile-bar {
    display: none;
    position: sticky;
    z-index: 30;
    top: 0;
    min-height: 64px;
    padding: 10px 16px;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.mobile-brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 800; }
.mobile-brand:hover { color: var(--text); }
.mobile-logo { width: 34px; height: 34px; object-fit: contain; border-radius: 10px; background: white; }

.menu-button,
.sidebar-close {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: white;
    color: var(--text);
    cursor: pointer;
}

.sidebar-close {
    display: none;
    margin-left: auto;
    border-color: rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .07);
    color: white;
}

.sidebar-overlay {
    position: fixed;
    z-index: 35;
    inset: 0;
    display: none;
    border: 0;
    background: rgba(15, 23, 42, .56);
    backdrop-filter: blur(2px);
}

.content-shell {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.main-content {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 30px 32px 48px;
}

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

.page-heading { min-width: 0; }
.page-title { margin: 0; font-size: clamp(25px, 3vw, 32px); line-height: 1.2; letter-spacing: -.035em; }
.page-description { max-width: 760px; margin: 7px 0 0; color: var(--muted); }
.page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 14px;
    color: var(--muted);
    font-weight: 700;
}

.back-link:hover { color: var(--primary-dark); }

h1, h2, h3 { color: var(--text); }
h2 { margin: 0 0 16px; font-size: 18px; letter-spacing: -.015em; }
h3 { margin: 0 0 12px; font-size: 15px; }

.section-heading { margin: 28px 0 14px; }
.muted { color: var(--muted); }
.text-strong { color: var(--text); font-weight: 750; }
.text-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.main-content > .card + .card { margin-top: 18px; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-header h2, .card-header h3 { margin-bottom: 3px; }
.card-subtitle { margin: 0; color: var(--muted); font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.metrics-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 15px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 18px; }
.two-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.metric-card {
    position: relative;
    min-height: 142px;
    overflow: hidden;
    padding: 20px;
}

.metric-card::after {
    content: "";
    position: absolute;
    right: -25px;
    bottom: -34px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--metric-soft, var(--primary-soft));
}

.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--metric-soft, var(--primary-soft)); color: var(--metric-color, var(--primary)); }
.metric-icon svg { width: 19px; height: 19px; }
.metric { position: relative; z-index: 1; margin-top: 18px; color: var(--metric-color, var(--primary-dark)); font-size: 30px; font-weight: 850; line-height: 1; letter-spacing: -.035em; }
.metric-caption { position: relative; z-index: 1; margin-top: 8px; color: var(--muted); font-size: 11px; }
.metric-card.green { --metric-color: #15803d; --metric-soft: #dcfce7; }
.metric-card.red { --metric-color: #dc2626; --metric-soft: #fee2e2; }
.metric-card.amber { --metric-color: #b45309; --metric-soft: #fef3c7; }
.metric-card.cyan { --metric-color: #0e7490; --metric-soft: #cffafe; }
.metric-card.purple { --metric-color: #7e22ce; --metric-soft: #f3e8ff; }

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, .75fr);
    align-items: start;
    gap: 18px;
}

.dashboard-stack { display: grid; gap: 18px; }
.dashboard-stack .card { margin: 0; }

.status-list { display: grid; gap: 0; margin-bottom: 16px; }
.status-row { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--border); color: #475569; font-size: 12px; }
.status-row:last-child { border-bottom: 0; }

.feature-grid { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 14px; border-top: 1px solid var(--border); }
.feature-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 999px; background: #f1f5f9; color: #64748b; font-size: 10px; font-weight: 750; }
.feature-pill.is-enabled { background: var(--success-soft); color: #166534; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; }
.feature-pill.is-enabled .status-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .12); }

.quick-actions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.quick-action { display: grid; gap: 2px; min-height: 70px; align-content: center; padding: 11px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-muted); color: var(--text); transition: border .14s ease, background .14s ease, transform .14s ease; }
.quick-action:hover { border-color: #c7d2fe; background: var(--primary-soft); color: #3730a3; transform: translateY(-1px); }
.quick-action span { font-weight: 800; }
.quick-action small { color: var(--muted); font-size: 10px; }

.activity-list { display: grid; }
.activity-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 62px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 850; }
.activity-item strong, .activity-item div span { display: block; }
.activity-item strong { color: var(--text); font-size: 12px; }
.activity-item div span { margin-top: 2px; color: var(--muted); font-size: 11px; }

.table-card { padding: 0; overflow: hidden; }
.table-card .card-header { margin: 0; padding: 20px 20px 16px; }
.table-wrap { width: 100%; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { background: var(--surface-muted); color: #475569; font-size: 11px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; white-space: nowrap; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: #fafbff; }
tbody tr:last-child td { border-bottom: 0; }
td small { color: var(--muted); }
.cell-main { display: block; color: var(--text); font-weight: 750; }
.cell-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.cell-actions { text-align: right; white-space: nowrap; }
.empty-table { padding: 42px 18px; color: var(--muted); text-align: center; }
.metadata-code { display: block; max-width: 430px; overflow-wrap: anywhere; color: #475569; font-size: 11px; white-space: normal; }

.btn,
button.btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    cursor: pointer;
    font-weight: 750;
    line-height: 1.2;
    box-shadow: 0 4px 10px rgba(79, 70, 229, .16);
    transition: transform .14s ease, background .14s ease, box-shadow .14s ease;
}

.btn:hover { color: white; background: var(--primary-dark); box-shadow: 0 6px 14px rgba(79, 70, 229, .2); }
.btn:active { transform: translateY(1px); }
.btn.secondary { border-color: var(--border); background: white; color: #475569; box-shadow: none; }
.btn.secondary:hover { border-color: #cbd5e1; background: var(--surface-muted); color: var(--text); }
.btn.warn { background: #d97706; box-shadow: 0 4px 10px rgba(217, 119, 6, .15); }
.btn.warn:hover { background: #b45309; }
.btn.danger { background: var(--danger); box-shadow: 0 4px 10px rgba(220, 38, 38, .14); }
.btn.danger:hover { background: #b91c1c; }
.btn.success-btn { background: #16a34a; box-shadow: 0 4px 10px rgba(22, 163, 74, .15); }
.btn.success-btn:hover { background: #15803d; }
.btn.link-btn { min-height: auto; padding: 0; background: transparent; color: var(--primary-dark); box-shadow: none; }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.actions,
.toolbar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.toolbar { margin-bottom: 18px; }
.toolbar-spacer { flex: 1; }
.filter-card { margin-bottom: 18px; padding: 17px 20px; }
.filter-card .toolbar { margin: 0; }

.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
label { display: block; margin-bottom: 6px; color: #334155; font-size: 12px; font-weight: 750; }

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    outline: 0;
    background: white;
    color: var(--text);
    transition: border .14s ease, box-shadow .14s ease;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

input[readonly] { background: var(--surface-muted); color: var(--muted); }
input[type="file"] { padding: 7px 9px; background: white; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.error-text { display: block; margin-top: 5px; color: #b91c1c; font-size: 12px; }

.switch-field { margin-bottom: 12px; }
.switch {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    margin: 0;
    cursor: pointer;
}

.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-control { position: relative; width: 42px; height: 24px; flex: 0 0 42px; border-radius: 999px; background: #cbd5e1; transition: background .16s ease; }
.switch-control::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(15, 23, 42, .25); transition: transform .16s ease; }
.switch input:checked + .switch-control { background: var(--primary); }
.switch input:checked + .switch-control::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-control { outline: 3px solid rgba(99, 102, 241, .3); outline-offset: 2px; }
.switch-label { color: #334155; font-size: 13px; font-weight: 700; }

.product-box { margin-top: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-muted); }
.product-box h3 { margin-bottom: 12px; }

.form-actions {
    position: sticky;
    z-index: 10;
    bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 20px 0 24px;
    padding: 13px 16px;
    border: 1px solid #c7d2fe;
    border-radius: 14px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 12px 30px rgba(30, 41, 59, .12);
    backdrop-filter: blur(14px);
}

.form-actions p { margin: 0; color: var(--muted); font-size: 12px; }

.alert {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-bottom: 18px;
    padding: 13px 15px;
    border: 1px solid;
    border-radius: 12px;
}

.alert svg { width: 19px; height: 19px; flex: 0 0 19px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; }
.alert-success { border-color: #bbf7d0; background: var(--success-soft); color: #166534; }
.alert-error { border-color: #fecaca; background: var(--danger-soft); color: #991b1b; }
.alert ul { margin: 0; padding-left: 18px; }
.inline-error { margin-top: 8px; padding: 7px 9px; border-radius: 8px; background: var(--danger-soft); color: #991b1b; font-size: 11px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .025em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge.active,
.badge.published,
.badge.ready { background: var(--success-soft); color: #166534; }
.badge.blocked,
.badge.failed { background: var(--danger-soft); color: #991b1b; }
.badge.draft,
.badge.processing { background: var(--warning-soft); color: #92400e; }
.badge.missing,
.badge.archived { background: #e2e8f0; color: #475569; }

.revision-strip { display: flex; align-items: center; gap: 9px; margin: -8px 0 18px; color: var(--muted); font-size: 12px; }
.danger-zone { border-color: #fecaca; background: #fffafa; }
.danger-zone .card-header h2 { color: #b91c1c; }
.solved-list { color: #475569; line-height: 1.8; overflow-wrap: anywhere; }

.question-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.question-card { padding: 17px; }
.question-card h3 { display: flex; justify-content: space-between; gap: 10px; }
.question-card img { width: 86px; height: 86px; object-fit: contain; border: 1px solid var(--border); border-radius: 11px; background: white; }
.preview-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 15px; }
.preview-box { padding: 10px; border-radius: 11px; background: var(--surface-muted); text-align: center; }
.preview-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 750; }
.preview-box .badge { display: flex; width: fit-content; margin: 7px auto 0; }
.empty-slot { min-height: 140px; display: grid; place-items: center; padding: 20px; border: 2px dashed #cbd5e1; border-radius: 12px; background: var(--surface-muted); color: var(--muted); text-align: center; }
.question-actions { display: flex; gap: 8px; margin-top: 12px; }

.pagination { margin-top: 18px; }
.pagination nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); }
.pagination nav > div:last-child { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; }
.pagination nav > div:last-child > div:last-child { display: flex; }
.pagination nav span[aria-current="page"] span { border-color: var(--primary); background: var(--primary); color: white; }
.pagination nav a,
.pagination nav span span {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border: 1px solid var(--border);
    background: white;
    color: #475569;
}
.pagination nav svg { width: 18px; height: 18px; }

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 12% 14%, rgba(129, 140, 248, .22), transparent 28%),
        radial-gradient(circle at 88% 88%, rgba(99, 102, 241, .17), transparent 30%),
        #f4f5fb;
}

.login-shell { width: min(940px, 100%); display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid rgba(226, 232, 240, .8); border-radius: 24px; background: white; box-shadow: 0 28px 70px rgba(30, 41, 59, .14); }
.login-aside { min-height: 570px; display: flex; flex-direction: column; justify-content: space-between; padding: 44px; background: linear-gradient(145deg, #312e81, #17143d); color: white; }
.login-brand { display: flex; align-items: center; gap: 13px; }
.login-brand .brand-logo { width: 50px; height: 50px; flex-basis: 50px; }
.login-aside h1 { max-width: 390px; margin: 0 0 14px; color: white; font-size: 37px; line-height: 1.12; letter-spacing: -.04em; }
.login-aside p { max-width: 370px; margin: 0; color: #c7d2fe; font-size: 15px; }
.login-footnote { color: #818cf8; font-size: 11px; }
.login-form-wrap { display: grid; align-items: center; padding: 48px; }
.login-form { width: 100%; max-width: 360px; margin: auto; }
.login-form h2 { margin-bottom: 7px; font-size: 25px; }
.login-form > .muted { margin: 0 0 28px; }
.login-form .field { margin-bottom: 17px; }
.login-form .btn { width: 100%; min-height: 46px; margin-top: 9px; }
.remember-row { display: flex; align-items: center; gap: 8px; margin: 3px 0 16px; color: #475569; font-size: 12px; font-weight: 650; }
.remember-row input { margin: 0; }

@media (max-width: 1200px) {
    .metrics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
    .sidebar { transform: translateX(-105%); transition: transform .2s ease; }
    .sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-open .sidebar-overlay { display: block; }
    .sidebar-close { display: grid; }
    .sidebar-brand { padding-right: 12px; }
    .content-shell { margin-left: 0; }
    .mobile-bar { display: flex; }
    .main-content { padding: 24px 20px 40px; }
    .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .main-content { padding: 20px 14px 34px; }
    .page-header { flex-direction: column; margin-bottom: 20px; }
    .page-actions { width: 100%; justify-content: flex-start; }
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-card { min-height: 126px; padding: 16px; }
    .metric { font-size: 26px; }
    .two-cols { grid-template-columns: 1fr; }
    .card { padding: 16px; }
    .table-card { padding: 0; }
    th, td { padding: 12px 13px; white-space: nowrap; }
    .metadata-code { min-width: 280px; white-space: normal; }
    .toolbar { align-items: stretch; }
    .toolbar > div:not(.toolbar-spacer) { flex: 1 1 100%; }
    .toolbar .btn, .actions .btn { flex: 1 1 auto; }
    .form-actions { align-items: stretch; flex-direction: column; bottom: 8px; }
    .form-actions .btn { width: 100%; }
    .login-page { padding: 14px; }
    .login-shell { grid-template-columns: 1fr; border-radius: 20px; }
    .login-aside { min-height: auto; padding: 25px; }
    .login-aside-content, .login-footnote { display: none; }
    .login-form-wrap { padding: 30px 24px 34px; }
    .pagination nav > div:first-child { display: none; }
    .pagination nav > div:last-child > div:first-child { display: none; }
    .activity-item { grid-template-columns: 38px minmax(0, 1fr); }
    .activity-item > .text-mono { grid-column: 2; }
}

@media (max-width: 460px) {
    .metrics-grid { grid-template-columns: 1fr; }
    .question-grid { grid-template-columns: 1fr; }
    .mobile-brand span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
