:root {
  --bg: #f2f0eb;
  --ink: #1d2733;
  --muted: #66707c;
  --line: #e3e1dc;
  --card: #ffffff;
  --accent: #1f4e79;
  --accent-soft: #e6eef6;
  --ok: #2e7d4f;
  --ok-soft: #e4f2ea;
  --wait: #b7791f;
  --wait-soft: #fbf0dc;
  --no: #9aa0a6;
  --no-soft: #eef0f2;
  --bad: #b4443b;
  --bad-soft: #fbe9e7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--ink); }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; line-height: 1.4; min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; padding: 12px 0 24px;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
select { font: inherit; color: inherit; }
code { font-size: 12px; }

/* demo controls, outside the phone */
.demo-bar { width: 390px; max-width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 8px 10px; font-size: 12px; color: var(--muted); }
.demo-bar b { color: var(--ink); margin-right: 2px; }
.seg { display: inline-flex; background: #e4e1da; border-radius: 9px; padding: 2px; }
.seg button { padding: 5px 10px; border-radius: 7px; font-weight: 600; font-size: 12px; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.demo-bar select { padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 12px; max-width: 150px; }
.demo-bar .reset { margin-left: auto; text-decoration: underline; font-size: 12px; }

/* phone frame */
.phone { width: 390px; height: 800px; background: #111; border-radius: 42px; padding: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); display: flex; flex-direction: column; }
.screen { flex: 1; overflow-y: auto; background: #fafafa; border-radius: 32px 32px 0 0; padding: 16px 14px 20px; }
.nav { height: 58px; flex: none; background: #fff; border-top: 1px solid var(--line); border-radius: 0 0 32px 32px; display: flex; justify-content: space-around; align-items: center; }
.nav button { font-size: 12px; color: var(--muted); padding: 8px 10px; text-align: center; }
.nav button.on { color: var(--accent); font-weight: 700; }
.foot { width: 390px; max-width: 100%; color: var(--muted); font-size: 12px; text-align: center; margin-top: 12px; padding: 0 8px; }

/* on a real phone the frame disappears */
@media (max-width: 440px) {
  body { padding: 0; }
  .demo-bar { padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
  .phone { width: 100%; height: auto; min-height: calc(100vh - 46px); border-radius: 0; padding: 0; box-shadow: none; background: #fafafa; }
  .screen { border-radius: 0; padding: 14px 16px 20px; }
  .nav { border-radius: 0; position: sticky; bottom: 0; }
  .foot { padding: 0 16px 16px; }
}

/* content */
h1 { font-size: 21px; line-height: 1.2; }
h2 { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 4px 6px; }
.top { margin: 2px 2px 12px; }
.top p, .muted { color: var(--muted); }
.small { font-size: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.big { font-size: 24px; font-weight: 800; }
.bar { display: block; height: 8px; background: var(--no-soft); border-radius: 5px; overflow: hidden; margin: 8px 0 10px; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 5px; }
.bar.thin { height: 5px; margin: 6px 0 0; }
.counts { display: flex; gap: 6px; }
.counts div { flex: 1; border-radius: 10px; padding: 6px 8px; font-size: 11px; }
.counts b { display: block; font-size: 18px; }
.c-ok { background: var(--ok-soft); color: var(--ok); }
.c-wait { background: var(--wait-soft); color: var(--wait); }
.c-no { background: var(--no-soft); color: #5f666d; }
.banner { border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; font-weight: 600; }
.banner.ok { background: var(--ok-soft); color: var(--ok); }

.row { display: block; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; margin-bottom: 6px; }
.row .t { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.row .n { color: var(--muted); font-weight: 600; margin-right: 5px; font-size: 12px; }
.row .v { font-weight: 700; white-space: nowrap; }
.row .v.done { color: var(--ok); }
.ctx { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.item-row { display: flex; align-items: flex-start; gap: 8px; }
.item-row .grow { flex: 1; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 4px; background: #cfd3d7; }
.s-confirmed { background: var(--ok); }
.s-waiting { background: var(--wait); }
.s-returned { background: var(--bad); }
.s-notyet { background: #cfd3d7; }

.back { color: var(--accent); font-weight: 600; margin: 0 2px 10px; }
.chip { display: inline-block; border-radius: 20px; padding: 3px 9px; font-size: 11px; font-weight: 700; margin-right: 4px; }
.chip.id { background: var(--accent-soft); color: var(--accent); }
.chip.star { background: var(--bad-soft); color: var(--bad); }
.title { font-size: 21px; font-weight: 800; line-height: 1.2; margin: 8px 0 2px; }
.video { height: 180px; border-radius: 14px; background: linear-gradient(135deg, #2b3a4a, #17212b); position: relative; margin: 12px 0 8px; color: #fff; display: flex; align-items: flex-end; padding: 12px; font-size: 12px; font-weight: 600; }
.video .play { position: absolute; left: 50%; top: 42%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255, 255, 255, .9); }
.video .play::after { content: ""; position: absolute; left: 20px; top: 15px; border-left: 17px solid #17212b; border-top: 11px solid transparent; border-bottom: 11px solid transparent; }
a { color: var(--accent); font-weight: 600; text-decoration: none; }
.tl { padding-left: 18px; margin: 4px 0 8px; }
.tl div { position: relative; margin-bottom: 7px; }
.tl div::before { content: ""; position: absolute; left: -18px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #cfd3d7; }
.tl .s-waiting::before { background: var(--wait); }
.tl .s-confirmed::before { background: var(--ok); }
.tl .s-returned::before { background: var(--bad); }
.tl .s-waiting, .tl .s-confirmed, .tl .s-returned { background: none; }
.note { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 10px; }
.note.warn { background: var(--bad-soft); color: var(--bad); margin: 8px 0 0; }
.btn { display: block; width: 100%; text-align: center; border-radius: 12px; padding: 11px; font-weight: 700; margin: 6px 0 10px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.secondary { background: #fff; border: 1px solid var(--line); }

/* instructor */
.tabs { display: flex; background: #eceae5; border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.tabs button { flex: 1; text-align: center; padding: 7px 0; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.field { display: block; width: 100%; margin: 4px 0 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.picker { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 10px; }
.picker button { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 4px 9px; font-size: 12px; }
.picker button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.m { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 0; }
.list .m + .m { border-top: 1px solid var(--line); }
.m .grow { flex: 1; }
.who { font-weight: 600; }
.st { display: block; font-size: 11.5px; color: var(--muted); }
.st.confirmed { color: var(--ok); }
.st.waiting { color: var(--wait); }
.st.returned { color: var(--bad); }
.st.notyet { color: var(--no); }
.btns { display: flex; gap: 5px; flex: none; }
.b { border-radius: 8px; padding: 6px 9px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.b.yes { background: var(--ok); color: #fff; }
.b.not { background: #fff; color: var(--bad); border: 1px solid #e5c3bf; }
.b.link { color: var(--muted); font-weight: 600; text-decoration: underline; padding: 6px 2px; }
.empty { color: var(--muted); padding: 8px 2px; }
.levels { display: flex; flex-wrap: wrap; gap: 5px; }
.lv { display: inline-block; border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.lv.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; }
