:root {
  --bg: var(--tg-theme-secondary-bg-color, #f1f2f6);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #fff));
  --text: var(--tg-theme-text-color, #16181d);
  --hint: var(--tg-theme-hint-color, #8a8f9c);
  --accent: var(--tg-theme-button-color, #3a7bf2);
  --accent-text: var(--tg-theme-button-text-color, #fff);
  --red: var(--tg-theme-destructive-text-color, #e5484d);
  --green: #2fa36b;
  --orange: #e08a1e;
  --line: color-mix(in srgb, var(--hint) 22%, transparent);
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not(.tg) {
    --bg: #101114; --card: #1b1d22; --text: #eceef2; --hint: #8b919e; --accent: #5b93f5;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
main { max-width: 560px; margin: 0 auto; padding: 12px 14px; }

/* header */
.head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 14px; }
.head h1 { font-size: 30px; margin: 0; font-weight: 700; letter-spacing: -.02em; }
.head .sub { color: var(--hint); font-size: 13px; }
.nav { display: flex; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; background: var(--card); display: grid; place-items: center;
  font-size: 18px; color: var(--accent);
}
.pill-btn { background: var(--card); color: var(--accent); border-radius: 18px; padding: 0 12px; height: 36px; font-size: 14px; font-weight: 500; }

/* day */
.day { margin-bottom: 14px; }
.day-title { display: flex; justify-content: space-between; font-size: 13px; color: var(--hint); text-transform: uppercase; letter-spacing: .03em; padding: 0 4px 6px; }
.day.today .day-title b { color: var(--accent); }
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.empty { padding: 12px 14px; color: var(--hint); font-size: 14px; }

.lesson { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; text-align: left; position: relative; }
.sw + .sw, .row + .row, .lesson + .lesson { border-top: 1px solid var(--line); }
.lesson .time { width: 44px; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }
.lesson .time.none { color: var(--hint); font-weight: 400; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.lesson .who { flex: 1; min-width: 0; }
.lesson .who b { font-weight: 600; }
.lesson .who small, .row small { display: block; color: var(--hint); font-size: 12.5px; }
.dur { font-size: 13px; color: var(--hint); font-variant-numeric: tabular-nums; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.badge.done { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.badge.missed { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }
.badge.cancelled { background: var(--line); color: var(--hint); }
.badge.debt { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.badge.ok { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.lesson.done .who b, .lesson.missed .who b { opacity: .75; }
.lesson.cancelled .who b, .lesson.cancelled .time { text-decoration: line-through; color: var(--hint); }

/* students / month */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; text-align: left; }
.row .grow { flex: 1; min-width: 0; }
.big { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.big small { font-weight: 400; text-align: right; }
.big.neg { color: var(--red); }
.big.pos { color: var(--green); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 10px 12px; }
.stat b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--hint); }
.section-title { font-size: 13px; color: var(--hint); text-transform: uppercase; letter-spacing: .03em; margin: 16px 4px 6px; }
.mrow .nums { display: flex; gap: 10px; font-size: 13px; color: var(--hint); margin-top: 2px; font-variant-numeric: tabular-nums; }
.mrow .nums b { color: var(--text); font-weight: 600; }
.bar { height: 4px; border-radius: 2px; background: var(--line); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

/* tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 5;
}
.tabs button { flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11.5px; color: var(--hint); padding: 4px 0; }
.tabs button span { font-size: 20px; filter: grayscale(1) opacity(.6); }
.tabs button.on { color: var(--accent); font-weight: 600; }
.tabs button.on span { filter: none; }
.fab {
  position: fixed; right: max(16px, calc(50% - 264px)); bottom: calc(84px + env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 50%; background: var(--accent); color: var(--accent-text);
  font-size: 28px; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent); z-index: 4;
}

/* sheet */
#sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 10; animation: fade .2s; }
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; z-index: 11;
  background: var(--bg); border-radius: 18px 18px 0 0; padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto; animation: up .22s ease-out;
}
#sheet::before { content: ""; display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
#sheet h2 { margin: 0 0 2px; font-size: 19px; }
#sheet .sub { color: var(--hint); font-size: 14px; margin-bottom: 14px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.act { background: var(--card); border-radius: 12px; padding: 12px 10px; font-weight: 500; display: flex; align-items: center; gap: 8px; justify-content: center; }
.act.sel { outline: 2px solid var(--accent); }
.form { background: var(--card); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.field { display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 46px; }
.field + .field { border-top: 1px solid var(--line); }
.field label { flex: none; width: 110px; color: var(--hint); font-size: 14px; }
.field input, .field select { flex: 1; min-width: 0; border: 0; background: none; padding: 12px 0; outline: none; text-align: right; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: 1; padding: 8px 0; }
.chip { padding: 5px 10px; border-radius: 14px; background: var(--bg); font-size: 13.5px; }
.chip.on { background: var(--accent); color: var(--accent-text); }
.primary { width: 100%; height: 48px; border-radius: 12px; background: var(--accent); color: var(--accent-text); font-weight: 600; font-size: 16px; }
.danger { width: 100%; height: 44px; color: var(--red); margin-top: 6px; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex: 1; padding: 10px 0; }
.colors button { width: 24px; height: 24px; border-radius: 50%; }
.colors button.on { outline: 2px solid var(--text); outline-offset: 2px; }

#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 20px; font-size: 14px; z-index: 20;
}
.field.stack { flex-direction: column; align-items: stretch; gap: 0; padding-top: 10px; }
.field.stack .chips { justify-content: flex-start; align-items: center; }
.act.wide { grid-column: 1 / -1; background: var(--accent); color: var(--accent-text); }
.badge.moved { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 4px; }
.slot { background: var(--card); border-radius: 12px; padding: 9px 6px; font-size: 12.5px; color: var(--hint); display: flex; flex-direction: column; align-items: center; gap: 1px; }
.slot b { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.slot.on { background: var(--accent); color: var(--accent-text); }
.slot.on b { color: var(--accent-text); }
.todo { background: var(--card); border-radius: var(--radius); margin-bottom: 14px; border: 1px solid color-mix(in srgb, var(--orange) 35%, transparent); }
.todo summary { list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; cursor: pointer; }
.todo summary::-webkit-details-marker { display: none; }
.todo summary span { color: var(--orange); font-weight: 600; font-size: 14px; }
.todo-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px; }
.todo-chip { display: flex; align-items: center; gap: 6px; background: var(--bg); border-radius: 16px; padding: 6px 10px; font-size: 14px; }
.todo-chip small { color: var(--hint); }
.todo-chip b { font-variant-numeric: tabular-nums; }

/* ---- week strip ---- */
.strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 10px; }
.ds { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 2px; border-radius: 12px; }
.ds small { font-size: 11px; color: var(--hint); text-transform: uppercase; }
.ds b { font-size: 18px; font-weight: 500; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; font-variant-numeric: tabular-nums; }
.ds.today b { color: var(--red); font-weight: 700; }
.ds.sel b { background: var(--text); color: var(--bg); }
.ds.sel.today b { background: var(--red); color: #fff; }
.ds i { font-style: normal; font-size: 13px; line-height: 10px; color: var(--hint); letter-spacing: 1px; height: 10px; }
.ds i.late { color: var(--red); }
.seg { display: grid; grid-template-columns: 1fr 1fr 1fr; background: color-mix(in srgb, var(--hint) 16%, transparent); border-radius: 9px; padding: 2px; margin-bottom: 12px; }
.seg button { border-radius: 7px; padding: 6px 0; font-size: 13px; font-weight: 500; color: var(--text); }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---- unmarked lessons ---- */
.alert { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; margin-bottom: 12px;
  background: color-mix(in srgb, var(--red) 10%, var(--card)); border-radius: var(--radius); padding: 11px 14px; color: var(--red); }
.alert b { display: block; font-weight: 600; }
.alert small { display: block; color: var(--hint); font-size: 12.5px; }
.badge.overdue { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.lesson.is-overdue .dot { box-shadow: 0 0 0 2px color-mix(in srgb, var(--red) 40%, transparent); }
.mark-day { color: var(--green); font-size: 12.5px; font-weight: 600; text-transform: none; letter-spacing: 0; margin-right: 10px; }
.day-title span { display: flex; align-items: center; }

/* ---- swipe ---- */
.sw { position: relative; overflow: hidden; }
.sw-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; color: #fff; font-weight: 600; font-size: 14px; background: var(--green); }
.sw[data-dir="l"] .sw-bg { background: var(--accent); }
.sw[data-dir="r"] .sw-move, .sw[data-dir="l"] .sw-done { visibility: hidden; }
.sw:not(.ready) .sw-bg { filter: saturate(.55) opacity(.85); }
.sw-row { position: relative; background: var(--card); touch-action: pan-y; }
.time.none { color: var(--accent); font-weight: 500; font-size: 12px; white-space: nowrap; width: 56px; }

/* ---- day timeline ---- */
.day > .day-title, main > .day-title { padding-top: 2px; }
.tl { position: relative; background: var(--card); border-radius: var(--radius); margin-bottom: 6px; cursor: copy; }
.tl-h { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.tl-h span { position: absolute; left: 8px; top: -8px; font-size: 11px; color: var(--hint); background: var(--card); padding: 0 4px; font-variant-numeric: tabular-nums; }
.tl-h:first-child span { top: 2px; }
.tl-now { position: absolute; left: 40px; right: 0; border-top: 2px solid var(--red); z-index: 2; }
.tl-now::before { content: ""; position: absolute; left: -5px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.tl-l { position: absolute; overflow: hidden; text-align: left; padding: 4px 8px; border-radius: 7px; font-size: 13px; line-height: 1.2;
  background: color-mix(in srgb, var(--c) 18%, var(--card)); border-left: 3px solid var(--c); cursor: pointer; z-index: 1; }
.tl-l b { display: block; font-weight: 600; color: color-mix(in srgb, var(--c) 55%, var(--text)); }
.tl-l small { display: block; color: var(--hint); font-size: 11.5px; }
.tl-l .badge { position: absolute; right: 4px; top: 4px; font-size: 10.5px; padding: 1px 6px; }
.tl-l.done, .tl-l.missed { opacity: .6; }
.tl-l.is-overdue { border-left-color: var(--red); }
.hint { text-align: center; color: var(--hint); font-size: 12px; margin: 4px 0 10px; }

/* ---- student cards ---- */
.cards { display: grid; gap: 10px; }
.scard { display: block; width: 100%; text-align: left; border-radius: 16px; padding: 13px 15px;
  background: color-mix(in srgb, var(--c) 13%, var(--card)); }
.sc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sc-name b { display: block; font-size: 17px; font-weight: 600; }
.sc-name small { display: block; font-size: 13px; color: var(--hint); }
.sc-big { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; color: color-mix(in srgb, var(--c) 60%, var(--text)); line-height: 1.1; }
.sc-big small { display: block; font-size: 12px; font-weight: 500; color: var(--hint); }
.scard.neg .sc-big { color: var(--red); }
.sc-bar { display: block; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--c) 22%, transparent); margin: 10px 0 8px; overflow: hidden; }
.sc-bar i { display: block; height: 100%; border-radius: 3px; background: var(--c); }
.scard.neg .sc-bar i { background: var(--red); }
.sc-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--hint); }
.sc-meta > span:first-child { margin-right: auto; }
.chip-o, .chip-g { padding: 2px 8px; border-radius: 10px; font-weight: 600; font-size: 12px; }
.chip-o { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }
.chip-g { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }

/* ---- month rings ---- */
.rings { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px 18px; background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.legend { display: grid; gap: 8px; flex: 1; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.legend span { display: flex; justify-content: space-between; flex: 1; font-size: 14px; color: var(--hint); }
.legend b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- toast with undo ---- */
#toast:not([hidden]) { display: flex; align-items: center; gap: 14px; }
#toast button { color: var(--accent); font-weight: 600; filter: brightness(1.4); }
.rings { gap: 14px; padding: 14px; }
.legend span { gap: 8px; font-size: 13.5px; }
.legend b { white-space: nowrap; }
.mrow .nums { flex-wrap: wrap; gap: 2px 10px; }
.mrow .nums > span { white-space: nowrap; }

/* ---- earnings ---- */
.earn { display: block; background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.earn small { display: block; color: var(--hint); font-size: 13px; }
.earn > b { display: block; font-size: 32px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 2px 0 10px; }
.earn-bar { display: block; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.earn-bar i { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.earn-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--hint); }
.money { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.money b { font-variant-numeric: tabular-nums; }
.badge.part { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }
.mrow { align-items: flex-start; }
.mrow .dot { margin-top: 6px; }
.plan-line { display: block; font-size: 13px; color: var(--hint); margin-top: 2px; }
.plan-line b { color: var(--text); font-weight: 700; }
.nw { white-space: nowrap; }

/* ---- payments: waiting / paid ---- */
.pay-sec { display: flex; justify-content: space-between; }
.pay-row { cursor: pointer; }
.pay-row .amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.paid-mark { color: var(--green); font-weight: 700; font-size: 17px; padding: 0 4px; }
.paid-btn { background: var(--green); color: #fff; border-radius: 14px; padding: 6px 11px; font-size: 13px; font-weight: 600; white-space: nowrap; }
#toast { white-space: nowrap; }

/* ---- month rows: name, make-ups tag, given / total, segmented bar ---- */
.mrow2 { display: block; width: 100%; text-align: left; padding: 11px 14px; }
.mrow2 + .mrow2 { border-top: 1px solid var(--line); }
.m-top { display: flex; align-items: center; gap: 8px; }
.m-top .dot { background: var(--c); }
.m-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.m-name b { font-weight: 600; }
.m-name small { color: var(--hint); font-size: 12px; }
.tag-carry { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 9px; background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }
.m-num { font-variant-numeric: tabular-nums; font-weight: 600; }
.m-of { color: var(--hint); font-size: 13px; font-variant-numeric: tabular-nums; }
.m-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); margin-top: 8px; }
.m-bar i { display: block; height: 100%; }
.b-done { background: var(--c, var(--hint)); }
.b-miss { background: var(--orange); }
.b-ahead { background: color-mix(in srgb, var(--c, var(--hint)) 35%, transparent); }
.m-legend { display: flex; justify-content: center; gap: 14px; font-size: 12px; color: var(--hint); margin: 8px 0 14px; }
.m-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }

/* ---- tab bar with "+" (iOS style) ---- */
.fab { display: none; }
.tabs { padding: 6px 4px calc(4px + env(safe-area-inset-bottom)); align-items: flex-end; background: color-mix(in srgb, var(--card) 96%, transparent); }
.tabs button { position: relative; gap: 3px; font-size: 10.5px; font-weight: 500; padding: 2px 0 4px; }
.tabs svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on svg { stroke-width: 2.1; }
.tabs .tab-plus { flex: none; width: 54px; height: 54px; max-width: none; border-radius: 50%; margin: -22px 6px 2px; padding: 0;
  background: var(--accent); color: var(--accent-text); justify-content: center; border: 4px solid var(--bg);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); }
.tabs .tab-plus svg { width: 26px; height: 26px; stroke-width: 2.4; }
.tabs .tab-plus:active { transform: scale(.94); }
.tab-badge { position: absolute; top: -1px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700; font-style: normal; line-height: 17px; text-align: center; }
.tab-badge[hidden] { display: none; }
.plus-ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 16px; font-weight: 700; flex: none; }
.chev { color: var(--hint); font-size: 20px; }
.tabs button span { font-size: 10.5px; filter: none; }
.plus-ico svg { width: 19px; height: 19px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.plus-list .row { padding: 11px 14px; }

/* ---- Telegram link in the student card ---- */
.tg-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tg-actions .act { background: var(--bg); color: var(--accent); }
.link-btn { color: var(--red); font-size: 14px; }
.chip-tg { padding: 2px 8px; border-radius: 10px; font-weight: 600; font-size: 12px; background: color-mix(in srgb, #2aabee 16%, transparent); color: #2aabee; }
.todo-move { background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }

/* ---- moving several lessons / offering windows ---- */
.move-day { color: var(--accent); }
.link-all { color: var(--accent); font-weight: 600; font-size: 14px; padding: 4px 4px 10px; }
.check { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--hint); display: grid; place-items: center; flex: none; font-size: 13px; color: #fff; }
.check.on { background: var(--accent); border-color: var(--accent); }
.bulk-row select { max-width: 48%; border: 0; border-radius: 9px; padding: 6px 8px; background: color-mix(in srgb, var(--accent) 12%, var(--bg)); color: var(--accent); font-size: 13px; font-weight: 600; }
.notify-row { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 12px; padding: 12px 14px; margin: 12px 0; font-size: 15px; }
.notify-row input { width: 20px; height: 20px; accent-color: var(--green); }
.offer-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.offer-chips .chip { background: var(--card); padding: 7px 12px; font-size: 14px; font-variant-numeric: tabular-nums; }
.offer-chips .chip.on { background: var(--accent); color: var(--accent-text); }
.offer-chips .chip-to { display: block; font-size: 10px; line-height: 1.1; opacity: .7; font-weight: 500; }
.sticky-send { position: sticky; bottom: 0; box-shadow: 0 -8px 16px var(--bg); }
button[disabled] { opacity: .45; }
.bulk-row select { max-width: none; flex: none; font-variant-numeric: tabular-nums; }
.day-title b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-title span { flex: none; white-space: nowrap; }

/* ---- Zoom link for the day ---- */
.zoom { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: var(--radius); padding: 8px 10px 8px 12px; margin-bottom: 12px; }
.zoom.ok { border: 1px solid color-mix(in srgb, var(--green) 35%, transparent); }
.zoom-ico { font-size: 20px; }
.zoom b { display: block; font-size: 14px; font-weight: 600; }
.zoom small { display: block; color: var(--hint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zoom .grow { flex: 1; min-width: 0; }
.zoom input { flex: 1; min-width: 0; border: 0; background: none; outline: none; padding: 8px 0; font-size: 14px; }
.zoom-save { background: var(--accent); color: var(--accent-text); border-radius: 14px; padding: 6px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }

/* ---- month calendar in "move" ---- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 8px; }
.cal-head b { font-size: 16px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-w { font-size: 11px; color: var(--hint); text-transform: uppercase; padding-bottom: 2px; }
.cal-d { height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 15px; font-variant-numeric: tabular-nums; background: var(--card); }
.cal-d.off { background: none; color: color-mix(in srgb, var(--hint) 60%, transparent); }
.cal-d.taken { background: none; color: var(--hint); text-decoration: line-through; }
.cal-d.f0 { color: var(--hint); }
.cal-d.f1, .cal-legend .f1 { background: color-mix(in srgb, var(--green) 14%, var(--card)); }
.cal-d.f2 { background: color-mix(in srgb, var(--green) 30%, var(--card)); }
.cal-d.f3, .cal-legend .f3 { background: color-mix(in srgb, var(--green) 48%, var(--card)); }
.cal-d.sel { outline: 2px solid var(--accent); font-weight: 700; }
.cal-legend { display: flex; gap: 12px; justify-content: center; font-size: 11.5px; color: var(--hint); margin: 8px 0 4px; }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.cal-legend i.taken { border: 1px solid var(--hint); }
.move-alt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.move-alt .act { font-size: 13px; padding: 10px 6px; }
.split-row { flex-wrap: wrap; }
.split-chips { display: flex; gap: 4px; }
.split-chips .chip { padding: 5px 9px; }
.split-chips { align-items: center; }
.split-in { width: 58px; text-align: center; padding: 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: inherit; font: inherit; }

/* ---- messages to students ---- */
.msg-modes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.msg-modes .chip { background: var(--card); padding: 7px 12px; font-size: 13.5px; }
.msg-modes .chip.on { background: var(--accent); color: var(--accent-text); }
.msg-text { width: 100%; border: 0; border-radius: var(--radius); background: var(--card); padding: 12px 14px; font: inherit; color: var(--text); resize: vertical; margin: 6px 0 4px; outline: none; }
.tpl { display: inline-flex; align-items: center; background: var(--card); border-radius: 14px; }
.tpl .chip { background: none; }
.tpl-x { color: var(--hint); font-size: 12px; padding: 0 8px 0 2px; }
.badge.muted { background: var(--line); color: var(--hint); }
.react-row .react-e, .react-e { font-size: 22px; width: 30px; text-align: center; flex: none; }
.react-row.on { background: color-mix(in srgb, #f2b705 16%, transparent); }
.notify-row input { flex: none; }
.report { background: var(--card); border-radius: 14px; padding: 14px; font-size: 14px; line-height: 1.5; margin-bottom: 10px; }
.special-btn { background: color-mix(in srgb, #f2b705 14%, var(--card)); color: #b88600; } .special-btn.on { background: #f2b705; color: #fff; }
.msg-preview { background: #fff; color: #111; border-radius: 12px 12px 12px 4px; padding: 9px 12px; font-size: 14px; line-height: 1.4; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---- tab bar, variant B: one floating Liquid Glass capsule, every tab the same size and labelled, "+" in the middle ---- */
body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.tabs {
  left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom)); width: min(310px, calc(100% - 60px)); margin: 0 auto;
  height: 60px; padding: 4px; gap: 2px; align-items: center; border-radius: 32px; border: 1px solid rgba(255, 255, 255, .65);
  background: color-mix(in srgb, var(--card) 45%, transparent);
  backdrop-filter: blur(18px) saturate(1.8); -webkit-backdrop-filter: blur(18px) saturate(1.8);
  box-shadow: 0 8px 26px rgba(20, 30, 60, .18), inset 0 1px 0 rgba(255, 255, 255, .7);
}
.tabs button { flex: 1; min-width: 0; flex-direction: column; justify-content: center; align-self: center; gap: 2px; height: 52px; padding: 0; border-radius: 26px; color: var(--text); }
.tabs button span { font-size: 10px; font-weight: 600; filter: none; line-height: 1.1; }
.tabs button.on { color: var(--accent); background: color-mix(in srgb, var(--card) 70%, transparent); }
.tabs svg { width: 22px; height: 22px; }
.tabs .tab-plus { flex: none; width: 50px; height: 50px; margin: 0 2px; padding: 0; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 80%, transparent); color: #fff; border: 1px solid rgba(255, 255, 255, .6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.tab-badge { top: 3px; left: 50%; right: auto; margin-left: 6px; }
@media (prefers-color-scheme: dark) {
  :root:not(.tg) .tabs { border-color: rgba(255, 255, 255, .14); box-shadow: 0 8px 26px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .16); }
}
.tg .tabs { border-color: color-mix(in srgb, var(--text) 12%, transparent); }

/* =====================================================================
   Liquid Glass theme: soft colour field behind, frosted glass on top.
   Kept at the end of the file so it overrides the flat look above.
   ===================================================================== */
:root {
  --glass: rgba(255, 255, 255, .5);
  --glass-strong: rgba(255, 255, 255, .68);
  --glass-edge: rgba(255, 255, 255, .72);
  --glass-shadow: 0 6px 22px rgba(30, 40, 80, .1), inset 0 1px 0 rgba(255, 255, 255, .85);
  --blur: blur(20px) saturate(1.8);
  --field: radial-gradient(60vw 50vh at 10% 0%, #c9dcff 0, transparent 70%), radial-gradient(55vw 45vh at 100% 30%, #ffd6e4 0, transparent 70%),
           radial-gradient(60vw 50vh at 0% 75%, #d5f3e3 0, transparent 70%), radial-gradient(55vw 45vh at 100% 100%, #fde7c5 0, transparent 70%), #eef0f6;
  --line: rgba(30, 40, 70, .09);
}
:root.dark {
  --glass: rgba(38, 40, 50, .52);
  --glass-strong: rgba(44, 46, 58, .72);
  --glass-edge: rgba(255, 255, 255, .12);
  --glass-shadow: 0 8px 26px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .1);
  --field: radial-gradient(60vw 50vh at 10% 0%, #1d2c52 0, transparent 70%), radial-gradient(55vw 45vh at 100% 30%, #3d1f33 0, transparent 70%),
           radial-gradient(60vw 50vh at 0% 75%, #163a2c 0, transparent 70%), radial-gradient(55vw 45vh at 100% 100%, #3b2c14 0, transparent 70%), #0e0f13;
  --line: rgba(255, 255, 255, .08);
}
@media (prefers-color-scheme: dark) { :root:not(.tg):not(.light) { --glass: rgba(38, 40, 50, .52); --glass-strong: rgba(44, 46, 58, .72); --glass-edge: rgba(255, 255, 255, .12);
  --glass-shadow: 0 8px 26px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .1); --line: rgba(255, 255, 255, .08);
  --field: radial-gradient(60vw 50vh at 10% 0%, #1d2c52 0, transparent 70%), radial-gradient(55vw 45vh at 100% 30%, #3d1f33 0, transparent 70%),
           radial-gradient(60vw 50vh at 0% 75%, #163a2c 0, transparent 70%), radial-gradient(55vw 45vh at 100% 100%, #3b2c14 0, transparent 70%), #0e0f13; } }

html, body { background: var(--field) fixed; background-color: var(--bg); }
body { min-height: 100vh; }

/* everything that used to be a white card is frosted glass now */
.list, .wtable, .stat, .earn, .rings, .tl, .todo, .alert, .zoom, .form, .home-card, .notify-row, .msg-text, .msg-preview,
.icon-btn, .pill-btn, .seg, .act, .slot, .cal-d:not(.off):not(.taken), .offer-chips .chip, .msg-modes .chip, .tpl {
  background-color: var(--glass);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
}
.list, .wtable, .stat, .earn, .rings, .tl, .todo, .form { border-radius: 20px; }
.seg button.on { background: var(--glass-strong); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.todo { border-color: color-mix(in srgb, var(--orange) 40%, var(--glass-edge)); }
.alert { background-color: color-mix(in srgb, var(--red) 12%, var(--glass)); }
.zoom.ok { border-color: color-mix(in srgb, var(--green) 45%, var(--glass-edge)); }
.act.wide:not(.special-btn) { background-color: color-mix(in srgb, var(--accent) 85%, transparent); }
.act.sel { outline: 2px solid var(--accent); }
.slot.on, .offer-chips .chip.on, .msg-modes .chip.on { background-color: var(--accent); }
.cal-d.f1 { background-color: color-mix(in srgb, var(--green) 16%, var(--glass)); }
.cal-d.f2 { background-color: color-mix(in srgb, var(--green) 32%, var(--glass)); }
.cal-d.f3 { background-color: color-mix(in srgb, var(--green) 50%, var(--glass)); }
.empty { color: var(--hint); }
.day-title, .section-title { color: color-mix(in srgb, var(--text) 55%, transparent); }   /* a bit darker than plain hint on glass */

/* sticky glass header */
main > .head { position: sticky; top: 0; z-index: 3; margin: -12px -14px 10px; padding: 12px 14px 10px;
  background-color: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-edge); border-radius: 0 0 22px 22px; box-shadow: 0 6px 18px rgba(30, 40, 80, .06); }

/* day timeline: lessons are tinted glass */
.tl-l { background: color-mix(in srgb, var(--c) 26%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid color-mix(in srgb, var(--c) 35%, var(--glass-edge)); border-left: 3px solid var(--c); border-radius: 10px; }
.tl-h span { background: none; }

/* student cards: glass tinted with the student's colour */
.scard { background: color-mix(in srgb, var(--c) 16%, var(--glass)); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow); border-radius: 20px; }
.sc-bar { background: color-mix(in srgb, var(--c) 18%, rgba(255, 255, 255, .45)); }

/* lists keep their rows transparent; the swipe background stays solid behind a row */
.sw-row, .row, .lesson, .mrow2 { background: transparent; }
.sw:not([data-dir]) .sw-bg { visibility: hidden; }   /* rows are see-through glass, so show the swipe colour only while swiping */
.sw[data-dir] .sw-row { background: var(--card); }

/* bottom sheet: floating glass with rounded corners all round */
#sheet { left: 6px; right: 6px; bottom: 6px; border-radius: 28px; max-width: 548px;
  background-color: var(--glass-strong); backdrop-filter: blur(28px) saturate(1.8); -webkit-backdrop-filter: blur(28px) saturate(1.8);
  border: 1px solid var(--glass-edge); box-shadow: 0 -4px 30px rgba(20, 30, 60, .18); }
#sheet-bg { background: rgba(20, 25, 40, .18); }
#sheet .form, #sheet .list, #sheet .act, #sheet .stat { background-color: var(--glass); }
/* wide buttons keep their colour in a sheet: their text is white */
#sheet .act.wide:not(.special-btn) { background-color: color-mix(in srgb, var(--accent) 85%, transparent); }
#sheet .special-btn { background-color: color-mix(in srgb, #f2b705 14%, var(--glass)); }
#sheet .special-btn.on { background-color: #f2b705; }

/* tab bar matches the rest */
.tabs { background: var(--glass); border-color: var(--glass-edge); }
.tabs button.on { background: var(--glass-strong); }
#toast { background: color-mix(in srgb, var(--text) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* week table: day on the left, times and students on the right */
.wtable { background: var(--glass, var(--card)); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.wt-row { display: grid; grid-template-columns: 54px 1fr; border-top: 1px solid color-mix(in srgb, var(--hint) 18%, transparent); }
.wt-row:first-child { border-top: 0; }
.wt-row.today .wt-day b { color: var(--red); }
.wt-day { display: flex; flex-direction: column; align-items: flex-start; padding: 8px 0 8px 12px; text-align: left; color: var(--text); }
.wt-day b { font-size: 15px; } .wt-day small { font-size: 11px; color: var(--hint); }
.wt-ls { padding: 4px 8px 4px 0; display: flex; flex-direction: column; }
.wt-l { display: flex; align-items: center; gap: 7px; padding: 4px 0; font-size: 14px; color: var(--text); text-align: left; }
.wt-l .dot { flex: none; }
.wt-t { width: 42px; flex: none; font-variant-numeric: tabular-nums; font-weight: 600; }
.wt-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wt-n small { color: var(--hint); }
.wt-s { font-size: 11px; color: var(--green); } .wt-l.missed .wt-s { color: var(--orange); }
.wt-l.done, .wt-l.missed { opacity: .6; }
.wt-empty { font-size: 13px; color: var(--hint); padding: 8px 0; }
.hist-undone { opacity: .5; }
/* sheet navigation: "‹ Назад" on the left, "Вперёд ›" and ✕ on the right */
.sheet-nav { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 6px; min-height: 30px; }
.sheet-nav-r { display: flex; gap: 6px; }
.sheet-nb { font-size: 15px; font-weight: 500; color: var(--accent); padding: 4px 10px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.sheet-x { color: var(--hint); background: color-mix(in srgb, var(--hint) 14%, transparent); width: 30px; padding: 4px 0; }

/* full screen in Telegram: keep clear of the status bar and Telegram's own buttons */
:root { --top-safe: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); }
main > .head { padding-top: calc(12px + var(--top-safe)); }
#sheet { max-height: min(88vh, calc(100vh - var(--top-safe) - 12px)); }
#arch-own[hidden] { display: none; }

/* ---- computer: a wide window. Everything for it stays here, under html.desk; the phone layout is untouched ---- */
html:not(.desk) .desk-only { display: none !important; }
html.desk body { padding: 0 0 20px 212px; }
html.desk main { max-width: 1320px; margin: 0; padding: 12px 20px; }
html.desk main > .head { margin: -12px -20px 12px; padding: calc(12px + var(--top-safe)) 20px 10px; }
html.desk .tabs { left: 14px; right: auto; top: calc(14px + var(--top-safe)); bottom: 14px; width: 184px; height: auto; margin: 0; padding: 10px; gap: 4px; flex-direction: column; align-items: stretch; border-radius: 22px; }
html.desk .tabs button { flex: none; width: 100%; max-width: none; height: 42px; flex-direction: row; justify-content: flex-start; gap: 10px; padding: 0 12px; border-radius: 12px; }
html.desk .tabs button span { font-size: 14px; }
html.desk .tabs .tab-plus { order: 5; width: 100%; height: 42px; margin: 6px 0 0; border-radius: 12px; color: #fff; }
html.desk .tabs .tab-plus svg { width: 20px; height: 20px; }
html.desk .tabs .tab-full { order: 6; margin-top: auto; color: var(--hint); }
html.desk .tab-badge { position: static; margin-left: auto; }
html.desk .desk-cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
html.desk .desk-side { position: sticky; top: 76px; display: grid; gap: 12px; max-height: calc(100vh - 92px); overflow-y: auto; }
html.desk .desk-side > * { margin: 0; }
html.desk .desk-pay { display: block; width: 100%; text-align: left; }
html.desk .desk-pay > b { font-size: 24px; }
.desk-wait { display: block; margin-top: 6px; font-size: 13px; color: var(--hint); }
/* windows open at the right as a panel, the journal stays in view */
html.desk #sheet { left: auto; right: 14px; top: calc(14px + var(--top-safe)); bottom: 14px; width: 440px; max-width: none; max-height: none; margin: 0; border-radius: 22px; }
html.desk #sheet::before { display: none; }
html.desk #sheet { animation: desk-in .16s ease-out; }
@keyframes desk-in { from { transform: translateX(24px); opacity: 0; } }
html.desk #sheet-bg { background: rgba(20, 25, 40, .08); }
html.desk #toast { bottom: 24px; }
html.desk .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
html.desk .cards .scard { margin: 0; }

/* line icons instead of emoji, in the colour of the text */
.ico { display: inline-flex; vertical-align: -3px; margin-right: 5px; }
.ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.act .ico { margin-right: 0; vertical-align: 0; }
.sub .ico svg { width: 15px; height: 15px; }
/* what the bot sent: one compact line at the bottom of the lesson window */
.sent-info { margin-top: 14px; }
.sent-title { font-size: 12px; color: var(--hint); margin: 0 4px 6px; }
.sent-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sent-chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; font-size: 12.5px; color: var(--hint); background: var(--glass, var(--card)); }
.sent-chip .ico { margin: 0; color: var(--green); }
.sent-chip .ico svg { width: 14px; height: 14px; }
.sent-chip b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.sent-chip.bad, .sent-chip.bad .ico { color: var(--red); }
.sent-err { font-size: 12px; color: var(--red); margin: 6px 4px 0; }

/* «Месяц»: lessons given out of the month's lessons, under the rings */
.l-strip { grid-column: 1 / -1; }
.l-strip span { display: flex; justify-content: space-between; font-size: 14px; color: var(--hint); }
.l-strip b { color: var(--text); font-variant-numeric: tabular-nums; }
.l-bar { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--hint) 22%, transparent); margin-top: 7px; overflow: hidden; }
.l-bar i { display: block; height: 100%; background: var(--green); border-radius: 3px; }
