/* ==========================================================================
   Dr. Leisser Intranet — Styles
   AConsultIT OÜ · Corporate German UI · 2026
   ========================================================================== */

:root {
    /* Brand palette — pharmacy green + neutral steel */
    --brand:        #1b7a4a;
    --brand-dark:   #145c38;
    --brand-light:  #2b9a62;
    --accent:       #d97706;     /* warm warning */
    --accent-dark:  #b45309;

    --bg:           #f5f7f9;
    --bg-card:      #ffffff;
    --bg-elevated:  #ffffff;
    --bg-muted:     #f0f3f6;

    --text:         #1a2433;
    --text-muted:   #5b6778;
    --text-light:   #8a95a6;

    --border:       #dde3eb;
    --border-soft:  #eef1f5;

    --success:      #15803d;
    --info:         #0369a1;
    --warning:      #b45309;
    --danger:       #b91c1c;

    --radius:       8px;
    --radius-lg:    12px;
    --shadow-sm:    0 1px 2px rgba(15,23,42,.06);
    --shadow-md:    0 4px 12px rgba(15,23,42,.08);
    --shadow-lg:    0 10px 30px rgba(15,23,42,.10);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--text); font-weight: 600; line-height: 1.2; }
h1 { font-size: 1.75rem; margin: 0 0 .5rem; }
h2 { font-size: 1.25rem; margin: 0 0 .75rem; }
h3 { font-size: 1.05rem; margin: 0 0 .5rem; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* =============================== TOPBAR =============================== */
.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky; top: 0; z-index: 100;
}
.topbar-inner {
    display: flex; align-items: center; gap: 24px;
    height: 64px;
}
.brand {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    background: var(--brand); color: white;
    border-radius: var(--radius); font-weight: 700; font-size: 14px;
    letter-spacing: 0.5px;
}
.brand-text { font-weight: 600; font-size: 1rem; }
.brand-suffix {
    padding: 2px 8px; background: var(--accent); color: white;
    border-radius: 4px; font-size: 0.75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
}

.mainnav { display: flex; gap: 4px; flex: 1; margin-left: 32px; }
.mainnav a {
    padding: 8px 14px; color: var(--text-muted);
    border-radius: var(--radius); font-weight: 500;
    transition: all 0.15s;
}
.mainnav a:hover { background: var(--bg-muted); color: var(--text); text-decoration: none; }
.mainnav a.active { background: var(--brand); color: white; }
.mainnav .nav-admin { color: var(--accent); }
.mainnav .nav-admin.active { background: var(--accent); color: white; }

.user-menu { display: flex; align-items: center; gap: 12px; }
.user-link {
    display: flex; flex-direction: column; align-items: flex-end;
    text-decoration: none; color: var(--text);
    padding: 6px 12px; border-radius: var(--radius);
    transition: background 0.15s;
}
.user-link:hover { background: var(--bg-muted); text-decoration: none; }
.user-name { font-weight: 600; font-size: 0.9rem; }
.user-role { font-size: 0.75rem; color: var(--text-light); }
.topbar-pw-btn { display:inline-flex;align-items:center;justify-content:center; width:38px;height:38px;background:var(--bg-muted);color:var(--text-muted);border-radius:var(--radius);text-decoration:none;font-size:1.1rem;transition:all 0.15s;} .topbar-pw-btn:hover{background:var(--brand);color:white;text-decoration:none;}
.logout-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    background: var(--bg-muted); color: var(--text-muted);
    border-radius: var(--radius); text-decoration: none;
    font-size: 1.25rem; transition: all 0.15s;
}
.logout-btn:hover { background: var(--danger); color: white; text-decoration: none; }

/* =============================== MAIN =============================== */
.main-content { padding: 32px 24px 64px; min-height: calc(100vh - 64px - 80px); }

.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-header h1 { margin-bottom: 0; }
.page-sub { color: var(--text-muted); margin: 4px 0 0; }

/* =============================== FOOTER =============================== */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    margin-top: auto;
}
.footer-inner {
    display: flex; justify-content: space-between; align-items: center;
    height: 60px; color: var(--text-light); font-size: 0.85rem;
}

/* =============================== BUTTONS =============================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px;
    background: var(--bg-card); color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem; font-weight: 500;
    cursor: pointer; text-decoration: none;
    transition: all 0.15s;
}
.btn:hover { background: var(--bg-muted); border-color: var(--text-light); text-decoration: none; }
.btn-primary {
    background: var(--brand); color: white; border-color: var(--brand);
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: white; }
.btn-warn {
    background: var(--bg-card); color: var(--danger); border-color: var(--danger);
}
.btn-warn:hover { background: var(--danger); color: white; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; }

/* =============================== FORMS =============================== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-label { font-weight: 500; font-size: 0.85rem; color: var(--text); }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="number"], input[type="search"], input[type="date"], input[type="datetime-local"],
input[type="file"], input[type="color"], select, textarea {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: white; color: var(--text);
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(27,122,74,.15);
}
input[disabled] { background: var(--bg-muted); color: var(--text-muted); cursor: not-allowed; }
textarea { resize: vertical; min-height: 80px; font-family: inherit; }

.hint { color: var(--text-light); font-size: 0.8rem; margin: 4px 0; }
.muted { color: var(--text-muted); font-size: 0.85rem; display: block; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 0; }
.checkbox input { width: 16px; height: 16px; cursor: pointer; }
.checkbox-big { padding: 12px; background: var(--bg-muted); border-radius: var(--radius); }

.checkbox-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}
.checkbox-card {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border: 1px solid var(--border);
    border-radius: var(--radius); cursor: pointer;
    transition: all 0.15s; background: var(--bg-card);
}
.checkbox-card:hover { border-color: var(--brand-light); background: var(--bg-muted); }
.checkbox-card input:checked + span,
.checkbox-card input:checked + div { font-weight: 600; }
.checkbox-card:has(input:checked) { border-color: var(--brand); background: rgba(27,122,74,0.05); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row .field { margin-bottom: 16px; }
@media (max-width: 720px) { .form-row { grid-template-columns: 1fr; } }

.form-section { margin: 24px 0; padding: 20px; background: var(--bg-muted); border-radius: var(--radius); }
.form-section h3 { margin-bottom: 8px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 920px) { .form-grid { grid-template-columns: 1fr; } }
.form-card { padding: 24px; background: white; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }

/* =============================== CARDS / TABLES =============================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    font-size: 0.9rem;
}
table thead th {
    text-align: left;
    padding: 10px 12px;
    background: var(--bg-muted);
    color: var(--text-muted);
    font-weight: 600; font-size: 0.8rem;
    text-transform: uppercase; letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border);
}
table thead th:first-child { border-top-left-radius: var(--radius); }
table thead th:last-child  { border-top-right-radius: var(--radius); }
table tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
table tbody tr:hover { background: var(--bg-muted); }
table tbody tr:last-child td { border-bottom: none; }
table td.actions { display: flex; gap: 6px; flex-wrap: wrap; }
table td.empty, .empty {
    text-align: center; color: var(--text-light); padding: 32px;
    font-style: italic;
}

.meta-small { font-size: 0.78rem; color: var(--text-light); margin-top: 2px; }
.empty-state {
    padding: 48px; text-align: center; color: var(--text-light);
    background: var(--bg-card); border-radius: var(--radius-lg);
    border: 1px dashed var(--border);
}

/* =============================== BADGES =============================== */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 9px; border-radius: 999px;
    font-size: 0.75rem; font-weight: 600;
    background: var(--bg-muted); color: var(--text-muted);
}
.badge-success { background: #d1fae5; color: var(--success); }
.badge-info    { background: #dbeafe; color: var(--info); }
.badge-warn    { background: #fef3c7; color: var(--warning); }
.badge-danger  { background: #fee2e2; color: var(--danger); }
.badge-quiz    { background: #ede9fe; color: #6d28d9; margin-left: 4px; }

.role-admin    { background: #fce7f3; color: #be185d; }
.role-manager  { background: #dbeafe; color: var(--info); }
.role-employee { background: var(--bg-muted); color: var(--text-muted); }

.tag {
    display: inline-block;
    padding: 2px 9px; border-radius: 4px;
    background: var(--tag-color, var(--brand)); color: white;
    font-size: 0.75rem; font-weight: 500;
}

.color-chip {
    display: inline-block; width: 14px; height: 14px;
    border-radius: 50%; vertical-align: middle;
    border: 1px solid var(--border);
}

/* =============================== FLASH =============================== */
.flash-stack { margin-bottom: 16px; }
.flash {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 10px;
    font-size: 0.9rem;
    border-left: 4px solid;
}
.flash-success { background: #d1fae5; color: var(--success); border-color: var(--success); }
.flash-info    { background: #dbeafe; color: var(--info);    border-color: var(--info); }
.flash-warning { background: #fef3c7; color: var(--warning); border-color: var(--warning); }
.flash-error   { background: #fee2e2; color: var(--danger);  border-color: var(--danger); }
.flash-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.2rem; color: inherit; opacity: 0.6; padding: 0 4px;
}
.flash-close:hover { opacity: 1; }

/* =============================== STATS =============================== */
.stats-grid, .admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px; text-align: center;
    box-shadow: var(--shadow-sm);
}
.stat-card.stat-alert {
    border-color: var(--accent);
    background: linear-gradient(180deg, #fef9e7 0%, white 100%);
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--brand); }
.stat-alert .stat-value { color: var(--accent); }
.stat-label { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

/* =============================== DASHBOARD GRID =============================== */
.dashboard-grid, .admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
@media (max-width: 920px) { .dashboard-grid, .admin-grid { grid-template-columns: 1fr; } }
.dashboard-grid .dash-section:first-child { grid-column: 1 / -1; }

.dash-section {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm);
}
.section-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}
.section-head h2 { margin: 0; }
.section-link { font-size: 0.85rem; }

/* =============================== VIDEO GRID =============================== */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.video-grid-compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.video-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: var(--shadow-sm);
}
.video-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}
.video-thumb {
    position: relative; aspect-ratio: 16/9; background: #0f172a;
    overflow: hidden;
}
.video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
    color: rgba(255,255,255,0.4); font-size: 3rem;
}
.video-thumb .duration {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(0,0,0,0.75); color: white;
    padding: 2px 6px; border-radius: 4px;
    font-size: 0.75rem; font-weight: 500;
}
.video-thumb .badge {
    position: absolute; top: 8px; left: 8px;
}
.video-thumb .badge-quiz {
    top: 36px; left: 8px;
}
.video-info { padding: 14px; }
.video-info h3 { font-size: 0.95rem; margin: 0 0 6px; }
.video-desc { font-size: 0.83rem; color: var(--text-muted); margin: 6px 0 0; line-height: 1.4; }

/* =============================== VIDEO PLAYER =============================== */
.video-page { max-width: 1100px; margin: 0 auto; }
.back-link {
    display: inline-block; margin-bottom: 16px;
    color: var(--text-muted); font-size: 0.9rem;
}
.video-player-wrap {
    background: #0f172a; border-radius: var(--radius-lg);
    overflow: hidden; margin-bottom: 20px;
}
#drl-video { width: 100%; display: block; max-height: 70vh; }
.video-detail h1 { margin-bottom: 12px; }
.video-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; color: var(--text-muted); font-size: 0.85rem; }
.video-description {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; margin: 16px 0;
    line-height: 1.6;
}

.quiz-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid var(--brand-light);
    border-radius: var(--radius-lg);
    padding: 20px; margin: 20px 0;
}
.quiz-card h3 { color: var(--brand-dark); margin-bottom: 8px; }
.quiz-status.success { color: var(--success); font-weight: 600; }
.quiz-status.info { color: var(--info); }

/* =============================== DOCS =============================== */
.docs-table { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.doc-item:last-child { border-bottom: none; }
.doc-item a { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; }
.doc-item .meta { font-size: 0.8rem; color: var(--text-light); }
.doc-icon { font-size: 1.2rem; }

.news-list { list-style: none; padding: 0; margin: 0; }
.news-list .news-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid var(--border-soft);
}
.news-list .news-item:last-child { border-bottom: none; }
.news-list .pin { margin-right: 4px; }
.news-list .meta { font-size: 0.8rem; color: var(--text-light); }

/* =============================== FILTERS =============================== */
.filter-bar {
    display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
    background: var(--bg-card); padding: 12px; border-radius: var(--radius-lg);
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.filter-search { flex: 1; min-width: 200px; }
.filter-select { min-width: 160px; }

/* =============================== QUIZ FORM =============================== */
.quiz-page { max-width: 800px; margin: 0 auto; }
.quiz-header { margin-bottom: 24px; }
.question-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.question-card h3 { font-size: 1rem; margin-bottom: 14px; }
.options { display: flex; flex-direction: column; gap: 8px; }
.option {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border: 1px solid var(--border);
    border-radius: var(--radius); cursor: pointer;
    transition: all 0.15s;
}
.option:hover { background: var(--bg-muted); border-color: var(--brand-light); }
.option:has(input:checked) { background: rgba(27,122,74,0.06); border-color: var(--brand); }
.option input { width: 16px; height: 16px; cursor: pointer; }
.quiz-actions { margin-top: 24px; text-align: center; }

/* =============================== QUIZ RESULT =============================== */
.quiz-result-page { max-width: 600px; margin: 60px auto; }
.result-card {
    text-align: center; padding: 48px 32px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.result-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 80px; height: 80px; border-radius: 50%;
    font-size: 3rem; color: white;
    margin-bottom: 16px;
}
.result-success .result-icon { background: var(--success); }
.result-fail .result-icon { background: var(--danger); }
.result-score { font-size: 1.5rem; margin: 16px 0; }
.result-score strong { font-size: 2.5rem; color: var(--brand); }
.result-fail .result-score strong { color: var(--danger); }
.result-pass, .result-quiz { color: var(--text-muted); }
.result-actions { margin-top: 24px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* =============================== NEWS =============================== */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}
.news-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.news-card.pinned { border-color: var(--accent); }
.pin-badge {
    display: inline-block; padding: 2px 10px;
    background: var(--accent); color: white;
    border-radius: 4px; font-size: 0.75rem; font-weight: 600;
    margin-bottom: 10px;
}
.news-card h2 { font-size: 1.1rem; margin-bottom: 8px; }
.news-card h2 a { color: var(--text); }
.news-meta { font-size: 0.8rem; color: var(--text-light); display: flex; gap: 6px; margin-bottom: 12px; }
.news-excerpt { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; }
.news-link { display: inline-block; margin-top: 12px; font-weight: 500; }

.news-detail { max-width: 800px; margin: 0 auto; }
.news-content { margin-top: 16px; line-height: 1.7; font-size: 1rem; }

/* =============================== PHARMACY =============================== */
.pharm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.pharm-card {
    display: block; padding: 20px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); color: var(--text);
    text-decoration: none; box-shadow: var(--shadow-sm);
    transition: all 0.15s;
}
.pharm-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; }
.pharm-card h2 { color: var(--brand); margin-bottom: 8px; }
.pharm-card p { margin: 4px 0; color: var(--text-muted); font-size: 0.9rem; }
.pharm-stats { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); font-size: 0.85rem; color: var(--text-muted); }

.pharm-detail { max-width: 1000px; margin: 0 auto; }
.pharm-header { margin-bottom: 32px; padding: 24px; background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border); }
.pharm-info p { margin: 6px 0; color: var(--text-muted); }
.pharm-notes { margin-top: 16px; padding: 12px; background: var(--bg-muted); border-radius: var(--radius); }

.staff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.staff-card {
    display: flex; align-items: center; gap: 14px;
    padding: 14px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.staff-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--brand); color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem; flex-shrink: 0;
}
.staff-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.staff-info strong { font-size: 0.95rem; }
.staff-role {
    display: inline-block; padding: 1px 6px;
    border-radius: 4px; font-size: 0.7rem; font-weight: 600;
    width: max-content;
}
.staff-email { font-size: 0.8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.staff-pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
}

/* =============================== ADMIN LAYOUT =============================== */
.admin-body { background: var(--bg); }
.admin-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 28px;
    padding: 28px 24px 64px;
}
@media (max-width: 920px) {
    .admin-layout { grid-template-columns: 1fr; }
    .sidebar { position: static; }
}
.sidebar {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px;
    height: max-content; position: sticky; top: 80px;
    box-shadow: var(--shadow-sm);
}
.sidebar-title {
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.6px;
    color: var(--text-light); padding: 0 8px; margin-bottom: 12px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
    padding: 8px 12px; border-radius: var(--radius);
    color: var(--text-muted); text-decoration: none;
    font-size: 0.9rem; transition: all 0.15s;
}
.sidebar-nav a:hover { background: var(--bg-muted); color: var(--text); }
.sidebar-nav a.active { background: var(--brand); color: white; }
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 0; }
.admin-main { min-width: 0; }

/* =============================== QUIZ ADMIN =============================== */
.qlist { padding-left: 0; counter-reset: qcount; list-style: none; }
.qitem {
    padding: 14px; margin-bottom: 10px;
    background: var(--bg-muted); border-radius: var(--radius);
    counter-increment: qcount;
}
.qitem::before {
    content: counter(qcount) ". ";
    font-weight: 700; color: var(--brand);
}
.qhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qopts { margin: 10px 0; padding-left: 24px; list-style: none; }
.qopts li { padding: 3px 0; color: var(--text-muted); }
.qopts .qopt-correct { color: var(--success); font-weight: 600; }
.opts-editor { background: var(--bg-muted); padding: 16px; border-radius: var(--radius); margin: 16px 0; }
.opts-editor h4 { margin-bottom: 8px; }
.opt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.opt-row input[type="text"] { flex: 1; }

.thumb-preview { display: block; max-width: 180px; margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius); }

/* =============================== AUTH PAGE =============================== */
.auth-body {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card {
    background: white; padding: 36px 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px;
    background: var(--brand); color: white;
    border-radius: var(--radius-lg);
    font-weight: 700; font-size: 1.25rem;
    letter-spacing: 0.5px; margin-bottom: 12px;
}
.auth-brand h1 { font-size: 1.4rem; margin-bottom: 4px; }
.auth-tagline { color: var(--text-muted); font-size: 0.9rem; margin: 0; }
.auth-form .field { margin-bottom: 16px; }
.auth-footer { text-align: center; margin-top: 24px; color: var(--text-light); font-size: 0.8rem; }

/* =============================== ERROR PAGES =============================== */
.error-page {
    max-width: 500px; margin: 80px auto;
    text-align: center;
    padding: 40px; background: var(--bg-card);
    border-radius: var(--radius-lg); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.error-page h1 { font-size: 2rem; color: var(--danger); margin-bottom: 12px; }
.error-page p { color: var(--text-muted); margin-bottom: 24px; }

/* =============================== MOBILE NAV =============================== */
@media (max-width: 768px) {
    .mainnav { display: none; }
    .topbar-inner { gap: 12px; }
    .brand-text { display: none; }
    .user-name { display: none; }
    .container { padding: 0 16px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .stats-grid, .admin-stats { grid-template-columns: repeat(2, 1fr); }
    h1 { font-size: 1.4rem; }
}

/* =============================== ADMIN MOBILE =============================== */
.sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text);
    line-height: 1;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
}
.sidebar-overlay.show { display: block; }

.sidebar-header-mobile {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.sidebar-user-mobile {
    display: none;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

@media (max-width: 920px) {
    /* Show hamburger */
    .sidebar-toggle { display: inline-flex; align-items: center; }

    /* Admin layout: single column, no gap */
    .admin-layout {
        display: block;
        padding: 16px;
    }

    /* Sidebar: hidden drawer on left */
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 280px;
        z-index: 300;
        border-radius: 0;
        border: none;
        border-right: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        overflow-y: auto;
        padding: 0;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-nav  { padding: 0 8px; }
    .sidebar-nav a { padding: 12px 14px; font-size: 1rem; }

    .sidebar-title { padding: 0 16px; display: none; }
    .sidebar-header-mobile { display: flex; }
    .sidebar-user-mobile   { display: block; }

    /* Main content: full width */
    .admin-main { margin: 0; }

    /* Tables: horizontal scroll */
    .card > table { min-width: 600px; }
    .card { overflow-x: auto; }

    /* Topbar */
    .topbar-inner { padding: 0 12px; }
    .brand-text   { display: inline; font-size: .9rem; }
    .user-menu    { gap: 6px; }

    /* Stats grid */
    .admin-stats  { grid-template-columns: repeat(2, 1fr); }
    .charts-row   { grid-template-columns: 1fr; }

    /* Form rows: single column */
    .form-row     { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .admin-layout { padding: 12px; }
    .admin-stats  { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-value   { font-size: 1.5rem; }
    .brand-suffix { display: none; }
    .brand-text   { font-size: .85rem; }
}
