body { font-family: "Manrope", system-ui, sans-serif; margin: 0; background: var(--bg); color: var(--text); }
.container { max-width: 960px; margin: 0 auto; padding: 20px 16px; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.3px; margin: 4px 0 14px; }
h2 { font-size: 19px; font-weight: 700; margin-bottom: 10px; }
h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.card { background: var(--surface); border-radius: 14px; padding: 14px; margin-bottom: 12px; box-shadow: 0 2px 8px var(--shadow-color); }
.menu {
    position: sticky; top: 0; z-index: 100;
    display: flex; flex-wrap: wrap; gap: 4px;
    max-width: 960px; margin: 8px auto 16px; padding: 6px;
    background: var(--nav); border-radius: 14px;
    box-shadow: 0 4px 14px var(--shadow-color-strong);
}
.menu a {
    flex: 1 1 auto; min-width: 80px; padding: 10px 8px;
    text-align: center; text-decoration: none; color: var(--text);
    border-radius: 10px; font-weight: 600; font-size: 14px;
}
.menu a:hover { background: #262626; }
.menu a.active { background: var(--accent); color: var(--bg); }
input, button, select, textarea {
    width: 100%; padding: 10px; margin: 6px 0; box-sizing: border-box;
    border-radius: 12px; border: 1px solid var(--surface-3); background: var(--surface);
    color: var(--text); font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
button { background: var(--accent); color: var(--bg); border: none; font-weight: 600; }
button:hover { background: var(--accent-dark); }
.error { color: var(--danger); margin-bottom: 10px; font-weight: 600; }
.hint { color: var(--muted); margin-bottom: 10px; font-size: 14px; }
.date { color: var(--muted-2); margin-bottom: 12px; }
.time { font-weight: 800; margin-bottom: 4px; }
.button {
    display: block; background: var(--accent); color: var(--bg); text-decoration: none;
    padding: 11px; border-radius: 12px; margin-top: 10px; text-align: center; font-weight: 600;
}
.button:hover { background: var(--accent-dark); }
.card a.inline { color: var(--accent); text-decoration: none; display: inline-block; margin-top: 8px; margin-right: 8px; font-weight: 600; }
.sort-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.sort-bar a { padding: 8px 14px; border-radius: 999px; text-decoration: none; background: var(--surface); color: var(--text-soft); font-size: 14px; font-weight: 600; border: 1px solid var(--surface-3); }
.sort-bar a.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.nav-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 48px; height: 48px; font-size: 22px; padding: 0 14px;
    border-radius: 12px; background: var(--surface); color: var(--text);
    text-decoration: none; border: 1px solid var(--surface-3); box-sizing: border-box;
}
.nav-btn:hover { background: var(--surface-2); }
.striped > .card:nth-child(even) { background: var(--surface-alt); }
.hidden { display: none !important; }
.row { display: flex; gap: 6px; }
.row > * { flex: 1; }
label { display: block; margin-top: 8px; color: var(--text-soft); font-weight: 500; }
.status-group { display: flex; gap: 6px; margin-top: 8px; }
.status-group input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.status-group label { flex: 1; text-align: center; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--surface-3); background: var(--surface-2); color: var(--text-soft); margin: 0; font-size: 14px; font-weight: 600; }
.status-group input:checked + label.st-present { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.status-group input:checked + label.st-absent { background: var(--danger); border-color: var(--danger); color: var(--bg); }
.status-group input:checked + label.st-excused { background: #eac435; border-color: #eac435; color: var(--text); }
.week-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px 2px; }
.day-card { min-width: 74px; flex: 0 0 auto; text-align: center; text-decoration: none; background: var(--surface); border-radius: 14px; padding: 10px 6px; color: var(--text); border: 2px solid transparent; box-shadow: 0 2px 8px var(--shadow-color); }
.day-card .dc-wd { font-weight: 800; }
.day-card .dc-date { color: var(--muted-2); font-size: 13px; }
.day-card .dc-count { color: var(--accent); font-size: 12px; margin-top: 4px; font-weight: 600; }
.day-card.today { border-color: var(--accent); }
.day-card.selected { background: var(--accent); color: var(--bg); }
.day-card.selected .dc-date, .day-card.selected .dc-count { color: var(--on-accent-soft); }
.session-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.day-block .session-row:first-of-type { border-top: none; }
.day-block.today-border { border: 2px solid var(--accent); }
.progress { background: var(--line); border-radius: 6px; height: 8px; margin-top: 6px; overflow: hidden; }
.progress div { background: var(--accent); height: 8px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-header { text-align: center; font-weight: 700; padding: 8px 0; color: var(--muted); font-size: 14px; }
.calendar-cell { min-height: 64px; border: 1px solid var(--surface-3); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; color: inherit; background: var(--surface); }
.calendar-cell.empty { background: transparent; border: none; }
.calendar-cell .day-num { font-size: 18px; font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; }
.dot-green { background: var(--accent); }
.dot-gray { background: var(--dim); }
.dot-holiday { background: var(--danger); }
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(8,12,12,0.72); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; padding: 16px; max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto; }
.card.live { border: 2px solid var(--accent); background: var(--surface); box-shadow: 0 2px 12px var(--accent-glow-strong); }
.striped > .card.live { background: var(--surface); }
.live-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: var(--bg); font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; margin-bottom: 6px; }
.live-badge .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--on-strong); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.8); } }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.tile { border-radius: 14px; padding: 12px 14px; color: var(--on-strong); box-shadow: 0 2px 8px var(--shadow-color); }
.tile .t-label { font-size: 12px; font-weight: 600; opacity: 0.85; }
.tile .t-value { font-size: 26px; font-weight: 800; }
.tile-seagrass { background: var(--accent); }
.tile-saffron { background: #eac435; color: var(--text); }
.tile-cayenne { background: var(--danger); }
.tile-jasmine { background: var(--on-strong); color: var(--text); }
.tile-onyx { background: var(--nav); }
.scrollbox { max-height: 320px; overflow-y: auto; border: 1px solid var(--surface-3); border-radius: 12px; padding: 6px; background: var(--surface-alt); margin-bottom: 10px; }
.rowline { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.rowline:last-child { border-bottom: none; }
.rowline .grow { flex: 1 1 auto; }
.rowline form { margin: 0; }
.mini-btn { width: 34px; height: 30px; padding: 0; margin: 0; border-radius: 8px; background: var(--nav); color: var(--on-strong); font-size: 14px; border: none; cursor: pointer; flex: 0 0 auto; }
.mini-btn:hover { background: var(--text-soft); }
.mini-btn:disabled { opacity: 0.4; cursor: default; }
.rank-row { flex-wrap: wrap; }
.rank-name { font-weight: 600; flex: 1 1 auto; }
.rank-tools { display: flex; gap: 4px; }
.belt { width: 46px; height: 14px; border-radius: 4px; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15); }
.colors-editor { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 4px 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; }
.chip input[type="color"] { width: 40px; height: 30px; padding: 2px; margin: 0; border-radius: 8px; border: 1px solid var(--surface-3); background: var(--surface); }
input, select, textarea, .rank-name { direction: ltr !important; unicode-bidi: normal !important; }
input[type="text"], input:not([type]) { color: var(--text) !important; }
.belt-inline { display: inline-block; width: 30px; height: 16px; border-radius: 4px; vertical-align: middle; margin-right: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15); flex: 0 0 auto; align-self: center; }

/* --- иконки вместо слов и нижняя навигация (телефон) --- */
.ibtn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
        border-radius: 12px; background: var(--surface-3); color: var(--text); text-decoration: none; border: 0;
        padding: 0; margin: 0; flex: 0 0 auto; font-size: 14px; }
.ibtn:hover, .ibtn:active { background: var(--hover); }
.ibtn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9;
            stroke-linecap: round; stroke-linejoin: round; }
button.ibtn, button.ibtn:hover { background: var(--surface-3); color: var(--text); }
.tabbar { display: none; }
.sheet { position: fixed; inset: 0; background: var(--overlay); display: none; z-index: 200; align-items: flex-end; }
.sheet.show { display: flex; }
.sheet-in { background: var(--surface); width: 100%; max-width: 960px; margin: 0 auto;
            border-radius: 18px 18px 0 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
.sheet-cap { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 6px 14px 2px; }
.sheet-in a, .sheet-in button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px; border-radius: 12px;
            color: var(--text); text-decoration: none; font-weight: 600; background: transparent; border: 0;
            font-size: 15px; margin: 0; font-family: inherit; }
.sheet-in a:active, .sheet-in button:active { background: var(--surface-2); }
.sheet-in svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.sheet-in form button { color: var(--danger-text); }
/* переключатель темы */
.theme-toggle { background: transparent; border: 1px solid var(--line); color: var(--text); width: 38px; height: 38px;
            border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; padding: 0; margin: 0; cursor: pointer; }
.theme-toggle svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html[data-theme="light"] .i-sun, html[data-theme="dark"] .i-moon { display: none; }
@media (max-width: 860px) {
  .menu { display: none; }
  body { padding-bottom: 88px; }
  .container { padding-top: 10px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
            background: var(--nav); border-top: 1px solid var(--line); justify-content: space-around;
            padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
            text-decoration: none; background: transparent; border: 0; color: var(--muted); font-size: 10px;
            font-weight: 700; padding: 6px 2px; margin: 0; width: auto; font-family: inherit; }
  .tabbar a.on, .tabbar button:active { color: var(--accent); }
  .tabbar svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8;
            stroke-linecap: round; stroke-linejoin: round; }
}

/* --- доработки поверх палитры --- */
body { background: var(--bg); }
.card { border: 1px solid var(--line); box-shadow: var(--shadow); }
.menu { border: 1px solid var(--line); }
.menu a:hover { background: var(--surface-2); }
.menu a.active, .menu a.active:hover { background: var(--accent); color: var(--on-accent); }
button, .button { color: var(--on-accent); }
.button[style*="var(--surface-3)"], button[style*="var(--surface-3)"] { color: var(--text); }
.button[style*="var(--nav)"], button[style*="var(--nav)"] { color: var(--text); }
.button[style*="var(--hover)"], button[style*="var(--hover)"] { color: var(--text); }
input, select, textarea { background: var(--input); color: var(--text); }
button { background: var(--accent); color: var(--on-accent); border: 0; font-weight: 600; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.sort-bar a { background: var(--surface); color: var(--text-soft); border: 1px solid var(--surface-3); }
.sort-bar a.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.nav-btn { background: var(--surface); color: var(--text); border: 1px solid var(--surface-3); }
.nav-btn:hover { background: var(--surface-2); }
.day-card { background: var(--surface); color: var(--text); }
.day-card.selected { background: var(--accent); color: var(--on-accent); }
.day-card.selected .dc-date, .day-card.selected .dc-count { color: var(--on-accent-soft); }
.calendar-cell { background: var(--surface); border: 1px solid var(--line); }
.status-group label { background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--surface-3); }
.status-group input:checked + label.st-present { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.status-group input:checked + label.st-absent { background: var(--danger); border-color: var(--danger); color: var(--on-strong); }
.status-group input:checked + label.st-excused { background: var(--warn); border-color: var(--warn); color: var(--on-accent); }
.card.live { border: 2px solid var(--accent); background: var(--surface); box-shadow: 0 2px 14px var(--accent-glow-strong); }
.striped > .card.live { background: var(--surface); }
.striped > .card:nth-child(even) { background: var(--surface-alt); }
.live-badge { background: var(--accent); color: var(--on-accent); }
.live-badge .pulse { background: var(--on-accent); }
.mini-btn { background: var(--surface-3); color: var(--text); }
.mini-btn:hover { background: var(--hover); }
.modal { background: var(--surface); }
.tile { color: var(--text); }
.tile-seagrass { background: var(--accent); color: var(--on-accent); }
.tile-saffron  { background: var(--warn); color: var(--on-accent); }
.tile-cayenne  { background: var(--danger); color: var(--on-strong); }
.tile-jasmine  { background: var(--on-strong); color: var(--on-accent); }
.tile-onyx     { background: var(--surface-3); color: var(--text); }
.scrollbox { background: var(--surface-alt); border: 1px solid var(--line); }
.rowline { border-bottom: 1px solid var(--line); }
.session-row { border-top: 1px solid var(--line); }
.progress { background: var(--line); }
.progress div { background: var(--accent); }
.dot-green { background: var(--accent); }
.dot-holiday { background: var(--danger); }
.error { color: var(--danger-text); }
a { color: var(--accent); }
a:visited { color: var(--accent-dark); }
audio { background: var(--surface-2); border-radius: 12px; width: 100%; }
audio::-webkit-media-controls-panel { background-color: var(--surface-2); }
audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display { color: var(--text); }
.hint, .date, .calendar-header, .sec-note { color: var(--muted-2); }
.day-card .dc-date { color: var(--muted-2); }
small, .sub { color: var(--muted-2); }
/* карточка ученика: карандаш в правом верхнем углу */
.student-card { position: relative; }
.student-card > strong { display: block; padding-right: 54px; }
.edit-corner { position: absolute; top: 12px; right: 12px; }
/* крупные кнопки-действия: подпись плотнее и темнее */
.button { font-weight: 800; letter-spacing: .1px; }
.card .button, .card.live .button { box-shadow: 0 2px 10px var(--accent-glow-strong), inset 0 0 0 1px rgba(0,0,0,.05); }

/* читаемость на телефоне: мелкий текст поднять, строки разредить */
body { font-size: 16px; line-height: 1.5; }
small { font-size: 14px; }
.sub, .hint, .date, .sec-note, .calendar-header, .day-card .dc-date { font-size: 14px; }
label { font-size: 14px; }
input, select, textarea, button, .button { font-size: 15px; }
.chip, .sort-bar a { font-size: 14px; }
.card, .rowline, .session-row { line-height: 1.45; }
.tabbar a, .tabbar button { font-size: 11px; }
.tabbar svg { width: 23px; height: 23px; }
.demo-ribbon { font-size: 13px; }
.sheet-in a, .sheet-in button { font-size: 16px; }
.ibtn { width: 42px; height: 42px; }

/* календарь выбора даты — тоже по теме (flatpickr.min.css идёт после style.css, нужна специфичность выше) */
html[data-theme] .flatpickr-calendar { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
html[data-theme] .flatpickr-months .flatpickr-month,
html[data-theme] .flatpickr-weekdays,
html[data-theme] .flatpickr-days { background: var(--surface); }
html[data-theme] .flatpickr-current-month,
html[data-theme] .flatpickr-monthDropdown-months,
html[data-theme] .numInputWrapper span { color: var(--text); }
html[data-theme] span.flatpickr-weekday { color: var(--muted); background: var(--surface); }
html[data-theme] .flatpickr-day { color: var(--text); }
html[data-theme] .flatpickr-day.prevMonthDay, html[data-theme] .flatpickr-day.nextMonthDay { color: var(--dim); }
html[data-theme] .flatpickr-day:hover { background: var(--surface-2); }
html[data-theme] .flatpickr-day.today { border-color: var(--accent); }
html[data-theme] .flatpickr-day.selected { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
html[data-theme] .flatpickr-calendar.arrowTop:after, html[data-theme] .flatpickr-calendar.arrowTop:before { border-bottom-color: var(--surface); }
html[data-theme] .flatpickr-calendar.arrowBottom:after, html[data-theme] .flatpickr-calendar.arrowBottom:before { border-top-color: var(--surface); }
html[data-theme] .flatpickr-input { background: var(--input); color: var(--text); }
/* на телефоне поля формы — в столбик: иначе select «день» сжимается до 80 px */
@media (max-width: 700px) {
  .row { flex-wrap: wrap; }
  .row > * { flex: 1 1 100%; }
  .row.schedule-row > * { flex: 1 1 100%; }
}

/* --- темы: переменные палитры --- */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--bg); --nav: var(--nav); --surface: var(--surface); --surface-2: var(--surface-2);
  --surface-3: var(--surface-3); --surface-alt: var(--surface-alt); --input: var(--input);
  --line: var(--line); --hover: var(--hover);
  --text: #EDF1F1; --text-soft: #D3DADA; --muted: #B4BEBE; --muted-2: #C2CCCC;
  --placeholder: #AEBEBE; --dim: #86989A;
  --accent: #F2A21C; --accent-dark: #D98A00; --on-accent: #16191A;
  --on-accent-soft: var(--on-accent-soft); --on-strong: var(--on-strong);
  --accent-glow: var(--accent-glow); --accent-glow-strong: var(--accent-glow-strong);
  --warn: var(--warn); --danger: var(--danger); --danger-text: var(--danger-text); --error-bg: var(--error-bg);
  --overlay: var(--overlay);
  --shadow-color: var(--shadow-color); --shadow-color-strong: var(--shadow-color-strong);
  --shadow: 0 2px 10px var(--shadow-color);
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: var(--on-strong); --nav: #FFFFFF; --surface: #FFFFFF; --surface-2: #F2E9E0;
  --surface-3: #EADFD3; --surface-alt: #FBF6F1; --input: #FFFFFF;
  --line: #E2D7CB; --hover: #EFE5DA;
  --text: #26221F; --text-soft: #45403A; --muted: #5E5850; --muted-2: #5E5850;
  --placeholder: #7C736B; --dim: #6E675F;
  --accent: #E9770A; --accent-dark: #C75F00; --on-accent: #241F1B;
  --on-accent-soft: rgba(36,31,27,.75); --on-strong: #FFFFFF;
  --accent-glow: rgba(233,119,10,0.20); --accent-glow-strong: rgba(233,119,10,0.28);
  --warn: #D8A400; --danger: #C43C08; --danger-text: #B23A1F; --error-bg: #FCE6DB;
  --overlay: rgba(41,37,33,.45);
  --shadow-color: rgba(41,37,33,0.10); --shadow-color-strong: rgba(41,37,33,0.16);
  --shadow: 0 2px 10px var(--shadow-color);
}

/* === palette-graphite: сгенерировано theme_graphite.py, ниже не править вручную === */

/* компактный корд — для плотных списков */
.cord-v.small { width:18px; height:46px; flex:0 0 18px; margin:0 8px 0 2px; }
.cord-v.small .body { left:1px; right:1px; top:4px; bottom:15px; border-radius:8px 8px 4px 4px; }
.cord-v.small .body:after { width:2px; margin-left:-1px; }
.cord-v.small .tassel { width:7px; height:15px; }
.cord-v.small .tassel:before { top:-4px; width:7px; height:5px; }
.cord-v.small .t1 { left:1px; }
.cord-v.small .t2 { right:1px; }
.row > #rank-belt { display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; vertical-align:middle; }
.row > .rank-line { display:inline-flex; align-items:center; gap:8px; width:100%; }
.row > .rank-line > #rank-select { flex:1 1 auto; min-width:0; }

/* --- пояса-кордао (по схеме школы: половины шнура + кисточки) --- */
.rim { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.42), inset 0 0 0 3px rgba(0,0,0,.22),
       inset 0 8px 10px -8px rgba(0,0,0,.5), inset 0 -8px 10px -8px rgba(0,0,0,.5); }
.cord-v { position:relative; display:inline-block; width:26px; height:84px; vertical-align:middle; margin:0 6px 0 2px; flex:0 0 26px; }
.cord-v .body { position:absolute; left:2px; right:2px; top:6px; bottom:26px; border-radius:11px 11px 5px 5px; overflow:hidden;
   background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.22) 0 2px, rgba(0,0,0,.12) 2px 5px),
                     linear-gradient(90deg, var(--a) 0 50%, var(--b) 50% 100%); }
.cord-v .body:after { content:""; position:absolute; left:50%; margin-left:-1.5px; top:0; bottom:0; width:3px; background:rgba(255,255,255,.5); }
.cord-v .tassel { position:absolute; bottom:0; width:10px; height:28px; background:var(--b);
   clip-path:polygon(29% 0, 71% 0, 100% 100%, 0 100%); }
.cord-v .tassel:before { content:""; position:absolute; left:0; top:-5px; width:10px; height:7px; border-radius:2px;
   background:inherit; filter:brightness(1.35); }
.cord-v .t1 { left:2px; transform:rotate(8deg); background:var(--c, var(--a)); }
.cord-v .t2 { right:2px; transform:rotate(-8deg); background:var(--c, var(--b)); }
.cord-h { position:relative; display:inline-block; width:104px; height:30px; vertical-align:-9px; margin-right:8px; }
.cord-h .loop { position:absolute; left:0; top:5px; width:15px; height:17px; border-radius:999px; box-sizing:border-box;
   background:linear-gradient(180deg, var(--a) 0 50%, var(--b) 50% 100%);
   -webkit-mask:radial-gradient(circle at 50% 50%, transparent 3px, #000 4px);
           mask:radial-gradient(circle at 50% 50%, transparent 3px, #000 4px); }
.cord-h .strap { position:absolute; left:13px; top:5px; width:66px; height:17px; border-radius:4px; overflow:hidden;
   background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.20) 0 2px, rgba(0,0,0,.10) 2px 5px),
                     linear-gradient(180deg, var(--a) 0 50%, var(--b) 50% 100%); }
.cord-h .strap:after { content:""; position:absolute; left:0; right:0; top:7px; height:2px; background:rgba(255,255,255,.5); }
.cord-h .tassel { position:absolute; width:21px; height:10px; background:var(--b);
   clip-path:polygon(0 33%, 0 67%, 100% 100%, 100% 0); }
.cord-h .tassel:before { content:""; position:absolute; left:0; top:-1px; width:5px; height:12px; border-radius:2px;
   background:inherit; filter:brightness(1.35); }
.cord-h .t1 { left:79px; top:4px; background:var(--c, var(--a)); transform:rotate(-3deg); }
.cord-h .t2 { left:79px; top:15px; background:var(--c, var(--b)); transform:rotate(3deg); }
.cord-badge { display:inline-block; width:34px; height:34px; flex:0 0 34px; border-radius:50%; position:relative; overflow:hidden;
   background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.22) 0 2px, rgba(0,0,0,.12) 2px 5px),
                     linear-gradient(90deg, var(--a) 0 50%, var(--b) 50% 100%); }
.cord-badge:after { content:""; position:absolute; left:50%; margin-left:-1.5px; top:0; bottom:0; width:3px; background:rgba(255,255,255,.5); }

/* --- иконки вместо слов и нижняя навигация (телефон) --- */
.ibtn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
        border-radius: 12px; background: var(--surface-3); color: var(--text); text-decoration: none; border: 0;
        padding: 0; margin: 0; flex: 0 0 auto; font-size: 14px; }
.ibtn:hover, .ibtn:active { background: var(--hover); }
.ibtn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9;
            stroke-linecap: round; stroke-linejoin: round; }
button.ibtn, button.ibtn:hover { background: var(--surface-3); color: var(--text); }
.tabbar { display: none; }
.sheet { position: fixed; inset: 0; background: var(--overlay); display: none; z-index: 200; align-items: flex-end; }
.sheet.show { display: flex; }
.sheet-in { background: var(--surface); width: 100%; max-width: 960px; margin: 0 auto;
            border-radius: 18px 18px 0 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
.sheet-cap { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 6px 14px 2px; }
.sheet-in a, .sheet-in button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px; border-radius: 12px;
            color: var(--text); text-decoration: none; font-weight: 600; background: transparent; border: 0;
            font-size: 15px; margin: 0; font-family: inherit; }
.sheet-in a:active, .sheet-in button:active { background: var(--surface-2); }
.sheet-in svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.sheet-in form button { color: var(--danger-text); }
/* переключатель темы */
.theme-toggle { background: transparent; border: 1px solid var(--line); color: var(--text); width: 38px; height: 38px;
            border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; padding: 0; margin: 0; cursor: pointer; }
.theme-toggle svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html[data-theme="light"] .i-sun, html[data-theme="dark"] .i-moon { display: none; }
@media (max-width: 860px) {
  .menu { display: none; }
  body { padding-bottom: 88px; }
  .container { padding-top: 10px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
            background: var(--nav); border-top: 1px solid var(--line); justify-content: space-around;
            padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
            text-decoration: none; background: transparent; border: 0; color: var(--muted); font-size: 10px;
            font-weight: 700; padding: 6px 2px; margin: 0; width: auto; font-family: inherit; }
  .tabbar a.on, .tabbar button:active { color: var(--accent); }
  .tabbar svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8;
            stroke-linecap: round; stroke-linejoin: round; }
}

/* --- доработки поверх палитры --- */
body { background: var(--bg); }
.card { border: 1px solid var(--line); box-shadow: var(--shadow); }
.menu { border: 1px solid var(--line); }
.menu a:hover { background: var(--surface-2); }
.menu a.active, .menu a.active:hover { background: var(--accent); color: var(--on-accent); }
button, .button { color: var(--on-accent); }
.button[style*="var(--surface-3)"], button[style*="var(--surface-3)"] { color: var(--text); }
.button[style*="var(--nav)"], button[style*="var(--nav)"] { color: var(--text); }
.button[style*="var(--hover)"], button[style*="var(--hover)"] { color: var(--text); }
input, select, textarea { background: var(--input); color: var(--text); }
button { background: var(--accent); color: var(--on-accent); border: 0; font-weight: 600; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.sort-bar a { background: var(--surface); color: var(--text-soft); border: 1px solid var(--surface-3); }
.sort-bar a.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.nav-btn { background: var(--surface); color: var(--text); border: 1px solid var(--surface-3); }
.nav-btn:hover { background: var(--surface-2); }
.day-card { background: var(--surface); color: var(--text); }
.day-card.selected { background: var(--accent); color: var(--on-accent); }
.day-card.selected .dc-date, .day-card.selected .dc-count { color: var(--on-accent-soft); }
.calendar-cell { background: var(--surface); border: 1px solid var(--line); }
.status-group label { background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--surface-3); }
.status-group input:checked + label.st-present { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.status-group input:checked + label.st-absent { background: var(--danger); border-color: var(--danger); color: var(--on-strong); }
.status-group input:checked + label.st-excused { background: var(--warn); border-color: var(--warn); color: var(--on-accent); }
.card.live { border: 2px solid var(--accent); background: var(--surface); box-shadow: 0 2px 14px var(--accent-glow-strong); }
.striped > .card.live { background: var(--surface); }
.striped > .card:nth-child(even) { background: var(--surface-alt); }
.live-badge { background: var(--accent); color: var(--on-accent); }
.live-badge .pulse { background: var(--on-accent); }
.mini-btn { background: var(--surface-3); color: var(--text); }
.mini-btn:hover { background: var(--hover); }
.modal { background: var(--surface); }
.tile { color: var(--text); }
.tile-seagrass { background: var(--accent); color: var(--on-accent); }
.tile-saffron  { background: var(--warn); color: var(--on-accent); }
.tile-cayenne  { background: var(--danger); color: var(--on-strong); }
.tile-jasmine  { background: var(--on-strong); color: var(--on-accent); }
.tile-onyx     { background: var(--surface-3); color: var(--text); }
.scrollbox { background: var(--surface-alt); border: 1px solid var(--line); }
.rowline { border-bottom: 1px solid var(--line); }
.session-row { border-top: 1px solid var(--line); }
.progress { background: var(--line); }
.progress div { background: var(--accent); }
.dot-green { background: var(--accent); }
.dot-holiday { background: var(--danger); }
.error { color: var(--danger-text); }
a { color: var(--accent); }
a:visited { color: var(--accent-dark); }
audio { background: var(--surface-2); border-radius: 12px; width: 100%; }
audio::-webkit-media-controls-panel { background-color: var(--surface-2); }
audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display { color: var(--text); }
.hint, .date, .calendar-header, .sec-note { color: var(--muted-2); }
.day-card .dc-date { color: var(--muted-2); }
small, .sub { color: var(--muted-2); }
/* карточка ученика: карандаш в правом верхнем углу */
.student-card { position: relative; }
.student-card > strong { display: block; padding-right: 54px; }
.edit-corner { position: absolute; top: 12px; right: 12px; }
/* крупные кнопки-действия: подпись плотнее и темнее */
.button { font-weight: 800; letter-spacing: .1px; }
.card .button, .card.live .button { box-shadow: 0 2px 10px var(--accent-glow-strong), inset 0 0 0 1px rgba(0,0,0,.05); }

/* читаемость на телефоне: мелкий текст поднять, строки разредить */
body { font-size: 16px; line-height: 1.5; }
small { font-size: 14px; }
.sub, .hint, .date, .sec-note, .calendar-header, .day-card .dc-date { font-size: 14px; }
label { font-size: 14px; }
input, select, textarea, button, .button { font-size: 15px; }
.chip, .sort-bar a { font-size: 14px; }
.card, .rowline, .session-row { line-height: 1.45; }
.tabbar a, .tabbar button { font-size: 11px; }
.tabbar svg { width: 23px; height: 23px; }
.demo-ribbon { font-size: 13px; }
.sheet-in a, .sheet-in button { font-size: 16px; }
.ibtn { width: 42px; height: 42px; }

/* календарь выбора даты — тоже по теме (flatpickr.min.css идёт после style.css, нужна специфичность выше) */
html[data-theme] .flatpickr-calendar { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
html[data-theme] .flatpickr-months .flatpickr-month,
html[data-theme] .flatpickr-weekdays,
html[data-theme] .flatpickr-days { background: var(--surface); }
html[data-theme] .flatpickr-current-month,
html[data-theme] .flatpickr-monthDropdown-months,
html[data-theme] .numInputWrapper span { color: var(--text); }
html[data-theme] span.flatpickr-weekday { color: var(--muted); background: var(--surface); }
html[data-theme] .flatpickr-day { color: var(--text); }
html[data-theme] .flatpickr-day.prevMonthDay, html[data-theme] .flatpickr-day.nextMonthDay { color: var(--dim); }
html[data-theme] .flatpickr-day:hover { background: var(--surface-2); }
html[data-theme] .flatpickr-day.today { border-color: var(--accent); }
html[data-theme] .flatpickr-day.selected { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
html[data-theme] .flatpickr-calendar.arrowTop:after, html[data-theme] .flatpickr-calendar.arrowTop:before { border-bottom-color: var(--surface); }
html[data-theme] .flatpickr-calendar.arrowBottom:after, html[data-theme] .flatpickr-calendar.arrowBottom:before { border-top-color: var(--surface); }
html[data-theme] .flatpickr-input { background: var(--input); color: var(--text); }
/* на телефоне поля формы — в столбик: иначе select «день» сжимается до 80 px */
@media (max-width: 700px) {
  .row { flex-wrap: wrap; }
  .row > * { flex: 1 1 100%; }
  .row.schedule-row > * { flex: 1 1 100%; }
}

/* --- темы: переменные палитры --- */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1E2A2D; --nav: #1A2528; --surface: #26383B; --surface-2: #2C4043;
  --surface-3: #33484B; --surface-alt: #22302F; --input: #1F2D2F;
  --line: #2E4144; --hover: #3A5254;
  --text: #EDF1F1; --text-soft: #D3DADA; --muted: #B4BEBE; --muted-2: #C2CCCC;
  --placeholder: #AEBEBE; --dim: #86989A;
  --accent: #F2A21C; --accent-dark: #D98A00; --on-accent: #16191A;
  --on-accent-soft: rgba(30,42,45,.78); --on-strong: #F5ECE4;
  --accent-glow: rgba(245,166,35,0.20); --accent-glow-strong: rgba(245,166,35,0.28);
  --warn: #EAC435; --danger: #E74504; --danger-text: #FF9166; --error-bg: #3B2A26;
  --overlay: rgba(8,12,12,.72);
  --shadow-color: rgba(0,0,0,0.25); --shadow-color-strong: rgba(0,0,0,0.35);
  --shadow: 0 2px 10px var(--shadow-color);
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #F5ECE4; --nav: #FFFFFF; --surface: #FFFFFF; --surface-2: #F2E9E0;
  --surface-3: #EADFD3; --surface-alt: #FBF6F1; --input: #FFFFFF;
  --line: #E2D7CB; --hover: #EFE5DA;
  --text: #26221F; --text-soft: #45403A; --muted: #5E5850; --muted-2: #5E5850;
  --placeholder: #7C736B; --dim: #6E675F;
  --accent: #E9770A; --accent-dark: #C75F00; --on-accent: #241F1B;
  --on-accent-soft: rgba(36,31,27,.75); --on-strong: #FFFFFF;
  --accent-glow: rgba(233,119,10,0.20); --accent-glow-strong: rgba(233,119,10,0.28);
  --warn: #D8A400; --danger: #C43C08; --danger-text: #B23A1F; --error-bg: #FCE6DB;
  --overlay: rgba(41,37,33,.45);
  --shadow-color: rgba(41,37,33,0.10); --shadow-color-strong: rgba(41,37,33,0.16);
  --shadow: 0 2px 10px var(--shadow-color);
}
/* иконки нижней навигации (Iconify): заливка вместо обводки */
.tabbar svg.ic { fill: currentColor; stroke: none; stroke-width: 0; }
