/* MathPath Academy design system */
:root {
  /* Syvara Learning brand: royal blue #1247BC, navy #0F1F82, mist #E7EDF8, mint #9AE8C1 */
  --bg: #f8f9fb;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --border: #e1e5ee;
  --text: #31333f;
  --heading: #0f1f82;
  --muted: #5b6072;
  --faint: #8a8fa3;
  --primary: #1247bc;
  --primary-hover: #0f1f82;
  --primary-soft: #e7edf8;
  --accent: #158237;
  --accent-soft: #e3f6ea;
  --mint: #9ae8c1;
  --warn: #926c05;
  --warn-soft: #fff8db;
  --danger: #c53030;
  --danger-soft: #fdeaea;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 31, 130, .05), 0 4px 14px rgba(15, 31, 130, .06);
  --sidebar: 256px;
  --font: "Source Sans 3", "Source Sans Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Montserrat", "Source Sans 3", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1220; --surface: #171b2e; --surface-2: #1e2339; --border: #2a3050;
    --text: #e8eaf5; --heading: #c9d3ff; --muted: #a3a9c6; --faint: #737a9a;
    --primary: #6f9bff; --primary-hover: #9dbaff; --primary-soft: #232a52;
    --accent: #35c99c; --accent-soft: #15342c; --warn: #e6b04f; --warn-soft: #3a2f17;
    --danger: #f07070; --danger-soft: #3d1c1f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1220; --surface: #171b2e; --surface-2: #1e2339; --border: #2a3050;
  --text: #e8eaf5; --heading: #c9d3ff; --muted: #a3a9c6; --faint: #737a9a;
  --primary: #6f9bff; --primary-hover: #9dbaff; --primary-soft: #232a52;
  --accent: #35c99c; --accent-soft: #15342c; --warn: #e6b04f; --warn-soft: #3a2f17;
  --danger: #f07070; --danger-soft: #3d1c1f;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; font-family: var(--display); color: var(--heading); font-weight: 700; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
img { max-width: 100%; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 1rem; line-height: 1.2; color: var(--heading); padding: 4px 10px 18px; }
.brand small { display: block; font-family: var(--font); font-weight: 500; font-size: .74rem; color: var(--faint); }
.brand:hover { text-decoration: none; }
/* ΣνΜ = S·V·M in Greek letters (Sigma, Nu, Mu) */
.brand-mark { min-width: 34px; height: 34px; padding: 0 7px; border-radius: 10px; background: linear-gradient(135deg, #1247bc, #0f1f82); color: #fff; display: grid; place-items: center; flex: none; font-family: var(--serif); font-size: 1.05rem; font-weight: 700; letter-spacing: .04em; line-height: 1; }
.nav-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 14px 10px 4px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; flex: none; }
.main { min-width: 0; }
.topbar { display: none; }
.content { max-width: 1180px; margin: 0 auto; padding: 28px 32px 64px; }
.content.narrow { max-width: 820px; }

.public-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 32px; max-width: 1180px; margin: 0 auto; gap: 12px; }
.public-top nav { display: flex; gap: 18px; align-items: center; }
.public-top nav a:not(.btn) { color: var(--muted); font-weight: 500; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
  .content { padding: 20px 16px 48px; }
  .public-top { padding: 14px 16px; }
  .public-top nav a.hide-sm { display: none; }
}
.scrim { display: none; }
.sidebar.open + .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 45; }

/* ---------- components ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }  /* the grid gap spaces cards; extra margin made them uneven */
.grid + .card, .grid + .grid, .card + .grid { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font: 600 .95rem var(--font); cursor: pointer; background: var(--primary); color: #fff; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: var(--accent); filter: brightness(.93); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger-soft); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 6px 11px; font-size: .84rem; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--primary); padding: 0; font: inherit; cursor: pointer; }
form.inline { display: inline; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge-free { background: var(--accent-soft); color: var(--accent); }
.badge-locked { background: var(--warn-soft); color: var(--warn); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.diff-Easy { background: var(--accent-soft); color: var(--accent); }
.diff-Medium { background: var(--primary-soft); color: var(--primary); }
.diff-Hard { background: var(--danger-soft); color: var(--danger); }

.flash-stack { display: grid; gap: 8px; margin-bottom: 18px; }
.flash { padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); display: flex; justify-content: space-between; gap: 12px; }
.flash-success { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.flash-error { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.flash-info { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.flash button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 1.1rem; line-height: 1; }
.notice { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: .9rem; margin-bottom: 16px; }

/* forms */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.hint { font-size: .8rem; color: var(--faint); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit;
}
textarea { resize: vertical; min-height: 110px; font-family: var(--mono); font-size: .88rem; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 160px; }

/* tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.empty { text-align: center; color: var(--faint); padding: 28px 12px; }

/* stats */
.stat { padding: 18px 20px; }
.stat .label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.stat .value { font-size: 1.65rem; font-weight: 750; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .8rem; color: var(--faint); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding-top: 8px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .fill { width: 100%; max-width: 42px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .bar span { font-size: .7rem; color: var(--faint); white-space: nowrap; }
.bars .bar:hover .fill { background: var(--primary-hover); }

/* courses */
.level-title { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; }
.level-title:first-child { margin-top: 0; }
.course-card { display: flex; flex-direction: column; gap: 10px; color: var(--text); transition: transform .15s, border-color .15s; }
.course-card:hover { text-decoration: none; border-color: var(--primary); transform: translateY(-2px); }
.course-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font: 700 1.35rem var(--serif); flex: none; }
.course-card .desc { color: var(--muted); font-size: .88rem; flex: 1; margin: 0; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 11px; border-radius: 99px; border: 1px solid var(--border); font-size: .82rem; color: var(--muted); background: var(--surface); }
.chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.q-list { display: grid; gap: 10px; }
.q-item { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; color: var(--text); padding: 16px 18px; }
.q-item:hover { border-color: var(--primary); text-decoration: none; }
.q-num { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.q-item .teaser { color: var(--muted); font-size: .86rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 620px) { .q-item { grid-template-columns: 1fr; } .q-num { display: none; } }

/* math content */
.math-content { font-family: var(--serif); font-size: 1.07rem; line-height: 1.75; overflow-wrap: break-word; }
.math-content .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.math-content table { border-collapse: collapse; margin: 12px 0; font-family: var(--font); font-size: .92rem; display: block; overflow-x: auto; }
.math-content th, .math-content td { border: 1px solid var(--border); padding: 6px 10px; }
.math-content pre { background: #0f1426; color: #e6e9f5; padding: 14px 16px; border-radius: var(--radius-sm); overflow-x: auto; font-size: .86rem; line-height: 1.55; }
.math-content pre code { background: none; padding: 0; color: inherit; }
.math-content code { font-family: var(--mono); font-size: .86em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.math-content blockquote { border-left: 3px solid var(--primary); margin: 0; padding-left: 14px; color: var(--muted); }
.math-content p:last-child { margin-bottom: 0; }

.solution-box { border: 1px solid var(--accent-soft); border-left: 4px solid var(--accent); }
.paywall { text-align: center; padding: 34px 24px; background: linear-gradient(180deg, var(--surface), var(--primary-soft)); }
.paywall .lock { font-size: 2rem; }
.blurred { filter: blur(6px); user-select: none; pointer-events: none; opacity: .6; margin-bottom: 16px; font-family: var(--serif); }
.options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; text-align: left; }
.option { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.option.featured { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.option .price { font-size: 1.4rem; font-weight: 750; }
.option form { margin-top: auto; }
@media (max-width: 760px) { .options { grid-template-columns: 1fr; } }

/* pricing */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.plan { display: flex; flex-direction: column; gap: 10px; }
.plan.featured { border: 2px solid var(--primary); position: relative; }
.plan .price { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; }
.plan ul { list-style: none; padding: 0; margin: 6px 0 12px; display: grid; gap: 8px; flex: 1; }
.plan li::before { content: "✓"; color: var(--accent); font-weight: 700; margin-right: 8px; }
.ribbon { position: absolute; top: -12px; left: 20px; background: var(--primary); color: #fff; font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
@media (max-width: 900px) { .plans { grid-template-columns: 1fr; } }

/* landing */
.hero { text-align: center; padding: 56px 16px 40px; max-width: 860px; margin: 0 auto; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.03em; line-height: 1.1; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, #1247bc, #0f1f82); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.12rem; color: var(--muted); max-width: 640px; margin: 16px auto 26px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-formula { font-size: 1.2rem; color: var(--faint); margin-top: 30px; }
.feature .ico { font-size: 1.5rem; }
.section { padding: 34px 32px; max-width: 1180px; margin: 0 auto; }
@media (max-width: 900px) { .section { padding: 26px 16px; } }
.footer { text-align: center; color: var(--faint); font-size: .84rem; padding: 30px 16px; border-top: 1px solid var(--border); margin-top: 30px; }

/* auth */
.auth-wrap { min-height: calc(100vh - 80px); display: grid; place-items: center; padding: 20px 16px; }
.auth-card { width: 100%; max-width: 420px; }

/* AI tutor */
.tutor { display: grid; grid-template-columns: 260px 1fr; gap: 16px; height: calc(100vh - 150px); min-height: 520px; }
.tutor-side { display: flex; flex-direction: column; gap: 10px; overflow: hidden; padding: 14px; }
.conv-list { overflow-y: auto; display: grid; gap: 2px; align-content: start; }
.conv-list a { display: block; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-list a:hover { background: var(--surface-2); text-decoration: none; }
.conv-list a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chat-log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 88%; padding: 12px 16px; border-radius: 14px; }
.msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.assistant.streaming { white-space: pre-wrap; }
.msg.error { align-self: center; background: var(--danger-soft); color: var(--danger); font-size: .9rem; }
.chat-form { border-top: 1px solid var(--border); padding: 12px; display: flex; gap: 10px; align-items: flex-end; }
.chat-form textarea { min-height: 48px; max-height: 200px; font-family: var(--font); font-size: .95rem; resize: none; }
.chat-empty { margin: auto; text-align: center; max-width: 440px; color: var(--muted); }
.suggestions { display: grid; gap: 8px; margin-top: 14px; }
.suggestions button { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; color: var(--text); font: inherit; font-size: .88rem; }
.suggestions button:hover { border-color: var(--primary); }
@media (max-width: 900px) { .tutor { grid-template-columns: 1fr; height: auto; } .tutor-side { max-height: 220px; } .chat { height: 70vh; } }

/* calendar */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dow { text-align: center; font-size: .74rem; color: var(--faint); font-weight: 600; text-transform: uppercase; padding-bottom: 4px; }
.cal .day { min-height: 78px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 8px; background: var(--surface); font-size: .85rem; display: flex; flex-direction: column; gap: 4px; text-align: left; font-family: inherit; color: var(--text); }
.cal .day.blank { background: transparent; border-color: transparent; }
.cal .day.past { color: var(--faint); background: var(--surface-2); }
.cal .day.today .n { background: var(--primary); color: #fff; border-radius: 99px; padding: 0 7px; }
.cal .day .n { font-weight: 600; align-self: flex-start; }
.cal button.day { cursor: pointer; }
.cal button.day.has { border-color: var(--accent); background: var(--accent-soft); }
.cal button.day.has:hover, .cal button.day.selected { box-shadow: 0 0 0 2px var(--accent); }
.cal .count { font-size: .72rem; color: var(--accent); font-weight: 600; }
.cal .slot-mini { font-size: .72rem; padding: 1px 5px; border-radius: 5px; background: var(--primary-soft); color: var(--primary); display: flex; justify-content: space-between; gap: 4px; align-items: center; }
.cal .slot-mini.booked { background: var(--accent-soft); color: var(--accent); }
.cal .slot-mini.held { background: var(--warn-soft); color: var(--warn); }
.cal .slot-mini form button { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; font-size: .8rem; }
@media (max-width: 620px) { .cal { gap: 3px; } .cal .day { min-height: 54px; padding: 4px; font-size: .78rem; } .cal .slot-mini { display: none; } .cal .count { font-size: .64rem; } }
.slot-list { display: grid; gap: 8px; }
.slot-btn { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font: inherit; color: var(--text); width: 100%; }
.slot-btn:hover, .slot-btn.selected { border-color: var(--primary); background: var(--primary-soft); }

/* admin review editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.preview-pane { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; min-height: 110px; overflow-x: auto; }
.preview-pane:empty::before { content: "Live preview appears here"; color: var(--faint); font-family: var(--font); font-size: .85rem; }
.source-preview { max-height: 520px; overflow: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.source-preview iframe { width: 100%; height: 520px; border: 0; }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 36px 20px; text-align: center; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input { display: none; }
.file-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; text-align: left; }
.file-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; font-size: .88rem; display: flex; justify-content: space-between; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } }

.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.overlay { position: fixed; inset: 0; background: rgba(15, 18, 32, .55); display: none; place-items: center; z-index: 100; color: #fff; text-align: center; }
.overlay.show { display: grid; }
.overlay .spinner { width: 42px; height: 42px; border-width: 3px; margin-bottom: 14px; }
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); cursor: pointer; padding: 5px 9px; font-size: .85rem; }

/* Dr. Sharon / Syvara additions */
.about-card { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.about-card .portrait { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, #1247bc, #0f1f82); color: #fff; display: grid; place-items: center; font: 700 1.15rem var(--serif); letter-spacing: .04em; }
.about-card p { margin: 0; }
.sidebar-about { margin: 10px 4px 0; padding: 12px; border-radius: var(--radius-sm); background: var(--primary-soft); font-size: .8rem; color: var(--muted); line-height: 1.45; }
.sidebar-about strong { color: var(--heading); display: block; margin-bottom: 2px; }
.info-banner { background: rgba(28, 131, 255, .1); color: #0054a3; border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 auto 8px; max-width: 760px; }
.back-link { font-size: .85rem; color: var(--muted); }
body.embedded .public-top .brand, body.embedded .footer { display: none; }
body.embedded .public-top { justify-content: flex-end; padding-top: 8px; padding-bottom: 8px; }
@media (max-width: 620px) { .about-card { grid-template-columns: 1fr; text-align: center; } .about-card .portrait { margin: 0 auto; } }

.plans.plans-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .plans.plans-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .plans.plans-4 { grid-template-columns: 1fr; } }
.q-num { width: auto; min-width: 40px; padding: 0 6px; font-size: .85rem; }

/* Socratic tutor */
.socratic-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.socratic-steps > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.socratic-steps span { grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; }
.socratic-steps strong { font-size: .9rem; color: var(--heading); }
.socratic-steps small { color: var(--muted); font-size: .8rem; }
.reveal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--primary-soft); font-size: .86rem; color: var(--text); }
.reveal-bar form { flex: none; }
@media (max-width: 620px) { .socratic-steps { grid-template-columns: 1fr; } .reveal-bar { flex-direction: column; align-items: stretch; } }
.how-it-works { margin: 8px 0 0; font-size: .86rem; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 7px 12px; display: inline-block; }
.how-it-works strong { color: var(--heading); font-weight: 600; }
.suggestions .small { display: block; margin-bottom: 2px; }

/* Tutor: current "new problem" marker, welcome text at the top, sidebar never scrolls sideways */
.conv-current { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary); font-weight: 600; text-align: center; }
.conv-current span { font-weight: 400; font-size: .8rem; color: var(--muted); }
.chat-log > .chat-empty { margin: 28px auto auto; }
.sidebar { overflow-x: hidden; }
.brand { min-width: 0; }
.brand > span:last-child { min-width: 0; overflow-wrap: anywhere; }

/* Tutor layout: columns start level; the blank page fits its content instead of filling the screen */
.tutor > .card + .card { margin-top: 0; }
.tutor.tutor-blank { height: auto; min-height: 0; }
.tutor.tutor-blank .chat-log { flex: none; overflow: visible; }
.tutor.tutor-blank .chat-log > .chat-empty { margin: 20px auto 8px; }
.chat-form > div { min-width: 0; }
.chat-form textarea { width: 100%; }
.chat-hint { font-size: .74rem; color: var(--faint); }

/* Question bank bulk show/hide */
.bulk-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.table tr.row-hidden td { background: var(--surface-2); }
.table tr.row-hidden td a:not(.btn) { color: var(--muted); }

/* "View as student" */
.view-as-bar { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 32px; background: #fff4d6; color: #5c4400; border-bottom: 1px solid #f0d58c; font-size: .9rem; }
.view-as-bar span { flex: 1 1 260px; }
.view-as-bar select { width: auto; padding: 5px 8px; font-size: .88rem; }
.nav-form { margin: 0; }
.nav-form button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); font: 500 1rem var(--font); cursor: pointer; text-align: left; }
.nav-form button:hover { background: var(--surface-2); color: var(--text); }
.nav-form svg { width: 18px; height: 18px; flex: none; }
@media (max-width: 900px) { .view-as-bar { padding: 10px 16px; } }

/* Tutor: free / locked notice for Question Bank problems */
.question-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 18px; background: var(--warn-soft); color: var(--text); border-bottom: 1px solid var(--border); font-size: .88rem; }
.question-note-free { background: var(--accent-soft); }
.question-note form { margin: 0; }
.admin-note { font-size: .8rem; color: var(--warn); margin-top: 3px; }
.admin-note a { color: inherit; text-decoration: underline; }

/* Undergraduate | Graduate tabs (green) */
.level-tabs { display: inline-flex; gap: 6px; padding: 5px; background: #e3f6ea; border: 1px solid #bfe6cc; border-radius: 12px; margin: 4px 0 14px; flex-wrap: wrap; }
.level-tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 9px; font-weight: 600; color: #146c2e; text-decoration: none; }
.level-tab:hover { background: #cdeed8; text-decoration: none; }
.level-tab.active { background: #158237; color: #fff; box-shadow: 0 1px 3px rgba(21, 130, 55, .35); }
.level-count { font-size: .76rem; font-weight: 500; padding: 1px 8px; border-radius: 99px; background: rgba(21, 130, 55, .12); }
.level-tab.active .level-count { background: rgba(255, 255, 255, .22); }
.level-hint { font-size: .88rem; color: #146c2e; background: #f0faf3; border-left: 3px solid #158237; padding: 8px 12px; border-radius: 6px; margin: -4px 0 16px; }
.level-tag { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 99px; font-size: .8rem; font-weight: 600; text-decoration: none; }
.level-tag-grad { background: #158237; color: #fff; }
.level-tag-ug { background: #e3f6ea; color: #146c2e; }
.level-tag:hover { text-decoration: none; filter: brightness(.95); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .level-tabs { background: #15342c; border-color: #1f4d3c; } :root:not([data-theme="light"]) .level-tab { color: #7fdca3; } :root:not([data-theme="light"]) .level-hint { background: #15342c; color: #9de3b8; } }
:root[data-theme="dark"] .level-tabs { background: #15342c; border-color: #1f4d3c; }
:root[data-theme="dark"] .level-tab { color: #7fdca3; }
:root[data-theme="dark"] .level-hint { background: #15342c; color: #9de3b8; }
.badge-purchased { background: #efe6fb; color: #6a1fa8; }
.plan li.not-included { color: var(--faint); }
.plan li.not-included::before { content: "–"; color: var(--faint); }
.contact-tutor { margin-top: 18px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2, #f5f8ff); }
.contact-tutor h3 { margin: 0 0 4px; font-size: 1.05rem; }
.contact-tutor textarea { width: 100%; margin: 8px 0 10px; }

.legal { max-width: 820px; margin: 0 auto; line-height: 1.65; }
.legal h2 { font-size: 1.15rem; margin: 22px 0 6px; }
.legal ul { padding-left: 1.2em; }
.legal li { margin: 4px 0; }
.legal-nav a.active { font-weight: 700; color: var(--text); }
.consent { margin-top: 12px; text-align: center; }
