/* השיעורים של בל: Apple-quiet, soft pink, RTL-first. Logical properties only, no left/right. */

:root {
  --bg: #fbf7f9;
  --bg-tint: #f8edf2;
  --surface: #ffffff;
  --surface-2: #fdf9fb;
  --fill: rgba(180, 70, 109, 0.07);
  --fill-2: rgba(110, 97, 104, 0.08);
  --text: #2b2027;
  --text-2: #6e6168;
  --text-3: #a3949b;
  --sep: rgba(90, 40, 60, 0.1);
  --accent: #b4466d;
  --accent-strong: #9a3a5c;
  --accent-ink: #ffffff;
  --accent-soft: #fbe3ec;
  --accent-soft-2: #f6d0de;
  --blush: #f2a7c1;
  --done: #2f7d57;
  --done-soft: #e4f3ea;
  --sched: #5452c4;
  --sched-soft: #edecfb;
  --missed: #74666d;
  --missed-soft: #f1ebee;
  --post: #8f5f00;
  --post-soft: #fff1cf;
  --glass: rgba(253, 249, 251, 0.82);
  --shadow: 0 1px 2px rgba(90, 40, 60, 0.05), 0 10px 28px rgba(90, 40, 60, 0.07);
  --shadow-lg: 0 24px 80px rgba(60, 20, 40, 0.22);
  --hero: linear-gradient(135deg, #fde7ef 0%, #f9d7e4 55%, #f4c9da 100%);
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Hebrew", "Heebo", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121013;
  --bg-tint: #1b1519;
  --surface: #1f1a1e;
  --surface-2: #262026;
  --fill: rgba(242, 141, 178, 0.1);
  --fill-2: rgba(200, 180, 190, 0.1);
  --text: #f6eef2;
  --text-2: #b6a8af;
  --text-3: #7f7178;
  --sep: rgba(255, 220, 235, 0.1);
  --accent: #f28db2;
  --accent-strong: #f6a8c5;
  --accent-ink: #2b0f1a;
  --accent-soft: rgba(242, 141, 178, 0.16);
  --accent-soft-2: rgba(242, 141, 178, 0.26);
  --blush: #c9668c;
  --done: #63d39c;
  --done-soft: rgba(99, 211, 156, 0.14);
  --sched: #aaa8ff;
  --sched-soft: rgba(170, 168, 255, 0.14);
  --missed: #b6a8af;
  --missed-soft: rgba(182, 168, 175, 0.12);
  --post: #f3c457;
  --post-soft: rgba(243, 196, 87, 0.14);
  --glass: rgba(31, 26, 30, 0.8);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.6);
  --hero: linear-gradient(135deg, #3a2230 0%, #2f1d28 60%, #261821 100%);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #121013;
    --bg-tint: #1b1519;
    --surface: #1f1a1e;
    --surface-2: #262026;
    --fill: rgba(242, 141, 178, 0.1);
    --fill-2: rgba(200, 180, 190, 0.1);
    --text: #f6eef2;
    --text-2: #b6a8af;
    --text-3: #7f7178;
    --sep: rgba(255, 220, 235, 0.1);
    --accent: #f28db2;
    --accent-strong: #f6a8c5;
    --accent-ink: #2b0f1a;
    --accent-soft: rgba(242, 141, 178, 0.16);
    --accent-soft-2: rgba(242, 141, 178, 0.26);
    --blush: #c9668c;
    --done: #63d39c;
    --done-soft: rgba(99, 211, 156, 0.14);
    --sched: #aaa8ff;
    --sched-soft: rgba(170, 168, 255, 0.14);
    --missed: #b6a8af;
    --missed-soft: rgba(182, 168, 175, 0.12);
    --post: #f3c457;
    --post-soft: rgba(243, 196, 87, 0.14);
    --glass: rgba(31, 26, 30, 0.8);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.6);
    --hero: linear-gradient(135deg, #3a2230 0%, #2f1d28 60%, #261821 100%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 3px solid var(--accent-soft-2); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
        stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 18px; height: 18px; }
svg.i.xs { width: 15px; height: 15px; }

/* ------------------------------------------------------------ shell */

.shell { min-height: 100dvh; }
.main {
  max-width: 760px;
  margin-inline: auto;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 104px);
}
.sidebar { display: none; }
.tabbar {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 20;
  display: flex;
  justify-content: space-around;
  padding: 7px 6px calc(env(safe-area-inset-bottom) + 6px);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-block-start: 1px solid var(--sep);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 64px;
  padding: 3px 6px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
}
.tab svg.i { width: 25px; height: 25px; }
.tab[aria-current="page"] { color: var(--accent); }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); }
  .tabbar { display: none; }
  .main { padding-block-end: 64px; padding-inline: 32px; max-width: 880px; width: 100%; }
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    inset-block-start: 0;
    height: 100dvh;
    padding: 24px 14px 18px;
    background: var(--bg-tint);
    border-inline-end: 1px solid var(--sep);
  }
  .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; font-weight: 700; font-size: 17px; }
  .brand img { width: 34px; height: 34px; border-radius: 9px; }
  .navlink {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 11px;
    color: var(--text-2);
    font-weight: 600;
    font-size: 15px;
  }
  .navlink:hover { background: var(--fill); color: var(--text); }
  .navlink[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
  .sidebar .spacer { flex: 1; }
  .sidebar .btn { margin-block-end: 6px; }
}

/* ------------------------------------------------------------ header */

.head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 18px;
}
.head h1 { margin: 0; font-size: 32px; line-height: 1.15; font-weight: 750; letter-spacing: -0.01em; }
.head .sub { margin: 2px 0 0; color: var(--text-2); font-size: 15px; }
.head .actions { display: flex; gap: 8px; flex: none; }
.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--fill);
  color: var(--accent);
}
.iconbtn:hover { background: var(--accent-soft); }
.iconbtn.placeholder { visibility: hidden; }
.debt-amt { color: var(--accent); font-weight: 700; }
.iconbtn.solid { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px rgba(180, 70, 109, 0.28); }
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-block-end: 4px;
  color: var(--accent);
  font-weight: 600;
  font-size: 16px;
}

/* ------------------------------------------------------------ blocks */

.section { margin-block: 22px; }
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 4px 8px;
  font-size: 15px;
  font-weight: 650;
  color: var(--text-2);
}
.section-title a, .section-title button { font-size: 14px; font-weight: 600; color: var(--accent); }
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card.pad { padding: 16px; }
.hero {
  position: relative;
  overflow: hidden;
  padding: 20px 18px 18px;
  border-radius: 22px;
  background: var(--hero);
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  inset-block-start: -40px;
  inset-inline-end: -30px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}
.hero h2 { margin: 0; font-size: 22px; font-weight: 750; }
.hero p { margin: 4px 0 0; color: var(--text-2); font-size: 15.5px; }
.hero .chips { margin-block-start: 12px; }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 14px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: start;
  min-width: 0;
}
.tile .k { font-size: 13px; color: var(--text-2); font-weight: 600; }
.tile .v { font-size: 22px; font-weight: 750; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .s { font-size: 12.5px; color: var(--text-3); }
.tile { color: var(--text); }
.tile.accent .v { color: var(--accent); }
.tile.good .v { color: var(--done); }
button.tile:hover { background: var(--surface-2); }

/* grouped list (iOS settings style) */
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list > * + * { border-block-start: 1px solid var(--sep); }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 11px 14px;
  text-align: start;
  color: var(--text);
  background: none;
}
button.row:hover, a.row:hover { background: var(--surface-2); }
button.row:active, a.row:active { background: var(--fill); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 620; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { display: flex; align-items: center; gap: 8px; flex: none; color: var(--text-3); }
.row .chev { color: var(--text-3); }
.row .when { flex: none; width: 54px; text-align: center; }
.row .when b { display: block; font-size: 17px; font-weight: 700; direction: ltr; }
.row .when small { display: block; font-size: 12px; color: var(--text-3); }
.row.dim .title, .row.dim .when b { color: var(--text-2); }
.row .preview { font-size: 13.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
                overflow: hidden; white-space: normal; }
.row.static { cursor: default; }
.quick { display: flex; gap: 6px; flex: none; }
.quick button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 650;
}
.quick .yes { background: var(--done-soft); color: var(--done); }
.quick .no { background: var(--missed-soft); color: var(--missed); }

.day-head { padding: 10px 14px 6px; font-size: 13.5px; font-weight: 650; color: var(--text-2); background: var(--surface-2); }

/* avatar */
.av {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 16px;
}
.av.lg { width: 76px; height: 76px; font-size: 30px; }
.av-0 { background: #fbd5e1; color: #8e2f52; }
.av-1 { background: #ffe1cc; color: #8a4b1e; }
.av-2 { background: #e7ddfb; color: #5b3fa0; }
.av-3 { background: #d6f0e2; color: #2d6b4e; }
.av-4 { background: #d6e8fb; color: #2a5b88; }
.av-5 { background: #fbefc5; color: #7a5d00; }
:root[data-theme="dark"] .av { filter: saturate(0.9) brightness(0.92); }

/* pills & chips */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
}
.st-scheduled { background: var(--sched-soft); color: var(--sched); }
.st-done { background: var(--done-soft); color: var(--done); }
.st-missed { background: var(--missed-soft); color: var(--missed); }
.st-postponed { background: var(--post-soft); color: var(--post); }
.pill.debt { background: var(--accent-soft); color: var(--accent); }
.pill.credit { background: var(--done-soft); color: var(--done); }
.pill.demo { background: var(--fill-2); color: var(--text-2); }
.pill.ok { background: var(--done-soft); color: var(--done); }
.pill.wait { background: var(--post-soft); color: var(--post); }
.pill.bad { background: var(--accent-soft); color: var(--accent); }
.pill.off { background: var(--fill-2); color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--fill-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}
button.chip { cursor: pointer; }
button.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.hero .chip { background: rgba(255, 255, 255, 0.62); color: var(--text); }
:root[data-theme="dark"] .hero .chip { background: rgba(255, 255, 255, 0.08); }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 14px;
  font-weight: 650;
  font-size: 16px;
  background: var(--fill);
  color: var(--accent);
  transition: transform 0.12s var(--ease), background 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--accent); background: transparent; }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14.5px; border-radius: 11px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 160px; }

/* search */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 42px;
  border-radius: 12px;
  background: var(--fill-2);
  color: var(--text-3);
}
.search input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; min-width: 0; }

/* forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13.5px; font-weight: 650; color: var(--text-2); padding-inline-start: 2px; }
.field small { font-size: 12.5px; color: var(--text-3); padding-inline-start: 2px; }
.input, .field input, .field select, .field textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--sep);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px; /* 16px stops iOS from zooming into the field */
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: 18px 50%, 13px 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-inline-start: 34px;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.input.ltr, .field input.ltr { direction: ltr; text-align: end; display: block; }

/* segmented control */
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: var(--fill-2);
}
.seg button {
  min-height: 38px;
  padding: 6px 4px;
  border-radius: 10px;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
  color: var(--text-2);
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.seg.status button[aria-pressed="true"][data-v="done"] { background: var(--done); color: #fff; }
.seg.status button[aria-pressed="true"][data-v="missed"] { background: var(--missed); color: #fff; }
.seg.status button[aria-pressed="true"][data-v="postponed"] { background: var(--post); color: #fff; }
.seg.status button[aria-pressed="true"][data-v="scheduled"] { background: var(--sched); color: #fff; }
:root[data-theme="dark"] .seg.status button[aria-pressed="true"] { color: #141014; }

/* switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.switch-row .t { font-weight: 600; }
.switch-row small { display: block; color: var(--text-3); font-size: 12.5px; font-weight: 500; }
.switch { position: relative; flex: none; width: 51px; height: 31px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--fill-2); transition: background 0.2s; }
.switch span::after {
  content: "";
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.22s var(--ease);
}
.switch input:checked + span { background: var(--done); }
.switch input:checked + span::after { transform: translateX(-20px); }
.switch input:focus-visible + span { outline: 3px solid var(--accent-soft-2); outline-offset: 2px; }

/* student page */
.profile { display: flex; align-items: center; gap: 16px; padding: 18px; }
.profile h2 { margin: 0; font-size: 24px; font-weight: 750; }
.profile .goal { margin: 4px 0 8px; color: var(--text-2); font-size: 15px; }
.actions-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-block: 12px; }
.act {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px 10px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 650;
}
.act span { color: var(--text-2); }
.act[aria-disabled="true"] { opacity: 0.45; }
.balance { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; }
.balance .k { font-size: 14px; color: var(--text-2); font-weight: 600; }
.balance .v { font-size: 26px; font-weight: 780; letter-spacing: -0.01em; }
.balance .v.debt { color: var(--accent); }
.balance .v.credit, .balance .v.zero { color: var(--done); }
.info { padding: 6px 0; }
.info .row { min-height: 50px; }
.info .label { width: 96px; flex: none; color: var(--text-2); font-size: 14px; }
.notes { white-space: pre-wrap; padding: 14px 16px; color: var(--text); font-size: 15px; }

/* finance */
.month-switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-block-end: 12px; }
.month-switch strong { font-size: 18px; }
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; align-items: end; height: 150px; padding: 14px 16px 8px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bar .col { width: 100%; max-width: 36px; border-radius: 9px 9px 4px 4px; background: var(--accent-soft-2); transition: height 0.5s var(--ease); }
.bar.cur .col { background: var(--accent); }
.bar small { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.bar b { font-size: 11.5px; color: var(--text-2); font-weight: 650; }
.h-0 { height: 2%; } .h-1 { height: 8%; } .h-2 { height: 16%; } .h-3 { height: 24%; } .h-4 { height: 32%; }
.h-5 { height: 40%; } .h-6 { height: 48%; } .h-7 { height: 56%; } .h-8 { height: 64%; } .h-9 { height: 72%; }
.h-10 { height: 80%; } .h-11 { height: 88%; } .h-12 { height: 96%; }

/* sheet */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(30, 10, 20, 0.32);
  animation: fade 0.2s ease;
}
.sheet {
  width: 100%;
  max-width: 600px;
  max-height: 94dvh;
  display: flex;
  flex-direction: column;
  border-radius: 22px 22px 0 0;
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  animation: rise 0.34s var(--ease);
}
.sheet-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px 10px;
}
.sheet-head::before {
  content: "";
  position: absolute;
  inset-block-start: 6px;
  inset-inline-start: 50%;
  width: 38px;
  height: 5px;
  margin-inline-start: -19px;
  border-radius: 3px;
  background: var(--sep);
}
.sheet-head h2 { margin: 0; font-size: 19px; font-weight: 750; }
.sheet-body { overflow-y: auto; padding: 4px 18px calc(env(safe-area-inset-bottom) + 20px); -webkit-overflow-scrolling: touch; }
.sheet-foot {
  position: sticky;
  inset-block-end: 0;
  padding: 12px 0 2px;
  background: linear-gradient(to top, var(--bg) 75%, transparent);
}
@media (min-width: 700px) {
  .backdrop { align-items: center; padding: 24px; }
  .sheet { border-radius: 22px; max-height: 88dvh; }
  .sheet-head::before { display: none; }
}
.sheet .card { box-shadow: none; border: 1px solid var(--sep); }
.sheet .list { box-shadow: none; border: 1px solid var(--sep); }

.lesson-top { display: flex; align-items: center; gap: 12px; margin-block: 2px 14px; }
.lesson-top .t { font-weight: 700; font-size: 18px; }
.lesson-top .m { color: var(--text-2); font-size: 14.5px; }

.note {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--fill);
  color: var(--text);
  font-size: 14px;
}
.note svg { color: var(--accent); margin-block-start: 1px; }
.note.warn { background: var(--post-soft); }
.note.warn svg { color: var(--post); }
.preview-msg {
  white-space: pre-wrap;
  padding: 12px 14px;
  border-radius: 16px 16px 4px 16px;
  background: #dcf8c6;
  color: #1d2a19;
  font-size: 15px;
  line-height: 1.45;
}
:root[data-theme="dark"] .preview-msg { background: #1f3b2a; color: #e6f4e8; }

details > summary { cursor: pointer; font-weight: 650; color: var(--accent); list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "＋ "; }
details[open] > summary::before { content: "− "; }

/* toast */
.toast {
  position: fixed;
  z-index: 80;
  inset-inline: 16px;
  inset-block-end: calc(env(safe-area-inset-bottom) + 84px);
  max-width: 460px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: #2b2027;
  color: #fff;
  box-shadow: var(--shadow-lg);
  font-size: 15px;
  animation: rise 0.3s var(--ease);
}
.toast .grow { flex: 1; }
.toast button { color: #f8b6cd; font-weight: 700; }
@media (min-width: 900px) { .toast { inset-block-end: 28px; } }

/* empty & misc */
.empty { padding: 26px 18px; text-align: center; color: var(--text-2); }
.empty .big { font-size: 34px; display: block; margin-block-end: 6px; }
.spinner { padding: 60px 0; text-align: center; color: var(--text-3); }
.foot { margin-block: 30px 10px; text-align: center; color: var(--text-3); font-size: 12.5px; }
.kbd { direction: ltr; unicode-bidi: isolate; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
       padding: 2px 6px; border-radius: 6px; background: var(--fill-2); word-break: break-all; }
.stack > * + * { margin-block-start: 10px; }
.sep { height: 1px; background: var(--sep); margin-block: 14px; }
.right { text-align: end; }
.nowrap { white-space: nowrap; }
.money { font-variant-numeric: tabular-nums; }

/* login */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: radial-gradient(1200px 600px at 50% -10%, #fbd9e5 0%, transparent 60%), var(--bg);
}
:root[data-theme="dark"] .login { background: radial-gradient(1200px 600px at 50% -10%, #3a2230 0%, transparent 60%), var(--bg); }
.login .card { width: 100%; max-width: 380px; padding: 30px 24px 24px; text-align: center; }
.login img { width: 76px; height: 76px; border-radius: 19px; box-shadow: 0 10px 30px rgba(180, 70, 109, 0.25); }
.login h1 { margin: 16px 0 4px; font-size: 25px; font-weight: 760; }
.login p { margin: 0 0 20px; color: var(--text-2); }
.login form { text-align: start; }
.login .alt { margin-block-start: 18px; font-size: 14px; color: var(--text-2); }

@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 380px) {
  .seg button { font-size: 13px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile .v { font-size: 20px; }
  .head h1 { font-size: 28px; }
}
