:root {
    --primary: #3454f5;
    --primary-dark: #172554;
    --primary-soft: #eef4ff;
    --accent: #10b981;
    --sidebar-bg: #ffffff;
    --body-bg: #f5f7fb;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --card-bg: #ffffff;
    --ink: var(--text-main);
    --muted: var(--text-muted);
    --line: var(--border);
    --surface: var(--card-bg);
    --soft: var(--body-bg);
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 12px 34px rgba(15, 23, 42, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--soft);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.brand-mark {
    align-items: center;
    color: var(--ink);
    display: inline-flex;
    font-size: 1.05rem;
    font-weight: 800;
    gap: .45rem;
    letter-spacing: 0;
}

.brand-mark span {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 8px;
    color: #fff;
    padding: .42rem .55rem;
}

.brand-logo {
    display: block;
    height: auto;
    max-height: 44px;
    max-width: 190px;
    object-fit: contain;
    width: auto;
}

.brand-logo-auth {
    max-height: 70px;
    max-width: 240px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.brand-logo-sidebar {
    max-height: 46px;
    max-width: 190px;
}

.brand-logo-public,
.brand-logo-verify {
    max-height: 48px;
}

.brand-text-fallback {
    color: var(--ink);
    font-weight: 900;
}

.btn-gradient {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: 0;
    box-shadow: 0 12px 26px rgba(81, 69, 245, 0.26);
    color: #fff;
    font-weight: 700;
}

.btn-gradient:hover {
    color: #fff;
    transform: translateY(-1px);
}

.btn-soft {
    background: #eef2ff;
    border: 1px solid #dbe4ff;
    color: var(--primary-dark);
    font-weight: 700;
    gap: .45rem;
}

.eyebrow {
    color: var(--primary);
    display: inline-block;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.public-nav {
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.hero-section {
    background:
        radial-gradient(circle at 78% 20%, rgba(6, 182, 212, .16), transparent 28%),
        linear-gradient(180deg, #fff 0%, #f7f8ff 100%);
    padding: 84px 0 56px;
}

.hero-section h1 {
    font-size: clamp(2.4rem, 5vw, 4.9rem);
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1.02;
    margin: 12px 0 20px;
}

.hero-section p {
    color: var(--muted);
    font-size: 1.15rem;
    max-width: 640px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 28px;
}

.hero-certificate,
.verify-card,
.error-card,
.section-card,
.auth-card {
    background: var(--surface);
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.hero-certificate {
    padding: 34px;
    position: relative;
}

.hero-certificate h2 {
    font-size: 1.8rem;
    font-weight: 900;
    margin: 14px 0 10px;
}

.qr-box {
    align-items: center;
    background: #f8fafc;
    border: 1px dashed #b8c1d8;
    border-radius: 8px;
    display: flex;
    font-size: 3rem;
    height: 132px;
    justify-content: center;
    margin-top: 22px;
    width: 132px;
}

.feature-section,
.verify-section,
.error-section {
    padding: 58px 0;
}

.feature-grid,
.metric-grid,
.quick-grid {
    display: grid;
    gap: 18px;
}

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

.feature-card,
.metric-card,
.quick-link {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
}

.feature-card i,
.metric-icon {
    align-items: center;
    background: linear-gradient(135deg, #eef2ff, #ecfeff);
    border-radius: 8px;
    color: var(--primary);
    display: inline-flex;
    height: 46px;
    justify-content: center;
    width: 46px;
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 18px 0 8px;
}

.feature-card p,
.metric-card small,
.section-card p {
    color: var(--muted);
}

.public-footer {
    background: #fff;
    border-top: 1px solid var(--line);
    color: var(--muted);
    padding: 24px 0;
}

.flash-wrap {
    padding: 18px 28px 0;
}

.public-flash {
    margin: 0 auto;
    max-width: 1140px;
    padding-left: 12px;
    padding-right: 12px;
}

.auth-panel > .alert {
    margin-bottom: 18px;
}

.auth-body {
    background:
        linear-gradient(135deg, rgba(248, 251, 255, .96), rgba(238, 242, 255, .95)),
        linear-gradient(45deg, rgba(81, 69, 245, .08), rgba(6, 182, 212, .08));
}

.auth-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-panel {
    margin: 0 auto;
    max-width: 520px;
    padding: 0;
    width: 92%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-card {
    backdrop-filter: blur(18px);
    background: rgba(255, 255, 255, .86);
    padding: 34px;
    width: 100%;
}

.auth-card h1 {
    font-size: 2rem;
    font-weight: 900;
    margin: 8px 0 8px;
}

.stack-form {
    display: grid;
    gap: 18px;
    margin-top: 24px;
}

.form-control,
.form-select {
    border-color: #dce3ef;
    border-radius: 8px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .2rem rgba(81, 69, 245, .14);
}

.auth-switch {
    margin: 22px 0 0;
    text-align: center;
}

.auth-showcase {
    align-items: center;
    background:
        linear-gradient(145deg, rgba(49, 46, 129, .96), rgba(15, 23, 42, .98)),
        linear-gradient(45deg, rgba(6, 182, 212, .2), rgba(81, 69, 245, .2));
    color: #fff;
    display: flex;
    padding: 42px;
}

.certificate-preview {
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 8px;
    padding: 34px;
}

.certificate-ribbon,
.status-pill {
    background: rgba(22, 163, 74, .12);
    border: 1px solid rgba(22, 163, 74, .2);
    border-radius: 999px;
    color: #15803d;
    display: inline-flex;
    font-size: .78rem;
    font-weight: 800;
    padding: .38rem .7rem;
}

.auth-showcase h2 {
    font-size: 2.15rem;
    font-weight: 900;
    margin: 18px 0 12px;
}

.auth-showcase p {
    color: #dbeafe;
}

.showcase-metrics {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 24px;
}

.showcase-metrics span {
    background: rgba(255, 255, 255, .1);
    border-radius: 8px;
    padding: 14px;
}

.showcase-metrics strong {
    display: block;
    font-size: 1.4rem;
}

.app-sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border-right: 1px solid var(--line);
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    left: 0;
    padding: 22px 0;
    position: fixed;
    top: 0;
    width: 280px;
    z-index: 1040;
}

.sidebar-brand {
    align-items: center;
    display: flex;
    justify-content: space-between;
    padding: 0 18px;
    flex-shrink: 0;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 14px 0 18px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.12);
    border-radius: 999px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(15, 23, 42, 0.24);
}

.sidebar-nav a {
    align-items: center;
    border-radius: 8px;
    color: #475569;
    display: flex;
    font-weight: 700;
    gap: 12px;
    padding: 12px 14px;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
    background: linear-gradient(135deg, #eef2ff, #ecfeff);
    color: var(--primary-dark);
    transform: translateX(2px);
}

.sidebar-card {
    background: linear-gradient(135deg, #eef2ff, #f0fdfa);
    border-radius: 8px;
    margin: auto 18px 0 18px;
    padding: 18px;
    flex-shrink: 0;
}

.sidebar-card span {
    color: var(--primary);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.sidebar-card strong {
    display: block;
    margin-top: 6px;
}

.sidebar-card p {
    color: var(--muted);
    margin: 6px 0 0;
}

.app-main {
    margin-left: 280px;
    min-height: 100vh;
}

.app-topbar {
    align-items: center;
    background: rgba(248, 250, 252, .9);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    padding: 22px 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(14px);
}

.app-topbar h1 {
    font-size: 1.45rem;
    font-weight: 900;
    margin: 2px 0 0;
}

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

.user-chip {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: flex;
    font-weight: 700;
    gap: 9px;
    padding: 6px 12px 6px 6px;
}

.user-chip small {
    color: var(--muted);
    display: block;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
    text-transform: capitalize;
}

.avatar {
    align-items: center;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    font-weight: 900;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.content-wrap {
    padding: 28px;
}

.admin-page-header {
    align-items: flex-start;
    display: flex;
    gap: 18px;
    justify-content: space-between;
}

.admin-page-header h2 {
    font-size: 1.9rem;
    font-weight: 900;
    margin: 4px 0 6px;
}

.admin-page-header p {
    color: var(--muted);
    margin: 0;
    max-width: 720px;
}

.filter-bar {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) auto;
    margin-bottom: 20px;
}

.question-filter {
    grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(130px, 1fr)) auto;
}

.exam-filter {
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(140px, 1fr)) auto;
}

.question-assignment-filter {
    grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 220px) minmax(130px, 180px) auto;
}

.premium-table-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.premium-table {
    margin: 0;
}

.premium-table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .06em;
    padding: 16px;
    text-transform: uppercase;
}

.premium-table tbody td {
    border-color: #edf2f7;
    padding: 16px;
    vertical-align: middle;
}

.premium-table td strong {
    display: block;
    font-weight: 900;
}

.premium-table td small {
    color: var(--muted);
    display: block;
    margin-top: 2px;
}

.status-badge,
.code-pill {
    border-radius: 999px;
    display: inline-flex;
    font-size: .76rem;
    font-weight: 900;
    padding: .38rem .7rem;
}

.status-badge.active {
    background: rgba(22, 163, 74, .12);
    color: #15803d;
}

.status-badge.draft {
    background: rgba(81, 69, 245, .12);
    color: var(--primary-dark);
}

.status-badge.inactive {
    background: rgba(100, 116, 139, .12);
    color: #475569;
}

.status-badge.archived {
    background: rgba(100, 116, 139, .16);
    color: #334155;
}

.status-badge.blocked {
    background: rgba(220, 38, 38, .12);
    color: #b91c1c;
}

.difficulty-badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: .76rem;
    font-weight: 900;
    padding: .38rem .7rem;
}

.difficulty-badge.easy {
    background: rgba(22, 163, 74, .12);
    color: #15803d;
}

.difficulty-badge.medium {
    background: rgba(245, 158, 11, .14);
    color: #b45309;
}

.difficulty-badge.hard {
    background: rgba(220, 38, 38, .12);
    color: #b91c1c;
}

.code-pill {
    background: #eef2ff;
    color: var(--primary-dark);
}

.action-cell {
    white-space: nowrap;
}

.action-cell form {
    display: inline-flex;
    margin-left: 6px;
}

.empty-state {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 700;
    padding: 24px;
    text-align: center;
}

.admin-form {
    display: grid;
    gap: 22px;
}

.form-section {
    background: linear-gradient(180deg, #ffffff, #fbfdff);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
}

.form-section-title {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.form-section-title h3 {
    font-size: 1rem;
    font-weight: 900;
    margin: 0;
}

.setting-switch {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 10px;
    min-height: 58px;
    padding: 12px 14px;
}

.setting-switch input {
    accent-color: var(--primary);
    height: 18px;
    width: 18px;
}

.setting-switch span {
    color: #334155;
    font-weight: 800;
}

.form-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

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

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

.assignment-card {
    align-items: flex-start;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 12px;
    padding: 16px;
}

.assignment-card:has(input:checked) {
    background: linear-gradient(135deg, #eef2ff, #ecfeff);
    border-color: #b8c7ff;
}

.assignment-card input {
    margin-top: 5px;
}

.assignment-card strong,
.assignment-card small {
    display: block;
}

.assignment-card small {
    color: var(--muted);
    margin-top: 3px;
}

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

.question-form .question-textarea {
    font-size: 1.05rem;
    line-height: 1.6;
}

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

.question-card {
    align-items: flex-start;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    padding: 20px;
}

.question-card h3 {
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.45;
    margin: 10px 0 8px;
}

.question-list.compact .question-card h3 {
    font-size: .95rem;
    margin-bottom: 0;
}

.question-card p {
    color: var(--muted);
    margin: 0;
}

.question-meta {
    align-items: center;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: .85rem;
    font-weight: 700;
}

.question-card-main {
    min-width: 0;
}

.upload-help,
.upload-summary {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 18px;
}

.upload-help h3 {
    font-size: 1rem;
    font-weight: 900;
}

.upload-help code {
    white-space: normal;
}

.upload-summary ul {
    color: var(--danger);
    margin-bottom: 0;
}

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

.exam-summary-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 24px;
}

.metric-card {
    box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
}

.metric-card span {
    color: var(--muted);
    display: block;
    font-weight: 700;
    margin-top: 16px;
}

.metric-card strong {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    margin: 4px 0;
}

.section-card {
    margin-top: 24px;
    padding: 26px;
    box-shadow: var(--shadow-soft);
}

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

.section-heading h2,
.certificate-focus h2,
.verify-card h1,
.error-card h1 {
    font-weight: 900;
}

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

.quick-link {
    align-items: center;
    color: var(--ink);
    display: flex;
    font-weight: 800;
    gap: 12px;
}

.quick-link i {
    color: var(--primary);
}

.exam-rules-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 20px 0 24px;
}

.exam-rules-grid div {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.exam-rules-grid span {
    color: var(--muted);
    display: block;
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.exam-rules-grid strong {
    display: block;
    font-size: 1.2rem;
    font-weight: 900;
    margin-top: 4px;
}

.exam-preview h3 {
    font-size: 1rem;
    font-weight: 900;
    margin-top: 22px;
}

.settings-readout {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.verify-card,
.error-card {
    margin: 0 auto;
    max-width: 900px;
    padding: 36px;
}

.verification-placeholder {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 22px;
    margin-top: 28px;
    padding: 22px;
}

.error-card {
    text-align: center;
}

.icon-btn {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    display: inline-flex;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 991px) {
    .feature-grid,
    .metric-grid,
    .quick-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-showcase {
        display: none;
    }

    .app-sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

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

    body.sidebar-open .sidebar-backdrop {
        background: rgba(15, 23, 42, .42);
        bottom: 0;
        display: block;
        left: 0;
        position: fixed;
        right: 0;
        top: 0;
        z-index: 1030;
    }

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

    .filter-bar,
    .question-filter,
    .exam-filter,
    .question-assignment-filter,
    .exam-summary-grid,
    .exam-rules-grid,
    .question-pick-grid,
    .assignment-grid {
        grid-template-columns: 1fr;
    }

    .admin-page-header {
        flex-direction: column;
    }

    .question-card {
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .feature-grid,
    .metric-grid,
    .quick-grid {
        grid-template-columns: 1fr;
    }

    .hero-section {
        padding-top: 52px;
    }

    .auth-panel,
    .content-wrap,
    .app-topbar {
        padding: 18px;
    }

    .topbar-actions .user-chip span:last-child {
        display: none;
    }

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