/* Smartway Language Centre WIP, Stelix design language: obsidian + paper, ember accent, Instrument Sans, rounded surfaces.
   Type is never below 16px (also stops iOS zooming into inputs). */
@font-face { font-family: 'Instrument Sans'; font-weight: 400; src: url(fonts/InstrumentSans-400-latin.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Instrument Sans'; font-weight: 500; src: url(fonts/InstrumentSans-500-latin.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Instrument Sans'; font-weight: 600; src: url(fonts/InstrumentSans-600-latin.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Instrument Sans'; font-weight: 700; src: url(fonts/InstrumentSans-700-latin.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; src: url(fonts/InstrumentSerif-400-latin.woff2) format('woff2'); font-display: swap; }

:root {
  --obsidian: #0a0908; --obsidian-2: #181614; --paper: #f8f4ef; --card: #fff; --wash: #f1ece4; --hair: #e6dfd4;
  --ink: #1a1714; --muted: #6b645c; --ember: #ff6a00; --ember-rgb: 255,106,0; --ember-soft: #fff0e4; --ember-ink: #b34700;
  --ok: #2c7a4b; --ok-soft: #e4f3ea; --bad: #b42318; --bad-soft: #fdeceb; --warn: #8a5a00; --warn-soft: #fff4d6; --info: #2b5fb4; --info-soft: #e7eefb;
  --r: 16px; --r-sm: 11px; --shadow: 0 1px 2px rgba(10,9,8,.05), 0 8px 24px rgba(10,9,8,.06);
  --side: 264px; --top: 60px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 16px/1.5 'Instrument Sans', system-ui, sans-serif; color: var(--ink); background: var(--paper); min-height: 100dvh; overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
p { margin: 0; } a { color: var(--ember-ink); }
em.serif, .serif { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; color: var(--ember); letter-spacing: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: 16px; } .nowrap { white-space: nowrap; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 500 16px ui-monospace, 'JetBrains Mono', Menlo, monospace; color: var(--muted); }
.eyebrow::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ember); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- iOS: a fixed solid strip over the status bar, the header sticky and solid, document + theme-color the same colour ---- */
.ios-strip { position: fixed; top: 0; left: 0; right: 0; height: var(--sat); background: var(--paper); z-index: 60; pointer-events: none; }
.topbar { position: sticky; top: var(--sat); z-index: 30; min-height: var(--top); background: var(--paper); border-bottom: 1px solid var(--hair); display: flex; align-items: center; gap: 10px; padding: 8px 16px; }
.topbar .title { font-weight: 650; font-size: 20px; letter-spacing: -.02em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- shell ---- */
.shell { display: flex; min-height: 100dvh; }
.side { width: var(--side); flex: none; background: var(--obsidian); color: #efe9e0; display: flex; flex-direction: column; padding: calc(var(--sat) + 18px) 14px 16px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; font-weight: 650; font-size: 18px; }
.side .brand .mark { width: 32px; height: 32px; border-radius: 10px; background: var(--ember); display: grid; place-items: center; color: #fff; font-weight: 700; }
.side .group { font: 500 16px ui-monospace, Menlo, monospace; color: #9a9187; padding: 14px 10px 6px; }
.side a.nav { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: #d8d0c5; text-decoration: none; font-weight: 500; }
.side a.nav:hover { background: var(--obsidian-2); }
.side a.nav.on { background: var(--ember); color: #fff; }
.side a.nav .badge { margin-left: auto; background: rgba(255,255,255,.16); border-radius: 999px; padding: 0 9px; font-size: 16px; }
.side a.nav.on .badge { background: rgba(0,0,0,.22); }
.side .foot { margin-top: auto; padding: 14px 8px 0; color: #9a9187; }
.side .foot button { margin-top: 8px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { padding: 22px 24px calc(40px + var(--sab)); width: 100%; max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; justify-content: space-between; }
.page-head .sub { color: var(--muted); margin-top: 6px; }
.menu-btn { display: none; }
.wip { display: inline-flex; align-items: center; gap: 6px; background: var(--ember-soft); color: var(--ember-ink); border-radius: 999px; padding: 2px 12px; font-weight: 600; white-space: nowrap; }

/* drawer (phone) */
.stx-scrim { z-index: 70; }
@media (max-width: 767px) {
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 88vw); z-index: 80; transform: translateX(-100%); transition: transform .2s; height: auto; }
  .side.open { transform: none; box-shadow: 20px 0 50px rgba(10,9,8,.3); }
  .menu-btn { display: inline-grid; }
  .page { padding: 16px 14px calc(88px + var(--sab)); }
  h1 { font-size: 26px; }
  .topbar { padding: 8px 12px; }
}

/* bottom tabs (student, tutor on phones) */
.tabs { display: none; }
@media (max-width: 767px) {
  .has-tabs .tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--card); border-top: 1px solid var(--hair); padding: 6px 6px calc(6px + var(--sab)); }
  .tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; color: var(--muted); text-decoration: none; font-size: 16px; font-weight: 500; border-radius: 12px; min-width: 0; }
  .tabs a svg { width: 24px; height: 24px; }
  .tabs a.on { color: var(--ember-ink); background: var(--ember-soft); }
}

/* ---- surfaces ---- */
.card { background: var(--card); border: 1px solid var(--hair); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card.flat { box-shadow: none; }
.card.dark { background: var(--obsidian); color: #f3ede4; border-color: var(--obsidian); }
.card.dark .muted { color: #b3aa9e; }
.card h2 { margin-bottom: 4px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 14px; }
.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.tile { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--hair); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
a.tile:hover { transform: translateY(-2px); border-color: var(--ember); }
.tile .n { font-size: 36px; font-weight: 650; letter-spacing: -.03em; line-height: 1; }
.tile .l { color: var(--muted); }
.tile .go { color: var(--ember-ink); font-weight: 600; margin-top: 4px; }
.tile.warn .n { color: var(--ember-ink); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 1px solid var(--hair); background: var(--card); font-weight: 600; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ember); border-color: var(--ember); color: #fff; }
.btn.primary:hover { background: #e85f00; }
.btn.dark { background: var(--obsidian); border-color: var(--obsidian); color: #fff; }
.btn.danger { color: var(--bad); border-color: #f0c4c0; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 40px; padding: 4px 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--hair); background: var(--card); display: inline-grid; place-items: center; padding: 0; }
.icon-btn svg { width: 22px; height: 22px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #d8d0c4; border-radius: var(--r-sm); background: #fff; }
textarea { min-height: 96px; resize: vertical; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; min-width: 0; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
label.check input { width: 22px; min-height: 22px; height: 22px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters label { min-width: 150px; flex: 1 1 150px; }
.filters .btn { flex: none; }
.seg { display: inline-flex; background: var(--wash); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font-weight: 600; color: var(--muted); text-decoration: none; min-height: 40px; display: inline-flex; align-items: center; }
.seg .on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.form { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.form .full { grid-column: 1 / -1; }
.error { color: var(--bad); background: var(--bad-soft); border-radius: var(--r-sm); padding: 10px 14px; }
.note { background: var(--info-soft); color: #1d3f7a; border-radius: var(--r-sm); padding: 10px 14px; }
.warnbox { background: var(--warn-soft); color: var(--warn); border-radius: var(--r-sm); padding: 10px 14px; }

/* ---- chips ---- */
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 1px 11px; background: var(--wash); color: var(--ink); font-weight: 600; white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); } .chip.info { background: var(--info-soft); color: var(--info); }
.chip.ember { background: var(--ember-soft); color: var(--ember-ink); } .chip.dark { background: var(--obsidian); color: #fff; }

/* ---- tables (stack into cards on a phone) ---- */
.tbl-wrap { overflow-x: auto; border-radius: var(--r); }
table.tbl { width: 100%; border-collapse: collapse; background: var(--card); }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--hair); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fcfaf6; }
.tbl tr.clickable { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; }
.card .tbl-wrap { margin: 0 -18px -18px; border-radius: 0 0 var(--r) var(--r); }
@media (max-width: 700px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 12px 14px; border-bottom: 1px solid var(--hair); }
  .tbl td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 14px; text-align: right; }
  .tbl td::before { content: attr(data-l); color: var(--muted); text-align: left; flex: none; }
  .tbl td[data-l=""]::before { content: none; }
  .tbl td.first { font-weight: 650; font-size: 18px; justify-content: flex-start; text-align: left; }
  .tbl td.first::before { content: none; }
  .tbl td.actions { justify-content: flex-start; flex-wrap: wrap; padding-top: 8px; }
  .tbl td.actions::before { content: none; }
}

/* ---- class cards, lists ---- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--hair); border-radius: var(--r); padding: 14px; min-width: 0; }
.item .when { flex: none; min-width: 74px; text-align: center; }
.item .when b { display: block; font-size: 22px; letter-spacing: -.02em; }
.item .what { flex: 1; min-width: 0; }
.item .what b { display: block; }
.item.booked { border-color: #bcdcc8; background: #f7fcf9; }
.item.full { background: var(--ok-soft); border-color: #bcdcc8; }
.item.dim { opacity: .65; }
@media (max-width: 520px) { .item { flex-wrap: wrap; } .item .act { width: 100%; display: flex; gap: 8px; } .item .act .btn { flex: 1; } }
.daybar { position: sticky; top: calc(var(--sat) + var(--top)); z-index: 20; background: var(--paper); padding: 8px 0; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.daybar a { flex: none; min-width: 64px; text-align: center; padding: 8px 10px; border-radius: 14px; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--hair); }
.daybar a b { display: block; font-size: 20px; line-height: 1.1; }
.daybar a.on { background: var(--obsidian); color: #fff; border-color: var(--obsidian); }
.bars { display: flex; align-items: end; gap: 10px; height: 150px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: end; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.bars .col { width: 100%; max-width: 54px; background: var(--wash); border-radius: 10px 10px 4px 4px; position: relative; flex: 1; display: flex; align-items: end; overflow: hidden; }
.bars .fill { width: 100%; background: var(--ember); }
.meter { height: 12px; border-radius: 999px; background: var(--wash); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ember); border-radius: 999px; }
.progress-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.news-card { border-radius: var(--r); padding: 18px; color: #fff; display: flex; flex-direction: column; gap: 8px; }
.news-card.ember { background: var(--ember); } .news-card.ink { background: var(--obsidian); } .news-card.moss { background: #2c5d43; }
.news-card.paper { background: var(--card); color: var(--ink); border: 1px solid var(--hair); }
.news-card a { color: inherit; font-weight: 700; }

/* ---- dialog ---- */
dialog { border: 0; border-radius: 22px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 30px 80px rgba(10,9,8,.35); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(10,9,8,.45); }
dialog .dlg { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--sab)); transform: translateX(-50%); background: var(--obsidian); color: #fff; padding: 12px 20px; border-radius: 999px; z-index: 300; max-width: calc(100vw - 24px); box-shadow: 0 14px 34px rgba(10,9,8,.3); }
.toast.bad { background: var(--bad); }
@media (max-width: 767px) { .has-tabs .toast { bottom: calc(90px + var(--sab)); } }

/* ---- login ---- */
.login { min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login .art { background: var(--obsidian); color: #f3ede4; padding: calc(var(--sat) + 40px) 48px 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 44px 44px; }
.login .art h1 { font-size: clamp(34px, 4.2vw, 56px); line-height: 1.04; }
.login .panel { padding: calc(var(--sat) + 40px) 40px 40px; display: flex; flex-direction: column; justify-content: center; gap: 22px; max-width: 520px; width: 100%; margin: 0 auto; }
.quick { display: grid; gap: 8px; }
.quick button { text-align: left; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--hair); border-radius: 14px; padding: 10px 14px; min-height: 52px; }
.quick button:hover { border-color: var(--ember); }
.quick button span { color: var(--muted); }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login .art { padding: calc(var(--sat) + 26px) 22px 26px; } .login .art h1 { font-size: 34px; } .login .panel { padding: 24px 18px 40px; } }

/* ---- student / tutor shells on a desktop ---- */
.app-narrow .page { max-width: 900px; }
.hero { border-radius: 22px; padding: 22px; background: var(--obsidian); color: #f6f0e6; display: flex; flex-direction: column; gap: 10px;
  background-image: radial-gradient(circle at 90% 0%, rgba(255,106,0,.35), transparent 55%); }
.hero h2 { font-size: 26px; }
.hero .btn { align-self: flex-start; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; text-align: right; }
.soon { border: 1.5px dashed #d3c8b8; border-radius: var(--r); padding: 18px; background: transparent; }
@media print { .side, .topbar, .tabs { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
