/* Цвета берутся из темы Telegram (переменные --tg-theme-*), запасные — для браузера. */
:root {
  --fb-bg: #efeff4;
  --fb-section: #ffffff;
  --fb-text: #000000;
  --fb-hint: #8e8e93;
  --fb-link: #2481cc;
  --fb-button: #2481cc;
  --fb-button-text: #ffffff;
  --fb-header: #6d6d72;
  --fb-danger: #e53935;
  --fb-separator: rgba(60, 60, 67, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --fb-bg: #0f0f0f;
    --fb-section: #1c1c1e;
    --fb-text: #ffffff;
    --fb-hint: #8d8e93;
    --fb-link: #62bcf9;
    --fb-button: #3e88f7;
    --fb-header: #8d8e93;
    --fb-danger: #ff5a52;
    --fb-separator: rgba(255, 255, 255, 0.1);
  }
}

:root {
  --bg: var(--tg-theme-secondary-bg-color, var(--fb-bg));
  --section: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, var(--fb-section)));
  --text: var(--tg-theme-text-color, var(--fb-text));
  --hint: var(--tg-theme-hint-color, var(--fb-hint));
  --link: var(--tg-theme-link-color, var(--fb-link));
  --accent: var(--tg-theme-accent-text-color, var(--link));
  --button: var(--tg-theme-button-color, var(--fb-button));
  --button-text: var(--tg-theme-button-text-color, var(--fb-button-text));
  --header: var(--tg-theme-section-header-text-color, var(--fb-header));
  --danger: var(--tg-theme-destructive-text-color, var(--fb-danger));
  --separator: var(--tg-theme-section-separator-color, var(--fb-separator));
  --ok: #2fa84f;
  --warn: #e0900b;
  --radius: 12px;
  /* Стекло нижней панели и переключатель вкладок: свои значения для светлой и тёмной темы */
  --glass-edge: rgba(255, 255, 255, 0.8);
  --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08), inset 0 1px 0 #fff;
  --tab-on: rgba(118, 118, 128, 0.15);
  --tab-on-shine: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --seg: rgba(118, 118, 128, 0.14);
  --seg-on: #ffffff;
}

/* Тема Telegram может не совпадать с темой телефона, поэтому смотрим и на data-scheme от приложения */
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme="light"]) {
    --glass-edge: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    --tab-on: rgba(255, 255, 255, 0.13);
    --tab-on-shine: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    --seg: rgba(118, 118, 128, 0.26);
    --seg-on: #48484a;
  }
}
:root[data-scheme="dark"] {
  --glass-edge: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --tab-on: rgba(255, 255, 255, 0.13);
  --tab-on-shine: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --seg: rgba(118, 118, 128, 0.26);
  --seg-on: #48484a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 16px calc(32px + env(safe-area-inset-bottom));
  transition: opacity .15s;
}
main.busy { opacity: .55; pointer-events: none; }
body.with-tabs main { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* --- Заголовки --- */
.page-title { font-size: 26px; font-weight: 700; margin: 8px 4px 2px; letter-spacing: -0.3px; }
.page-sub { color: var(--hint); margin: 0 4px 4px; font-size: 15px; }
.page-head { display: flex; align-items: flex-start; gap: 8px; }
.page-head > div { flex: 1; min-width: 0; }
.round-btn {
  flex: none;
  width: 40px; height: 40px;
  margin-top: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--section);
  color: var(--link);
  display: grid; place-items: center;
}
.round-btn:active { filter: brightness(.92); }
.svg-icon { display: grid; place-items: center; }

/* --- Секции в стиле настроек Telegram --- */
.section { margin: 18px 0 0; }
.section-title {
  color: var(--header);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .3px;
  margin: 0 16px 6px;
}
.section-note { color: var(--hint); font-size: 13px; margin: 6px 16px 0; }
.card { background: var(--section); border-radius: var(--radius); overflow: hidden; }
.card.padded { padding: 14px 16px; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  background: none;
  border: 0;
  text-align: left;
  position: relative;
}
.row + .row::before {
  content: "";
  position: absolute;
  top: 0; right: 0; left: 16px;
  border-top: 1px solid var(--separator);
}
.row.has-icon + .row::before, .row + .row.has-icon::before { left: 60px; }
button.row:active { background: var(--separator); }
.row .main { flex: 1; min-width: 0; }
.row .title { overflow-wrap: anywhere; }
.row .sub { color: var(--hint); font-size: 14px; margin-top: 1px; overflow-wrap: anywhere; }
.row .right { color: var(--hint); font-size: 15px; white-space: nowrap; }
.row .chevron { color: var(--hint); opacity: .6; font-size: 22px; line-height: 1; margin-left: -4px; }
.row.accent .title { color: var(--accent); }
.row.danger .title { color: var(--danger); }

.icon {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: #fff; font-size: 16px; font-weight: 600;
  flex: none;
}
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 16px;
  flex: none;
}
.row.has-avatar + .row::before, .row + .row.has-avatar::before { left: 68px; }

/* --- Значки --- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--separator);
  color: var(--hint);
}
.badge.debt { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

/* --- Кнопки --- */
.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 13px 16px;
  background: var(--button);
  color: var(--button-text);
  font-weight: 600;
  font-size: 16px;
  text-align: center;
}
.btn:active { filter: brightness(.92); }
.btn:disabled { opacity: .5; }
.btn.secondary { background: var(--section); color: var(--link); }
.btn.danger { background: var(--section); color: var(--danger); }
.btn.small { padding: 8px 10px; font-size: 14px; border-radius: 9px; }
.btn.tonal { background: color-mix(in srgb, var(--button) 13%, transparent); color: var(--link); }
.buttons { display: flex; gap: 8px; margin-top: 14px; }
.buttons > * { flex: 1; }
.stack { display: grid; gap: 8px; margin-top: 14px; }

/* --- Главная карточка экрана --- */
.hero { background: var(--section); border-radius: var(--radius); padding: 16px; margin-top: 8px; }
.hero .label { color: var(--hint); font-size: 14px; }
.hero .big { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; margin: 2px 0; }
.hero .big.debt { color: var(--danger); }
.hero .big.ok { color: var(--ok); }
.hero .title { font-size: 20px; font-weight: 700; }
.hero .meta { color: var(--hint); font-size: 14px; margin-top: 4px; }

/* --- Урок с действиями --- */
.lesson { padding: 12px 16px; position: relative; }
.lesson + .lesson::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--separator); }
.lesson .when { font-weight: 600; }
.lesson .state { color: var(--hint); font-size: 14px; margin-top: 2px; }
.lesson .state.ok { color: var(--ok); }
.lesson .state.warn { color: var(--warn); }
.lesson .buttons { margin-top: 10px; }

/* --- Выбор дня и времени --- */
.days { display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px; scrollbar-width: none; scroll-snap-type: x proximity; }
.days::-webkit-scrollbar { display: none; }
.day {
  flex: none;
  width: 48px;
  padding: 7px 0 8px;
  border: 0;
  border-radius: 10px;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  scroll-snap-align: start;
}
.day .wd { font-size: 12px; color: var(--hint); }
.day .num { font-size: 18px; font-weight: 600; }
.day .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--hint); opacity: .7; }
.day .dot.none { visibility: hidden; }
.day.active { background: var(--button); color: var(--button-text); }
.day.active .wd { color: var(--button-text); opacity: .8; }
.day.active .dot { background: var(--button-text); }

.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; padding: 12px; }
.chip {
  border: 0;
  border-radius: 10px;
  background: var(--bg);
  padding: 9px 4px;
  text-align: center;
  font-weight: 500;
  display: flex; flex-direction: column; align-items: center;
}
.chip small { font-size: 11px; color: var(--warn); font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.active { background: var(--button); color: var(--button-text); }
.chip.active small { color: var(--button-text); }
.chip:disabled { opacity: .35; }
.chip.wide { grid-column: span 2; }

.summary { text-align: center; color: var(--hint); font-size: 14px; margin-top: 14px; }
.summary b { color: var(--text); font-weight: 600; }

/* --- Формы --- */
.field { padding: 10px 16px; position: relative; display: block; }
.field + .field::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--separator); }
.field .label { display: block; color: var(--hint); font-size: 13px; margin-bottom: 3px; }
.input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 2px 0;
  font-size: 17px;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}
textarea.input { resize: vertical; min-height: 84px; line-height: 1.4; }
select.input { background: transparent; }
.input::placeholder { color: var(--hint); opacity: .7; }
.inline-inputs { display: flex; align-items: center; gap: 10px; }
.inline-inputs select { width: auto; flex: 1; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 31px; background: var(--separator); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }

/* --- Финансы --- */
.month-switch { display: flex; align-items: center; margin-top: 12px; }
.month-switch .arrow { width: 48px; height: 44px; border: 0; background: none; color: var(--link); font-size: 26px; line-height: 1; }
.month-switch .arrow:disabled { color: var(--hint); opacity: .35; }
.month-switch .month-name { flex: 1; text-align: center; font-weight: 600; }
.hero .meter { display: flex; gap: 2px; height: 10px; margin-top: 16px; }
.meter > div { min-width: 4px; }
.meter > div:first-child { border-radius: 4px 0 0 4px; }
.meter > div:last-child { border-radius: 0 4px 4px 0; }
.meter > div:only-child { border-radius: 4px; }
.meter .done, .legend .swatch.done { background: var(--button); }
.meter .planned, .legend .swatch.planned { background: color-mix(in srgb, var(--button) 38%, var(--section)); }
.legend { display: grid; gap: 6px; margin-top: 12px; font-size: 14px; }
.legend > div { display: flex; align-items: center; gap: 8px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .what { flex: 1; color: var(--hint); }
.legend .sum { white-space: nowrap; }
.legend .total { padding-top: 8px; margin-top: 2px; border-top: 1px solid var(--separator); font-weight: 600; }
.legend .total .what { color: var(--text); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stat { background: var(--section); border-radius: var(--radius); padding: 14px; min-width: 0; }
.stat .label { color: var(--hint); font-size: 14px; }
.stat .value { font-size: 22px; font-weight: 700; white-space: nowrap; margin: 2px 0; }
.stat .value.debt { color: var(--danger); }
.stat .sub { color: var(--hint); font-size: 13px; }

.income-head { display: flex; gap: 8px; align-items: baseline; }
.income-head .title { flex: 1; min-width: 0; }
.income-head .sum { font-weight: 600; white-space: nowrap; }
.bar { height: 6px; min-width: 6px; border-radius: 3px; background: var(--button); margin-top: 7px; }

.segment { display: flex; gap: 3px; padding: 3px; margin: 0 16px 12px; border-radius: 10px; background: var(--bg); }
.segment button { flex: 1; border: 0; border-radius: 8px; padding: 7px 4px; background: transparent; display: flex; flex-direction: column; align-items: center; }
.segment button.active { background: var(--button); color: var(--button-text); }
.segment small { font-size: 12px; color: var(--hint); }
.segment button.active small { color: var(--button-text); opacity: .85; }
.segment + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: 1px solid var(--separator); }
.tax-sum { font-weight: 700; font-size: 17px; white-space: nowrap; color: var(--text); }
.tax-off { color: var(--hint); font-size: 14px; padding: 0 16px 14px; }

/* --- Вкладки внутри экрана --- */
.seg { display: flex; gap: 3px; padding: 3px; margin-top: 18px; border-radius: 10px; background: var(--seg); }
.seg button {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 8px;
  padding: 7px 4px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
}
.seg button.active { background: var(--seg-on); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); }
.seg-body > .section:first-child { margin-top: 14px; }

/* --- Нижняя панель разделов: парящая стеклянная капсула, как в Telegram --- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: calc(100% - 28px);
  max-width: 480px;
  display: flex;
  padding: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--section) 66%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  backdrop-filter: blur(24px) saturate(1.8);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
  z-index: 5;
}
.tabbar[hidden], body.typing .tabbar { display: none; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tabbar { background: var(--section); }
}
.tabbar .tab {
  flex: 1;
  min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 0 5px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text);
  font-size: 10px;
  font-weight: 600;
  position: relative;
}
.tabbar .tab span { position: relative; z-index: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar .tab.active { color: var(--link); }
.tabbar .tab.active::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--tab-on);
  box-shadow: var(--tab-on-shine);
}
.tabbar .tab .cnt {
  position: absolute;
  z-index: 2;
  top: 0;
  left: calc(50% + 5px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* --- Домашние задания --- */
.padded-block { padding: 12px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.choices button {
  min-width: 0;
  border: 0;
  border-radius: 10px;
  padding: 8px 4px;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center;
}
.choices b { font-weight: 600; font-size: 14px; white-space: nowrap; }
.choices small { font-size: 12px; opacity: .8; }
.choices button.active { background: var(--button); color: var(--button-text); }
.due-custom { margin-top: 10px; }
.due-custom[hidden] { display: none; }
.due-custom .input { background: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: 16px; }
.due-summary { text-align: center; color: var(--hint); font-size: 14px; margin-top: 10px; }

.files { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.card > .files { padding: 12px 16px; }
.field .files { margin-top: 6px; }
.file-cell { position: relative; min-width: 0; }
.file-tile {
  width: 100%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 10px;
  padding: 6px;
  background: var(--bg);
  color: var(--link);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  overflow: hidden;
  font-size: 12px;
}
.file-tile .name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--hint); }
.file-tile.photo { padding: 0; }
.file-tile.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-tile.broken::after { content: "Фото не загрузилось"; color: var(--hint); padding: 6px; text-align: center; }
.file-tile.add { border: 1.5px dashed color-mix(in srgb, var(--link) 55%, transparent); background: none; cursor: pointer; }
.file-tile.add .name { color: var(--link); white-space: normal; text-align: center; }
.file-tile.loading { color: var(--hint); }
.file-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 24px; height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 12px;
  line-height: 24px;
  padding: 0;
}
.photo-view {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, .92);
  display: grid; place-items: center;
  padding: 16px;
}
.photo-view img { width: 100%; height: 100%; object-fit: contain; }
.photo-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top)); right: 12px;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 18px;
}
.quote { white-space: pre-wrap; overflow-wrap: anywhere; }
.text-block.hint { color: var(--hint); font-size: 15px; }
.hw-card { padding: 14px 16px; position: relative; }
.hw-card + .hw-card::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--separator); }
.hw-head { display: flex; align-items: flex-start; gap: 8px; }
.hw-head .main { flex: 1; min-width: 0; }
.hw-head .title { font-weight: 600; overflow-wrap: anywhere; }
.hw-head .sub { color: var(--hint); font-size: 14px; margin-top: 2px; }
.hw-head .sub.warn { color: var(--warn); }
.hw-card .quote { margin-top: 8px; font-size: 15px; }
.hw-body { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.hw-card .files { margin-top: 10px; }
.hw-card .buttons { margin-top: 12px; }

/* --- Прочее --- */
.text-block { padding: 12px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.link-box {
  font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg);
  border-radius: 8px;
  padding: 9px 10px;
  margin-top: 8px;
  overflow-wrap: anywhere;
  user-select: all;
  -webkit-user-select: all;
}
.amount-plus { color: var(--ok); font-weight: 600; }
.amount-minus { color: var(--text); }
.empty { text-align: center; color: var(--hint); padding: 22px 16px; font-size: 15px; }
.welcome { text-align: center; padding: 28px 8px 6px; }
.welcome .logo {
  width: 84px; height: 84px; margin: 0 auto 14px;
  border-radius: 24px;
  background: linear-gradient(135deg, #5aa7f0, #7b6cf0);
  color: #fff; display: grid; place-items: center;
  font-size: 40px; font-weight: 800;
}
.welcome h1 { margin: 0 0 6px; font-size: 26px; }
.welcome p { margin: 0 auto; color: var(--hint); max-width: 340px; }

.loader {
  width: 28px; height: 28px;
  margin: 30vh auto 0;
  border-radius: 50%;
  border: 3px solid var(--separator);
  border-top-color: var(--button);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: rgba(30, 30, 30, .92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 15px;
  text-align: center;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
body.with-tabs .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
.error-box { text-align: center; padding: 30vh 16px 0; color: var(--hint); }
.error-box .btn { margin-top: 16px; }

/* --- Лёгкие экраны репетитора: крупные заголовки, карточки дел, плитки учеников --- */
.big-head { display: flex; align-items: flex-end; gap: 8px; padding: 6px 2px 0; }
.big-head .txt { flex: 1; min-width: 0; }
.big-head .over { display: block; color: var(--hint); font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.big-title { font-size: 32px; font-weight: 800; letter-spacing: -0.6px; line-height: 1.1; margin: 0; overflow-wrap: anywhere; }
.big-head .round-btn { margin-top: 0; }
.add-btn {
  flex: none; height: 40px; padding: 0 15px 0 11px; border: 0; border-radius: 20px;
  background: var(--button); color: var(--button-text); font-weight: 600; font-size: 15px;
  display: flex; align-items: center; gap: 4px;
}
.add-btn:active, .rb:active, .act:active, .gtile:active, .date-card:active, .mark:active, .les:active { filter: brightness(.94); }
.stitle { display: flex; align-items: center; gap: 8px; margin: 26px 2px 10px; font-size: 21px; font-weight: 700; letter-spacing: -0.3px; }
.stitle.small { font-size: 17px; margin: 20px 2px 8px; }
.count {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px;
  background: var(--danger); color: #fff; font-size: 13px; font-weight: 700; line-height: 22px; text-align: center; letter-spacing: 0;
}
.count.grey { background: var(--hint); }

.tasks { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.task {
  display: block; width: 100%; background: var(--section); border: 0; border-radius: 18px;
  padding: 12px 12px 12px 14px; text-align: left;
}
.task .top { display: flex; align-items: center; gap: 12px; }
.task .txt, .claim .txt, .invite .txt { flex: 1; min-width: 0; }
.task .q, .claim .q { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task .m, .claim .m { color: var(--hint); font-size: 14px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task .avatar { width: 44px; height: 44px; font-size: 18px; font-weight: 700; }
.task .avatar.sq { border-radius: 14px; color: #fff; }
.task > .top > .svg-icon { color: var(--hint); opacity: .55; }
.task.done { display: flex; align-items: center; gap: 12px; }
.task.done .avatar { color: #fff; }
.avw { position: relative; flex: none; }
.avw .kind {
  position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--section); color: #fff; display: grid; place-items: center;
}
.rb { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; }
.rb.no { background: var(--seg); color: var(--header); }
.rb.yes { background: var(--button); color: var(--button-text); }
.rb:disabled { opacity: .5; }
.marks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.marks.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mark {
  border: 0; border-radius: 14px; background: var(--bg); padding: 10px 4px 9px;
  display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 13px; font-weight: 600;
}
.mark .e { font-size: 26px; line-height: 1; }
.skip { display: block; margin: 8px auto 0; padding: 6px; border: 0; background: none; color: var(--link); font-size: 14px; font-weight: 500; }

.week { display: flex; gap: 5px; margin-bottom: 8px; }
.week .day { flex: 1; min-width: 0; width: auto; height: auto; padding: 8px 0 7px; border-radius: 14px; background: var(--section); scroll-snap-align: none; }
.week .day .num { font-weight: 700; font-size: 19px; }
.week .day.active { background: var(--button); color: var(--button-text); }
.week .day.today:not(.active) .num { color: var(--link); }
.les {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 14px;
  border: 0; background: none; text-align: left; position: relative;
}
.les + .les::before { content: ""; position: absolute; top: 0; left: 110px; right: 0; border-top: 1px solid var(--separator); }
.les .tm { width: 48px; flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.les .avatar { width: 34px; height: 34px; font-size: 15px; }
.les .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.les .nm i { font-style: normal; color: var(--hint); }
.les > .svg-icon { color: var(--hint); opacity: .55; }
.dot-ico { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 15px; }
.dot-ico.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.dot-ico.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.dot-ico.debt { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.search { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding: 0 14px; border-radius: 14px; background: var(--seg); color: var(--hint); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 11px 0; font-size: 16px; color: var(--text); }
.gtiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.gtile {
  border: 0; background: var(--section); border-radius: 20px; padding: 14px; min-height: 132px; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left;
}
.gtile[hidden] { display: none; }
.gtile .avatar { width: 50px; height: 50px; font-size: 20px; font-weight: 700; margin-bottom: 9px; }
.gtile .q { font-size: 17px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gtile .m { color: var(--hint); font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gtile .badge { margin-top: 6px; font-size: 12px; }

.student-head { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 6px; }
.student-head .avatar { width: 76px; height: 76px; font-size: 32px; font-weight: 700; }
.student-head .big-title { font-size: 28px; margin-top: 10px; }
.student-head .m { color: var(--hint); font-size: 15px; margin-top: 3px; }
.student-head .edit { position: absolute; top: 2px; right: 0; margin: 0; }
.who { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; margin-top: 18px; border-radius: 16px; background: var(--seg); }
.who button {
  height: 46px; border: 0; border-radius: 13px; background: transparent; color: var(--hint);
  display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 16px; font-weight: 600;
}
.who button.active { background: var(--seg-on); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }
.red-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.acts { display: flex; justify-content: space-evenly; margin-top: 18px; }
.act {
  width: 96px; padding: 0; border: 0; background: none; color: var(--link);
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
}
.act .c { width: 54px; height: 54px; border-radius: 50%; background: var(--section); display: grid; place-items: center; }
.invite { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; margin-top: 16px; }
.invite .btn { flex: none; }
.ul { display: flex; gap: 24px; margin: 24px 2px 14px; border-bottom: 1px solid var(--separator); }
.ul button {
  padding: 0 0 10px; margin-bottom: -1px; border: 0; border-bottom: 2.5px solid transparent; background: none;
  color: var(--hint); font-size: 17px; font-weight: 600;
}
.ul button.active { color: var(--text); border-bottom-color: var(--button); }
.dates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.date-card {
  position: relative; border: 0; background: var(--section); border-radius: 16px; padding: 12px 12px 11px; text-align: left;
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
}
.date-card .wd { color: var(--hint); font-size: 13px; }
.date-card .n { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }
.date-card .tt { color: var(--header); font-size: 14px; }
.date-card .dot-ico { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; }
.emo { width: 36px; height: 36px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: 19px; flex: none; }
.row .sub.one { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .hint { color: var(--hint); }
.new-note { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.new-note .input { flex: 1; min-width: 0; border-radius: 22px; background: var(--section); padding: 12px 16px; }
.seg-body > .card.text-block { margin-top: 0; }
.lock { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 10px; color: var(--hint); font-size: 13px; }
.balance { padding: 16px; margin-top: 18px; }
.balance .lbl { display: flex; align-items: center; gap: 8px; color: var(--hint); font-size: 15px; font-weight: 600; }
.balance .lbl .badge { margin-left: auto; }
.balance .big { font-size: 36px; font-weight: 800; letter-spacing: -0.8px; margin-top: 2px; }
.balance .big.debt { color: var(--danger); }
.balance .big.ok { color: var(--ok); }
.claim { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 10px 10px 14px; border-radius: 14px; background: var(--bg); }
.claim .rb.no { background: var(--section); }
.seg .count { min-width: 20px; height: 20px; line-height: 20px; font-size: 12px; padding: 0 6px; }
.seg button { display: flex; align-items: center; justify-content: center; gap: 6px; }
