/* ===== Программа учёта учеников — оформление ===== */
:root {
  --bg: #f5efe4;
  --paper: #fffdf8;
  --ink: #2a2320;
  --muted: #7d7068;
  --line: #e7dccb;
  --accent: #c8553d;
  --accent-dark: #a2412d;
  --teal: #2f6f7e;
  --ok: #2e9e4f;
  --ok-bg: #dcf3e2;
  --bad: #d64541;
  --bad-bg: #fde3e1;
  --blue: #3a6fd8;
  --blue-bg: #dde8fd;
  --warn-bg: #fff3d6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 8px 24px rgba(60, 40, 20, .07);
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-head: 'Comfortaa', 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink);
  background: var(--bg);
  background-image: radial-gradient(circle at 12% 8%, rgba(200, 85, 61, .07) 0, transparent 32%),
                    radial-gradient(circle at 88% 30%, rgba(47, 111, 126, .07) 0, transparent 30%);
  background-attachment: fixed;
}
body.modal-open { overflow: hidden; }
a { color: var(--accent-dark); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; margin-top: 1.4em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
[hidden] { display: none !important; }

/* Мазок кисти под заголовком */
.brush { display: inline-block; position: relative; z-index: 0; }
.brush::after {
  content: ''; position: absolute; left: -4px; right: -6px; bottom: .08em; height: .42em; z-index: -1;
  background: linear-gradient(100deg, rgba(200, 85, 61, .0) 0, rgba(200, 85, 61, .28) 6%, rgba(232, 160, 80, .32) 70%, rgba(232, 160, 80, 0) 100%);
  border-radius: 40% 60% 50% 70% / 60% 40% 70% 40%;
  transform: rotate(-1deg);
}

/* ---------- Шапка ---------- */
.topline { background: var(--ink); color: #f1e6d6; font-size: .85rem; text-align: center; padding: 6px 16px; }
.topline a { color: #ffd9a8; text-decoration: none; font-weight: 700; margin-left: 6px; }
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  max-width: 1200px; margin: 0 auto; padding: 14px 16px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); font-family: var(--font-head); font-weight: 700; }
.brand img { height: 48px; width: auto; }
.site-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.site-nav a { text-decoration: none; color: var(--ink); padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: .95rem; }
.site-nav a:hover, .site-nav a.active { background: var(--paper); box-shadow: var(--shadow); }
.page { max-width: 1200px; margin: 0 auto; padding: 8px 16px 120px; }
.site-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px 100px; }
body.auth .site-footer, body.cabinet .site-footer, body.director .site-footer { padding-bottom: 32px; }

/* ---------- Карточки ---------- */
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(16px, 3vw, 28px); margin-bottom: 20px; border: 1px solid rgba(231, 220, 203, .7); }
.lead { color: var(--muted); margin-top: -.3em; }

/* ---------- Формы ---------- */
.form { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.span-2 { grid-column: 1 / -1; }
label { display: grid; gap: 6px; font-weight: 700; font-size: .95rem; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; min-height: 44px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200, 85, 61, .15); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 800; margin-bottom: 8px; padding: 0; }
.hint { color: var(--muted); font-size: .875rem; margin: 6px 0 0; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 800;
  border: 0; border-radius: 10px; padding: 10px 18px; min-height: 44px; cursor: pointer; text-decoration: none;
  transition: transform .08s, box-shadow .15s, background .15s; white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 3px 0 var(--accent-dark); }
.btn-primary:hover { background: #d4624a; }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-dark); }
.btn-ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-small { min-height: 34px; padding: 6px 12px; font-size: .875rem; }
.btn-wide { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-dark); font-weight: 700; cursor: pointer; text-decoration: underline; }

/* Объёмные кнопки оплаты */
.btn-3d, .btn-green-3d, .btn-red-3d {
  position: relative; display: inline-flex; align-items: center; justify-content: center; text-align: center;
  font: inherit; font-weight: 900; letter-spacing: .04em; color: #fff; text-decoration: none; cursor: pointer;
  border: 0; border-radius: 14px; padding: 16px 26px; min-height: 58px; font-size: 1.02rem;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .25);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s;
}
.btn-green-3d {
  background: linear-gradient(180deg, #5fdc7a 0%, #2fb24f 55%, #22963f 100%);
  box-shadow: 0 6px 0 #17702d, 0 12px 20px rgba(23, 112, 45, .35), inset 0 2px 0 rgba(255, 255, 255, .35);
}
.btn-red-3d {
  background: linear-gradient(180deg, #ff7a6e 0%, #e5453a 55%, #c7342b 100%);
  box-shadow: 0 6px 0 #8f2019, 0 12px 20px rgba(143, 32, 25, .35), inset 0 2px 0 rgba(255, 255, 255, .3);
}
.btn-green-3d:hover, .btn-red-3d:hover { filter: brightness(1.05); }
.btn-green-3d:active { transform: translateY(5px); box-shadow: 0 1px 0 #17702d, 0 4px 8px rgba(23, 112, 45, .3), inset 0 2px 0 rgba(255, 255, 255, .3); }
.btn-red-3d:active { transform: translateY(5px); box-shadow: 0 1px 0 #8f2019, 0 4px 8px rgba(143, 32, 25, .3), inset 0 2px 0 rgba(255, 255, 255, .3); }
.btn-green-3d:disabled, .btn-red-3d:disabled { filter: grayscale(.5); opacity: .6; cursor: default; transform: none; }
.btn-green-3d.btn-small { min-height: 40px; padding: 8px 16px; margin-top: 10px; box-shadow: 0 4px 0 #17702d; }

.btn-calc {
  display: block; width: 100%; max-width: 460px; margin: 22px auto 0; font: inherit; font-weight: 900; letter-spacing: .06em;
  color: #fff; border: 0; border-radius: 14px; padding: 16px; cursor: pointer;
  background: linear-gradient(180deg, #e2785f, var(--accent) 60%, var(--accent-dark));
  box-shadow: 0 6px 0 #7f2f20, 0 12px 20px rgba(127, 47, 32, .3);
  transition: transform .08s, box-shadow .08s;
}
.btn-calc:active { transform: translateY(5px); box-shadow: 0 1px 0 #7f2f20; }

/* ---------- Вход / регистрация ---------- */
.auth-card { max-width: 440px; margin: 24px auto; background: var(--paper); border-radius: 20px; box-shadow: var(--shadow); padding: clamp(20px, 5vw, 36px); }
.auth-wide { max-width: 720px; }
.auth-links { display: grid; gap: 12px; margin-top: 16px; text-align: center; }
.alert { border-radius: 10px; padding: 12px 14px; margin: 12px 0; }
.alert-error { background: var(--bad-bg); color: #8a201b; }
.alert-ok { background: var(--ok-bg); color: #1b6631; }

/* ---------- Кабинет ученика ---------- */
.staff-banner { background: var(--blue-bg); color: #24479a; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-weight: 700; }
.profile { display: flex; gap: 22px; align-items: center; }
.avatar {
  flex: none; width: 112px; height: 112px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(135deg, #f2c48d, var(--accent)); color: #fff; font-family: var(--font-head); font-size: 2.2rem;
  box-shadow: 0 0 0 5px #fff, 0 0 0 7px var(--line);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; font-weight: 800; color: var(--accent); }
.student-name { margin: 2px 0 6px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: .95rem; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; align-items: center; }
.note { margin-top: 10px; background: var(--warn-bg); border-radius: 10px; padding: 8px 12px; font-size: .92rem; }

.calc-grid { display: grid; gap: 22px; }
.field-row { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; max-width: 460px; }
.radio-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.radio-card { display: flex; align-items: center; gap: 10px; font-weight: 600; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--accent); background: #fff6f2; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; font-weight: 600; }
.chip:has(input:checked) { border-color: var(--accent); background: #fff6f2; }
.sub-field { margin-top: 12px; max-width: 280px; }
.days-row { display: flex; gap: 8px; flex-wrap: wrap; }
.day { display: block; cursor: pointer; }
.day input { position: absolute; opacity: 0; pointer-events: none; }
.day span {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; font-weight: 800; font-size: 1.05rem;
  background: #fff; border: 2px solid var(--line); transition: all .12s;
}
.day input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 3px 0 var(--accent-dark); }
.day input:focus-visible + span { box-shadow: 0 0 0 3px rgba(200, 85, 61, .3); }
.day.disabled span { opacity: .35; cursor: not-allowed; }
#promoFieldset input { max-width: 280px; text-transform: uppercase; }

.result { margin-top: 24px; border-top: 2px dashed var(--line); padding-top: 20px; display: grid; gap: 14px; }
.res-block { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.res-title { font-weight: 800; margin-bottom: 4px; }
.res-total { font-weight: 800; margin-top: 6px; }
.res-sum { font-family: var(--font-head); font-size: 1.4rem; font-weight: 700; color: var(--accent-dark); margin-top: 6px; }
.res-warn { background: var(--warn-bg); border-radius: 8px; padding: 6px 10px; margin-top: 8px; font-size: .92rem; }
.res-good { background: var(--ok-bg); color: #1b6631; border-radius: 8px; padding: 6px 10px; margin-top: 8px; font-size: .92rem; font-weight: 700; }
.res-dates { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.res-dates span { background: var(--bg); border-radius: 6px; padding: 2px 8px; font-weight: 700; font-size: .9rem; }
.pay-instr ol { margin: 4px 0 0; padding-left: 20px; }
.pay-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 6px 0 8px; }
#pdfStatus { margin-top: 18px; border-radius: 12px; padding: 14px 16px; background: var(--bg); font-weight: 700; }
#pdfStatus.status-success { background: var(--ok-bg); color: #1b6631; }
#pdfStatus.status-error { background: var(--bad-bg); color: #8a201b; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.dates-cell { font-size: .875rem; min-width: 140px; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 800; white-space: nowrap; }
.tag-ok { background: var(--ok-bg); color: #1b6631; }
.tag-bad { background: var(--bad-bg); color: #8a201b; }
.tag-blue { background: var(--blue-bg); color: #24479a; }
.tag-gray { background: #eee7dc; color: var(--muted); }
.att-list { display: flex; flex-wrap: wrap; gap: 6px; }
.att { border-radius: 8px; padding: 3px 10px; font-size: .85rem; font-weight: 700; }
.att-attended { background: var(--ok-bg); color: #1b6631; }
.att-missed { background: var(--bad-bg); color: #8a201b; }
.att-makeup { background: var(--blue-bg); color: #24479a; }

/* ---------- Кабинет администратора ---------- */
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; background: #eadfcd; padding: 4px; border-radius: 12px; flex-wrap: wrap; }
.tab { border: 0; background: none; font: inherit; font-weight: 800; padding: 8px 14px; border-radius: 9px; cursor: pointer; color: var(--ink); }
.tab.active { background: var(--paper); box-shadow: var(--shadow); }
.date-nav { display: flex; align-items: center; gap: 6px; }
.date-nav input { width: auto; }
.date-nav .btn { min-width: 44px; padding: 8px 10px; }
.day-title { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--paper); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); border-left: 5px solid var(--line); }
.stat .label { font-size: .8rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-family: var(--font-head); font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.s-visits { border-left-color: var(--teal); }
.stat.s-cash { border-left-color: #e0a63a; }
.stat.s-link { border-left-color: #8a5cd1; }
.stat.s-card { border-left-color: var(--blue); }
.stat.s-total { border-left-color: var(--ok); }

.list-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.day-table tbody tr { cursor: pointer; transition: filter .1s; user-select: none; }
.day-table tbody tr:hover { filter: brightness(.97); }
.day-table td { vertical-align: middle; }
.row-paid td { background: var(--ok-bg); }
.row-unpaid td { background: var(--bad-bg); }
.row-makeup td { background: var(--blue-bg); }
.row-group td { background: transparent !important; cursor: default; font-family: var(--font-head); font-weight: 700; color: var(--accent-dark); padding-top: 18px; border-bottom: 2px solid var(--line); }
.student-cell { font-weight: 800; }
.student-cell .small { font-weight: 400; }
.mark-badge { font-size: .82rem; font-weight: 800; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.filters label { font-size: .8rem; }
.filters input, .filters select { min-height: 40px; padding: 7px 10px; }
.inline-comment { min-height: 36px; padding: 6px 8px; font-size: .9rem; resize: vertical; min-width: 120px; }
.row-actions { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.row-actions .btn { min-width: 44px; }

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(42, 35, 32, .96); backdrop-filter: blur(6px);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}
.bottom-bar .bar-items { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.bar-handle { display: none; }
.bottom-bar .btn { background: #3d3430; color: #fff; border: 1px solid #574b45; }
.bottom-bar .btn:hover { background: #4b403b; }
.bottom-bar .btn.tg { background: #2a9fd8; border-color: #2a9fd8; }
.bottom-bar .btn.mail { background: var(--accent); border-color: var(--accent); }

/* ---------- Модальные окна ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(30, 22, 18, .5); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--paper); border-radius: 18px; width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); animation: pop .18s; }
.modal-wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 6px; }
.modal-head h3 { margin: 0; }
.modal-x { border: 0; background: none; font-size: 30px; line-height: 1; cursor: pointer; color: var(--muted); width: 44px; height: 44px; }
.modal-body { padding: 8px 20px 20px; overflow: auto; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.modal-actions.wrap { flex-wrap: wrap; justify-content: center; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font: inherit; font-weight: 800; cursor: pointer; transition: all .12s; }
.action-btn .ico { font-size: 1.6rem; }
.action-btn:hover { transform: translateY(-1px); }
.action-btn.a-attended:hover, .action-btn.a-attended.on { border-color: var(--ok); background: var(--ok-bg); }
.action-btn.a-missed:hover, .action-btn.a-missed.on { border-color: var(--bad); background: var(--bad-bg); }
.action-btn.a-makeup:hover, .action-btn.a-makeup.on { border-color: var(--blue); background: var(--blue-bg); }
.action-btn.a-pay:hover { border-color: #e0a63a; background: var(--warn-bg); }
.makeup-box { margin-top: 12px; background: var(--blue-bg); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.pay-types { display: flex; gap: 8px; flex-wrap: wrap; }
.search-results { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; }
.search-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.search-item:last-child { border-bottom: 0; }
.search-item:hover, .search-item.sel { background: #fff6f2; }
.recipients { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.recipients label { display: flex; align-items: center; gap: 10px; font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.group-editor { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #fff; }
.group-editor summary { cursor: pointer; font-weight: 800; display: flex; justify-content: space-between; gap: 10px; }
.group-editor .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.days-inline { display: flex; gap: 10px; flex-wrap: wrap; }
.days-inline label { display: flex; align-items: center; gap: 4px; font-weight: 600; }

.camera { position: relative; background: #111; border-radius: 12px; overflow: hidden; min-height: 200px; display: grid; place-items: center; }
.camera video, .camera .preview { width: 100%; max-height: 60vh; object-fit: contain; display: block; }
.camera .cam-msg { color: #ddd; padding: 16px; text-align: center; }
.file-btn { position: relative; }

/* Тосты */
#toasts { position: fixed; bottom: 84px; right: 16px; z-index: 200; display: grid; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 700; transition: opacity .4s, transform .4s; max-width: 340px; }
.toast-err { background: var(--bad); }
.toast.out { opacity: 0; transform: translateY(-8px); }

/* ---------- Кабинет директора ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.chart-box { position: relative; height: 300px; }
.bar-list { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr auto; gap: 10px; align-items: center; font-size: .9rem; }
.bar-track { background: var(--bg); border-radius: 6px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--teal); }
.bar-fill.exp { background: var(--accent); }
.pos { color: var(--ok); }
.neg { color: var(--bad); }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }

/* ---------- Мобильные ---------- */
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .profile { flex-direction: column; text-align: center; }
  .profile-meta, .profile-actions { justify-content: center; }
  .pay-buttons { grid-template-columns: 1fr; }
  .day span { width: 46px; height: 46px; }
  .chart-grid { grid-template-columns: 1fr; }
  .brand span { font-size: .95rem; }
  .brand img { height: 38px; }
  .bottom-bar .btn { flex: 1 1 45%; font-size: .85rem; padding: 10px 8px; }
  .page { padding-bottom: 90px; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
}
@media print {
  .topline, .site-header, .bottom-bar, .site-footer, .tabs { display: none; }
}
#abTable td, #abTable th { padding-left: 7px; padding-right: 7px; }

/* ---------- Педагоги (кабинет директора) ---------- */
#tTable td { vertical-align: top; }
#tTable tr.muted td { opacity: .65; }
.sched-grid { display: grid; gap: 6px; margin-top: 8px; }
.sched-row { display: grid; grid-template-columns: 120px 130px auto 130px 110px auto; gap: 8px; align-items: center; justify-content: start; }
.sched-row input { min-height: 38px; padding: 6px 8px; }
.sched-day { font-weight: 700; }
.sched-total { margin-top: 8px; }
.tcal-head, .tcal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.tcal-head { margin: 12px 0 6px; font-size: .8rem; font-weight: 800; color: var(--muted); text-align: center; text-transform: uppercase; }
.tcal-cell {
  min-height: 78px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; padding: 6px; font: inherit;
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; color: var(--ink);
}
.tcal-cell.empty { border: 0; background: none; }
.tcal-cell:disabled { cursor: default; }
.tcal-cell.st-off { background: #f3ede3; color: var(--muted); border-color: transparent; }
.tcal-cell.st-holiday { background: #eee7dc; color: var(--muted); border-style: dashed; }
.tcal-cell.st-work { background: var(--ok-bg); border-color: #9fd5ad; cursor: pointer; }
.tcal-cell.st-absent { background: var(--bad-bg); border-color: var(--bad); cursor: pointer; }
.tcal-cell.st-absent .tcal-t, .tcal-cell.st-absent .tcal-n { text-decoration: line-through; }
.tcal-cell.st-work:hover, .tcal-cell.st-absent:hover { filter: brightness(.96); }
.tcal-n { font-weight: 800; font-size: 1.05rem; }
.tcal-t { font-size: .75rem; }
.tcal-s { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.tcal-cell.st-absent .tcal-s { color: #8a201b; }
.tcal-cell.st-work .tcal-s { color: #1b6631; }
.tcal-p { font-size: .75rem; margin-top: auto; font-variant-numeric: tabular-nums; }
.tcal-r { font-size: .72rem; color: #8a201b; margin-top: auto; }
.t-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
#tTable td:first-child { min-width: 250px; }
.t-actions .btn { min-height: 32px; padding: 4px 9px; font-size: .8rem; }
#tTable td, #tTable th { padding-left: 7px; padding-right: 7px; }
#tTable th { white-space: normal; }
.tcal-sum { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; padding: 12px; background: var(--bg); border-radius: 10px; font-size: .95rem; }
.pay-calc { background: var(--bg); border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; }
.pay-calc > div { display: flex; justify-content: space-between; gap: 10px; }
.pay-calc b { font-variant-numeric: tabular-nums; }
.pay-calc .pc-total { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 4px; font-size: 1.1rem; }
@media (max-width: 720px) {
  .sched-row { grid-template-columns: 1fr 1fr auto 1fr; }
  .sched-row .sched-day { grid-column: 1 / -1; }
  .sched-row .sched-len, .sched-row [data-clear] { grid-column: span 2; }
  .tcal-cell { min-height: 58px; padding: 4px; }
  .tcal-t, .tcal-p, .tcal-r { display: none; }
}

/* Значок корзины */
.ico-trash { display: block; }
[data-del]:hover { color: var(--bad); border-color: var(--bad); }

/* Даты абонемента */
.dt { display: inline-block; white-space: nowrap; }
.dt-attended, .dt-madeup { text-decoration: line-through; text-decoration-color: var(--bad); text-decoration-thickness: 2px; color: var(--muted); }
.dt-madeup::after { content: 'отр.'; display: inline-block; margin-left: 2px; font-size: .72em; color: var(--blue); }
.dt-missed { color: var(--bad); font-weight: 700; }

/* Промокод ученика */
.promo-locked { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.promo-locked input { max-width: 200px; background: #f3ede3; color: var(--ink); font-weight: 800; letter-spacing: .05em; cursor: not-allowed; }
.staff-promo { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--blue-bg); display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.staff-promo label { flex: 1; min-width: 220px; }

/* ---------- Вход по PIN и инструменты кабинета ---------- */
.pin-input { font-size: 2rem; letter-spacing: .6em; text-align: center; font-weight: 800; padding: 10px 0 10px .6em; max-width: 240px; margin: 0 auto; }
.pin-input-sm { font-size: 1.3rem; letter-spacing: .5em; max-width: 180px; margin: 0; }
.quick-login { text-align: center; }
.quick-login .form { justify-items: center; }
.quick-login .btn-wide { max-width: 240px; }
.avatar-sm { width: 76px; height: 76px; font-size: 1.6rem; margin: 0 auto 12px; }
label.check { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
.tabs-wide { display: grid; grid-template-columns: 1fr 1fr; margin: 6px 0 16px; }
.tabs-wide .tab { text-align: center; }

.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: -6px 0 20px; }
.tool {
  display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
  transition: border-color .15s, transform .08s;
}
.tool:hover { border-color: var(--accent); }
.tool:active { transform: translateY(1px); }
.tool svg { flex: none; color: var(--accent); }
.tool span { display: grid; gap: 2px; }
.tool small { color: var(--muted); font-size: .82rem; }
.tool-qr { border-color: var(--accent); background: #fff6f2; }

/* ---------- QR-код ученика ---------- */
.qr-show { text-align: center; }
.qr-box { background: #fff; border-radius: 14px; padding: 6px; display: inline-block; box-shadow: 0 0 0 1px var(--line); }
.qr-box svg { width: min(78vw, 320px); height: auto; display: block; }
.qr-name { font-family: var(--font-head); font-weight: 700; font-size: 1.3rem; margin-top: 10px; }
.qr-card { color: var(--muted); }

/* ---------- Сканер QR (администратор) ---------- */
.scan-btn { margin-left: 10px; }
.bottom-bar .btn.scan { background: var(--ok); border-color: var(--ok); }
.scan-wrap { position: relative; background: #111; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; }
.scan-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 14% 22%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); pointer-events: none; }
.scan-msg { text-align: center; margin: 8px 0; }
.scan-manual { display: flex; gap: 8px; margin-top: 10px; }
.scan-card { display: flex; gap: 12px; align-items: center; border-radius: 12px; padding: 12px; background: var(--bg); border: 2px solid var(--line); margin-top: 8px; }
.scan-card.sc-ok { background: var(--ok-bg); border-color: var(--ok); }
.scan-card.sc-warn { background: var(--bad-bg); border-color: var(--bad); }
.scan-card.sc-info { background: var(--blue-bg); border-color: var(--blue); }
.sc-name { font-weight: 800; font-size: 1.15rem; }
.sc-note { margin-top: 4px; font-weight: 700; }
.avatar-xs { width: 56px; height: 56px; font-size: 1.2rem; box-shadow: none; }
.ci-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.ci-head .avatar { margin: 0; }
.ci-ab { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 10px 0 14px; }
.big-ok { font-size: 1.2rem; font-weight: 800; text-align: center; }
.checkin-card .btn-3d { width: 100%; }
.install-steps { padding-left: 22px; line-height: 1.7; }
.ios-share { display: inline-block; border: 1.5px solid var(--blue); color: var(--blue); border-radius: 6px; padding: 0 6px; font-weight: 800; }
.mailtest-row { display: flex; gap: 8px; flex-wrap: wrap; } .mailtest-row input { flex: 1; min-width: 200px; min-height: 36px; }
.mail-preview { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.mp-body { margin-top: 8px; line-height: 1.55; }
.cron-url { display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; word-break: break-all; font-size: .82rem; }

/* Почтовый ящик школы (SMTP) */
.smtp-box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.smtp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.smtp-grid input, .smtp-grid select { min-height: 38px; padding: 6px 8px; }
@media (max-width: 720px) { .smtp-grid { grid-template-columns: 1fr; } }

/* Педагоги дня (кабинет администратора) */
.day-teachers { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; margin: 4px 0 12px; background: var(--bg); border-radius: 12px; }
.dt-label { font-weight: 800; margin-right: 2px; }
.dteach { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 12px; }
.dteach .btn-small { min-height: 30px; padding: 3px 10px; border-radius: 999px; }
.dt-name { font-weight: 800; }
.dt-time { font-size: .88rem; color: var(--teal); font-weight: 700; }
.dt-extra { color: var(--blue); }
.dt-cancel { color: var(--bad); text-decoration: line-through; }
.dteach-off { opacity: .75; border-style: dashed; padding-right: 12px; }
.tcal-cell.st-extra { background: var(--blue-bg); border-color: #9db6ef; }
.tcal-x { font-size: .72rem; font-weight: 800; color: var(--blue); }

/* ---------- Меню «⚙ Настройки» в шапке ---------- */
.site-header { position: relative; }
.site-nav { align-items: center; }
.nav-menu { position: relative; }
.nav-menu-btn {
  font: inherit; font-weight: 700; font-size: .95rem; color: var(--ink); background: none; border: 0; cursor: pointer;
  padding: 8px 14px; border-radius: 999px;
}
.nav-menu-btn:hover, .nav-menu.open .nav-menu-btn { background: var(--paper); box-shadow: var(--shadow); }
.nav-caret { display: inline-block; font-size: .75em; transition: transform .15s; }
.nav-menu.open .nav-caret { transform: rotate(180deg); }
.nav-menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 270px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 40px rgba(0, 0, 0, .18);
  padding: 6px; display: flex; flex-direction: column; animation: pop .15s;
}
.nav-menu-list[hidden] { display: none; }
.site-nav .nav-menu-item, .nav-menu-item {
  display: block; width: 100%; text-align: left; font: inherit; font-weight: 600; font-size: .95rem; color: var(--ink);
  background: none; border: 0; border-radius: 10px; padding: 11px 14px; cursor: pointer; text-decoration: none; box-shadow: none; white-space: nowrap;
}
.site-nav .nav-menu-item:hover, .nav-menu-item:focus-visible { background: var(--bg); box-shadow: none; }
@media (max-width: 720px) {
  .site-nav { gap: 2px; }
  .site-nav a, .nav-menu-btn { padding: 7px 10px; font-size: .9rem; }
  .nav-menu { position: static; }
  .nav-menu-list { left: 12px; right: 12px; top: 100%; min-width: 0; }
  .nav-menu-item { padding: 13px 14px; font-size: 1rem; white-space: normal; }
}

/* ---------- Мобильная версия: панель действий выдвигается вверх ---------- */
@media (max-width: 720px) {
  .bottom-bar[data-drawer] {
    padding-top: 14px;
    transform: translateY(calc(100% - env(safe-area-inset-bottom)));
    transition: transform .28s cubic-bezier(.2, .8, .2, 1);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0);
    touch-action: none;
  }
  .bottom-bar[data-drawer].open { transform: translateY(0); box-shadow: 0 -8px 30px rgba(0, 0, 0, .3); }
  .bottom-bar[data-drawer].dragging { transition: none; }
  .bottom-bar[data-drawer] .bar-handle {
    display: flex; align-items: center; gap: 8px; position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%);
    background: rgba(42, 35, 32, .96); color: #fff; border: 0; border-radius: 16px 16px 0 0;
    padding: 9px 26px 7px; font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, .18); touch-action: none; -webkit-tap-highlight-color: transparent;
  }
  .bar-handle::before {
    content: ""; position: absolute; top: 4px; left: 50%; width: 36px; height: 4px; margin-left: -18px;
    border-radius: 2px; background: rgba(255, 255, 255, .35);
  }
  .bar-arrow {
    display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
    background: var(--accent); font-size: .7rem; line-height: 1; transition: transform .25s; animation: bar-bob 1.6s ease-in-out 3;
  }
  .bottom-bar[data-drawer].open .bar-arrow { transform: rotate(180deg); animation: none; }
  .bottom-bar[data-drawer].open .bar-handle-text { opacity: .8; }
  @keyframes bar-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
}
@media (max-width: 720px) and (prefers-reduced-motion: reduce) {
  .bottom-bar[data-drawer], .bar-arrow { transition: none; animation: none; }
}

/* ---------- «Бесплатное обучение» (приглашение друзей) ---------- */
:root { --leaf: #3f8f2a; --leaf-2: #66b33a; --leaf-dark: #2c6b1c; --leaf-bg: #eef8e6; }
.tool.tool-free {
  grid-column: 1 / -1; position: relative; color: #fff; border: 0; text-decoration: none;
  background: linear-gradient(135deg, var(--leaf-2), var(--leaf)); box-shadow: 0 5px 0 var(--leaf-dark), var(--shadow);
  padding: 16px 18px; margin-bottom: 4px;
}
.tool.tool-free:hover { border: 0; filter: brightness(1.05); }
.tool.tool-free:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--leaf-dark), var(--shadow); }
.tool.tool-free svg { color: #fff; }
.tool.tool-free b { font-size: 1.15rem; letter-spacing: .01em; }
.tool.tool-free small { color: rgba(255, 255, 255, .92); font-size: .9rem; }
.tool-badge {
  margin-left: auto; font-style: normal; font-weight: 800; background: #fff; color: var(--leaf-dark);
  border-radius: 999px; padding: 6px 12px; white-space: nowrap; font-size: .95rem;
}
.free-txt { color: var(--leaf); font-weight: 700; }
.free-txt-wait { color: var(--bad); font-weight: 700; }
.invited-by { color: var(--leaf-dark); font-weight: 700; white-space: nowrap; }
.free-settings { background: var(--leaf-bg); }
.res-free { background: var(--leaf-bg); color: var(--leaf-dark); border-radius: 10px; padding: 8px 12px; margin: 6px 0; }
.res-sum-free { color: var(--leaf); }
.pay-buttons-one { grid-template-columns: 1fr; }
.btn-free { background: var(--leaf); border-color: var(--leaf); color: #fff; white-space: nowrap; }
.btn-free:hover { background: var(--leaf-dark); }
.free-lead { font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; color: var(--leaf-dark); margin: 0 0 8px; }
.free-steps { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 4px; }
.free-label { display: grid; gap: 6px; font-weight: 700; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font-size: .9rem; background: var(--bg); }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.free-sum { border-radius: 12px; padding: 10px 14px; background: var(--bg); color: var(--muted); }
.free-sum.on { background: var(--leaf-bg); color: var(--leaf-dark); }
.free-h { margin: 16px 0 8px; }
.friends { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.friend { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); }
.friend span:last-child { display: grid; gap: 2px; }
.friend small { color: var(--muted); font-size: .85rem; }
.friend-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none; }
.friend-wait b { color: var(--bad); }
.friend-wait .friend-dot { background: var(--bad); }
.friend-paid b { color: var(--leaf); }
.friend-paid .friend-dot { background: var(--leaf); }
.friend-paid { background: var(--leaf-bg); border-color: #cfe8bf; }
.free-rules { margin: 14px 0 0; }
.invite-banner { background: var(--leaf-bg); color: var(--leaf-dark); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; }
@media (max-width: 720px) { .tool-badge { padding: 4px 9px; font-size: .85rem; } }

.free-page { max-width: 760px; margin-left: auto; margin-right: auto; }
.free-page h1 { margin-top: 0; }
.free-page .free-label { margin-bottom: 6px; }

/* ---------- «Не оплачено» у администратора ---------- */
button.stat { font: inherit; text-align: left; cursor: pointer; color: inherit; width: 100%; border: 0; border-left: 5px solid var(--line); }
.stat.s-unpaid { border-left-color: var(--bad); }
.stat.s-unpaid:hover { box-shadow: 0 0 0 2px var(--bad), var(--shadow); }
.ud-list { display: flex; flex-wrap: wrap; gap: 4px; }
.ud { display: inline-block; font-size: .8rem; padding: 2px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.ud-attended, .ud-makeup { background: var(--ok-bg); color: var(--ok); font-weight: 700; }
.ud-missed { background: var(--bad-bg); color: var(--bad); font-weight: 700; }
.ud-today { outline: 2px solid var(--accent); }
.unpaid-table td { vertical-align: top; }

/* ---------- Кабинет ученика: «Стоимость и оплата» — раскрывающийся фисташковый блок ---------- */
:root { --pist: #93c572; --pist-dark: #5f8f3e; --pist-bg: #e9f4dc; }
.calc-fold { padding: 0; overflow: hidden; border: 1.5px solid var(--pist); }
.calc-fold > .fold-head {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px clamp(16px, 3vw, 28px); background: linear-gradient(135deg, #b5d98f, var(--pist)); color: #1f3a12;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.calc-fold > .fold-head::-webkit-details-marker { display: none; }
.calc-fold > .fold-head::marker { content: ''; }
.fold-title { display: grid; gap: 2px; }
.fold-name { font-family: var(--font-head); font-weight: 700; font-size: 1.35rem; }
.fold-title small { font-size: .88rem; opacity: .8; }
.fold-arrow {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255, 255, 255, .55); color: var(--pist-dark); transition: transform .25s ease;
}
.calc-fold[open] > .fold-head .fold-arrow { transform: rotate(180deg); }
.calc-fold > .fold-head:hover .fold-arrow { background: #fff; }
.calc-fold > .fold-head:focus-visible { outline: 3px solid var(--pist-dark); outline-offset: -3px; }
.fold-body { padding: clamp(16px, 3vw, 28px); background: var(--paper); }
.calc-fold[open] .fold-body { animation: fold-in .22s ease; }
@keyframes fold-in { from { opacity: 0; transform: translateY(-6px); } }
.btn-qr { font-weight: 800; letter-spacing: .02em; min-width: 40px; }
.vcard-info { display: grid; gap: 4px; margin: 10px auto; text-align: left; width: max-content; max-width: 100%; }
.qr-box svg { max-width: 100%; height: auto; }

/* ---------- Отработка в дополнительное время, список «Посетили занятия» ---------- */
.extra-check { align-items: flex-start; background: var(--blue-bg); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; font-weight: 500; }
.extra-mk { background: var(--blue-bg); border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
.extra-mk-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.stat.s-visits:is(button):hover { box-shadow: 0 0 0 2px var(--teal), var(--shadow); }
button.stat.s-visits { border-left-color: var(--teal); }
.vis-h { margin: 14px 0 6px; }
.vis-h.pos { color: var(--ok); } .vis-h.blue { color: var(--blue); } .vis-h.neg { color: var(--bad); } .vis-h.muted { color: var(--muted); }
.vis-list { margin: 0; padding-left: 28px; display: grid; gap: 3px; }

/* ---------- Кабинет ученика: расписание, отработки, договор; обязательные поля ---------- */
a.tool { text-decoration: none; }
.tool.tool-makeup { cursor: default; background: #EEF3FD; border: 1.5px dashed #8BA6E0; }
.tool.tool-makeup:hover { border-color: #8BA6E0; }
.tool.tool-makeup:active { transform: none; }
.tool.tool-makeup svg { color: #3E63B8; }
.tool.tool-makeup b { color: #24479A; letter-spacing: .02em; }
.sched-view { text-align: center; }
.sched-view img { max-width: 100%; height: auto; border-radius: 12px; }
.req { color: var(--bad); font-weight: 800; }
.sched-settings { background: #F2F6FD; }
.sched-row { display: flex; gap: 16px; align-items: flex-start; margin-top: 8px; flex-wrap: wrap; }
.sched-prev { width: 180px; min-height: 90px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.sched-prev img { max-width: 100%; max-height: 220px; border-radius: 6px; }
