/* ==========================================================
   Study Key - one stylesheet (v2.1.1), works on phone, tablet, PC
   and prints clean exam papers.
   ========================================================== */
:root {
    --navy: #1e3a8a;
    --navy-2: #172554;
    --blue: #2563eb;
    --blue-soft: #eff4ff;
    --gold: #f59e0b;
    --ink: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #f6f7fb;
    --card: #ffffff;
    --ok: #15803d;
    --ok-soft: #ecfdf3;
    --err: #b91c1c;
    --err-soft: #fef2f2;
    --warn: #b45309;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --sidebar: 260px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .25rem; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
h3 { font-size: 1.05rem; margin: 0 0 .2rem; }
p { margin: 0 0 .6rem; }
code { background: #f1f5f9; padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.text-error { color: var(--err); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
h1:focus { outline: none; }

/* ---------- App shell ---------- */
.shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar);
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
    color: #e0e7ff;
    overflow-y: auto;
    z-index: 30;
    transition: transform .25s ease;
}
.brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.1rem 1.25rem;
    color: #fff; font-weight: 700; font-size: 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.brand:hover { text-decoration: none; }
.brand-logo {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--gold); color: var(--navy-2);
    font-family: Georgia, serif; font-size: 1.3rem;
}

.nav { padding: .75rem .6rem 2rem; display: flex; flex-direction: column; gap: 2px; }
.nav-group {
    margin: 1rem .65rem .3rem;
    font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
    color: #a5b4fc;
}
.nav-link {
    display: flex; align-items: center; gap: .6rem;
    padding: .55rem .75rem; border-radius: 8px;
    color: #e0e7ff; font-size: .95rem;
}
.nav-link:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav-link.active { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; }
.nav-icon { width: 1.2rem; text-align: center; opacity: .9; }
.nav-sub { flex-direction: column; align-items: flex-start; gap: 0; padding-left: 2.55rem; }
.nav-sub small { color: #a5b4fc; font-size: .75rem; }
.nav-book { line-height: 1.3; }
.version-box { margin: 0 1.25rem 1.5rem; padding-top: .75rem; border-top: 1px solid rgba(255,255,255,.1); font-size: .75rem; color: #a5b4fc; line-height: 1.6; }
.version-warn { margin-top: .4rem; padding: .4rem .5rem; border-radius: 6px; background: rgba(251, 191, 36, .15); color: #fde68a; }
.nav-note { padding: .3rem .75rem .3rem 2.55rem; font-size: .8rem; color: #a5b4fc; }

.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.75rem 2rem 4rem; }
.backdrop { display: none; }

/* ---------- Buttons, chips, alerts ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem 1rem; min-height: 40px;
    border: 1px solid var(--line); border-radius: 9px;
    background: #fff; color: var(--ink);
    font: inherit; font-size: .95rem; font-weight: 500;
    cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { color: var(--err); border-color: #fecaca; }
.btn-danger:hover { background: var(--err-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--blue); padding-left: 0; }
.btn-ghost:hover { background: transparent; text-decoration: underline; }
.btn-sm { padding: .35rem .75rem; min-height: 34px; font-size: .88rem; }
.btn-lg { padding: .75rem 1.3rem; font-size: 1rem; }
.icon-btn {
    width: 42px; height: 42px; border: 0; border-radius: 10px;
    background: transparent; font-size: 1.35rem; cursor: pointer; color: var(--navy);
}
.icon-btn:hover { background: var(--blue-soft); }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.chip {
    display: inline-block; padding: .12rem .55rem; border-radius: 999px;
    background: var(--blue-soft); color: var(--navy); font-size: .78rem; font-weight: 500;
}
.chip-muted { background: #f3f4f6; color: var(--muted); }

.badge { padding: .1rem .5rem; border-radius: 6px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; }
.badge-mcq { background: #fef3c7; color: #92400e; }
.badge-short { background: #dbeafe; color: #1e40af; }
.badge-long { background: #ede9fe; color: #5b21b6; }

.alert { padding: .85rem 1rem; border-radius: 10px; margin: 0 0 1rem; }
.alert-error { background: var(--err-soft); color: var(--err); border: 1px solid #fecaca; }

.loading { display: flex; align-items: center; gap: .6rem; color: var(--muted); padding: 2rem 0; }
.spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 3px solid #dbeafe; border-top-color: var(--blue);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Page pieces ---------- */
.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: .6rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.section-title { margin-top: 2rem; }

.hero {
    background: linear-gradient(135deg, var(--navy) 0%, #2b4fb8 100%);
    color: #fff; border-radius: 16px; padding: 2rem;
    margin-bottom: 1.5rem;
}
.hero h1 { font-size: 2rem; }
.hero p { color: #dbe4ff; max-width: 640px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.hero .btn:not(.btn-primary) { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .3); color: #fff; }
.hero .btn-primary { background: var(--gold); border-color: var(--gold); color: var(--navy-2); }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-top: 2rem; }
.step { display: flex; gap: .7rem; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.step b {
    flex: none; display: grid; place-items: center; width: 28px; height: 28px;
    border-radius: 50%; background: var(--blue-soft); color: var(--navy);
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.book-card { display: flex; gap: 1rem; padding: 1rem; color: inherit; transition: transform .12s, box-shadow .12s; }
.book-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(30, 58, 138, .12); }
.book-cover {
    flex: none; width: 62px; height: 82px; border-radius: 8px;
    display: grid; place-items: center;
    background: linear-gradient(160deg, var(--navy), var(--blue));
    color: var(--gold); font-family: Georgia, serif; font-size: 2rem; font-weight: 700;
}
.book-info { min-width: 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.panel {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.25rem; margin: 1.25rem 0; box-shadow: var(--shadow);
}
details.panel > summary { cursor: pointer; font-weight: 600; color: var(--navy); list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel[open] > summary { margin-bottom: 1rem; }

/* ---------- Forms ---------- */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 500; }
input[type=text], input[type=number], input:not([type]), select {
    width: 100%; min-height: 42px; padding: .5rem .7rem;
    border: 1px solid #d1d5db; border-radius: 9px;
    font: inherit; font-size: 1rem; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid #bfdbfe; border-color: var(--blue); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 1rem 0 .5rem; }
.validation-message { color: var(--err); font-size: .8rem; font-weight: 400; }
.invalid { border-color: var(--err) !important; }
.block-label { margin-top: 1rem; }

.check { flex-direction: row; align-items: center; gap: .6rem; font-weight: 400; cursor: pointer; padding: .45rem .2rem; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); flex: none; }
.check small { margin-left: auto; }
.check-strong { font-weight: 600; }
.check.is-disabled { opacity: .5; cursor: default; }
.switch { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--blue); }

/* ---------- Book page ---------- */
.unit-list { display: flex; flex-direction: column; gap: .6rem; }
.unit-card { display: flex; align-items: center; gap: 1rem; padding: .85rem 1rem; }
.unit-no {
    flex: none; width: 42px; height: 42px; border-radius: 10px;
    display: grid; place-items: center;
    background: var(--blue-soft); color: var(--navy); font-weight: 700; font-size: 1.1rem;
}
.unit-info { flex: 1; min-width: 0; }
.unit-title { font-weight: 600; color: var(--ink); font-size: 1.02rem; }
.unit-actions { display: flex; gap: .4rem; flex: none; }

/* ---------- Unit page ---------- */
.tabs {
    display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: .75rem;
    scrollbar-width: thin;
}
.tab {
    flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px;
    padding: .4rem .9rem; font: inherit; font-size: .9rem; cursor: pointer; color: var(--ink);
}
.tab small { color: var(--muted); margin-left: .2rem; }
.tab.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.tab.active small { color: #c7d2fe; }
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; margin-bottom: 1rem; }
.toolbar select { width: auto; min-width: 180px; }
.ex-title { font-weight: 600; color: var(--navy); }

.q-list { display: flex; flex-direction: column; gap: .8rem; }
.q-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: var(--shadow); }
.q-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.q-label { font-weight: 600; color: var(--navy); font-size: .9rem; }
.q-marks { margin-left: auto; color: var(--muted); font-size: .8rem; }
.q-body { margin-bottom: .4rem; }

.opt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem .75rem; margin: .5rem 0; }
.opt { display: flex; gap: .45rem; align-items: baseline; padding: .35rem .55rem; border-radius: 8px; border: 1px solid transparent; }
.opt.correct { background: var(--ok-soft); border-color: #bbf7d0; color: var(--ok); font-weight: 600; }

.solution { margin-top: .6rem; padding: .85rem 1rem; background: #f8fafc; border-left: 4px solid var(--ok); border-radius: 8px; }
.sol-source { font-size: .78rem; color: var(--muted); margin-bottom: .3rem; }
.answer { margin-bottom: .4rem; }
.sol-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ok); margin: .35rem 0 .25rem; }
.sol-body { white-space: pre-line; }

/* Math text: keep long formulas inside the screen */
.math { overflow-wrap: anywhere; }
div.math { overflow-x: auto; overflow-y: hidden; }
.katex { font-size: 1.08em; }
.katex-display { margin: .4rem 0; overflow-x: auto; overflow-y: hidden; }
.q-body, .item-body > .math { white-space: pre-line; }

/* ---------- Paper builder ---------- */
.builder .panel h2 { display: flex; align-items: center; gap: .6rem; }
.step-no {
    display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
    background: var(--navy); color: #fff; font-size: .9rem;
}
.unit-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 1rem; margin-top: .5rem; }
.count-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.summary-row { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin: 1rem 0; }

/* ---------- Saved papers ---------- */
.paper-list { display: flex; flex-direction: column; gap: .6rem; }
.paper-row { display: flex; align-items: center; gap: 1rem; padding: .9rem 1rem; }
.paper-row-main { flex: 1; min-width: 0; }
.paper-row-title { font-weight: 600; color: var(--ink); }
.paper-row-actions { display: flex; gap: .4rem; flex: none; }

/* ---------- Paper view ---------- */
.paper-toolbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
    padding: .6rem 0; margin-bottom: 1rem; background: var(--bg);
}
.toolbar-right { display: flex; gap: .4rem; margin-left: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: .45rem .9rem; font: inherit; font-size: .9rem; cursor: pointer; color: var(--ink); }
.seg button.active { background: var(--navy); color: #fff; }

.paper {
    background: #fff; border: 1px solid var(--line); border-radius: 6px;
    padding: 2.25rem 2.5rem; box-shadow: var(--shadow);
    font-family: "Times New Roman", Georgia, serif; font-size: 1.05rem;
}
.paper-head { text-align: center; border-bottom: 2px solid var(--ink); padding-bottom: 1rem; margin-bottom: 1.25rem; }
.paper-book { font-size: .95rem; letter-spacing: .03em; }
.paper-head h1 { font-size: 1.45rem; margin: .3rem 0 .5rem; }
.key-stamp { display: inline-block; border: 2px solid var(--ok); color: var(--ok); padding: .1rem .7rem; font-weight: 700; letter-spacing: .08em; font-size: .85rem; margin-bottom: .5rem; font-family: system-ui, sans-serif; }
.paper-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: .25rem 1.75rem; font-size: .95rem; }
.student-lines { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 1.5rem; margin-top: 1rem; text-align: left; }
.student-lines span { display: flex; align-items: flex-end; gap: .4rem; flex: 1 1 180px; }
.student-lines i { flex: 1; border-bottom: 1px solid var(--ink); height: 1.1em; }

.paper-section { margin-bottom: 1.75rem; }
.paper-section h2 {
    font-size: 1.12rem; display: flex; justify-content: space-between; gap: 1rem;
    border-bottom: 1px solid #d1d5db; padding-bottom: .3rem;
}
.sec-marks { font-weight: 400; font-size: .95rem; white-space: nowrap; }
.instr { font-style: italic; color: #374151; }
.paper-list-items { list-style: none; padding: 0; margin: 0; }
.paper-list-items > li { display: flex; gap: .6rem; padding: .55rem 0; border-bottom: 1px dashed #e5e7eb; break-inside: avoid; }
.paper-list-items > li:last-child { border-bottom: 0; }
.item-no { flex: none; min-width: 2.4rem; font-weight: 700; }
.item-body { flex: 1; min-width: 0; }
.paper .solution { font-family: system-ui, "Segoe UI", sans-serif; font-size: .95rem; }
.key-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: .3rem;
    background: var(--ok-soft); border: 1px solid #bbf7d0; border-radius: 8px; padding: .6rem .8rem; margin-bottom: .75rem;
    font-family: system-ui, sans-serif; font-size: .9rem;
}

.head-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip-warn { background: #fef3c7; color: #92400e; }

/* ---------- Quiz setup ---------- */
.field-label { font-size: .9rem; font-weight: 500; margin: .9rem 0 .4rem; }
.pill-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.pill {
    min-height: 40px; padding: .4rem .95rem; border-radius: 999px;
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    font: inherit; font-size: .92rem; cursor: pointer;
}
.pill.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.pill:disabled { opacity: .4; cursor: not-allowed; }
.pill-input { width: 90px !important; }

/* ---------- Quiz taking ---------- */
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.quiz-progress-text { font-size: 1.1rem; }
.timer {
    flex: none; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.15rem;
    padding: .4rem .85rem; border-radius: 10px; background: var(--blue-soft); color: var(--navy);
}
.timer.is-low { background: var(--err-soft); color: var(--err); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.progress { height: 8px; border-radius: 99px; background: #e5e7eb; overflow: hidden; margin-bottom: 1rem; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), #60a5fa); transition: width .3s; }

.quiz-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem 1.4rem; box-shadow: var(--shadow); }
.quiz-question { font-size: 1.15rem; margin: .25rem 0 1rem; white-space: pre-line; }
.choices { display: flex; flex-direction: column; gap: .55rem; margin-bottom: .5rem; }
.choice {
    display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left;
    min-height: 54px; padding: .65rem .9rem;
    border: 2px solid var(--line); border-radius: 12px; background: #fff;
    font: inherit; font-size: 1.05rem; color: var(--ink); cursor: pointer;
    transition: border-color .12s, background .12s;
}
.choice:hover { border-color: #93c5fd; background: #f8fbff; }
.choice.is-chosen { border-color: var(--blue); background: var(--blue-soft); }
.choice-letter {
    flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
    background: #f3f4f6; font-weight: 700; text-transform: lowercase;
}
.choice.is-chosen .choice-letter { background: var(--blue); color: #fff; }

.quiz-nav { display: flex; justify-content: space-between; gap: .6rem; margin: 1rem 0; }
.quiz-nav .btn { min-width: 130px; }
.palette-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; font-weight: 600; margin-bottom: .6rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #e5e7eb; margin: 0 .2rem 0 .5rem; vertical-align: middle; }
.dot-done { background: var(--blue); }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: .4rem; margin-bottom: 1rem; }
.pal {
    height: 44px; border-radius: 10px; border: 1px solid var(--line); background: #f9fafb;
    font: inherit; font-weight: 600; cursor: pointer; color: var(--ink);
}
.pal.is-done { background: var(--blue); border-color: var(--blue); color: #fff; }
.pal.is-current { outline: 3px solid #fbbf24; outline-offset: 1px; }
.submit-wide { width: 100%; }

/* ---------- Quiz result ---------- */
.result-card {
    display: flex; gap: 1.75rem; align-items: center; flex-wrap: wrap;
    background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem; box-shadow: var(--shadow);
}
.score-ring {
    --pct: 0;
    flex: none; width: 150px; height: 150px; border-radius: 50%;
    background: conic-gradient(var(--ok) calc(var(--pct) * 1%), #e5e7eb 0);
    display: grid; place-items: center;
}
.score-inner {
    width: 118px; height: 118px; border-radius: 50%; background: #fff;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-inner b { font-size: 1.7rem; line-height: 1.1; }
.score-inner span { color: var(--muted); font-size: .9rem; }
.result-info { flex: 1; min-width: 240px; }
.result-msg { font-weight: 500; }
.stat-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: .75rem 0; }
.stat { min-width: 86px; padding: .55rem .8rem; border-radius: 10px; background: #f3f4f6; text-align: center; }
.stat b { display: block; font-size: 1.2rem; }
.stat span { font-size: .78rem; color: var(--muted); }
.stat-ok { background: var(--ok-soft); color: var(--ok); }
.stat-bad { background: var(--err-soft); color: var(--err); }
.result-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.summary-stats { margin-bottom: 1rem; }

.review.is-right { border-left: 5px solid var(--ok); }
.review.is-wrong { border-left: 5px solid var(--err); }
.review.is-skipped { border-left: 5px solid #9ca3af; }
.verdict { font-size: .8rem; font-weight: 700; padding: .1rem .5rem; border-radius: 6px; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.bad { background: var(--err-soft); color: var(--err); }
.verdict.skip { background: #f3f4f6; color: var(--muted); }
.opt.wrong { background: var(--err-soft); border-color: #fecaca; color: var(--err); text-decoration: line-through; }
.mine { margin-left: auto; font-size: .72rem; font-weight: 600; text-decoration: none; display: inline-block; padding: 0 .4rem; border-radius: 4px; background: rgba(0,0,0,.06); }

.grade-badge {
    flex: none; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
    font-weight: 800; font-size: 1.05rem;
}
.grade-a { background: var(--ok-soft); color: var(--ok); }
.grade-b { background: #dbeafe; color: #1e40af; }
.grade-d { background: #fef3c7; color: #92400e; }
.grade-f { background: var(--err-soft); color: var(--err); }
.grade-na { background: #f3f4f6; color: var(--muted); }

/* Blazor error bar */
#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: #fffbeb; border-top: 1px solid #fcd34d; padding: .7rem 1.25rem; box-shadow: 0 -1px 4px rgba(0,0,0,.1);
}
#blazor-error-ui .reload { margin-left: .5rem; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

/* ==========================================================
   Tablet & phone: sidebar becomes a slide-in menu
   ========================================================== */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); box-shadow: 4px 0 24px rgba(0,0,0,.2); }
    .menu-open .sidebar { transform: translateX(0); }
    .menu-open .backdrop {
        display: block; position: fixed; inset: 0; z-index: 25; background: rgba(15, 23, 42, .45);
    }
    .main { margin-left: 0; }
    .topbar {
        display: flex; align-items: center; gap: .5rem;
        position: sticky; top: 0; z-index: 20;
        height: 56px; padding: 0 .6rem;
        background: #fff; border-bottom: 1px solid var(--line);
    }
    .topbar-title { font-weight: 700; color: var(--navy); font-size: 1.05rem; }
    .content { padding: 1.25rem 1.25rem 3rem; }
    .paper-toolbar { top: 56px; }
    .count-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .steps { grid-template-columns: 1fr; }
}

@media (max-width: 599.98px) {
    body { font-size: 15px; }
    h1 { font-size: 1.35rem; }
    .hero { padding: 1.4rem; border-radius: 12px; }
    .hero h1 { font-size: 1.55rem; }
    .content { padding: 1rem .8rem 3rem; }
    .card-grid { grid-template-columns: 1fr; }
    .page-head .btn { width: 100%; }
    .unit-card, .paper-row { flex-wrap: wrap; }
    .unit-actions, .paper-row-actions { width: 100%; }
    .unit-actions .btn, .paper-row-actions .btn { flex: 1; }
    .opt-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .toolbar select { width: 100%; }
    .builder .btn-lg { width: 100%; }
    .paper { padding: 1.1rem .9rem; border-radius: 0; margin: 0 -.8rem; border-left: 0; border-right: 0; }
    .paper-toolbar { gap: .4rem; }
    .seg { width: 100%; }
    .seg button { flex: 1; }
    .toolbar-right { margin-left: 0; width: 100%; }
    .toolbar-right .btn { flex: 1; }
    .item-no { min-width: 2rem; }
    .q-card { padding: .85rem; }
    .head-actions { width: 100%; }
    .head-actions .btn { width: auto; flex: 1; }
    .quiz-card { padding: 1rem; }
    .quiz-question { font-size: 1.05rem; }
    .quiz-nav .btn { flex: 1; min-width: 0; }
    .result-card { justify-content: center; text-align: center; padding: 1.2rem; }
    .result-info .stat-row, .result-actions { justify-content: center; }
    .result-actions .btn { flex: 1 1 140px; }
    .score-ring { width: 130px; height: 130px; }
    .score-inner { width: 102px; height: 102px; }
}

/* ==========================================================
   Print: only the paper, black on white, A4
   ========================================================== */
/* ---------- Math lines (one block per line, so PDF page breaks fall between lines) ---------- */
.math-line { min-height: 1em; }
.math-gap { height: .6em; }

/* ---------- "Paper ready" bar: print / PDF right after a paper is generated ---------- */
.ready-bar { position: relative; max-width: 900px; margin: 0 auto 1rem; padding: 1rem 2.6rem 1rem 1.1rem;
             background: var(--ok-soft); border: 1px solid #bbf7d0; border-radius: var(--radius); }
.ready-text { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: baseline; margin-bottom: .7rem; }
.ready-text strong { color: var(--ok); font-size: 1.05rem; }
.ready-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.ready-actions .btn { width: 100%; justify-content: center; }
.ready-close { position: absolute; top: .45rem; right: .55rem; border: 0; background: none; font-size: 1.4rem;
               line-height: 1; color: var(--muted); cursor: pointer; padding: .2rem .4rem; }
@media (max-width: 800px) { .ready-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .ready-actions { grid-template-columns: 1fr; } }

/* ---------- WhatsApp sharing ---------- */
.btn-whatsapp { background: #25d366; border-color: #25d366; color: #fff; font-weight: 600; }
.btn-whatsapp:hover { background: #1ebe5b; text-decoration: none; }
.btn-whatsapp:disabled { opacity: .6; }
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .8rem;
             padding-top: .8rem; border-top: 1px solid #bbf7d0; }
.share-label { font-weight: 600; color: var(--ok); margin-right: .2rem; }
.share-row-compact { max-width: 900px; margin: 0 auto .9rem; padding: 0; border: 0; }
.share-ready { position: relative; max-width: 900px; margin: 0 auto 1rem; padding: .9rem 2.6rem .9rem 1rem;
               display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem;
               background: #f0fdf4; border: 1px solid #86efac; border-radius: var(--radius); }
@media (max-width: 600px) {
    .share-row .btn, .share-ready .btn { flex: 1 1 100%; }
}

/* ---------- PDF export (Download PDF on the paper page) ---------- */
.pdf-note { max-width: 900px; margin: 0 auto .75rem; padding: .6rem .9rem; border-radius: 8px;
            background: #fffbeb; border: 1px solid #fde68a; color: var(--warn); font-size: .92rem; }
.paper.pdf-export { border: 0; box-shadow: none; border-radius: 0; margin: 0; padding: 0;
                    background: #fff; color: #000; font-size: 15px; max-width: none; }
.paper.pdf-export .opt.correct, .paper.pdf-export .key-grid, .paper.pdf-export .solution { background: #fff !important; }
.paper.pdf-export .paper-list-items > li { border-bottom-color: #d1d5db; }
.paper.pdf-export .opt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.paper.pdf-export a { color: inherit; }

@media print {
    @page { size: A4; margin: 14mm 12mm; }
    body { background: #fff; font-size: 12pt; }
    .no-print, .sidebar, .topbar, .backdrop, #blazor-error-ui { display: none !important; }
    .main { margin: 0; }
    .content { max-width: none; padding: 0; }
    .paper { border: 0; box-shadow: none; padding: 0; margin: 0; }
    .paper-section h2 { break-after: avoid; }
    .opt.correct, .key-grid, .solution { background: #fff !important; }
    a { color: inherit; }
}

/* ==========================================================
   v2.0.0 - accounts, locked units, buying, admin pages
   ========================================================== */
.alert-ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #bbf7d0; }
.hero-note { font-size: .95rem; opacity: .9; }

/* sign in */
.btn-google { background: #fff; border-color: #d1d5db; color: var(--ink); font-weight: 600; gap: .5rem; }
.btn-google:hover { background: #f9fafb; }
.g-logo {
    display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
    background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0);
    color: #fff; font-weight: 800; font-size: .8rem;
}
.btn-block { width: 100%; justify-content: center; }
.signin-card { max-width: 440px; margin: 2rem auto; text-align: center; }
.signin-card .benefits { list-style: none; padding: 0; margin: 1rem 0 1.25rem; text-align: left; display: grid; gap: .35rem; }
.brand-logo.big { width: 56px; height: 56px; font-size: 1.4rem; margin: 0 auto .75rem; }

/* user box in the side menu */
.user-box { padding: .25rem .75rem .75rem; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: .5rem; }
.user-box .nav-note { margin: .4rem 0 0; font-size: .78rem; }
.user-chip { display: flex; align-items: center; gap: .6rem; color: inherit; padding: .35rem; border-radius: 10px; }
.user-chip:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.user-chip img, .user-chip .avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; object-fit: cover; }
.user-chip .avatar { display: grid; place-items: center; background: var(--gold); color: var(--navy-2); font-weight: 700; }
.user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.user-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.user-text small { opacity: .75; }
.nav-link .badge { margin-left: auto; background: var(--gold); color: var(--navy-2); border-radius: 999px; }

/* locked units */
.chip-free { background: var(--ok-soft); color: var(--ok); }
.chip-login { background: #e0f2fe; color: #075985; }
.chip-lock { background: #f3f4f6; color: #374151; }
.chip-price { background: #fef3c7; color: #92400e; font-weight: 600; }
.unit-locked .unit-no { background: #e5e7eb; color: var(--muted); }
.unit-locked .unit-title { color: #374151; }
.unlock {
    display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; justify-content: space-between;
    padding: 1rem 1.1rem; margin: 0 0 1rem; border-radius: var(--radius);
    background: linear-gradient(135deg, #eff4ff, #fff7e6); border: 1px solid #dbe4ff;
}
.unlock p { margin: 0; }
.unlock-text { display: flex; flex-direction: column; gap: .15rem; }
.unlock-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn-buy { background: var(--gold); border-color: var(--gold); color: var(--navy-2); font-weight: 700; }
.btn-buy:hover { background: #e48c06; }
.btn-buy-outline { border-color: var(--gold); }
.access-banner { padding: .75rem 1rem; border-radius: 10px; margin: 0 0 1rem; }
.access-ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #bbf7d0; }
.access-wait { background: #fffbeb; color: var(--warn); border: 1px solid #fde68a; }

/* buy page */
.price-tag { font-size: 1.6rem; font-weight: 800; color: var(--navy); display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.price-tag small { font-size: .78rem; font-weight: 500; color: var(--muted); }
.buy-steps { padding-left: 1.25rem; margin: 0 0 1rem; display: grid; gap: .3rem; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.qr-card { padding: 0; overflow: hidden; cursor: pointer; text-align: center; border: 2px solid transparent; }
.qr-card.selected { border-color: var(--blue); }
.qr-head { padding: .5rem; color: #fff; font-weight: 700; letter-spacing: .02em; border-radius: 8px 8px 0 0; }
.wallet-jazzcash { background: #c8102e; color: #fff; }
.wallet-easypaisa { background: #3bb54a; color: #fff; }
.qr-img { display: block; width: 100%; max-width: 220px; aspect-ratio: 1; object-fit: contain; margin: .75rem auto; background: #fff; }
.qr-missing { padding: 2.5rem 1rem; color: var(--muted); font-size: .9rem; }
.qr-acc { display: flex; flex-direction: column; padding: 0 1rem 1rem; }
.acc-no { font-size: 1.15rem; font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.wallet-edit { display: grid; gap: .6rem; }
.wallet-edit .qr-head { margin: -1rem -1rem .25rem; }
label.check { display: flex; align-items: center; gap: .5rem; }
label.check input { width: auto; }

/* tables (account, admin) */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: #f9fafb; font-weight: 600; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table select { width: auto; }
.row-muted td { opacity: .55; }
.num-input { width: 7.5rem; }
.status { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-approved { background: var(--ok-soft); color: var(--ok); }
.status-rejected { background: var(--err-soft); color: var(--err); }
.search { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.search input { min-width: 220px; width: auto; }
.search select { width: auto; }

/* payments review */
.pay-list { display: grid; gap: .75rem; }
.pay-card { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-start; }
.pay-main { display: grid; gap: .2rem; min-width: 0; }
.pay-top { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: 1.1rem; }
.tid { font-size: 1rem; font-weight: 700; user-select: all; }
.pay-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.note-input { width: 220px; }

/* account */
.profile { display: flex; gap: 1rem; align-items: center; }
.profile h2 { margin: 0; }
.profile-pic { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }

@media (max-width: 640px) {
    .price-tag { align-items: flex-start; }
    .search input, .note-input { min-width: 0; width: 100%; }
    .pay-actions { width: 100%; }
}

/* ==========================================================
   v2.1.0 - WhatsApp payments & support, recorded payments
   ========================================================== */
.support-link {
    display: inline-flex; align-items: center; gap: .6rem; padding: .55rem .8rem; border-radius: 10px;
    background: #e9fbef; border: 1px solid #b7ebc6; color: #075e2b;
}
.support-link:hover { background: #dbf7e4; text-decoration: none; }
.support-text { display: flex; flex-direction: column; line-height: 1.2; }
.support-text small { color: #3f7a55; }
.wa-icon { font-size: 1.2rem; }
.nav-support { padding: .5rem .75rem; }
.nav-support .support-link { display: flex; background: rgba(37, 211, 102, .15); border-color: rgba(37, 211, 102, .35); color: #fff; }
.nav-support .support-text small { color: rgba(255,255,255,.75); }
.support-row { margin: 1.25rem 0; }

/* buy page steps */
.buy-flow { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 1rem; }
.flow-step { display: flex; gap: .9rem; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.flow-no {
    flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: var(--navy); color: #fff; font-weight: 700;
}
.flow-body { min-width: 0; flex: 1; }
.flow-body h2 { margin-bottom: .25rem; }
.flow-body .qr-grid { margin: .75rem 0 0; }
.wa-email { margin-top: .5rem; }
.wait-box { display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.unlocked-now { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; }

/* payments page */
.totals { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin: 0 0 .75rem; padding: .6rem .9rem; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.pay-wa { border-left: 4px solid #25d366; }
.wa-note { color: #075e2b; }
.pay-form { flex-basis: 100%; border-top: 1px dashed var(--line); padding-top: .75rem; }
.reject-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
label.inline { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; }
label.inline input { width: auto; }

/* v2.1.1 - payee name on the Buy page */
.payee-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-top: .35rem; }
.payee-name { font-size: 1.05rem; }
.acc-no-row { display: inline-flex; gap: .5rem; align-items: center; justify-content: center; }
.payee-preview { background: var(--blue-soft); border-radius: 8px; padding: .45rem .6rem; }

/* ---------- 2.2.0 Reading content ---------- */
.badge-kind { background: #fef3c7; color: #92400e; }
.mode-switch { display: flex; gap: .4rem; margin-bottom: 1rem; }
.mode-switch .tab { font-size: .98rem; padding: .5rem 1.1rem; }
.lesson-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1rem; align-items: start; }
.lesson-toc {
    position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto;
    display: flex; flex-direction: column; gap: .15rem; background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); padding: .5rem;
}
.toc-item {
    text-align: left; border: 0; background: none; font: inherit; font-size: .9rem; color: var(--ink);
    padding: .45rem .6rem; border-radius: 8px; cursor: pointer; line-height: 1.3;
}
.toc-item:hover { background: var(--blue-soft); }
.toc-item.active { background: var(--navy); color: #fff; }
.toc-no { font-weight: 700; margin-right: .25rem; }
.lesson h2 { margin-top: 0; color: var(--navy); font-size: 1.3rem; }
.lesson-body { line-height: 1.65; overflow-x: auto; }
.lesson-body .lesson-p { margin: .45rem 0; }
.lesson-body .lesson-h { color: var(--navy); margin: 1.2rem 0 .4rem; }
.lesson-body h4.lesson-h { font-size: 1rem; }
.lesson-body .lesson-list { margin: .35rem 0 .6rem; padding-left: 1.4rem; }
.lesson-body .lesson-list li { margin: .2rem 0; }
.lesson-note {
    background: var(--blue-soft); border-left: 4px solid var(--blue); border-radius: 8px;
    padding: .6rem .9rem; margin: .7rem 0;
}
.lesson-body .katex-display { overflow-x: auto; overflow-y: hidden; padding: .2rem 0; }
.lesson-nav { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1.5rem; flex-wrap: wrap; }
@media (max-width: 860px) {
    .lesson-layout { grid-template-columns: 1fr; }
    .lesson-toc { position: static; max-height: 220px; }
}


/* ===================== 2.3.0 Urdu medium (right-to-left, Nastaliq) ===================== */
.medium-ur {
    font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", serif;
    line-height: 2.25;
    text-align: right;
}
.medium-ur .katex { direction: ltr; unicode-bidi: isolate; font-size: 1.05em; }
.medium-ur .katex-display { direction: ltr; text-align: center; }
.medium-ur .q-head, .medium-ur .paper-meta, .medium-ur .student-lines { direction: rtl; }
.medium-ur .q-label, .medium-ur .q-marks, .medium-ur .badge { font-family: "Noto Nastaliq Urdu", system-ui, sans-serif; }
.medium-ur .opt b, .medium-ur .choice-letter { font-family: system-ui, sans-serif; }
.medium-ur .item-no { margin-left: .5rem; margin-right: 0; }
.medium-ur .sol-body, .medium-ur .answer { text-align: right; }
.medium-ur h1, .medium-ur h2 { line-height: 1.9; }
.medium-ur .paper-head h1, .medium-ur .paper-book { text-align: center; }
.medium-ur ol, .medium-ur ul { padding-right: 1.4rem; padding-left: 0; }
bdi.medium-ur { line-height: inherit; font-size: .95em; }
.chip-urdu { background: #e8f5e9; color: #1b5e20; border-color: #a5d6a7; font-family: "Noto Nastaliq Urdu", system-ui, sans-serif; }
.medium-ur .math-line[dir="ltr"] { text-align: right; }

/* ==========================================================
   2.5.0 Top navigation, notifications, teachers, contact, AI
   ========================================================== */
:root { --topnav-h: 60px; }

/* top bar */
.topnav {
    position: sticky; top: 0; z-index: 40;
    background: linear-gradient(90deg, var(--navy) 0%, var(--navy-2) 100%);
    color: #e0e7ff; box-shadow: 0 2px 10px rgba(15, 23, 42, .18);
}
.topnav-inner {
    max-width: 1240px; margin: 0 auto; height: var(--topnav-h);
    display: flex; align-items: center; gap: .75rem; padding: 0 1rem;
}
.topnav .brand { display: flex; align-items: center; gap: .55rem; color: #fff; font-weight: 700; font-size: 1.1rem; padding: 0; white-space: nowrap; }
.topnav .brand:hover { text-decoration: none; }
.topnav-menu { display: flex; align-items: center; gap: .15rem; flex: 1; min-width: 0; }
.top-link {
    display: inline-flex; align-items: center; gap: .3rem; padding: .45rem .7rem; border-radius: 8px;
    color: #e0e7ff; background: transparent; border: 0; font: inherit; font-size: .95rem; cursor: pointer; white-space: nowrap;
}
.top-link:hover { background: rgba(255,255,255,.1); text-decoration: none; color: #fff; }
.top-link.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.caret { font-size: .7rem; opacity: .8; }
.nav-toggle { display: none; color: #fff; }
.nav-toggle:hover { background: rgba(255,255,255,.12); }

/* dropdowns */
.dd { position: relative; }
.dd-panel {
    display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
    min-width: 230px; padding: .4rem; border-radius: 12px; background: #fff; color: var(--ink);
    box-shadow: 0 12px 32px rgba(15, 23, 42, .22); border: 1px solid var(--line);
}
.dd.open > .dd-panel { display: block; }
.dd-right { left: auto; right: 0; }
.dd-wide { min-width: min(720px, 92vw); padding: .6rem; }
.dd-item {
    display: flex; align-items: center; justify-content: space-between; gap: .6rem;
    padding: .45rem .65rem; border-radius: 8px; color: var(--ink); font-size: .93rem;
}
.dd-item:hover { background: var(--blue-soft); text-decoration: none; }
.dd-strong { font-weight: 600; color: var(--navy); }
.dd-head { font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: .5rem .65rem .2rem; }
.dd-note { display: block; padding: .5rem .65rem; color: var(--muted); font-size: .88rem; }
.dd-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .25rem .75rem; }
.dd-user { display: flex; flex-direction: column; padding: .45rem .65rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; line-height: 1.3; }
.dd-user small { color: var(--muted); }
.dd-backdrop { position: fixed; inset: 0; z-index: 35; }
.medium-tag { font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: #f3f4f6; color: var(--muted); }
.medium-tag.ur { background: #ecfdf3; color: var(--ok); font-family: "Noto Nastaliq Urdu", serif; }
.badge-gold { background: var(--gold); color: var(--navy-2); border-radius: 999px; }

/* right side: bell + avatar */
.topnav-right { display: flex; align-items: center; gap: .4rem; margin-left: auto; }
.bell { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; font-size: 1.15rem; }
.bell:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.bell-count {
    position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
    background: #ef4444; color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center;
}
.user-btn { border: 0; background: transparent; padding: 2px; border-radius: 50%; cursor: pointer; }
.user-btn img, .user-btn .avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; }
.user-btn .avatar { background: var(--gold); color: var(--navy-2); font-weight: 700; }
.topnav .btn-google { min-height: 36px; }

/* page body with top bar */
.content { max-width: 1140px; }
.paper-toolbar { top: var(--topnav-h); }

/* "Continue as" bar */
.continue-bar { background: #fffbeb; border-bottom: 1px solid #fde68a; }
.continue-inner { max-width: 1140px; margin: 0 auto; padding: .5rem 1rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .93rem; }
.continue-inner img { width: 28px; height: 28px; border-radius: 50%; }
.continue-actions { display: flex; gap: .35rem; margin-left: auto; }
.keep-row { display: flex; gap: .5rem; align-items: flex-start; justify-content: center; margin: .8rem 0 .4rem; font-size: .9rem; text-align: left; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: #fff; margin-top: 2rem; }
.footer-inner { max-width: 1140px; margin: 0 auto; padding: 1.2rem 1rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; font-size: .9rem; }
.footer-col { display: flex; flex-direction: column; gap: .35rem; }
.footer-versions { color: var(--muted); font-size: .78rem; }
.site-footer .version-warn { max-width: 1140px; margin: 0 auto .6rem; padding: .45rem .8rem; border-radius: 8px; background: #fffbeb; color: var(--warn); font-size: .85rem; }

/* home + books */
.hero-lead { font-size: 1.08rem; line-height: 1.5; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.filter-bar label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--muted); min-width: 170px; }
.filter-bar select { min-height: 38px; }
.book-group { margin-top: 1.5rem; }
.group-sub { margin: 1rem 0 .5rem; color: var(--navy); font-size: 1rem; }

/* notifications */
.note-list { display: flex; flex-direction: column; gap: .5rem; }
.note-item { display: flex; gap: .8rem; align-items: flex-start; padding: .85rem 1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.note-item.unread { border-left: 4px solid var(--blue); background: #f8faff; }
.note-icon { font-size: 1.4rem; line-height: 1; }
.note-main { flex: 1; min-width: 0; }
.note-title { font-weight: 600; }
.note-body { color: var(--ink); font-size: .93rem; margin-top: .15rem; }
.note-meta { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.note-item .actions { margin-top: .5rem; }
.empty { text-align: center; color: var(--muted); }

/* teachers, students, assignments */
.person { display: flex; gap: .8rem; align-items: flex-start; }
.person img, .person .avatar { width: 48px; height: 48px; border-radius: 50%; flex: none; object-fit: cover; display: grid; place-items: center; }
.person .avatar { background: var(--gold); color: var(--navy-2); font-weight: 700; font-size: 1.2rem; }
.person-main { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.work-list { display: flex; flex-direction: column; gap: .5rem; }
.work-item { display: flex; align-items: center; gap: .9rem; color: inherit; margin: 0; }
.work-item:hover { text-decoration: none; border-color: var(--blue); }
.work-item.late { border-left: 4px solid var(--err); }
.work-icon { font-size: 1.5rem; width: 2rem; text-align: center; }
.work-icon.big { font-size: 2.2rem; width: 3rem; }
.work-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.work-head { display: flex; gap: 1rem; align-items: flex-start; }
.work-head > div { flex: 1; }
.work-details { white-space: pre-wrap; background: var(--bg); border-radius: 10px; padding: .8rem 1rem; margin: 1rem 0; }
.progress-pill { white-space: nowrap; padding: .2rem .65rem; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-weight: 600; font-size: .85rem; }
.kind-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.kind-btn { display: flex; align-items: center; gap: .5rem; justify-content: center; padding: .7rem; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; }
.kind-btn span { font-size: 1.3rem; }
.kind-btn.active { border-color: var(--blue); background: var(--blue-soft); color: var(--navy); font-weight: 600; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .35rem .9rem; margin: .5rem 0 1rem; }
.check { display: flex; align-items: center; gap: .45rem; font-size: .93rem; }
.block-label { display: flex; flex-direction: column; gap: .3rem; margin: .6rem 0; }
.block-label textarea, .block-label input, .block-label select { width: 100%; }
.add-card { border: 2px dashed var(--line); background: transparent; font: inherit; color: var(--blue); cursor: pointer; min-height: 110px; }
.add-card:hover { border-color: var(--blue); }

/* contact */
.contact-grid { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(300px, 2fr); gap: 1rem; align-items: start; }
.contact-line { font-size: .95rem; }
.msg-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.msg-body { white-space: pre-wrap; background: var(--bg); padding: .75rem 1rem; border-radius: 10px; margin: .6rem 0; }

/* AI */
.ai-answer { background: #f8faff; border: 1px solid #dbe4ff; border-radius: 12px; padding: 1rem 1.1rem; margin-top: 1rem; }
.ai-q.saved { opacity: .75; }
.ai-link { margin-left: .25rem; }
.review-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .6rem; }
.review-row input { flex: 1; min-width: 200px; }

@media (max-width: 1080px) {
    .nav-toggle { display: inline-grid; place-items: center; order: 3; }
    .topnav-right { order: 2; }
    .topnav-menu {
        display: none; position: absolute; top: var(--topnav-h); left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 0; padding: .5rem;
        background: var(--navy-2); max-height: calc(100vh - var(--topnav-h)); overflow-y: auto;
        box-shadow: 0 12px 24px rgba(0,0,0,.25);
    }
    .topnav-menu.open { display: flex; }
    .topnav-menu .top-link { width: 100%; justify-content: space-between; padding: .7rem .8rem; }
    .topnav-menu .dd-panel { position: static; box-shadow: none; border: 0; margin: 0 0 .4rem; min-width: 0; background: rgba(255,255,255,.06); }
    .topnav-menu .dd-item, .topnav-menu .dd-head, .topnav-menu .dd-note { color: #e0e7ff; }
    .topnav-menu .dd-item:hover { background: rgba(255,255,255,.1); }
    .topnav-menu .dd-wide { min-width: 0; }
    .topnav-menu .dd-columns { grid-template-columns: 1fr; }
    .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .topnav .brand-name { display: none; }
    .work-head { flex-direction: column; }
    .continue-actions { margin-left: 0; }
}

/* 2.6.0 Book extraction panel */
.bar { display: block; height: 8px; border-radius: 999px; background: #e5e7eb; overflow: hidden; margin: .35rem 0; max-width: 420px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--ok)); border-radius: 999px; transition: width .4s; }
.bar.big { height: 14px; max-width: none; flex: 1; }
.progress-row { display: flex; align-items: center; gap: .8rem; }
.table input.num { width: 5.5rem; }
.table input { width: 100%; min-width: 0; }
.row-error td { background: #fef2f2; }

/* 2.7.0 Toasts (pop-up messages) and notification switch */
.toaster { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .5rem; width: min(380px, calc(100vw - 2rem)); }
.toast {
    display: flex; gap: .7rem; align-items: flex-start; padding: .8rem .9rem; border-radius: 12px;
    background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--blue);
    box-shadow: 0 12px 30px rgba(15, 23, 42, .18); animation: toast-in .25s ease-out;
}
.toast-success { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--err); }
.toast-icon {
    flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
    font-weight: 700; color: #fff; background: var(--blue); font-size: .95rem;
}
.toast-success .toast-icon { background: var(--ok); }
.toast-error .toast-icon { background: var(--err); }
.toast-info .toast-icon { background: #eef2ff; }
.toast-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; font-size: .92rem; }
.toast-main b { color: var(--ink); }
.toast-main span { color: var(--muted); }
.toast-main small { color: var(--blue); font-weight: 600; }
.toast-close { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .9rem; padding: .1rem .2rem; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.notify-switch { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; font-size: .92rem; }
.notify-switch span { flex: 1; min-width: 220px; }
@media (max-width: 600px) {
    .toaster { top: calc(var(--topnav-h) + .5rem); bottom: auto; left: 1rem; right: 1rem; width: auto; }
}
@media print { .toaster { display: none !important; } }

/* ---- 2.10.0 SEO: internal links (book intro, related books, exercise list, unit nav, footer books) ---- */
.book-intro { max-width: 70ch; margin: .5rem 0 0; line-height: 1.6; }
.related, .unit-links { margin-top: 2rem; }
.related h2, .unit-links h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.related-links, .ex-links { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .35rem 1rem; }
.ex-links a, .related-links a { font-weight: 600; }
.ex-nav, .unit-nav { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; align-items: center; margin-top: 1rem; }
.footer-books { display: flex; flex-direction: column; gap: .2rem; }
.footer-books a { font-size: .9rem; }

/* ---- 2.11.0 Program code (Computer Science): ``` blocks and `inline code` in questions, solutions and reading ---- */
.code-block {
    direction: ltr; text-align: left; white-space: pre; overflow-x: auto;
    background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: .75rem 1rem; margin: .5rem 0;
    font-family: Consolas, "Cascadia Mono", "Courier New", monospace; font-size: .9rem; line-height: 1.5; tab-size: 4;
}
.code-block code { font: inherit; color: inherit; background: none; padding: 0; }
.code-inline {
    font-family: Consolas, "Cascadia Mono", "Courier New", monospace; font-size: .92em;
    background: var(--blue-soft); color: var(--navy-2); border-radius: 5px; padding: .05em .35em; white-space: pre-wrap;
}
@media print {
    .code-block { white-space: pre-wrap; background: #fff; color: #000; border: 1px solid #999; break-inside: avoid; }
    .code-inline { background: none; border: 1px solid #ccc; }
}
.pdf-export .code-block { white-space: pre-wrap; background: #fff; color: #000; border: 1px solid #999; }

/* ===================== 2.14.0 Pricing, cart, checkout, receipts, legal pages ===================== */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.plan { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow);
        display: flex; flex-direction: column; gap: .6rem; position: relative; }
.plan h2 { margin: 0; font-size: 1.2rem; }
.plan-best { border: 2px solid var(--gold); }
.plan-ribbon { position: absolute; top: -.7rem; right: 1rem; background: var(--gold); color: #fff; font-size: .75rem; font-weight: 700;
               border-radius: 999px; padding: .15rem .6rem; }
.plan-price { font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.plan-price small { font-size: .9rem; font-weight: 600; color: var(--muted); }
.plan-pkr { font-weight: 600; color: var(--ink); }
.plan ul { margin: .2rem 0; padding-left: 1.1rem; }
.plan li { margin: .2rem 0; }
.plan .btn { margin-top: auto; }
.price-note { font-size: .9rem; color: var(--muted); }
.price-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .6rem; }
.price-book { display: flex; align-items: center; justify-content: space-between; gap: .6rem; background: var(--card);
              border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; }
.price-book .title { font-weight: 600; }
.cart-line { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.cart-line .line-main { flex: 1; }
.cart-price { text-align: right; white-space: nowrap; font-weight: 700; }
.cart-price small { display: block; font-weight: 400; color: var(--muted); }
.cart-total { display: flex; justify-content: space-between; align-items: center; font-size: 1.15rem; font-weight: 700;
              border-top: 2px solid var(--line); padding-top: .8rem; margin-top: .4rem; }
.checkout-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 800px) { .checkout-grid { grid-template-columns: 1fr; } }
.accept-box { background: var(--blue-soft); border-radius: 10px; padding: .8rem; }
.accept-box label { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
.accept-box input { margin-top: .25rem; width: 1.1rem; height: 1.1rem; }
.sandbox-banner { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; border-radius: 10px; padding: .6rem .8rem; margin: .6rem 0; font-weight: 600; }
.secure-note { font-size: .85rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; }
.receipt { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; max-width: 820px; }
.receipt-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 2px solid var(--navy); padding-bottom: .8rem; margin-bottom: .8rem; }
.receipt-head img { max-height: 64px; max-width: 200px; }
.receipt-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .4rem 1rem; margin: .8rem 0; }
.receipt-meta div { font-size: .92rem; }
.receipt-meta b { display: block; color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; }
.order-state { border-radius: 10px; padding: .8rem 1rem; margin-bottom: 1rem; }
.order-state.ok { background: var(--ok-soft); color: var(--ok); }
.order-state.wait { background: #fffbeb; color: var(--warn); }
.order-state.bad { background: var(--err-soft); color: var(--err); }
.legal { max-width: 860px; line-height: 1.65; }
.legal h2 { margin-top: 1.6rem; font-size: 1.15rem; }
.legal .legal-meta { color: var(--muted); font-size: .9rem; }
.legal-links { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .9rem; }
.settings-section { margin-bottom: 1.5rem; }
.settings-section h2 { margin-top: 0; }
.logo-preview { max-height: 70px; max-width: 220px; border: 1px solid var(--line); border-radius: 8px; padding: .3rem; background: #fff; }
.copy-url { font-family: Consolas, monospace; font-size: .85rem; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .5rem; word-break: break-all; }
.event-log { font-family: Consolas, monospace; font-size: .78rem; white-space: pre-wrap; background: var(--bg); border-radius: 8px; padding: .5rem; max-height: 260px; overflow: auto; }
.brand-company-logo { height: 30px; width: auto; border-radius: 6px; background: #fff; padding: 2px; }
@media print {
    .receipt { border: 0; padding: 0; max-width: none; }
    .order-state, .no-print-receipt { display: none !important; }
}

/* 2.14.0 (b) - legal contact block, footer legal links */
.company-contact { margin: .5rem 0 1rem; line-height: 1.6; }
.site-footer .legal-links a { margin: 0 .15rem; }

/* 2.16.0 - original book links, Solution Book (licence line on every printed page), report link, staff notes */
.book-links { margin: .6rem 0; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.book-links p { flex-basis: 100%; margin: .2rem 0 0; }
.report-link { color: var(--muted, #64748b); }
.note-input { min-width: 16rem; flex: 1; }
.tab-select { margin-left: auto; }
.solution-book .sb-licence { font-size: .75rem; color: #94a3b8; text-align: right; }
.solution-book .sb-exercise { margin: 1rem 0 .4rem; font-size: 1.05rem; border-bottom: 1px solid #e2e8f0; }
.solution-book .sb-question { break-inside: avoid-page; page-break-inside: avoid; padding: .5rem 0; border-bottom: 1px dashed #e2e8f0; }
.solution-book .sb-unit + .sb-unit { break-before: page; page-break-before: always; }
@media print {
    .solution-book .sb-licence { position: fixed; top: 0; right: 0; }
}

/* 2.17.0 - Explain with AI (free AI websites, no key) */
.ask-ai { margin: .5rem 0; padding: .6rem .75rem; border: 1px solid var(--line, #e2e8f0); border-radius: 10px; background: var(--soft, #f8fafc); }
.ask-ai-buttons { display: flex; flex-wrap: wrap; gap: .4rem; margin: .35rem 0; }
.ask-ai p { margin: .2rem 0; }
@media print { .ask-ai { display: none; } }

/* 2.18.0 - in-app dialogs (instead of the browser's confirm / alert) */
.dlg-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(15, 23, 42, .45); display: flex;
                align-items: center; justify-content: center; padding: 1rem; animation: dlg-fade .12s ease-out; }
.dlg { background: var(--card, #fff); color: inherit; width: min(440px, 100%); border-radius: 14px; padding: 1.1rem 1.2rem 1rem;
       box-shadow: 0 20px 50px rgba(15, 23, 42, .3); outline: none; animation: dlg-pop .14s ease-out; }
.dlg-head { display: flex; align-items: center; gap: .55rem; margin-bottom: .35rem; }
.dlg-head h2 { margin: 0; font-size: 1.1rem; }
.dlg-icon { font-size: 1.35rem; line-height: 1; }
.dlg-text { margin: .3rem 0 1rem; line-height: 1.5; white-space: pre-line; }
.dlg-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.dlg-danger .dlg-icon { color: var(--err, #b91c1c); }
@keyframes dlg-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dlg-pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 520px) {
    .dlg-backdrop { align-items: flex-end; padding: 0; }
    .dlg { border-radius: 16px 16px 0 0; padding-bottom: 1.4rem; }
    .dlg-actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .dlg, .dlg-backdrop { animation: none; } }

/* 2.21.0 - "Install app" button (menu and footer); app window without the browser bar */
.install-btn { white-space: nowrap; padding-left: .5rem; }
.link-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; text-align: left; }
@media (max-width: 520px) { .install-btn { font-size: .8rem; padding: .3rem .4rem; } }
@media (display-mode: standalone) { .install-btn { display: none; } }

/* 2.22.0 - Smart Syllabus: choice on Make a paper, excluded-content list, paper-pattern papers, Admin page */
.smart-choice { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .6rem; padding: .6rem .75rem;
    background: var(--blue-soft); border-radius: var(--radius); }
.smart-excluded { margin: .2rem 0 .7rem; }
.smart-excluded > summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.smart-pattern-note { background: var(--ok-soft); border-radius: var(--radius); padding: .6rem .8rem; }
.smart-items { display: grid; gap: .6rem; margin-top: .5rem; }
.smart-unit { border: 1px solid var(--line); border-radius: 10px; padding: .5rem .75rem; background: var(--card); }
.smart-unit-title { margin-bottom: .25rem; }
.smart-unit ul { margin: 0; padding-inline-start: 1.1rem; }
.smart-unit li { margin: .15rem 0; }
.smart-tag { display: inline-block; font-size: .72rem; padding: 0 .4rem; margin-inline-end: .3rem; border-radius: 999px;
    background: var(--line); color: var(--ink); vertical-align: middle; }
.smart-kind-1 .smart-tag { background: var(--err-soft); color: var(--err); }
.smart-kind-5 .smart-tag { background: var(--ok-soft); color: var(--ok); }
.smart-tabs { flex-wrap: wrap; margin: .5rem 0 .8rem; }
.smart-admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.smart-admin-form { margin: .6rem 0; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-radius: 999px; padding: .1rem .6rem; }
.pattern-group + .pattern-group { margin-top: .6rem; }
.pattern-long .item-body { flex: 1; }
.pattern-part { display: flex; gap: .5rem; align-items: flex-start; padding: .25rem 0; }
.pattern-part .part-body { flex: 1; min-width: 0; }
.part-label { font-weight: 600; min-width: 1.8rem; }
.part-marks { white-space: nowrap; color: var(--muted); }
.paper.pdf-export .part-marks, .paper.pdf-export .smart-tag { color: #000; }

/* 2.22.3 - Smart Syllabus on the Pricing page */
.smart-promo { margin: 1.2rem 0; padding: 1rem 1.2rem; border-radius: var(--radius); background: var(--blue-soft);
    border: 1px solid #c7d7fe; }
.smart-promo h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.smart-badge { display: inline-block; margin: .15rem .3rem .15rem 0; padding: .05rem .55rem; border-radius: 999px;
    background: var(--ok-soft); color: var(--ok); font-size: .8rem; text-decoration: none; }

/* 2.23.0 - Sales Officers: contact box (checkout, pricing, failed order), record-a-sale page */
.sales-contact { margin: 1rem 0; padding: .8rem 1rem; border-radius: var(--radius); background: var(--ok-soft); border: 1px solid #b7e4c7; }
.sales-contact.is-compact { padding: .55rem .8rem; }
.sales-contact-title { font-weight: 700; margin-bottom: .3rem; }
.sales-contact ul { list-style: none; margin: .2rem 0; padding: 0; display: grid; gap: .3rem; }
.sales-contact li { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; }
.sales-contact li a { text-decoration: none; white-space: nowrap; }
.sales-contact p { margin: .3rem 0; }
.sale-books { margin: .5rem 0 .8rem; }
.nowrap { white-space: nowrap; }

/* 2.23.1 - refund policy highlight */
.legal-highlight { margin: .8rem 0 1rem; padding: .7rem .9rem; border-radius: var(--radius); background: var(--blue-soft); border: 1px solid #c7d7fe; }

/* 2.24.0 - tagline: in the header on wide screens, as a thin bar under the header on smaller screens */
.topnav .brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.topnav .brand-tagline { display: none; font-size: .68rem; font-weight: 500; color: #c7d2fe; white-space: normal; max-width: 260px; }
.tagline-bar { background: #eef2ff; color: #3730a3; font-size: .78rem; text-align: center; padding: .25rem .75rem; border-bottom: 1px solid #e0e7ff; }
@media (min-width: 1280px) {
    .topnav .brand-tagline { display: block; }
    .tagline-bar { display: none; }
}
@media print { .tagline-bar { display: none; } }
.alert-info { background: var(--blue-soft); color: #1e3a8a; border: 1px solid #c7d7fe; }   /* 2.25.0 */

/* 2.27.0 - textbook disclaimer */
.textbook-disclaimer { margin: .8rem 0; padding: .7rem .9rem; border-radius: 8px; background: #fff8e1; border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b; color: #44403c; font-size: .9rem; line-height: 1.5; }
.textbook-disclaimer b:first-child { color: #166534; }
.paper .textbook-disclaimer { font-size: .8rem; background: #fffdf5; }
@media print { .textbook-disclaimer { background: #fff; border-color: #999; color: #000; } }

/* 2.28.0 - complete solutions: read online only (no selection, nothing printed) */
.solution-reader { -webkit-user-select: none; user-select: none; }
.print-blocked { display: none; }
@media print {
    .solution-reader, .solution-reader * { display: none !important; }
    .print-blocked { display: block !important; font-size: 14pt; text-align: center; margin-top: 30vh; }
}

/* 2.29.0 - Original textbook page */
.textbook-links { display: grid; gap: .6rem; }
.textbook-link { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }

/* 2.30.0 - textbook viewer (publisher's Google Drive file) */
.textbook-tabs { flex-wrap: wrap; margin: .5rem 0; }
.textbook-viewer { margin: .8rem 0 .4rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #f8fafc; }
.textbook-viewer iframe { display: block; width: 100%; height: 80vh; min-height: 520px; border: 0; }
@media (max-width: 600px) { .textbook-viewer iframe { height: 75vh; min-height: 420px; } }

/* 2.30.2 - download button and disclaimer centred below the textbook viewer */
.textbook-below { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .4rem; margin: 1rem auto; max-width: 820px; }
.textbook-below .textbook-disclaimer { text-align: center; margin-top: .4rem; }

/* 2.31.0 - Sales mode: free page */
.free-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; margin: 1rem 0; }
.free-book { display: flex; flex-direction: column; gap: .15rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--card); text-decoration: none; color: inherit; }
.free-book:hover { border-color: var(--blue); }
.sales-mode .seg { margin: .4rem 0; flex-wrap: wrap; }

/* 2.31.1 – guests: sign in to keep records */
.keep-record { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
    background: var(--blue-soft); border: 1px solid #c7d7fe; color: #1e3a8a; border-radius: 10px; padding: .6rem .85rem; margin: 0 0 1rem; }
.keep-record span { flex: 1 1 18rem; }
