/* Interface polish guided by unslop, Damir Sokolovsky (@heydamir), CC BY 4.0.
   https://github.com/heydamir/unslop — preserve this attribution in adaptations. */
:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  color: #20252d;
  background: #f6f7f9;
  --ink: #20252d;
  --secondary: #515b6b;
  --muted: #667085;
  --accent: #4c5bc4;
  --accent-soft: #f4f5fc;
  --surface: #fff;
  --raised: #f1f3f6;
  --border: #e3e6eb;
  --sidebar: #1b2435;
  --radius: 16px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; border: 0; background: none; transition: color 160ms var(--ease), background-color 160ms var(--ease), border-color 160ms var(--ease); }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, tr[tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { text-decoration: none; color: var(--accent); }
svg { display: block; flex-shrink: 0; }
button svg { pointer-events: none; }
h1, h2, h3, p { margin: 0; }
input, select { color: var(--ink); min-width: 0; }
button, label { user-select: none; }
.app-shell { min-height: 100svh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; padding: 32px 20px 24px; background: var(--sidebar); color: #c1c9d6; display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 12px; color: #fff; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 23px; font-weight: 500; }
.brand-title { font-size: 20px; font-weight: 600; letter-spacing: .04em; line-height: 1.2; }
.brand-caption { font-size: 12px; line-height: 18px; color: #a6b2c6; margin-top: 4px; }
.nav-caption { padding: 36px 12px 12px; font-size: 12px; color: #a6b2c6; }
.nav-list { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 40px; width: 100%; padding: 8px 12px; border-radius: 8px; text-align: left; color: #c1c9d6; font-size: 14px; line-height: 20px; font-weight: 400; }
.nav-item:hover { background: #ffffff09; color: #fff; }
.nav-item.active { background: #ffffff12; color: #fff; font-weight: 500; box-shadow: inset 2px 0 0 #aab3ff; }
.sidebar .nav-item:focus-visible { outline-color: #c5cbff; }
.sidebar-bottom { margin-top: auto; padding-top: 40px; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; padding: 24px 12px 0; color: #a6b2c6; font-size: 12px; }
.workspace { margin-left: 248px; min-width: 0; }
.topbar { height: 72px; padding: 0 40px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--border); background: var(--surface); }
.breadcrumb { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.breadcrumb strong { color: var(--ink); font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.role-control { display: flex; align-items: center; gap: 12px; padding-left: 20px; border-left: 1px solid var(--border); }
.avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; color: var(--secondary); background: var(--raised); font-size: 12px; font-weight: 500; }
.mobile-brand { display: none; }
main { max-width: 1520px; margin: 0 auto; padding: 40px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.eyebrow { margin-bottom: 8px; font-size: 12px; line-height: 18px; color: var(--muted); }
h1 { font-size: 32px; line-height: 40px; font-weight: 500; letter-spacing: -.02em; }
.subtitle { margin-top: 8px; color: var(--secondary); font-size: 14px; line-height: 22px; }
.page-actions { display: flex; align-items: center; gap: 8px; padding-top: 24px; }
.btn { min-height: 40px; padding: 8px 16px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap; }
.btn.secondary { border: 1px solid var(--border); background: var(--surface); color: var(--ink); }
.btn.secondary:hover { background: var(--raised); border-color: #cbd0d9; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #3e4bab; }
.btn.ghost { color: var(--secondary); padding: 8px; }
.btn.ghost:hover { background: var(--raised); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--secondary); }
.icon-btn:hover { background: var(--raised); color: var(--ink); }
.period-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.segmented { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: #eceff3; }
.segment { min-height: 32px; padding: 4px 12px; border-radius: 6px; color: var(--secondary); font-size: 13px; line-height: 20px; font-weight: 400; white-space: nowrap; }
.segment.active { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px #0000000a; }
.period-label { display: flex; align-items: center; gap: 8px; font-size: 12px; line-height: 20px; color: var(--secondary); }
.period-label strong { font-weight: 400; }
.stats-grid { display: grid; grid-template-columns: 1.25fr repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { min-width: 0; min-height: 144px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.stat-top { color: var(--secondary); font-size: 13px; line-height: 20px; }
.stat-value { margin-top: 12px; font-size: 32px; line-height: 40px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-caption { margin-top: 8px; font-size: 12px; line-height: 18px; color: var(--muted); }
.stat-primary { border-top: 2px solid var(--accent); padding-top: 23px; }
.stat-primary .stat-value { color: var(--accent); }
.panel { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px; }
.panel-title { display: flex; align-items: center; gap: 8px; font-size: 16px; line-height: 24px; font-weight: 500; }
.small-count { color: var(--muted); font-size: 12px; line-height: 16px; font-weight: 400; font-variant-numeric: tabular-nums; }
.panel-description { margin-top: 4px; color: var(--secondary); font-size: 13px; line-height: 20px; }
.search { display: flex; align-items: center; gap: 8px; min-height: 40px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--muted); background: var(--surface); }
.search input { width: 172px; border: 0; outline: none; background: transparent; color: var(--ink); font-size: 13px; line-height: 20px; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.search:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; text-align: left; font-variant-numeric: tabular-nums; }
thead { background: #f9fafb; }
th { padding: 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); color: var(--secondary); font-size: 12px; line-height: 18px; font-weight: 500; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
td { padding: 20px 16px; border-bottom: 1px solid var(--border); font-size: 14px; line-height: 20px; vertical-align: middle; }
.summary-table tbody tr[data-teacher] { cursor: pointer; }
.summary-table tbody tr[data-teacher]:hover { background: #fafbfc; }
.summary-table .teacher-cell { min-width: 184px; }
.teacher-identity { display: flex; align-items: center; gap: 12px; }
.teacher-name { color: var(--ink); font-size: 14px; line-height: 20px; font-weight: 500; }
.directory-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.teacher-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.teacher-cards > .empty { grid-column: 1 / -1; }
.teacher-card { display: flex; flex-direction: column; min-width: 0; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.teacher-card .teacher-name { overflow-wrap: anywhere; }
.teacher-card-summary { display: flex; justify-content: space-between; gap: 16px; margin: 24px 0; }
.teacher-card-summary > div:last-child { text-align: right; }
.teacher-card-summary span { display: block; color: var(--muted); font-size: 12px; line-height: 18px; }
.teacher-card-summary strong { display: block; margin-top: 8px; color: var(--ink); font-size: 24px; line-height: 32px; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.teacher-card > .btn { width: 100%; margin-top: auto; }
.personal-weeks { padding: 0 24px; }
.personal-week { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 20px 0; border-top: 1px solid var(--border); }
.personal-week h3 { font-size: 14px; line-height: 20px; font-weight: 500; }
.personal-week p { margin-top: 8px; color: var(--secondary); font-size: 12px; line-height: 20px; }
.personal-week > strong { flex-shrink: 0; color: var(--accent); font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; }
.personal-week > strong.partial-total { color: #806021; }
.journal-teacher-filter { display: flex; align-items: center; gap: 12px; padding: 0 24px 24px; color: var(--secondary); font-size: 13px; }
.journal-teacher-filter .small-select { max-width: 300px; }
.lesson-teacher { margin-top: 4px; color: var(--secondary); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
.week-head { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 124px; }
.week-head strong { color: var(--secondary); font-size: 12px; font-weight: 500; }
.week-head small { color: var(--muted); font-size: 11px; font-weight: 400; }
.week-cell { text-align: right; }
.week-money { color: var(--ink); font-size: 14px; font-weight: 500; }
.week-breakdown { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; color: var(--secondary); font-size: 12px; line-height: 18px; }
.tiny-kind { display: inline-flex; align-items: center; gap: 4px; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot.ordinary { background: #727fce; }
.dot.special { background: #9b7ab0; }
.dot.cancelled { background: #85909e; }
.dot.pupil_absent { background: #b58a39; }
.dot.teacher_absent { background: #b36574; }
.total-heading, .total-cell { text-align: right; background: var(--accent-soft); }
.row-total { color: var(--accent); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.summary-table tfoot td { border-bottom: 0; background: #f9fafb; font-size: 13px; font-weight: 500; text-align: right; }
.summary-table tfoot td:first-child { text-align: left; }
.summary-table tfoot .row-total { background: var(--accent-soft); font-size: 15px; }
.panel-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 24px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--secondary); font-size: 12px; line-height: 20px; }
.legend span { display: flex; align-items: center; gap: 8px; }
.muted-note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; line-height: 20px; }
.bottom-note { display: flex; justify-content: space-between; gap: 16px; margin-top: 20px; color: var(--muted); font-size: 12px; line-height: 20px; }
.bottom-note span { display: flex; align-items: center; gap: 8px; }
.notice { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 24px; padding: 16px; border: 1px solid #e8d7ac; border-radius: 12px; background: #fffbf1; color: #725a24; font-size: 13px; line-height: 20px; }
.notice strong { font-weight: 500; }
.notice.blue { border-color: #d8dff0; background: var(--accent-soft); color: #495680; }
.back-button { display: inline-flex; align-items: center; gap: 8px; padding: 0; margin-bottom: 20px; min-height: 32px; font-size: 13px; color: var(--secondary); }
.back-button:hover { color: var(--accent); }
.lesson-toolbar { display: flex; align-items: center; gap: 8px; }
.small-select { height: 40px; padding: 8px 28px 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--secondary); font-size: 13px; line-height: 20px; max-width: 220px; }
.weeks-list { display: flex; flex-direction: column; gap: 24px; padding: 0 24px 24px; }
.week-section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.week-section-header h3 { color: var(--secondary); font-size: 13px; line-height: 20px; font-weight: 500; }
.week-section-header span { color: var(--muted); font-size: 12px; line-height: 20px; }
.lesson-list { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.lesson-row { display: grid; grid-template-columns: 92px minmax(120px, 1fr) minmax(112px, 172px) 108px; align-items: center; gap: 16px; padding: 20px; border-bottom: 1px solid var(--border); }
.lesson-row:last-child { border-bottom: 0; }
.lesson-date { color: var(--muted); font-size: 12px; line-height: 18px; }
.lesson-pupil { color: var(--ink); font-size: 14px; line-height: 20px; font-weight: 500; }
.lesson-topic { margin-top: 4px; color: var(--secondary); font-size: 12px; line-height: 20px; }
.lesson-amount { text-align: right; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.lesson-amount.negative { color: #a03f52; }
.status { display: inline-flex; align-items: center; gap: 6px; justify-self: start; padding: 4px 8px; border-radius: 6px; max-width: 100%; color: var(--secondary); background: var(--raised); font-size: 11px; line-height: 16px; white-space: nowrap; font-weight: 400; }
.status.special { color: #725587; background: #f5f0f7; }
.status.pupil_absent { color: #806021; background: #faf4e8; }
.status.teacher_absent { color: #9a4354; background: #fbf0f2; }
.section-space { margin-top: 24px; }
.rate-type { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 400; }
.rate-amount { font-size: 16px; font-weight: 500; }
.inherited { display: inline-block; color: var(--secondary); font-size: 12px; line-height: 18px; }
.personal { color: var(--accent); }
.history-list { padding: 0 24px; }
.history-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 0; border-top: 1px solid var(--border); }
.history-name { color: var(--ink); font-size: 13px; line-height: 20px; }
.history-detail { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 20px; }
.history-value { color: var(--ink); font-size: 14px; line-height: 20px; font-weight: 500; font-variant-numeric: tabular-nums; }
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 272px; gap: 24px; }
.help-card { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 24px; height: fit-content; }
.help-card h3 { color: var(--ink); font-size: 14px; line-height: 20px; margin-top: 16px; font-weight: 500; }
.help-card p { color: var(--secondary); font-size: 13px; line-height: 22px; margin-top: 8px; }
.info-symbol { color: var(--muted); }
.help-rule { margin-top: 20px; padding-top: 4px; border-top: 1px solid var(--border); }
.mobile-nav { display: none; }

.modal { width: 480px; max-width: 100%; max-height: 90dvh; min-width: 0; overflow: auto; flex-shrink: 1; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: 0 8px 24px #0000000f; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px; }
.modal-head h2 { font-size: 24px; line-height: 32px; font-weight: 500; }
.modal-head p { margin-top: 8px; color: var(--secondary); font-size: 13px; line-height: 20px; }
.modal-body { min-width: 0; padding: 0 24px 24px; }
.form-field { display: block; margin: 0 0 20px; min-width: 0; }
.form-field > span { display: block; margin-bottom: 8px; color: var(--secondary); font-size: 13px; line-height: 20px; }
.form-field input, .form-field select { width: 100%; min-height: 44px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 8px 12px; font-size: 16px; }
.form-hint { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 20px; }
.form-error { margin: 12px 0; color: #a03f52; font-size: 13px; line-height: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.modal-actions .btn { min-height: 44px; }
.toast { position: fixed; bottom: 32px; left: calc(50% + 124px); z-index: 120; max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 13px; line-height: 20px; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity 160ms var(--ease), transform 160ms var(--ease); }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: no-preference) { .fade-in { animation: fade-in 180ms var(--ease);  } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 701px) { .mobile-week { display: none; } }
@media (max-width: 1200px) and (min-width: 701px) {
  .teacher-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { width: 216px; padding-inline: 16px; }
  .workspace { margin-left: 216px; }
  .topbar { padding-inline: 24px; }
  main { padding: 32px 24px; }
  .stat-card { padding: 20px 16px; }
  .stat-primary { padding-top: 19px; }
  .stats-grid { gap: 12px; }
  .page-heading { flex-wrap: wrap; gap: 16px; }
  .page-actions { padding-top: 0; }
  .period-toolbar { flex-wrap: wrap; }
  .panel-head { flex-wrap: wrap; gap: 16px; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .help-card { max-width: none; }
  .lesson-row { grid-template-columns: 80px minmax(100px, 1fr) 124px 88px; gap: 12px; padding: 16px; }
}
@media (max-width: 960px) and (min-width: 701px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { min-height: 132px; }
  .readonly-label { display: none; }
  .lesson-row { grid-template-columns: 72px minmax(0, 1fr) auto; }
  .lesson-row .status { grid-column: 2; grid-row: 2; }
  .lesson-date { grid-row: 1 / 3; }
  .lesson-amount { grid-column: 3; grid-row: 1 / 3; }
}
@media (max-width: 700px) {
  .directory-toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .teacher-cards { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .teacher-card { padding: 20px; }
  .personal-weeks { padding: 0 16px; }
  .personal-week { align-items: flex-start; gap: 16px; }
  .personal-week h3 { font-size: 12px; }
  .personal-week > strong { font-size: 16px; }
  .journal-teacher-filter { align-items: stretch; flex-direction: column; gap: 8px; padding: 0 16px 20px; }
  .journal-teacher-filter .small-select { width: 100%; max-width: none; }
  .sidebar { display: none; }
  .workspace { margin-left: 0; }
  .topbar { height: 64px; padding: 0 16px; position: sticky; top: 0; z-index: 30; gap: 12px; }
  .breadcrumb { display: none; }
  .mobile-brand { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; letter-spacing: .04em; }
  .mobile-brand .brand-mark { width: 32px; height: 32px; font-size: 20px; border-radius: 8px; }
  .topbar-actions { gap: 8px; }
  .role-control { border: 0; padding: 0; gap: 8px; }
  .role-control .avatar { display: none; }
  main { padding: 24px 16px 112px; }
  .page-heading { display: block; margin-bottom: 24px; }
  .page-heading h1 { font-size: 28px; line-height: 36px; }
  .eyebrow { font-size: 12px; line-height: 18px; margin-bottom: 4px; }
  .subtitle { font-size: 13px; line-height: 20px; margin-top: 8px; }
  .page-actions { padding-top: 16px; gap: 8px; }
  .page-actions .btn { min-height: 44px; padding: 8px 12px; font-size: 12px; }
  .period-toolbar { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 20px; }
  .segmented { width: 100%; }
  .segment { min-height: 36px; flex: 1; padding: 8px; font-size: 12px; }
  .period-label { font-size: 12px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
  .stat-card { min-height: 128px; padding: 16px; border-radius: 12px; }
  .stat-primary { padding-top: 15px; }
  .stat-top { font-size: 12px; line-height: 18px; }
  .stat-value { margin-top: 8px; font-size: clamp(22px, 6.4vw, 28px); line-height: 36px; }
  .stat-caption { margin-top: 4px; font-size: 12px; line-height: 18px; }
  .panel { border-radius: 14px; }
  .panel-head { align-items: stretch; flex-direction: column; gap: 16px; padding: 20px 16px; }
  .panel-title { font-size: 16px; }
  .panel-description { font-size: 12px; line-height: 20px; }
  .search { min-height: 44px; }
  .search input { width: 100%; font-size: 14px; }
  .summary-table { white-space: normal; display: block; }
  .summary-table thead, .summary-table tfoot { display: none; }
  .summary-table tbody { display: block; }
  .summary-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 20px 16px; border-top: 1px solid var(--border); }
  .summary-table td { display: block; padding: 0 !important; border: 0; }
  .summary-table .teacher-cell { min-width: 0; grid-column: 1; }
  .teacher-identity { gap: 8px; }
  .teacher-identity .avatar { width: 32px; height: 32px; font-size: 11px; border-radius: 8px; }
  .teacher-name { font-size: 13px; }
  .summary-table .total-cell { grid-column: 2; grid-row: 1; align-self: center; background: transparent; }
  .summary-table .arrow-cell { display: none; }
  .summary-table .week-cell { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--border); padding-top: 12px !important; }
  .mobile-week { color: var(--secondary); font-size: 12px; line-height: 18px; max-width: 58%; }
  .week-money { font-size: 14px; }
  .week-breakdown { margin-top: 4px; font-size: 11px; }
  .row-total { font-size: 15px; }
  .panel-footer { display: block; padding: 16px; }
  .legend { gap: 8px 12px; font-size: 11px; }
  .panel-footer .muted-note { margin-top: 12px; }
  .bottom-note { flex-direction: column; gap: 8px; margin-top: 20px; }
  .bottom-note span { align-items: flex-start; }
  .mobile-nav { display: flex; position: fixed; inset: auto 0 0; z-index: 40; gap: 4px; border-top: 1px solid var(--border); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); }
  .mobile-nav .nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 48px; padding: 4px; text-align: center; font-size: 11px; line-height: 16px; color: var(--secondary); }
  .mobile-nav .nav-item.active { color: var(--accent); background: var(--accent-soft); box-shadow: none; }
  .lesson-toolbar { flex-wrap: wrap; width: 100%; gap: 8px; }
  .lesson-toolbar .search { flex: 1; min-width: 140px; }
  .small-select { min-height: 44px; font-size: 12px; max-width: 172px; }
  .weeks-list { gap: 24px; padding: 0 16px 20px; }
  .week-section-header { align-items: flex-start; gap: 12px; }
  .week-section-header h3 { font-size: 12px; line-height: 18px; max-width: 62%; }
  .week-section-header span { font-size: 12px; line-height: 18px; text-align: right; }
  .lesson-row { grid-template-columns: 60px minmax(0, 1fr) auto; gap: 8px 12px; padding: 16px 12px; }
  .lesson-date { grid-column: 1; grid-row: 1 / 3; align-self: center; font-size: 11px; }
  .lesson-pupil { font-size: 14px; }
  .lesson-topic { font-size: 12px; line-height: 18px; }
  .lesson-row .status { grid-column: 2; grid-row: 2; font-size: 11px; white-space: normal; }
  .lesson-row .lesson-amount { grid-column: 3; grid-row: 1 / 3; align-self: center; font-size: 14px; }
  .notice { margin-bottom: 20px; padding: 12px; font-size: 12px; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .rate-table th { font-size: 11px; padding: 12px; }
  .rate-table td { font-size: 13px; padding: 16px 12px; }
  .rate-table th:first-child, .rate-table td:first-child { padding-left: 16px; }
  .rate-table th:last-child, .rate-table td:last-child { padding-right: 16px; }
  .rate-type { min-width: 112px; max-width: 144px; white-space: normal; font-size: 12px; line-height: 20px; }
  .rate-amount { font-size: 14px; }
  .inherited { font-size: 11px; }
  .history-list { padding: 0 16px; }
  .history-item { padding: 16px 0; }
  .history-value { font-size: 13px; }
  .help-card { padding: 20px; }

  .modal-head { padding: 20px; }
  .modal-head h2 { font-size: 22px; line-height: 28px; }
  .modal-body { padding: 0 20px 20px; }
  .toast { left: 50%; bottom: 88px; width: max-content; }
}


.dot.trial{background:#a16207}

/* Native top-layer dialogs; no root scroll lock or JavaScript focus trap. */
 dialog.modal { margin: auto; padding: 0; color: var(--ink, #20252d); border: 1px solid var(--border, #e3e6eb); max-inline-size: calc(100% - 32px); max-block-size: calc(100dvh - 32px); }
 dialog:modal { overscroll-behavior: contain; }
 dialog::backdrop { background: #17203366; overflow: hidden; overscroll-behavior: contain; }
 .skip-link { position: fixed; inset: 8px auto auto 8px; z-index: 40; padding: 12px 16px; background: #fff; color: var(--ink, #20252d); border: 2px solid var(--accent, #4c5bc4); border-radius: 8px; transform: translateY(-160%); }
 .skip-link:focus { transform: none; }
 textarea { font: inherit; }
 textarea:focus-visible { outline: 2px solid var(--accent, #4c5bc4); outline-offset: 3px; }
 @media (pointer: coarse) { .icon-btn { min-inline-size: 44px; min-block-size: 44px; } }


@media (prefers-reduced-motion: reduce) { .toast { transition: opacity .16s; } }
