:root {
  --bg: #f6f7fb; --card: #fff; --text: #1d2033; --muted: #646a85; --line: #e3e5ef;
  --brand: #4f46e5; --brand-2: #06b6d4; --brand-soft: #eef0ff; --ok: #059669; --ok-soft: #e7f8f1;
  --warn: #b45309; --warn-soft: #fff5e5; --bad: #dc2626; --bad-soft: #fdecec; --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 24, 60, .06), 0 4px 16px rgba(20, 24, 60, .05);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11131c; --card: #1a1d2a; --text: #e9eaf2; --muted: #9aa0bd; --line: #2b2f42; --brand: #818cf8;
    --brand-soft: #23264a; --ok: #34d399; --ok-soft: #12302a; --warn: #fbbf24; --warn-soft: #33270f; --bad: #f87171; --bad-soft: #3a1b1b;
    --shadow: none; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* layout */
.top { position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; text-decoration: none; color: var(--text); }
.brand img { width: 28px; height: 28px; }
.top select { max-width: 52vw; }
.wrap { display: flex; max-width: 1180px; margin: 0 auto; }
.side { width: 220px; flex: none; padding: 16px 10px; position: sticky; top: 56px; align-self: flex-start; }
.side a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.side a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.main { flex: 1; min-width: 0; padding: 18px 16px 90px; }
.tabs { display: none; }
@media (max-width: 760px) {
  .side { display: none; }
  .tabs { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabs a { flex: 1; text-align: center; padding: 8px 2px 6px; font-size: .72rem; color: var(--muted); text-decoration: none; }
  .tabs a .i { display: block; font-size: 1.25rem; line-height: 1.2; }
  .tabs a.on { color: var(--brand); font-weight: 600; }
}
.i { font-style: normal; }

/* parts */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-size: 1.5rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.list > li:first-child { border-top: 0; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: .78rem; background: var(--brand-soft); color: var(--brand); font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
.when { width: 64px; flex: none; text-align: center; background: var(--brand-soft); color: var(--brand); border-radius: 10px; padding: 6px 2px; font-size: .78rem; line-height: 1.2; }
.when b { display: block; font-size: 1.05rem; }
.empty { text-align: center; color: var(--muted); padding: 22px 8px; }
.hero { background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #fff; border: 0; }
.hero .muted { color: rgba(255, 255, 255, .85); }
.hero .btn { background: #fff; color: var(--brand); }

/* forms */
label { display: block; font-weight: 600; font-size: .88rem; margin: 12px 0 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
input[type=checkbox], input[type=radio] { width: auto; }
input.secret { -webkit-text-security: disc; text-security: disc; }
textarea { min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 10px 16px;
  background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.alt { background: var(--brand-soft); color: var(--brand); }
.btn.ghost { background: transparent; color: var(--brand); padding: 6px 10px; }
.btn.bad { background: var(--bad-soft); color: var(--bad); }
.btn.sm { padding: 6px 12px; font-size: .88rem; }
.btn[disabled] { opacity: .6; cursor: default; }
.btn.block { width: 100%; }
.err { color: var(--bad); font-size: .9rem; margin-top: 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } }
.picks { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.picks .check { margin: 4px 0; }

/* auth */
.auth { max-width: 420px; margin: 6vh auto; padding: 0 16px; }
.auth .brand { justify-content: center; font-size: 1.6rem; margin-bottom: 6px; }
.auth .brand img { width: 40px; height: 40px; }
.seg { display: flex; background: var(--brand-soft); border-radius: 10px; padding: 3px; margin-bottom: 4px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 8px; font: inherit; color: var(--brand); cursor: pointer; }
.seg button.on { background: var(--card); font-weight: 700; box-shadow: var(--shadow); }

/* modal & toast */
#modal { position: fixed; inset: 0; z-index: 20; background: rgba(10, 12, 30, .45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; overflow: auto; }
#modal[hidden] { display: none; }
#modal .box { background: var(--card); border-radius: var(--radius); width: 100%; max-width: 560px; padding: 18px; }
#toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: #1d2033; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 30; max-width: 90vw; }
#toast.show { opacity: 1; }

/* classroom & tests */
.room { position: fixed; inset: 0; z-index: 15; background: #000; display: flex; flex-direction: column; }
.room .bar { display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: #111; color: #fff; }
.room iframe { flex: 1; border: 0; width: 100%; }
.q { padding: 14px 0; border-top: 1px solid var(--line); }
.q:first-child { border-top: 0; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; font-weight: 400; cursor: pointer; }
.opt input { margin-top: 4px; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.timer { position: sticky; top: 60px; z-index: 4; }
.qedit { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; }
.pre { white-space: pre-wrap; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
th { font-size: .82rem; color: var(--muted); border-top: 0; }
.scroll { overflow-x: auto; }

/* notification bell */
.bell { position: relative; text-decoration: none; font-size: 1.25rem; padding: 4px 6px; }
.bell span { position: absolute; top: -2px; right: -6px; background: var(--bad); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 99px; padding: 0 5px; line-height: 16px; min-width: 16px; text-align: center; }

/* progress bars */
.barrow { display: grid; grid-template-columns: 44px 1fr 44px; gap: 8px; align-items: center; margin: 4px 0; }
.track { display: block; height: 10px; background: var(--brand-soft); border-radius: 99px; overflow: hidden; }
.track span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 99px; }

/* public tutor pages */
main.pub { max-width: 880px; margin: 0 auto; padding: 18px 16px 40px; }
footer.pub { text-align: center; padding: 20px 16px 40px; }
a.card.tutor { display: block; color: inherit; text-decoration: none; }
a.card.tutor:hover { border-color: var(--brand); }
.hero form input, .hero form select { color: var(--text); }

/* print (reports, receipts) */
@media print {
  .top, .side, .tabs, .noprint, #toast { display: none !important; }
  body, .card { background: #fff; color: #000; box-shadow: none; }
  .main { padding: 0; }
  .card { border: 0; }
}
