/* ==========================================================================
   Quiz Platform — Arabic RTL admin dashboard
   Identity: purple #6D5BD0 + gold #E0A93A
   ========================================================================== */

:root {
    --purple: #6D5BD0;
    --purple-800: #4a3aa0;
    --purple-700: #5746b8;
    --purple-600: #6250c4;
    --purple-100: #eeebff;
    --purple-50: #f6f4ff;
    --gold: #E0A93A;
    --gold-700: #b9851f;
    --gold-100: #fbf0d8;
    --bg: #f5f3fb;
    --surface: #ffffff;
    --surface-2: #faf9ff;
    --surface-3: #f1eefb;
    --text: #211a3b;
    --text-2: #4a4360;
    --muted: #7b7590;
    --border: #e8e3f3;
    --border-strong: #d8d1ea;
    --danger: #d14343;
    --danger-100: #fdecec;
    --success: #218c61;
    --success-100: #e7f7ef;
    --warning: #b57a12;
    --warning-100: #fdf3df;
    --info: #2f6fdb;
    --info-100: #eaf2ff;
    --sidebar: #241b4d;
    --sidebar-2: #2e2360;
    --sidebar-text: #c8c1e6;
    --shadow-sm: 0 1px 2px rgba(33, 26, 59, .05);
    --shadow: 0 10px 30px rgba(33, 26, 59, .07);
    --shadow-lg: 0 24px 60px rgba(33, 26, 59, .14);
    --radius: 18px;
    --radius-sm: 12px;
    --radius-xs: 9px;
    --font: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --sidebar-w: 270px;
}

[data-theme="dark"] {
    --bg: #12101d;
    --surface: #1b172b;
    --surface-2: #211c34;
    --surface-3: #2a2440;
    --text: #f1eefb;
    --text-2: #cfc8e2;
    --muted: #9b94b0;
    --border: #302a46;
    --border-strong: #41395e;
    --purple-100: #2e2653;
    --purple-50: #241e40;
    --gold-100: #3b2e17;
    --danger-100: #3b2024;
    --success-100: #17362a;
    --warning-100: #3a2d17;
    --info-100: #1a2b4a;
    --sidebar: #171226;
    --sidebar-2: #211a3a;
    --sidebar-text: #b9b1d4;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
    --shadow: 0 10px 30px rgba(0, 0, 0, .28);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .42);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol {
    margin: 0;
}

ul, ol {
    padding: 0;
    list-style: none;
}

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

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

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .88em;
    background: var(--surface-3);
    color: var(--purple);
    padding: 2px 6px;
    border-radius: 6px;
    direction: ltr;
    display: inline-block;
}

::selection {
    background: var(--purple);
    color: #fff;
}

.skip-link {
    position: fixed;
    top: -60px;
    right: 16px;
    z-index: 200;
    background: var(--purple);
    color: #fff;
    padding: 10px 18px;
    border-radius: 0 0 10px 10px;
    transition: top .2s ease;
}

.skip-link:focus {
    top: 0;
}

body.no-scroll {
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   Brand
   -------------------------------------------------------------------------- */

.brand-mark {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(145deg, var(--purple), var(--purple-800));
    box-shadow: 0 12px 24px rgba(109, 91, 208, .32);
    flex: 0 0 auto;
}

.brand-mark-sm {
    width: 42px;
    height: 42px;
    border-radius: 13px;
}

.brand-q {
    color: #fff;
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    transform: translateY(-1px);
}

.brand-mark-sm .brand-q {
    font-size: 21px;
}

.brand-dot {
    position: absolute;
    left: 10px;
    bottom: 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gold);
    border: 2px solid var(--purple-800);
}

.brand-mark-sm .brand-dot {
    left: 7px;
    bottom: 7px;
    width: 8px;
    height: 8px;
}

.eyebrow {
    display: inline-block;
    color: var(--purple);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

[data-theme="dark"] .eyebrow {
    color: #a99cf0;
}

/* --------------------------------------------------------------------------
   Authentication pages
   -------------------------------------------------------------------------- */

.auth-page {
    position: relative;
    display: grid;
    place-items: center;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 15% 15%, rgba(224, 169, 58, .12), transparent 34%),
        radial-gradient(circle at 85% 20%, rgba(109, 91, 208, .22), transparent 40%),
        linear-gradient(145deg, #f8f6ff 0%, #efecfb 45%, #f7f3e9 100%);
    padding: 40px 20px;
}

[data-theme="dark"] .auth-page {
    background:
        radial-gradient(circle at 15% 15%, rgba(224, 169, 58, .10), transparent 34%),
        radial-gradient(circle at 85% 20%, rgba(109, 91, 208, .24), transparent 42%),
        linear-gradient(145deg, #12101d 0%, #171326 50%, #1c1728 100%);
}

.auth-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .5;
    pointer-events: none;
}

.auth-orb-1 {
    width: 360px;
    height: 360px;
    background: rgba(109, 91, 208, .32);
    top: -120px;
    right: -80px;
}

.auth-orb-2 {
    width: 300px;
    height: 300px;
    background: rgba(224, 169, 58, .22);
    bottom: -100px;
    left: -70px;
}

.auth-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 470px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.auth-shell-wide {
    max-width: 600px;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.auth-brand h1 {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.02em;
}

.auth-brand p {
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}

.auth-card {
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: var(--shadow-lg);
    padding: 34px;
    backdrop-filter: blur(18px);
}

.auth-card-wide {
    max-width: 560px;
    width: 100%;
    align-self: center;
}

.auth-card-head {
    margin-bottom: 24px;
}

.auth-card-head h2 {
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.auth-card-head p {
    color: var(--muted);
    font-size: 13.5px;
    margin-top: 6px;
}

.auth-note,
.auth-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px dashed var(--border);
    color: var(--muted);
    font-size: 12.5px;
}

.auth-note a {
    font-weight: 700;
}

.auth-hint i,
.auth-note i {
    color: var(--gold-700);
}

.auth-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}

.dot-sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    opacity: .5;
}

.theme-float {
    position: fixed;
    z-index: 5;
    top: 20px;
    left: 20px;
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: blur(12px);
}

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */

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

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    padding: 22px 16px 18px;
    background:
        radial-gradient(circle at 85% 0%, rgba(224, 169, 58, .14), transparent 30%),
        linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: var(--sidebar-text);
    border-left: 1px solid rgba(255, 255, 255, .05);
    transition: transform .28s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 22px;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.sidebar-brand-text strong {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.01em;
}

.sidebar-brand-text small {
    color: var(--sidebar-text);
    font-size: 11.5px;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 18px 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .16) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .14);
    border-radius: 999px;
}

.nav-section {
    margin-bottom: 18px;
}

.nav-section-label {
    display: block;
    padding: 0 12px 8px;
    color: rgba(200, 193, 230, .58);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 12px;
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    transition: background .18s ease, color .18s ease, transform .18s ease;
    margin-bottom: 3px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}

.nav-link.is-active {
    background: linear-gradient(90deg, rgba(109, 91, 208, .98), rgba(109, 91, 208, .62));
    color: #fff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .18);
}

.nav-link.is-active::after {
    content: "";
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 22px;
    border-radius: 3px 0 0 3px;
    background: var(--gold);
}

.nav-icon {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .07);
    font-size: 13px;
    flex: 0 0 auto;
}

.nav-link.is-active .nav-icon {
    background: rgba(255, 255, 255, .16);
    color: var(--gold);
}

.nav-text {
    flex: 1;
    white-space: nowrap;
}

.nav-phase {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: 9.5px;
    font-weight: 700;
    color: var(--gold);
    background: rgba(224, 169, 58, .16);
    border: 1px solid rgba(224, 169, 58, .24);
    border-radius: 999px;
}

.sidebar-footer {
    padding: 14px 10px 0;
    border-top: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.env-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--sidebar-text);
    font-size: 11px;
}

.sidebar-version {
    color: rgba(200, 193, 230, .5);
    font-size: 10.5px;
}

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 3px rgba(224, 169, 58, .14);
    flex: 0 0 auto;
}

.status-dot.is-ok {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(33, 140, 97, .14);
}

.status-dot.is-bad {
    background: var(--danger);
    box-shadow: 0 0 0 3px rgba(209, 67, 67, .14);
}

.status-dot.is-warn {
    background: var(--gold);
    box-shadow: 0 0 0 3px rgba(224, 169, 58, .14);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(14, 10, 28, .55);
    backdrop-filter: blur(2px);
}

.app-main {
    min-height: 100vh;
    margin-right: var(--sidebar-w);
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 28px;
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.topbar-start {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-title h1 {
    font-size: 19px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -.01em;
}

.topbar-title p {
    color: var(--muted);
    font-size: 11.5px;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 460px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-2);
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.icon-btn:hover {
    background: var(--purple-50);
    border-color: var(--purple-100);
    color: var(--purple);
}

.icon-btn:active {
    transform: scale(.96);
}

.icon-btn-danger:hover {
    background: var(--danger-100);
    border-color: color-mix(in srgb, var(--danger) 20%, transparent);
    color: var(--danger);
}

.menu-toggle {
    display: none;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
}

.avatar {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--purple), var(--purple-800));
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    flex: 0 0 auto;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}

.avatar-sm {
    width: 34px;
    height: 34px;
    font-size: 13px;
}

.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    padding-left: 4px;
}

.user-meta strong {
    font-size: 12.5px;
    font-weight: 700;
}

.user-meta small {
    color: var(--muted);
    font-size: 10.5px;
    margin-top: 2px;
}

.logout-form {
    display: inline-flex;
}

.content {
    flex: 1;
    width: 100%;
    max-width: 1520px;
    margin: 0 auto;
    padding: 26px 28px 40px;
}

.app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 28px 22px;
    color: var(--muted);
    font-size: 11px;
}

/* --------------------------------------------------------------------------
   Page headings and actions
   -------------------------------------------------------------------------- */

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.page-heading h2 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.025em;
    line-height: 1.2;
}

.page-heading p {
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
    max-width: 680px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease, color .16s ease;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0) scale(.99);
}

.btn-primary {
    background: linear-gradient(145deg, var(--purple), var(--purple-700));
    color: #fff;
    box-shadow: 0 10px 22px rgba(109, 91, 208, .26);
}

.btn-primary:hover {
    box-shadow: 0 14px 28px rgba(109, 91, 208, .34);
    color: #fff;
}

.btn-ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-2);
}

.btn-ghost:hover {
    background: var(--purple-50);
    border-color: var(--purple-100);
    color: var(--purple);
}

.btn-gold {
    background: linear-gradient(145deg, var(--gold), var(--gold-700));
    color: #fff;
    box-shadow: 0 10px 22px rgba(224, 169, 58, .24);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-block {
    width: 100%;
}

.btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.link-more {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--purple);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.link-more i {
    font-size: 9px;
    transition: transform .18s ease;
}

.link-more:hover i {
    transform: translateX(-3px);
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

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

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

.card-head h3 {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.01em;
}

.card-head p {
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
}

/* --------------------------------------------------------------------------
   Stats
   -------------------------------------------------------------------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 16px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--border-strong);
}

.stat-card.stat-warning {
    border-color: color-mix(in srgb, var(--danger) 22%, var(--border));
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 15px;
    font-size: 19px;
    flex: 0 0 auto;
}

.stat-purple {
    background: var(--purple-100);
    color: var(--purple);
}

.stat-indigo {
    background: var(--info-100);
    color: var(--info);
}

.stat-gold {
    background: var(--gold-100);
    color: var(--gold-700);
}

.stat-red {
    background: var(--danger-100);
    color: var(--danger);
}

.stat-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-body span {
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
}

.stat-body strong {
    font-size: 27px;
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: -.03em;
}

.stat-body small {
    color: var(--muted);
    font-size: 10.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-grid-small {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 4px;
}

.mini-stat {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.mini-stat > i {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--purple-50);
    color: var(--purple);
    font-size: 13px;
    flex: 0 0 auto;
}

.mini-stat div {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.mini-stat strong {
    font-size: 17px;
    font-weight: 800;
}

.mini-stat span {
    color: var(--muted);
    font-size: 10.5px;
}

/* --------------------------------------------------------------------------
   Dashboard grids, chart, health, lists
   -------------------------------------------------------------------------- */

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(290px, .85fr);
    gap: 16px;
    margin-top: 16px;
}

.chart-card {
    display: flex;
    flex-direction: column;
}

.chart-bars {
    display: flex;
    align-items: stretch;
    gap: 7px;
    height: 216px;
    padding: 8px 4px 0;
    margin-top: auto;
}

.chart-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    height: 100%;
}

.chart-value {
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 700;
    height: 12px;
}

.chart-bar {
    width: 100%;
    max-width: 24px;
    min-height: 3px;
    border-radius: 7px 7px 3px 3px;
    background: linear-gradient(180deg, var(--purple) 0%, #a99cf0 100%);
    box-shadow: 0 4px 10px rgba(109, 91, 208, .18);
    transition: height .35s ease, filter .18s ease;
}

.chart-col:hover .chart-bar {
    filter: brightness(1.08);
}

.chart-label {
    color: var(--muted);
    font-size: 9.5px;
    white-space: nowrap;
    margin-top: 2px;
}

.chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: var(--muted);
    font-size: 11.5px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.chart-empty-state {
    display: flex;
    min-height: 220px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 24px;
    text-align: center;
    border: 1px dashed var(--border-strong);
    border-radius: 13px;
    background: var(--surface-2);
    color: var(--muted);
}

.chart-empty-state i {
    color: var(--purple);
    font-size: 28px;
    opacity: .45;
    margin-bottom: 3px;
}

.chart-empty-state strong {
    color: var(--text-2);
    font-size: 14px;
}

.chart-empty-state span {
    max-width: 330px;
    font-size: 11.5px;
    line-height: 1.7;
}

.health-card {
    display: flex;
    flex-direction: column;
}

.health-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.health-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}

.health-list li:last-child {
    border-bottom: 0;
}

.health-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 13px;
    flex: 0 0 auto;
}

.health-icon.is-ok {
    background: var(--success-100);
    color: var(--success);
}

.health-icon.is-bad {
    background: var(--danger-100);
    color: var(--danger);
}

.health-icon.is-warn {
    background: var(--warning-100);
    color: var(--warning);
}

.health-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.health-text strong {
    font-size: 12px;
    font-weight: 700;
}

.health-text small {
    color: var(--muted);
    font-size: 10.5px;
    margin-top: 1px;
}

.health-note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 13px;
    padding: 9px 11px;
    border-radius: 10px;
    background: var(--warning-100);
    color: var(--warning);
    font-size: 10.5px;
}

.activity-list,
.user-list {
    display: flex;
    flex-direction: column;
}

.activity-list li,
.user-list li {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.activity-list li:last-child,
.user-list li:last-child {
    border-bottom: 0;
}

.activity-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--purple-50);
    color: var(--purple);
    font-size: 12px;
    flex: 0 0 auto;
}

.activity-text,
.user-list-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    line-height: 1.3;
}

.activity-text strong,
.user-list-text strong {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-text small,
.user-list-text small {
    color: var(--muted);
    font-size: 10.5px;
    margin-top: 2px;
}

/* --------------------------------------------------------------------------
   Roadmap
   -------------------------------------------------------------------------- */

.roadmap-card {
    margin-top: 16px;
}

.roadmap {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    position: relative;
}

.roadmap li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    min-width: 0;
}

.roadmap li.is-done {
    background: var(--success-100);
    border-color: color-mix(in srgb, var(--success) 16%, var(--border));
}

.roadmap-dot {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--purple-100);
    color: var(--purple);
    font-size: 10.5px;
    font-weight: 800;
    flex: 0 0 auto;
}

.roadmap li.is-done .roadmap-dot {
    background: var(--success);
    color: #fff;
}

.roadmap li div {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}

.roadmap strong {
    font-size: 11.5px;
    font-weight: 800;
}

.roadmap small {
    color: var(--muted);
    font-size: 10px;
    margin-top: 2px;
}

/* --------------------------------------------------------------------------
   Onboarding and placeholders
   -------------------------------------------------------------------------- */

.onboarding-card {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-bottom: 18px;
    background:
        radial-gradient(circle at 100% 0%, rgba(224, 169, 58, .12), transparent 34%),
        linear-gradient(135deg, var(--purple-50), var(--surface) 70%);
    border-color: var(--purple-100);
}

.onboarding-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(145deg, var(--purple), var(--purple-800));
    color: #fff;
    font-size: 24px;
    flex: 0 0 auto;
    box-shadow: 0 14px 28px rgba(109, 91, 208, .26);
}

.onboarding-body {
    flex: 1;
    min-width: 0;
}

.onboarding-body h2 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 5px;
}

.onboarding-body p {
    color: var(--muted);
    font-size: 12.5px;
    max-width: 760px;
}

.onboarding-actions {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.onboarding-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    min-width: 118px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--success);
    font-size: 10.5px;
    font-weight: 700;
    text-align: center;
    flex: 0 0 auto;
}

.onboarding-badge i {
    font-size: 20px;
}

.placeholder-card {
    max-width: 820px;
    margin: 10px auto;
    text-align: center;
    padding: 46px 34px;
    background:
        radial-gradient(circle at 50% 0%, var(--purple-50), transparent 55%),
        var(--surface);
}

.placeholder-icon {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    border-radius: 22px;
    background: var(--purple-100);
    color: var(--purple);
    font-size: 30px;
}

.placeholder-card h2 {
    font-size: 23px;
    font-weight: 800;
    margin: 10px 0 6px;
}

.placeholder-card > p {
    color: var(--muted);
    font-size: 13px;
    max-width: 560px;
    margin: 0 auto;
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 18px;
    max-width: 690px;
    margin: 26px auto 0;
    text-align: right;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 11.5px;
    line-height: 1.45;
}

.feature-list i {
    color: var(--success);
    font-size: 10px;
    margin-top: 4px;
    flex: 0 0 auto;
}

.placeholder-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.placeholder-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-card {
    max-width: 780px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field label {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-2);
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap > i {
    position: absolute;
    right: 14px;
    color: var(--muted);
    font-size: 13px;
    pointer-events: none;
    transition: color .18s ease;
}

.input-wrap input,
.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-2);
    color: var(--text);
    padding: 11px 14px;
    font-size: 13px;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
    outline: none;
}

.input-wrap input {
    padding-right: 42px;
    padding-left: 42px;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.input-wrap input:focus {
    border-color: var(--purple);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(109, 91, 208, .12);
}

.input-wrap input:focus + .input-action,
.input-wrap:focus-within > i {
    color: var(--purple);
}

.input-wrap input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
    color: var(--muted);
    opacity: .7;
}

.input-action {
    position: absolute;
    left: 6px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
}

.input-action:hover {
    background: var(--purple-50);
    color: var(--purple);
}

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

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    padding-top: 6px;
    border-top: 1px dashed var(--border);
    margin-top: 4px;
    padding-top: 16px;
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 11px;
    border: 1px solid transparent;
    font-size: 12.5px;
    line-height: 1.5;
    margin-bottom: 16px;
    position: relative;
}

.alert > i {
    margin-top: 2px;
    flex: 0 0 auto;
}

.alert > span {
    flex: 1;
}

.alert-success {
    background: var(--success-100);
    border-color: color-mix(in srgb, var(--success) 18%, transparent);
    color: var(--success);
}

.alert-error {
    background: var(--danger-100);
    border-color: color-mix(in srgb, var(--danger) 18%, transparent);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-100);
    border-color: color-mix(in srgb, var(--warning) 18%, transparent);
    color: var(--warning);
}

.alert-info {
    background: var(--info-100);
    border-color: color-mix(in srgb, var(--info) 18%, transparent);
    color: var(--info);
}

.alert-close {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: currentColor;
    opacity: .65;
    flex: 0 0 auto;
}

.alert-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, .05);
}

.alert.is-hiding {
    animation: fadeOut .25s ease forwards;
}

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-purple {
    background: var(--purple-100);
    color: var(--purple);
}

.badge-gold {
    background: var(--gold-100);
    color: var(--gold-700);
}

.badge-success {
    background: var(--success-100);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-100);
    color: var(--danger);
}

.badge-muted {
    background: var(--surface-3);
    color: var(--muted);
}

/* --------------------------------------------------------------------------
   Tables (ready for content screens)
   -------------------------------------------------------------------------- */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

th, td {
    padding: 11px 13px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th {
    background: var(--surface-2);
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

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

tbody tr:hover {
    background: var(--purple-50);
}

/* --------------------------------------------------------------------------
   Empty states
   -------------------------------------------------------------------------- */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    text-align: center;
    padding: 42px 20px;
    color: var(--muted);
}

.empty-state > i {
    font-size: 34px;
    color: var(--border-strong);
}

.empty-state h2 {
    font-size: 19px;
    color: var(--text);
}

.empty-state p {
    font-size: 12px;
    max-width: 420px;
}

.empty-state-sm {
    padding: 24px 12px;
}

.empty-state-sm > i {
    font-size: 26px;
}

/* --------------------------------------------------------------------------
   Content management — Phase 1
   -------------------------------------------------------------------------- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

.badge-warning {
    background: var(--warning-100);
    color: var(--warning);
}

.badge-info {
    background: var(--info-100);
    color: var(--info);
}

.btn-sm {
    padding: 7px 9px;
    border-radius: 8px;
    font-size: 11px;
}

.btn-danger-ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--danger);
}

.btn-danger-ghost:hover {
    background: var(--danger-100);
    border-color: color-mix(in srgb, var(--danger) 22%, transparent);
    color: var(--danger);
}

/* Filters ----------------------------------------------------------------- */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 16px 18px;
    margin-bottom: 16px;
}

.filter-field {
    display: flex;
    flex: 0 1 160px;
    min-width: 130px;
    flex-direction: column;
    gap: 6px;
}

.filter-field.filter-grow {
    flex: 2 1 230px;
}

.filter-field.filter-wide {
    flex: 1.4 1 220px;
}

.filter-field > label {
    color: var(--text-2);
    font-size: 11px;
    font-weight: 700;
}

.filter-field input,
.filter-field select {
    width: 100%;
    min-height: 39px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.filter-field input:focus,
.filter-field select:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-100);
}

.filter-field .input-wrap input {
    padding-right: 36px;
}

.filter-field .input-wrap > i {
    right: 12px;
    font-size: 12px;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 1px;
}

.filter-actions .btn {
    min-height: 39px;
    padding: 9px 14px;
}

/* Tables ------------------------------------------------------------------ */

.table-card {
    padding: 0;
    overflow: hidden;
}

.table-card .table-wrap {
    border: 0;
    border-radius: 0;
}

.table-card .pagination {
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

.table-card td,
.table-card th {
    padding: 11px 12px;
}

.actions-col {
    width: 1%;
}

.check-col {
    width: 38px;
    text-align: center;
}

.check-col input {
    accent-color: var(--purple);
    width: 15px;
    height: 15px;
}

.table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.table-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 4px 8px;
    border-radius: 7px;
    background: var(--purple-50);
    color: var(--purple);
    font-size: 11.5px;
    font-weight: 800;
}

.table-number:hover {
    background: var(--purple-100);
    color: var(--purple-800);
}

.cell-title {
    display: flex;
    align-items: center;
    gap: 9px;
}

.cell-icon {
    display: grid;
    place-items: center;
    width: 33px;
    height: 33px;
    flex: 0 0 auto;
    border-radius: 9px;
    background: var(--purple-50);
    color: var(--purple);
    font-size: 13px;
}

.cell-title > div,
.cell-stack {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.cell-title strong,
.cell-stack strong {
    font-size: 12.5px;
    font-weight: 800;
}

.cell-title small,
.cell-stack small {
    color: var(--muted);
    font-size: 10.5px;
}

.cell-wrap {
    min-width: 230px;
    max-width: 370px;
    white-space: normal;
    line-height: 1.6;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.bulk-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.bulk-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
}

.bulk-controls select {
    min-height: 34px;
    max-width: 230px;
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 11px;
    outline: none;
}

.bulk-controls select:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-100);
}

.compact-table {
    margin: 14px 0;
}

/* Pagination -------------------------------------------------------------- */

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    color: var(--muted);
    font-size: 11px;
}

.pagination-summary {
    font-weight: 600;
}

.page-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 31px;
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.page-link:hover {
    border-color: var(--purple-100);
    background: var(--purple-50);
    color: var(--purple);
}

.page-link.is-current {
    border-color: var(--purple);
    background: var(--purple);
    color: #fff;
}

.page-link.is-disabled {
    opacity: .45;
    pointer-events: none;
}

.page-ellipsis {
    padding: 0 2px;
    color: var(--muted);
}

/* Forms ------------------------------------------------------------------- */

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

.help-text {
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.55;
}

.help-box {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 11.5px;
    line-height: 1.65;
}

.help-box code,
.help-text code {
    padding: 1px 4px;
    border-radius: 4px;
    background: var(--surface-3);
    color: var(--purple);
    font-size: .95em;
}

.required {
    color: var(--danger);
}

.field-error {
    color: var(--danger);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.45;
}

.is-invalid {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px var(--danger-100) !important;
}

.check-row,
.radio-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-2);
    font-size: 12px;
    line-height: 1.5;
    cursor: pointer;
}

.radio-row {
    align-items: flex-start;
    padding: 5px 0;
}

.check-row input,
.radio-row input,
.field input[type="checkbox"],
.field input[type="radio"] {
    width: auto;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    accent-color: var(--purple);
    flex: 0 0 auto;
}

.content-alert ul {
    margin: 5px 0 0;
    padding-right: 17px;
    line-height: 1.7;
}

.content-empty {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
}

.empty-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--purple-50);
    color: var(--purple);
    font-size: 23px;
}

.empty-state h3 {
    color: var(--text);
    font-size: 17px;
    font-weight: 800;
}

/* Question editor --------------------------------------------------------- */

.editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.52fr) minmax(290px, .82fr);
    align-items: start;
    gap: 18px;
    max-width: 1400px;
}

.editor-card {
    padding: 22px;
}

.editor-section {
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px dashed var(--border);
}

.editor-section:last-of-type {
    border-bottom: 0;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.section-head h3 {
    font-size: 15px;
    font-weight: 800;
}

.section-head .muted {
    font-size: 10.5px;
    line-height: 1.5;
}

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

.choice-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 20px auto;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-2);
    transition: border-color .16s ease, background .16s ease;
}

.choice-row.is-correct {
    border-color: var(--purple);
    background: var(--purple-50);
}

.choice-letter {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.choice-row.is-correct .choice-letter,
.preview-choice.is-correct .choice-letter {
    border-color: var(--purple);
    background: var(--purple);
    color: #fff;
}

.choice-input {
    width: 100%;
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 12px;
    outline: none;
}

.choice-input:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-100);
}

.choice-radio {
    accent-color: var(--purple);
    width: 17px;
    height: 17px;
    cursor: pointer;
}

.choice-correct-label {
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 700;
    white-space: nowrap;
}

.choice-row.is-correct .choice-correct-label {
    color: var(--purple);
}

.preview-card {
    position: sticky;
    top: 92px;
    padding: 18px;
    background: linear-gradient(160deg, var(--surface), var(--surface-2));
}

.preview-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
}

.preview-card-head small {
    color: var(--muted);
    font-size: 10px;
}

.question-preview {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.preview-meta {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.preview-prompt {
    margin: 8px 0 13px;
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.65;
}

.preview-choices {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preview-choice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 12px;
    line-height: 1.4;
}

.preview-choice.is-correct {
    border-color: var(--purple);
    background: var(--purple-50);
    color: var(--purple);
    font-weight: 700;
}

.preview-choice .choice-letter {
    width: 22px;
    height: 22px;
    font-size: 9px;
}

.preview-answer {
    padding-top: 12px;
    border-top: 1px dashed var(--border);
    color: var(--muted);
    font-size: 11.5px;
}

.preview-answer strong {
    color: var(--success);
}

/* Media ------------------------------------------------------------------- */

.media-preview {
    display: block;
    max-width: 100%;
    max-height: 230px;
    border: 1px solid var(--border);
    border-radius: 12px;
    object-fit: cover;
}

.media-placeholder {
    display: flex;
    min-height: 110px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11px;
}

.media-placeholder i {
    font-size: 20px;
    color: var(--border-strong);
}

.media-preview-wrap {
    margin-top: 8px;
}

.upload-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-top: 8px;
}

.upload-row input[type="file"] {
    max-width: 100%;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text-2);
    font: inherit;
    font-size: 11px;
}

.upload-row input[type="file"]::file-selector-button {
    margin-left: 8px;
    padding: 5px 9px;
    border: 0;
    border-radius: 6px;
    background: var(--purple-50);
    color: var(--purple);
    font: inherit;
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
}

.mini-thumb {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    object-fit: cover;
}

.table-thumb {
    width: 62px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 8px;
    object-fit: cover;
}

.delete-preview-image {
    display: block;
    max-width: 100%;
    max-height: 180px;
    margin: 0 0 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    object-fit: cover;
}

.question-image {
    display: block;
    max-width: 100%;
    max-height: 260px;
    margin-bottom: 10px;
    border-radius: 12px;
    object-fit: cover;
}

/* Focus pairs ------------------------------------------------------------- */

.focus-pairs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px 0 12px;
}

.focus-pair-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 105px 36px;
    align-items: end;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
}

.pair-index {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin-bottom: 7px;
    border-radius: 8px;
    background: var(--purple);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
}

.pair-time {
    min-width: 0;
}

.emoji-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 22px;
    margin-top: 5px;
}

.emoji-chips span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 25px;
    min-height: 25px;
    padding: 2px 5px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    font-size: 16px;
    line-height: 1;
}

.focus-pair-row .icon-btn {
    margin-bottom: 1px;
}

/* Danger and review ------------------------------------------------------- */

.danger-card {
    border-color: color-mix(in srgb, var(--danger) 22%, var(--border));
    background: linear-gradient(160deg, var(--surface), var(--danger-100));
}

.danger-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.danger-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    border-radius: 13px;
    background: var(--danger-100);
    color: var(--danger);
    font-size: 19px;
}

.danger-head h3 {
    margin-bottom: 3px;
    font-size: 17px;
    font-weight: 800;
}

.danger-head p {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.6;
}

.danger-actions {
    margin-top: 8px;
}

.danger-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.stat-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 26px;
    padding: 12px 15px;
    margin: 6px 0 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
}

.stat-strip > div {
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.stat-strip span {
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
}

.stat-strip strong {
    color: var(--text);
    font-size: 17px;
}

.review-question {
    padding: 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

/* Slider ------------------------------------------------------------------ */

.slider-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    align-items: start;
    gap: 18px;
    max-width: 1150px;
}

.slider-preview-card {
    position: sticky;
    top: 92px;
}

.slider-preview {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
}

.slider-preview-image {
    display: block;
    width: 100%;
    height: 175px;
    border: 0;
    border-radius: 0;
    object-fit: cover;
}

.slider-preview-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 13px;
}

.slider-preview-body strong {
    font-size: 13px;
    font-weight: 800;
}

.slider-preview-body small {
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-4px);
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card,
.card,
.mini-stat {
    animation: fadeUp .35s ease both;
}

.stat-card:nth-child(2) { animation-delay: .03s; }
.stat-card:nth-child(3) { animation-delay: .06s; }
.stat-card:nth-child(4) { animation-delay: .09s; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

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

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(100%);
        box-shadow: -20px 0 60px rgba(0, 0, 0, .25);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .app-main {
        margin-right: 0;
    }

    .menu-toggle {
        display: inline-grid;
    }

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

    .topbar {
        padding: 13px 18px;
    }

    .content {
        padding: 22px 18px 34px;
    }
}

@media (max-width: 760px) {
    .stat-grid,
    .stat-grid-small {
        grid-template-columns: 1fr;
    }

    .mini-stat {
        padding: 11px 13px;
    }

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

    .page-heading h2 {
        font-size: 22px;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .btn {
        flex: 1;
    }

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

    .onboarding-badge {
        flex-direction: row;
        width: 100%;
        justify-content: flex-start;
        text-align: right;
    }

    .feature-list {
        grid-template-columns: 1fr;
    }

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

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

    .topbar-title p {
        display: none;
    }

    .user-meta {
        display: none;
    }

    .user-chip {
        padding: 3px;
        border: 0;
        background: transparent;
    }

    .topbar-actions {
        gap: 6px;
    }

    .icon-btn {
        width: 37px;
        height: 37px;
    }

    .chart-bars {
        height: 180px;
        gap: 3px;
    }

    .chart-label {
        font-size: 8px;
    }

    .chart-value {
        font-size: 8px;
    }

    .auth-card {
        padding: 26px 22px;
        border-radius: 22px;
    }

    .auth-page {
        padding: 26px 14px;
    }

    .placeholder-card {
        padding: 34px 18px;
    }
}

@media (max-width: 640px) {
    .table-card .table-wrap {
        overflow: visible;
    }

    .table-card table {
        display: block;
        width: 100%;
    }

    .table-card thead {
        display: none;
    }

    .table-card tbody {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }

    .table-card tbody tr {
        display: block;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface);
    }

    .table-card tbody tr:hover {
        background: var(--surface);
    }

    .table-card td,
    .table-card td.check-col,
    .table-card td.actions-col {
        display: grid;
        grid-template-columns: 86px minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        width: auto;
        padding: 6px 0;
        border: 0;
        white-space: normal;
        text-align: right;
    }

    .table-card td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 10.5px;
        font-weight: 700;
        text-align: right;
    }

    .table-card td.hide-sm {
        display: grid !important;
    }

    .table-card .cell-wrap {
        min-width: 0;
        max-width: none;
    }

    .table-card .table-actions {
        justify-content: flex-start;
    }

    .table-card .table-thumb {
        width: 54px;
        height: 38px;
    }

    .table-card .pagination {
        border-top: 0;
    }
}

@media (max-width: 480px) {
    .content {
        padding: 18px 12px 30px;
    }

    .topbar {
        padding: 11px 12px;
    }

    .card {
        padding: 17px;
        border-radius: 15px;
    }

    .auth-brand {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .auth-brand h1 {
        font-size: 26px;
    }

    .auth-footer {
        flex-wrap: wrap;
    }

    .chart-bars {
        overflow-x: auto;
    }

    .chart-col {
        min-width: 20px;
    }
}

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

/* --------------------------------------------------------------------------
   Content management responsive refinements
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
    .editor-layout,
    .slider-editor {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .preview-card,
    .slider-preview-card {
        position: static;
    }

    .preview-card {
        order: -1;
    }
}

@media (max-width: 900px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .hide-sm {
        display: none !important;
    }

    .table-card th,
    .table-card td {
        padding: 9px 7px;
    }

    .table-card table {
        font-size: 11.5px;
    }

    .table-card .cell-wrap {
        min-width: 0;
        max-width: 180px;
        white-space: normal;
    }

    .table-card .cell-stack small {
        white-space: normal;
    }

    .table-card .table-actions {
        gap: 4px;
    }

    .table-card .table-actions .btn-sm {
        width: 30px;
        height: 30px;
        padding: 0;
    }

    .filter-field,
    .filter-field.filter-grow,
    .filter-field.filter-wide {
        flex: 1 1 180px;
    }

    .focus-pair-row {
        grid-template-columns: 26px minmax(0, 1fr) 90px 34px;
    }
}

@media (max-width: 760px) {
    .filter-bar {
        padding: 14px;
    }

    .filter-field,
    .filter-field.filter-grow,
    .filter-field.filter-wide {
        flex: 1 1 100%;
    }

    .filter-actions {
        width: 100%;
    }

    .filter-actions .btn {
        flex: 1;
    }

    .table-card {
        padding: 0;
    }

    .bulk-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .bulk-controls {
        width: 100%;
    }

    .bulk-controls select {
        flex: 1 1 150px;
        max-width: none;
    }

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

    .table-actions .btn-sm {
        width: 32px;
        height: 32px;
        padding: 0;
    }

    .focus-pair-row {
        grid-template-columns: 26px minmax(0, 1fr);
        align-items: start;
    }

    .focus-pair-row .pair-time {
        grid-column: 2;
    }

    .focus-pair-row > .icon-btn {
        grid-column: 2;
        justify-self: end;
    }

    .choice-row {
        grid-template-columns: 24px minmax(0, 1fr) 18px;
    }

    .choice-correct-label {
        display: none;
    }

    .choice-letter {
        width: 23px;
        height: 23px;
        font-size: 10px;
    }

    .danger-actions-row .btn {
        flex: 1;
    }

    .stat-strip {
        gap: 16px;
    }

    .editor-card {
        padding: 17px;
    }

    .preview-card {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .table-card {
        padding: 0;
        border-radius: 15px;
    }

    .bulk-controls select {
        flex-basis: 100%;
    }

    .pagination {
        padding: 12px;
    }

    .page-link {
        min-width: 29px;
        padding: 5px 7px;
    }

    .cell-wrap {
        min-width: 190px;
    }

    .slider-preview-image {
        height: 140px;
    }
}

.review-queue-card {
    margin-bottom: 16px;
}

/* Import / export --------------------------------------------------------- */

.view-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
    margin-bottom: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.view-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: 10px;
    color: var(--text-2);
    font-size: 12.5px;
    font-weight: 700;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.view-tabs a:hover {
    background: var(--surface);
    color: var(--text);
}

.view-tabs a.is-active {
    background: var(--purple);
    color: #fff;
    box-shadow: 0 5px 14px color-mix(in srgb, var(--purple) 28%, transparent);
}

.import-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}

.report-card {
    margin-bottom: 16px;
}

.report-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.report-stats .stat-card {
    padding: 14px;
    gap: 11px;
    align-items: center;
}

.report-stats .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--purple-100);
    color: var(--purple);
    font-size: 16px;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.3;
}

.stat-value {
    display: block;
    font-size: 21px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -.02em;
}

.stat-hint {
    display: block;
    color: var(--muted);
    font-size: 10px;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0;
}

.report-summary > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.report-summary span {
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
}

.report-summary strong {
    font-size: 12.5px;
    font-weight: 800;
}

.report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    align-items: center;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.report-actions form {
    display: inline-flex;
}

.section-title {
    margin: 18px 0 10px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
}

.report-table td,
.report-table th {
    vertical-align: top;
}

.prompt-cell {
    max-width: 330px;
    white-space: normal;
    line-height: 1.55;
}

.mono-cell {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 10.5px;
    direction: ltr;
    unicode-bidi: plaintext;
    white-space: nowrap;
}

.nowrap {
    white-space: nowrap;
}

.table-note {
    margin-top: 9px;
    color: var(--muted);
    font-size: 10.5px;
}

.empty-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 15px;
    border: 1px dashed var(--border-strong);
    border-radius: 11px;
    color: var(--muted);
    font-size: 11.5px;
}

.empty-inline i {
    color: var(--success);
}

.code-block,
.code-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    line-height: 1.7;
}

.code-block {
    overflow-x: auto;
    padding: 14px 16px;
    border-radius: 11px;
    background: #1d1930;
    color: #f5f2ff;
    border: 1px solid #302a4c;
    white-space: pre;
}

.code-input {
    width: 100%;
    resize: vertical;
    min-height: 190px;
    text-align: left;
    direction: ltr;
}

.legacy-card {
    margin-bottom: 16px;
}

.export-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0;
}

.export-meta > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 11px;
}

.export-meta span {
    color: var(--muted);
}

.export-meta code {
    font-size: 10.5px;
    color: var(--purple);
    word-break: break-all;
}

.file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.file-list a,
.file-list span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 10.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.file-list a:hover {
    border-color: var(--purple);
    color: var(--purple);
}

.btn.is-disabled {
    opacity: .45;
    pointer-events: none;
}

/* Account detail and helper text ------------------------------------------ */

.avatar-initial {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--purple), var(--purple-800));
    color: #fff;
    font-size: 11.5px;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    border-top: 1px solid var(--border);
    background: var(--border);
}

.detail-grid > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    padding: 12px 16px;
    background: var(--surface);
}

.detail-grid .muted {
    font-size: 10.5px;
}

.detail-grid strong {
    font-size: 12.5px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.detail-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.detail-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
}

.detail-list li:first-child {
    border-top: 0;
}

.detail-list span {
    color: var(--muted);
}

.detail-list strong {
    font-weight: 700;
}

.form-hint {
    margin: 0;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.6;
}

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

@media (max-width: 1000px) {
    .import-grid,
    .report-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 640px) {
    .report-stats,
    .report-summary,
    .export-meta,
    .detail-grid,
    .form-grid.two-col {
        grid-template-columns: 1fr;
    }

    .view-tabs a {
        flex: 1 1 calc(50% - 6px);
        justify-content: center;
    }

    .report-actions .btn,
    .report-actions form,
    .report-actions form .btn {
        width: 100%;
    }

    .prompt-cell {
        max-width: 220px;
    }
}
