:root {
  --bg: #F7F3EE; --ink: #1E1A22; --muted: #5E5663; --faint: #8A818D;
  --accent: #8C2446; --accent-dark: #6B1A35; --line: #E6DFD7; --line-soft: #EFE9E2; --panel: #FFFFFF; --head: #F3EEE8;
  --ok-fg: #1E6B57; --ok-bg: #DCEEE7; --warn-fg: #9A3F0A; --warn-bg: #FBE6D6; --info-fg: #2C5C8F; --info-bg: #E1EAF5;
  --rose-bg: #F3E1E7;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); } a:hover { color: var(--accent-dark); }
h1, .display { font-family: "Playfair Display", Georgia, serif; font-weight: 600; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex-shrink: 0; background: var(--ink); color: var(--bg); display: flex; flex-direction: column; gap: 32px; padding: 28px 18px; }
.brand { padding: 0 10px; }
.brand-name { font-family: "Playfair Display", Georgia, serif; font-style: italic; font-weight: 600; font-size: 32px; line-height: 1; color: var(--bg); text-decoration: none; }
.brand-sub { margin-top: 6px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #B8AFBA; }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu a { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 10px; color: #E4DDE6; text-decoration: none; font-weight: 500; }
.menu a:hover { background: #2E2833; color: #fff; }
.menu a[aria-current="page"] { background: var(--accent); color: #fff; font-weight: 600; }
.menu-title { margin: 14px 14px 4px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #8A818D; }
.menu-title:first-child { margin-top: 0; }
.menu .menu-dir-all { display: none; }
.menu a.menu-dir { min-height: 38px; font-size: 14px; }
.me { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid #3A3340; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.me small { color: #B8AFBA; }
.me form button { background: none; border: 0; padding: 0; color: #E3B8C6; font: inherit; cursor: pointer; text-align: left; }

.main { flex-grow: 1; min-width: 0; padding: 32px 40px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.page-head h1 { margin: 4px 0 0; font-size: 36px; line-height: 1.1; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: flex; background: #EDE6DE; border-radius: 10px; padding: 4px; gap: 4px; }
.seg a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.seg a[aria-current="page"] { background: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 16px; border-radius: 10px; background: #fff; border: 1px solid #D9D0C6; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.btn:hover { border-color: var(--accent); color: var(--accent); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.tag { display: inline-flex; align-items: center; min-height: 22px; padding: 1px 9px; border-radius: 11px; font-size: 12px; font-weight: 700; }
.tag-ok { background: var(--ok-bg); color: var(--ok-fg); }
.tag-warn { background: var(--warn-bg); color: var(--warn-fg); }
.tag-info { background: var(--info-bg); color: var(--info-fg); }
.tag-rose { background: var(--rose-bg); color: var(--accent); }
.tag-muted { background: var(--head); color: var(--muted); }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }

/* Неделя */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.day { display: flex; flex-direction: column; gap: 8px; padding: 12px; min-height: 220px; }
.day.today { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.day.school { background: linear-gradient(#fff, #fff) padding-box; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.day-name { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.day-num { font-family: "Playfair Display", Georgia, serif; font-size: 24px; font-weight: 600; }
.today .day-num { color: var(--accent); }
.lesson { border-radius: 10px; padding: 8px 10px; background: var(--head); display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.lesson b { font-size: 14px; line-height: 1.25; }
.lesson.held { background: var(--ok-bg); }
.lesson.cancelled { background: #fff; border: 1px dashed #D9D0C6; color: var(--faint); }
.lesson.cancelled b { text-decoration: line-through; }
.lesson.moved { background: var(--info-bg); }
.event { border-radius: 8px; padding: 6px 8px; font-size: 12px; font-weight: 600; line-height: 1.3; }
.event.k-competition, .event.k-concert, .event.k-trip { background: var(--rose-bg); color: var(--accent); }
.event.k-day_off, .event.k-break, .event.k-change { background: var(--warn-bg); color: var(--warn-fg); }
.event.k-training, .event.k-event { background: var(--info-bg); color: var(--info-fg); }
.school-note { font-size: 11px; font-weight: 600; color: var(--info-fg); }
.empty { font-size: 13px; color: var(--faint); }

/* Месяц */
.month { overflow-x: auto; }
.month table { width: 100%; min-width: 760px; border-collapse: collapse; table-layout: fixed; }
.month th { padding: 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--head); text-align: left; }
.month td { vertical-align: top; height: 118px; padding: 8px; border-top: 1px solid var(--line-soft); border-left: 1px solid var(--line-soft); }
.month td:first-child { border-left: 0; }
.month td.other { background: #FBF9F6; color: var(--faint); }
.month td.today { box-shadow: inset 0 0 0 2px var(--accent); }
.month .num { font-weight: 700; font-size: 14px; text-decoration: none; color: inherit; }
.month .line { display: block; font-size: 12px; line-height: 1.3; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month .line.cancelled { text-decoration: line-through; color: var(--faint); }

/* Сезон */
.table-wrap { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th { padding: 10px 8px; background: var(--head); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: center; white-space: nowrap; }
.grid th:first-child, .grid td:first-child { text-align: left; padding-left: 16px; }
.grid td { padding: 8px; border-top: 1px solid var(--line-soft); text-align: center; font-variant-numeric: tabular-nums; }
.grid td.zero { color: var(--faint); }
.grid small { display: block; font-size: 11px; color: var(--warn-fg); }
.events-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.events-list section { padding: 16px 18px; }
.events-list h2 { margin: 0 0 8px; font-size: 16px; }
.ev-row { display: flex; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.ev-row b { width: 76px; flex-shrink: 0; }

@media (max-width: 1100px) { .week { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar { width: auto; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px; gap: 8px; }
  .brand { display: flex; align-items: baseline; gap: 10px; }
  .brand-name { font-size: 24px; }
  .brand-sub { margin: 0; }
  .menu { flex-direction: row; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; }
  .menu a { min-height: 40px; flex-shrink: 0; white-space: nowrap; }
  .menu-title, .menu .menu-dir { display: none; }
  .menu .menu-dir-all { display: flex; }
  .me { display: none; }
  .main { padding: 20px 16px; }
  .page-head h1 { font-size: 28px; }
  .week { grid-template-columns: minmax(0, 1fr); }
  .day { min-height: 0; }
}

/* Отметка посещений (в первую очередь — телефон) */
button, .btn, .chip { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.lesson-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.lesson-card h1 { margin: 2px 0 0; font-size: 30px; line-height: 1.15; }
.lesson-when { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-top: 8px; margin: 0 -4px; padding-inline: 4px; scrollbar-width: none; }
.chip { flex-shrink: 0; display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid #D9D0C6; background: #fff; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.alert { padding: 12px 16px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-fg); font-weight: 600; }
.empty-box { padding: 20px; color: var(--muted); }

.att-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.att-row form { display: flex; align-items: stretch; gap: 8px; margin: 0; }
.att-name { flex-grow: 1; min-width: 0; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 16px/1.25 inherit; font-family: inherit; text-align: left; cursor: pointer; }
.att-num { width: 22px; flex-shrink: 0; color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.att-btns { display: flex; gap: 6px; }
.att-btns button { width: 56px; min-height: 56px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--muted); font: 700 14px inherit; font-family: inherit; cursor: pointer; }
.att-row.s-present .att-name { background: var(--ok-bg); border-color: var(--ok-bg); color: var(--ok-fg); }
.att-row.s-absent .att-name { background: var(--warn-bg); border-color: var(--warn-bg); color: var(--warn-fg); }
.att-row.s-excused .att-name { background: var(--info-bg); border-color: var(--info-bg); color: var(--info-fg); }
.att-btns .b-present[aria-pressed="true"] { background: var(--ok-fg); border-color: var(--ok-fg); color: #fff; }
.att-btns .b-absent[aria-pressed="true"] { background: var(--warn-fg); border-color: var(--warn-fg); color: #fff; }
.att-btns .b-excused[aria-pressed="true"] { background: var(--info-fg); border-color: var(--info-fg); color: #fff; }
.pending { opacity: .6; }

.att-bar { position: sticky; bottom: 0; z-index: 5; margin: 0 -40px; padding: 12px 40px calc(12px + env(safe-area-inset-bottom, 0px)); background: rgba(247, 243, 238, .96); border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.att-counts { display: flex; gap: 6px; flex-wrap: wrap; }
.att-counts .tag { min-height: 28px; font-size: 13px; }
.att-bulk { display: flex; gap: 8px; }
.att-bulk form { margin: 0; }
.att-bulk .btn { cursor: pointer; font-family: inherit; }
.lesson-links { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: 14px; font-weight: 600; }
.lesson-links a { min-height: 44px; display: inline-flex; align-items: center; }
.choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.choice-item { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); }
.choice-item:hover { border-color: var(--accent); }
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.25); }

/* Журнал */
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.field select, .field input { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid #D9D0C6; background: #fff; font: 600 14px inherit; font-family: inherit; color: var(--ink); }
.journal td form { margin: 0; display: flex; justify-content: center; }
.journal td.name { font-weight: 600; white-space: nowrap; }
.journal th a { color: inherit; text-decoration: none; }
.cell { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 36px; border-radius: 8px; border: 1px solid transparent; font: 700 15px inherit; font-family: inherit; cursor: pointer; }
.legend .cell { width: 26px; height: 26px; cursor: default; }
.c-present { background: var(--ok-bg); color: var(--ok-fg); }
.c-absent { background: var(--warn-bg); color: var(--warn-fg); }
.c-excused { background: var(--info-bg); color: var(--info-fg); }
.c-none { background: #fff; border-color: #D9D0C6; color: var(--faint); }

@media (max-width: 800px) {
  .att-bar { margin: 0 -16px; padding-inline: 16px; }
  .att-bulk { width: 100%; }
  .att-bulk form { flex: 1; }
  .att-bulk .btn { width: 100%; padding: 0 8px; }
  .lesson-card h1 { font-size: 26px; }
}
@media (max-width: 380px) {
  .att-btns button { width: 48px; }
  .att-num { display: none; }
}

/* Финансы */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat span { font-size: 13px; color: var(--muted); }
.stat b { font-size: 28px; line-height: 1.15; }
.stat small { color: var(--muted); }
.stat-inline { min-width: 200px; }
.ok { color: var(--ok-fg); } .warn { color: var(--warn-fg); } .info { color: var(--info-fg); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.btn { cursor: pointer; font-family: inherit; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-danger { background: var(--warn-fg); border-color: var(--warn-fg); color: #fff; }
.btn-danger-link { margin-left: auto; color: var(--warn-fg); border-color: transparent; background: none; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.alert-ok { background: var(--ok-bg); color: var(--ok-fg); }
.grid.money td, .grid.list td, .grid.log td { text-align: left; }
.grid.money th, .grid.list th, .grid.log th { text-align: left; }
.grid.money td:nth-child(n+3):not(.what):not(:last-child) { text-align: right; white-space: nowrap; }
.grid td.what { font-size: 13px; color: var(--muted); max-width: 420px; }
.grid td.name { font-weight: 600; white-space: nowrap; }
.row-actions { white-space: nowrap; font-size: 13px; }
.row-actions a { margin-right: 8px; }
.two-col { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel-title { margin: 0; padding: 14px 16px 6px; font-size: 16px; }

/* Формы */
.form-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.form-card h2 { margin: 0; font-size: 18px; }
.form-card.narrow { max-width: 560px; }
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 18px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row > label { font-size: 13px; font-weight: 600; color: var(--muted); }
.form-row .req { color: var(--accent); }
.form-row input:not([type=checkbox]):not([type=radio]), .form-row select, .form-row textarea, .input,
.grid.rows input:not([type=checkbox]), .grid.rows select {
  min-height: 44px; width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid #D9D0C6; background: #fff;
  font: 500 15px inherit; font-family: inherit; color: var(--ink);
}
.form-row textarea { min-height: 80px; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-check > label { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; color: var(--ink); min-height: 44px; }
.form-check input { width: 20px; height: 20px; accent-color: var(--accent); }
.form-row div:has(> div > label > input[type=checkbox]) { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; padding: 6px 10px; border: 1px solid #D9D0C6; border-radius: 10px; background: #fff; }
.form-row div > div > label { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 14px; }
.form-row input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
.help { font-size: 12px; color: var(--faint); }
.error { font-size: 13px; color: var(--warn-fg); font-weight: 600; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--warn-fg) !important; }
.grid.rows td { padding: 6px; vertical-align: top; text-align: left; min-width: 110px; }
.grid.rows th { text-align: left; }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); background: rgba(247, 243, 238, .96); border-top: 1px solid var(--line); }
.input { width: auto; min-width: 220px; }

@media (max-width: 1000px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .two-col { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 800px) { .stat b { font-size: 22px; } .btn-danger-link { margin-left: 0; } }

/* Расписание ученика */
.stack { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lesson-line { color: var(--ink); text-decoration: none; font-size: 14px; }
.lesson-line.cancelled { color: var(--faint); text-decoration: line-through; }
.ev-row.is-today b:first-child { color: var(--accent); }
.ev-row > b:first-child { width: 120px; }
.kind-head td { background: #FBF9F6; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.list-title { margin: 8px 0 0; font-size: 16px; }

/* ——— Финансы: список слева, календарь справа ——— */
.fin-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.fin-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.fin-side { position: sticky; top: 16px; padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.fin-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.fin-toolbar .seg a { cursor: pointer; }
.fin-search { flex: 1; min-width: 180px; }
.fin-filter { margin: 0; }
.fin-filter select { min-width: 220px; }
.seg a { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 14px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.seg a[aria-current="page"] { background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg-full { display: grid; grid-template-columns: repeat(3, 1fr); }

.fin-list { display: flex; flex-direction: column; gap: 10px; }
.fin-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.2fr) auto; gap: 16px; align-items: center; padding: 14px 16px; transition: border-color .15s; }
.fin-row:hover { border-color: #D9CFC4; }
.fin-who { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.avatar { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--rose-bg); color: var(--accent); font-weight: 700; font-size: 16px; }
.fin-name { font-weight: 700; font-size: 16px; color: var(--ink); text-decoration: none; }
.fin-name:hover { color: var(--accent); }
.fin-what { display: flex; flex-direction: column; gap: 1px; margin-top: 2px; font-size: 13px; color: var(--muted); }
.fin-what em { font-style: normal; color: var(--accent); font-weight: 600; }
.fin-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.fin-nums div { display: flex; flex-direction: column; gap: 2px; }
.fin-nums dt { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.fin-nums dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-balance { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.fin-balance b { font-family: "Playfair Display", Georgia, serif; font-size: 22px; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.pill.tag-ok { background: var(--ok-bg); color: var(--ok-fg); } .pill.tag-warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill.tag-info { background: var(--info-bg); color: var(--info-fg); } .pill.tag-muted { background: var(--head); color: var(--muted); }

.fin-number { padding: 0; overflow: hidden; }
.fin-number summary { display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; list-style: none; }
.fin-number summary::-webkit-details-marker { display: none; }
.fin-number summary::after { content: "›"; font-size: 22px; color: var(--faint); transition: transform .15s; }
.fin-number[open] summary::after { transform: rotate(90deg); }
.fin-num-no { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--head); font-weight: 700; color: var(--muted); }
.fin-num-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fin-num-title small { color: var(--muted); font-size: 13px; }
.fin-num-total { font-family: "Playfair Display", Georgia, serif; font-size: 20px; white-space: nowrap; }
.fin-num-students { list-style: none; margin: 0; padding: 0 16px 10px; border-top: 1px solid var(--line-soft); }
.fin-num-students li { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr) auto; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.fin-num-students li:last-child { border-bottom: 0; }
.fin-num-students a { font-weight: 600; color: var(--ink); text-decoration: none; }
.fin-num-students b { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* календарь */
.side-block { display: flex; flex-direction: column; gap: 10px; }
.side-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.side-head a { font-size: 13px; font-weight: 600; }
.month-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: #FDFBF9; color: var(--ink); text-decoration: none; }
.tile:hover { border-color: var(--accent); }
.tile-name { font-weight: 700; font-size: 13px; text-transform: capitalize; }
.tile-sum { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile.is-current { border-color: var(--accent); }
.tile.is-selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.tile.is-selected .tile-sum { color: #F3D9E2; }
.cal-head { display: flex; justify-content: space-between; align-items: center; }
.cal-head b { font-size: 15px; }
.cal-nav { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; color: var(--ink); text-decoration: none; font-size: 22px; }
.cal-nav:hover { background: var(--head); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--faint); padding: 4px 0; }
.cal-day { height: 36px; border: 0; background: none; font: 600 14px Manrope, sans-serif; color: var(--ink); cursor: pointer; border-radius: 0; font-variant-numeric: tabular-nums; }
.cal-day:hover { background: var(--head); border-radius: 8px; }
.cal-day.is-other { color: #C4BAC6; }
.cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--accent); border-radius: 8px; }
.cal-day.in-range { background: var(--rose-bg); color: var(--accent); }
.cal-day.is-start, .cal-day.is-end { background: var(--accent); color: #fff; }
.cal-day.is-start { border-radius: 8px 0 0 8px; } .cal-day.is-end { border-radius: 0 8px 8px 0; }
.cal-day.is-start.is-end { border-radius: 8px; }
.range-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; margin: 0; }
.range-form .field input { min-width: 0; width: 100%; }
.range-form .btn { grid-column: 1 / -1; }

@media (max-width: 1100px) {
  .fin-layout { grid-template-columns: minmax(0, 1fr); }
  .fin-side { position: static; order: -1; }
  .fin-row { grid-template-columns: minmax(0, 1fr) auto; }
  .fin-nums { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 600px) {
  .fin-num-students li { grid-template-columns: 1fr auto; }
  .fin-num-students .fin-what { grid-column: 1 / -1; grid-row: 2; }
  .fin-balance b { font-size: 19px; }
}

/* Вход */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.login-card .muted { margin: -8px 0 4px; }
/* лого над полями: по ширине не больше 220px, по высоте не больше трети экрана (невысокие телефоны) */
.login-logo { display: block; width: min(220px, 64%); height: auto; max-height: 32vh; object-fit: contain; margin: 0 auto; }
.login-sub { margin: 0 0 6px; text-align: center; color: var(--muted); font-size: 14px; }
@media (max-width: 480px) {
  .login-page { padding: 16px 12px; }
  .login-card { padding: 22px 18px; }
  .login-logo { width: min(180px, 58%); max-height: 28vh; }
}
.login-brand { font-family: "Playfair Display", Georgia, serif; font-style: italic; font-weight: 600; font-size: 38px; color: var(--accent); }
.login-btn { width: 100%; min-height: 48px; font-size: 16px; }

/* ——— Кабинет родителя (телефон в первую очередь) ——— */
.cab-body { background: var(--bg); }
.cab { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.cab-preview { padding: 8px 16px; background: var(--info-bg); color: var(--info-fg); font-size: 13px; font-weight: 600; }
.cab-head { display: flex; justify-content: space-between; align-items: center; padding: calc(16px + env(safe-area-inset-top, 0px)) 18px 8px; }
.cab-brand { font-family: "Playfair Display", Georgia, serif; font-style: italic; font-weight: 600; font-size: 26px; color: var(--ink); text-decoration: none; }
.cab-me { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.cab-me .avatar { width: 36px; height: 36px; background: var(--accent); color: #fff; font-size: 14px; }
.cab-me form { margin: 0; }
.cab-logout { border: 0; background: none; color: var(--accent); font: 600 13px Manrope, sans-serif; cursor: pointer; padding: 8px 0 8px 6px; }
.cab-children { padding: 4px 18px 0; }
.cab-main { flex: 1; padding: 10px 18px 100px; display: flex; flex-direction: column; gap: 14px; }
.cab-title { margin: 4px 0 0; font-size: 28px; }
.cab-sub { margin: -8px 0 0; font-size: 14px; }
.cab-next { background: var(--ink); color: var(--bg); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.cab-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #E3B8C6; }
.cab-when { font-family: "Playfair Display", Georgia, serif; font-size: 26px; font-weight: 600; line-height: 1.15; }
.cab-what { font-size: 16px; font-weight: 700; }
.cab-where { font-size: 13px; color: #CFC6D2; }
.cab-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; border-radius: 16px; }
.cab-card h2 { margin: 0; font-size: 16px; }
.cab-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cab-card-head a { font-size: 13px; font-weight: 600; }
.cab-line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: #4A424F; }
.cab-line b { color: var(--ink); white-space: nowrap; }
.cab-line b.ok { color: var(--ok-fg); }
.cab-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; border-top: 1px solid var(--line-soft); font-weight: 700; }
.cab-total b { font-size: 24px; }
.cab-visits { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.cab-visit { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 10px; background: var(--head); color: var(--muted); text-align: center; }
.cab-visit span { font-size: 12px; } .cab-visit small { font-size: 11px; opacity: .8; }
.cab-visit.v-present { background: var(--ok-bg); color: var(--ok-fg); }
.cab-visit.v-absent { background: var(--warn-bg); color: var(--warn-fg); }
.cab-visit.v-excused { background: var(--info-bg); color: var(--info-fg); }
.cab-event { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.cab-event:first-of-type { border-top: 0; }
.cab-event > b { width: 92px; flex-shrink: 0; }
.cab-event > span { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.cab-day.is-today { border-color: var(--accent); }
.cab-day-name { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.cab-lesson { display: flex; gap: 14px; align-items: baseline; padding: 6px 0; }
.cab-lesson > b { width: 48px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.cab-lesson-name { font-weight: 600; }
.cab-lesson.cancelled .cab-lesson-name { text-decoration: line-through; color: var(--faint); }
.cab-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid var(--line); padding: 6px 6px calc(10px + env(safe-area-inset-bottom, 0px)); }
.cab-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 52px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.cab-nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }
