/* =====================================================================
   features.css — Phase 1 features + admin portal + dark mode
   Builds on style.css (teal theme). Uses the same CSS variables.
   ===================================================================== */

/* ----------------------------------------------------------------- Dark mode */
:root { --transition: .25s ease; }

[data-theme="dark"] {
    --teal:       #2dd4bf;
    --teal-dark:  #14b8a6;
    --teal-light: #5eead4;
    --mint:       #14302b;
    --amber:      #fbbf24;
    --coral:      #f87171;
    --green:      #4ade80;
    --ink:        #e6f1ee;
    --slate:      #9fb3ad;
    --bg:         #0e1a17;
    --card:       #16241f;
    --border:     #26413a;
    --shadow:     0 4px 18px rgba(0, 0, 0, 0.35);
    --shadow-lg:  0 12px 38px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
[data-theme="dark"] .site-header { background: #112019; border-bottom-color: var(--border); }
[data-theme="dark"] .hero { background: linear-gradient(160deg, #122722 0%, #0e1a17 70%); }
[data-theme="dark"] .section-alt { background: #112019; }
[data-theme="dark"] .site-footer { background: #0a1411; }
[data-theme="dark"] .btn-light { background: #1f3a32; color: var(--teal-light); }
[data-theme="dark"] .btn-light:hover { background: #264a40; }
[data-theme="dark"] img { opacity: .92; }
[data-theme="dark"] .art-card,
[data-theme="dark"] .topic-card,
[data-theme="dark"] .quiz-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .best-card,
[data-theme="dark"] .feature { background: var(--card); }
[data-theme="dark"] .nav-drop-menu { background: var(--card); border-color: var(--border); }

/* Smooth theme transition on key surfaces */
body, .site-header, .site-footer, .card, .stat-card, .quiz-card, .topic-card {
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

/* ----------------------------------------------------------------- Theme toggle btn */
.theme-toggle {
    background: transparent; border: 1px solid var(--border); border-radius: 999px;
    width: 38px; height: 38px; cursor: pointer; font-size: 16px; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background var(--transition), border-color var(--transition);
}
.theme-toggle:hover { background: var(--mint); border-color: var(--teal); }

/* ----------------------------------------------------------------- Nav dropdowns */
.site-nav { align-items: center; }
.nav-dropdown { position: relative; display: inline-block; }
.nav-drop-toggle {
    background: none; border: none; cursor: pointer; font-weight: 600; font-size: 1rem;
    color: var(--ink); font-family: inherit; padding: 0; display: inline-flex; align-items: center;
}
.nav-drop-toggle.active, .nav-drop-toggle:hover { color: var(--teal); }
.nav-drop-menu {
    position: absolute; top: 130%; left: 0; min-width: 220px; background: #fff;
    border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
    padding: 8px; opacity: 0; visibility: hidden; transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s; z-index: 60;
}
.nav-dropdown:hover .nav-drop-menu,
.nav-dropdown.open .nav-drop-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-drop-menu a {
    display: block; padding: 9px 12px; border-radius: 8px; font-weight: 600; color: var(--ink);
    white-space: nowrap;
}
.nav-drop-menu a:hover { background: var(--mint); color: var(--teal-dark); }
.nav-admin { color: var(--amber) !important; font-weight: 700; }

@media (max-width: 880px) {
    .nav-drop-menu {
        position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none;
        border: none; padding: 0 0 0 14px; display: none; min-width: 0;
    }
    .nav-dropdown.open .nav-drop-menu { display: block; }
    .nav-dropdown:hover .nav-drop-menu { display: none; }
    .nav-dropdown.open:hover .nav-drop-menu { display: block; }
}

/* ----------------------------------------------------------------- Badge toasts */
.badge-toast-host {
    position: fixed; top: 84px; right: 18px; z-index: 1000;
    display: flex; flex-direction: column; gap: 10px; max-width: 340px;
}
.badge-toast {
    display: flex; gap: 12px; align-items: center; background: var(--card);
    border: 2px solid var(--amber); border-radius: var(--radius-sm); padding: 12px 14px;
    box-shadow: var(--shadow-lg); transform: translateX(120%); opacity: 0;
    transition: transform .35s cubic-bezier(.2,.9,.3,1.2), opacity .35s;
}
.badge-toast.show { transform: translateX(0); opacity: 1; }
.badge-toast.hide { transform: translateX(120%); opacity: 0; }
.badge-toast .bt-icon { font-size: 30px; line-height: 1; }
.badge-toast .bt-copy { display: flex; flex-direction: column; }
.badge-toast .bt-copy strong { font-size: 12px; color: var(--amber); text-transform: uppercase; letter-spacing: .04em; }
.badge-toast .bt-name { font-weight: 800; color: var(--ink); }
.badge-toast .bt-desc { font-size: 13px; color: var(--slate); }

/* ----------------------------------------------------------------- Generic page hero */
.page-hero { background: linear-gradient(160deg, var(--mint) 0%, var(--bg) 75%); padding: 48px 0 36px; }
.page-hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 8px; }
.page-hero p { color: var(--slate); max-width: 720px; }
.crumb { font-size: 14px; color: var(--slate); margin-bottom: 10px; }
.crumb a { color: var(--teal); }

/* ----------------------------------------------------------------- Study materials */
.study-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 20px; }
.study-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; display: flex; flex-direction: column;
}
.study-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.study-card .sc-icon { font-size: 40px; }
.study-card h3 { margin: 10px 0 6px; }
.study-card p { color: var(--slate); flex: 1; }
.study-card .sc-meta { font-size: 13px; color: var(--teal); font-weight: 700; margin: 10px 0; }
.study-progress { height: 8px; background: var(--mint); border-radius: 99px; overflow: hidden; margin: 6px 0 12px; }
.study-progress > i { display: block; height: 100%; background: var(--teal); }

.study-article { max-width: 820px; margin: 0 auto; }
.study-article h2 { margin-top: 34px; border-bottom: 2px solid var(--mint); padding-bottom: 6px; }
.study-article h3 { margin-top: 24px; color: var(--teal-dark); }
.study-article p, .study-article li { line-height: 1.75; color: var(--ink); }
.study-article ul, .study-article ol { padding-left: 22px; }
.key-box {
    background: var(--mint); border-left: 4px solid var(--teal); border-radius: 10px;
    padding: 16px 18px; margin: 20px 0;
}
.key-box h4 { margin: 0 0 8px; color: var(--teal-dark); }
.callout {
    background: #fff7ed; border-left: 4px solid var(--amber); border-radius: 10px;
    padding: 14px 16px; margin: 18px 0;
}
[data-theme="dark"] .callout { background: #2a2113; }
.proc-steps { counter-reset: step; list-style: none; padding: 0; }
.proc-steps li {
    position: relative; padding: 10px 0 10px 46px; border-bottom: 1px dashed var(--border);
}
.proc-steps li::before {
    counter-increment: step; content: counter(step); position: absolute; left: 0; top: 8px;
    width: 30px; height: 30px; background: var(--teal); color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.study-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 24px; }
.study-toc a { background: var(--mint); color: var(--teal-dark); padding: 6px 12px; border-radius: 99px; font-weight: 600; font-size: 14px; }
.study-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 30px 0; padding: 20px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }

/* ----------------------------------------------------------------- Tools library */
.tools-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 24px; }
.tools-search {
    flex: 1; min-width: 220px; padding: 12px 16px; border: 1px solid var(--border);
    border-radius: 99px; font-size: 1rem; background: var(--card); color: var(--ink);
}
.tools-filter { padding: 11px 14px; border: 1px solid var(--border); border-radius: 99px; background: var(--card); color: var(--ink); font-size: .95rem; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.cat-chip {
    background: var(--card); border: 1px solid var(--border); border-radius: 99px; padding: 7px 14px;
    cursor: pointer; font-weight: 600; font-size: 14px; color: var(--slate); transition: .15s;
}
.cat-chip:hover { border-color: var(--teal); color: var(--teal); }
.cat-chip.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); gap: 18px; }
.tool-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
    display: flex; flex-direction: column; text-align: left;
}
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.tool-card .tc-icon { font-size: 38px; }
.tool-card h3 { margin: 8px 0 4px; font-size: 1.05rem; }
.tool-card .tc-cat { font-size: 12px; font-weight: 700; color: var(--teal); text-transform: uppercase; letter-spacing: .03em; }
.tool-card p { color: var(--slate); font-size: 14px; flex: 1; margin: 8px 0; }
.tools-empty { text-align: center; padding: 40px; color: var(--slate); display: none; }

.tool-detail { max-width: 820px; margin: 0 auto; }
.tool-detail-head { display: flex; gap: 18px; align-items: center; margin-bottom: 8px; }
.tool-detail-head .td-icon {
    font-size: 56px; width: 92px; height: 92px; display: flex; align-items: center; justify-content: center;
    background: var(--mint); border-radius: var(--radius); flex-shrink: 0;
}
.spec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 16px; margin: 24px 0; }
.spec-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
.spec-item h4 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--teal); }
.spec-item p { margin: 0; color: var(--ink); }

/* ----------------------------------------------------------------- Mock exam */
.exam-intro { max-width: 760px; margin: 0 auto; }
.exam-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 16px; margin: 24px 0; }
.exam-fact { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: center; }
.exam-fact strong { font-size: 1.6rem; display: block; color: var(--teal); }
.exam-fact span { color: var(--slate); font-size: 14px; }
.exam-bar {
    position: sticky; top: 0; z-index: 50; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 18px; display: flex; align-items: center;
    justify-content: space-between; gap: 14px; box-shadow: var(--shadow); margin-bottom: 18px; flex-wrap: wrap;
}
.exam-timer { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.exam-timer.warning { color: var(--amber); }
.exam-timer.danger { color: var(--coral); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.exam-qnav { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0; }
.exam-qnav button {
    width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--card);
    cursor: pointer; font-size: 12px; font-weight: 700; color: var(--slate);
}
.exam-qnav button.answered { background: var(--teal); color: #fff; border-color: var(--teal); }
.exam-qnav button.current { outline: 3px solid var(--amber); }
.exam-qnav button.flagged { border-color: var(--amber); }
.exam-q-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.exam-q-text { font-size: 1.15rem; font-weight: 600; margin: 10px 0 20px; }
.exam-options { display: flex; flex-direction: column; gap: 10px; }
.exam-opt {
    display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 2px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer; transition: .15s; background: var(--bg);
}
.exam-opt:hover { border-color: var(--teal); }
.exam-opt.selected { border-color: var(--teal); background: var(--mint); }
.exam-opt .eo-label { font-weight: 800; color: var(--teal); }
.exam-nav-btns { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.topic-breakdown { display: flex; flex-direction: column; gap: 14px; margin: 20px 0; }
.tb-row { display: grid; grid-template-columns: 180px 1fr 90px; gap: 12px; align-items: center; }
.tb-bar { height: 14px; background: var(--mint); border-radius: 99px; overflow: hidden; }
.tb-bar > i { display: block; height: 100%; border-radius: 99px; }
@media (max-width: 600px) { .tb-row { grid-template-columns: 1fr; gap: 4px; } }

/* ----------------------------------------------------------------- Flashcards */
.fc-filters { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: center; margin-bottom: 22px; }
.fc-filter-group { display: flex; flex-direction: column; gap: 4px; }
.fc-filter-group label { font-size: 12px; font-weight: 700; color: var(--slate); text-transform: uppercase; letter-spacing: .04em; }
.fc-filter-group select {
    padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--card); color: var(--ink); font-size: 14px; min-width: 180px;
}
.fc-stats { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.fc-stat { font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--card); }
.fc-stat.mastered { color: var(--green); }
.fc-stat.again { color: var(--coral); }

.fc-stage { max-width: 680px; margin: 0 auto; }
.fc-counter { display: flex; justify-content: center; gap: 18px; margin-bottom: 12px; color: var(--slate); font-size: 14px; font-weight: 600; }
.fc-counter b { color: var(--ink); }

.flashcard {
    perspective: 1600px; width: 100%; min-height: 460px; cursor: pointer; margin: 0 auto;
}
.flashcard-inner {
    position: relative; width: 100%; min-height: 460px; transition: transform .55s; transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.fc-face {
    position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
    border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
    padding: 46px 26px 56px; display: flex; flex-direction: column; align-items: stretch;
    text-align: left; overflow-y: auto;
}
.fc-front { background: var(--card); }
.fc-back  { background: var(--mint); transform: rotateY(180deg); }

.fc-meta { display: flex; justify-content: space-between; align-items: center; position: absolute; top: 12px; left: 16px; right: 16px; }
.fc-topic { font-size: 12px; font-weight: 800; color: var(--teal); text-transform: uppercase; letter-spacing: .03em; }
.fc-diff { font-size: 11px; font-weight: 800; text-transform: uppercase; padding: 3px 10px; border-radius: 99px; background: var(--mint); color: var(--teal-dark); }
.fc-diff.diff-beginner { background: #e8f6ee; color: #15803d; }
.fc-diff.diff-intermediate { background: #fef3e2; color: #b45309; }
.fc-diff.diff-advanced { background: #fdeaea; color: #b91c1c; }

.fc-question { font-size: 1.18rem; font-weight: 700; line-height: 1.45; margin: 4px 0 16px; color: var(--ink); }
.fc-hint { font-size: 13px; color: var(--slate); }
.fc-front .fc-hint { white-space: nowrap; }

/* Front: clickable option buttons */
.fc-options { display: flex; flex-direction: column; gap: 10px; }
.fc-option {
    display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
    padding: 12px 14px; border: 2px solid var(--border); border-radius: 12px;
    background: var(--card); color: var(--ink); font-size: .98rem; line-height: 1.4;
    cursor: pointer; transition: border-color .15s, background .15s, transform .1s;
}
.fc-option:hover { border-color: var(--teal); background: var(--mint); }
.fc-option:active { transform: scale(.99); }
.fc-option.selected { border-color: var(--teal); background: var(--mint); box-shadow: 0 0 0 2px rgba(13,148,136,.15); }
.fc-opt-label {
    flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--mint);
    color: var(--teal-dark); font-weight: 800; font-size: .85rem; display: flex; align-items: center; justify-content: center;
}
.fc-option.selected .fc-opt-label { background: var(--teal); color: #fff; }
.fc-opt-text { flex: 1; }

.fc-front-foot { margin-top: auto; padding-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fc-check { white-space: nowrap; }

/* Back: result banner + reviewed options + explanation */
.fc-back-result { font-weight: 800; font-size: 1.02rem; padding: 10px 14px; border-radius: 12px; margin: 6px 0 14px; }
.fc-back-result.correct { background: #e8f6ee; color: #15803d; border: 1px solid #b7e4c7; }
.fc-back-result.wrong   { background: #fdeaea; color: #b91c1c; border: 1px solid #f5c2c2; }
.fc-back-result.neutral { background: var(--card); color: var(--teal-dark); border: 1px solid var(--border); }

.fc-back-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.fco { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); font-size: .92rem; line-height: 1.4; }
.fco-label { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .78rem; background: var(--mint); color: var(--slate); }
.fco-text { flex: 1; }
.fco-mark { flex: 0 0 auto; font-weight: 800; }
.fco.correct { background: #e8f6ee; border-color: #b7e4c7; color: #14532d; }
.fco.correct .fco-label { background: var(--green); color: #fff; }
.fco.correct .fco-mark { color: var(--green); }
.fco.wrong { background: #fdeaea; border-color: #f5c2c2; color: #7f1d1d; }
.fco.wrong .fco-label { background: var(--coral); color: #fff; }
.fco.wrong .fco-mark { color: var(--coral); }
.fco.muted { opacity: .6; }

.fc-explanation { font-size: 14px; color: var(--ink); line-height: 1.6; }
.fc-explanation .fc-expl-text { margin: 0 0 8px; }
.fc-explanation .fc-tool-note { margin: 0; padding: 8px 12px; background: var(--card); border-radius: 10px; border: 1px dashed var(--border); }
.fc-back .fc-hint { margin-top: 10px; }

/* Action row */
.fc-actions { display: flex; gap: 10px; justify-content: center; margin: 22px 0 8px; flex-wrap: wrap; }
.fc-actions .btn.is-active { box-shadow: 0 0 0 3px rgba(13,148,136,.25); }
.fc-statusline { text-align: center; font-weight: 700; min-height: 22px; }
.fc-statusline.mastered { color: var(--green); }
.fc-statusline.again { color: var(--coral); }

@media (max-width: 600px) {
    .fc-face { padding: 44px 16px 50px; }
    .fc-question { font-size: 1.05rem; }
    .fc-front-foot { justify-content: center; }
    .fc-check { width: 100%; }
}

/* ----------------------------------------------------------------- Badges page */
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 18px; }
.badge-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 16px;
    text-align: center; box-shadow: var(--shadow); position: relative; transition: transform .2s;
}
.badge-card:hover { transform: translateY(-3px); }
.badge-card.locked { opacity: .55; filter: grayscale(.6); }
.badge-card .bc-icon { font-size: 48px; line-height: 1; }
.badge-card.locked .bc-icon { filter: grayscale(1); }
.badge-card h3 { margin: 10px 0 4px; font-size: 1.05rem; }
.badge-card p { color: var(--slate); font-size: 13px; }
.badge-card .bc-earned { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--green); }
.badge-card .bc-lock { position: absolute; top: 12px; right: 12px; font-size: 16px; }
.badge-summary { display: flex; align-items: center; gap: 16px; justify-content: center; margin-bottom: 26px; }
.badge-summary .bs-ring { font-size: 2rem; font-weight: 800; color: var(--teal); }

/* ----------------------------------------------------------------- Topic progress (dashboard) */
.topic-progress-list { display: flex; flex-direction: column; gap: 14px; }
.tp-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 18px; }
.tp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tp-head .tp-name { font-weight: 700; }
.tp-head .tp-pct { font-weight: 800; }
.tp-bar { height: 12px; background: var(--mint); border-radius: 99px; overflow: hidden; }
.tp-bar > i { display: block; height: 100%; border-radius: 99px; transition: width .5s; }
.tp-meta { font-size: 13px; color: var(--slate); margin-top: 6px; }
.weak-areas { background: #fff7ed; border-left: 4px solid var(--amber); border-radius: 10px; padding: 16px 18px; margin: 18px 0; }
[data-theme="dark"] .weak-areas { background: #2a2113; }
.weak-areas h3 { margin: 0 0 8px; }
.weak-areas a { font-weight: 700; }
.mastery-good > i { background: var(--green); }
.mastery-mid  > i { background: var(--amber); }
.mastery-low  > i { background: var(--coral); }

/* breakdown row labels (mock result) */
.tb-name { font-weight: 600; }
.tb-score { font-weight: 700; text-align: right; white-space: nowrap; }

/* ----------------------------------------------------------------- Dashboard Phase 1 */
.dash-two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; margin: 18px 0 6px; }
@media (max-width: 800px) { .dash-two-col { grid-template-columns: 1fr; gap: 8px; } }
.dash-col { min-width: 0; }
.focus-empty { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 22px; text-align: center; }
.focus-empty span { font-size: 2rem; display: block; margin-bottom: 6px; }
.focus-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.focus-item { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 10px 14px; }
.focus-icon { font-size: 1.3rem; }
.focus-name { font-weight: 600; flex: 1; }
.focus-pct { font-weight: 800; color: var(--coral); }
.dash-badges-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 26px; }
.dash-badge-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 0 8px; }
.dash-badge { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 96px; text-align: center;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 8px; }
.dash-badge-icon { font-size: 1.8rem; }
.dash-badge-name { font-size: .76rem; font-weight: 600; line-height: 1.2; }

/* ----------------------------------------------------------------- Print button + print styles */
.print-bar { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.print-only { display: none; }

@media print {
    .site-header, .site-footer, .nav-toggle, .theme-toggle, .badge-toast-host,
    .print-bar, .quiz-progress-bar, .quiz-meta-row, .result-actions, .back-link,
    .skip-link, .study-cta, .exam-bar, .exam-qnav, .fc-actions, .fc-filters,
    .no-print, .print-toolbar { display: none !important; }
    body { background: #fff !important; color: #000 !important; }
    .container, .container.narrow { max-width: 100% !important; width: 100% !important; }
    .print-only { display: block; }
    .review-card, .print-q { break-inside: avoid; page-break-inside: avoid; }
    a[href]::after { content: ""; }
    .print-answer { font-weight: bold; }
    .print-hide-answers .print-answer, .print-hide-answers .review-explain { display: none !important; }
    .print-sheet { box-shadow: none !important; margin: 0 !important; padding: 0 !important; max-width: 100% !important; }
}

/* ----------------------------------------------------------------- Quiz topbar / print link */
.quiz-topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.print-link { font-weight: 600; color: var(--teal); text-decoration: none; font-size: .92rem; }
.print-link:hover { text-decoration: underline; }

/* ----------------------------------------------------------------- Printable quiz sheet */
.print-page { background: #eef2f1; margin: 0; }
.print-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    background: #fff; padding: 12px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.print-toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; }
.print-sheet { background: #fff; max-width: 820px; margin: 24px auto; padding: 40px 48px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08); color: #111; }
.print-head { border-bottom: 2px solid var(--teal); padding-bottom: 14px; margin-bottom: 22px; }
.print-head h1 { margin: 0 0 6px; font-size: 1.6rem; color: #111; }
.print-sub { margin: 0 0 10px; color: #555; font-size: .95rem; }
.print-meta { margin: 10px 0 4px; font-size: .92rem; color: #333; }
.print-brand { margin: 4px 0 0; font-size: .8rem; color: #888; }
.print-qlist { margin: 0; padding-left: 26px; }
.print-q { margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px dashed #ddd; }
.print-qtext { font-weight: 700; margin: 0 0 8px; }
.print-opts { list-style: none; margin: 0; padding: 0; }
.print-opt { margin: 5px 0; padding: 4px 8px; border: 1px solid #e2e2e2; border-radius: 6px; }
.print-opt.correct { background: #e7f6ee; border-color: #58b985; }
.print-opt-label { font-weight: 700; margin-right: 6px; }
.print-expl { margin: 8px 0 0; font-size: .9rem; color: #345; background: #f3f7f6; padding: 8px 10px; border-radius: 6px; }
.print-foot { margin-top: 26px; padding-top: 12px; border-top: 1px solid #ddd; font-size: .78rem; color: #999; }

/* ----------------------------------------------------------------- Admin portal */
.admin-body { background: var(--bg); }
.admin-shell { display: flex; min-height: 100vh; }
.admin-side {
    width: 240px; background: #0d2b24; color: #d7efe8; flex-shrink: 0; display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
[data-theme="dark"] .admin-side { background: #08110e; }
.admin-side .as-brand { padding: 20px; font-weight: 800; font-size: 1.2rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.admin-side nav { display: flex; flex-direction: column; padding: 12px; gap: 4px; flex: 1; }
.admin-side nav a { color: #b8ddd4; padding: 11px 14px; border-radius: 8px; font-weight: 600; display: flex; gap: 10px; }
.admin-side nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-side nav a.active { background: var(--teal); color: #fff; }
.admin-side .as-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; }
.admin-side .as-foot a { color: var(--teal-light); }
.admin-main { flex: 1; padding: 28px 32px; max-width: 100%; overflow-x: auto; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 10px; }
.admin-topbar h1 { margin: 0; font-size: 1.6rem; }
.admin-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 28px; }
.admin-stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.admin-stat .as-icon { font-size: 26px; }
.admin-stat strong { display: block; font-size: 1.9rem; color: var(--teal); margin: 6px 0 2px; }
.admin-stat span { color: var(--slate); font-size: 14px; }
.admin-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 24px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.admin-table th { color: var(--slate); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.admin-table tr:hover td { background: var(--mint); }
.admin-form label { display: block; font-weight: 700; margin: 14px 0 4px; font-size: 14px; }
.admin-form input, .admin-form select, .admin-form textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem;
    background: var(--bg); color: var(--ink); font-family: inherit;
}
.admin-form textarea { min-height: 80px; resize: vertical; }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.badge-pill { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.pill-admin { background: var(--amber); color: #4a2c00; }
.pill-user { background: var(--mint); color: var(--teal-dark); }
.bar-h { height: 10px; background: var(--mint); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar-h > i { display: block; height: 100%; background: var(--teal); }
.admin-mobile-toggle { display: none; }
.admin-tag { background: var(--amber); color: #4a2c00; font-size: 11px; padding: 2px 7px; border-radius: 99px; font-weight: 800; vertical-align: middle; }
.an-icon { display: inline-block; width: 1.3em; text-align: center; }
.admin-whoami { font-weight: 600; color: var(--slate); }
.admin-menu-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; font-size: 1.2rem; padding: 4px 12px; cursor: pointer; color: var(--ink); }
.admin-content { min-height: 200px; }
.admin-flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 600; }
.admin-flash.success { background: #e7f6ee; color: #166534; border: 1px solid #86efac; }
.admin-flash.error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.admin-flash.info { background: var(--mint); color: var(--teal-dark); border: 1px solid var(--teal-light); }
[data-theme="dark"] .admin-flash.success { background: #11271a; }
[data-theme="dark"] .admin-flash.error { background: #2a1414; }
.admin-page-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-search { max-width: 320px; }
.admin-table .ta-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-empty { text-align: center; padding: 30px; color: var(--slate); }
@media (max-width: 820px) {
    .admin-shell { flex-direction: column; }
    .admin-side { width: 100%; height: auto; position: relative; flex-direction: column; }
    .admin-side nav { flex-direction: row; flex-wrap: wrap; }
    .admin-side.open nav, .admin-side nav { display: flex; }
    .admin-main { padding: 18px; }
    .admin-menu-btn { display: inline-block; }
}
