/* =========================================================
   РепетиторБот — оформление сайта

   Цвета заданы переменными. Репетитор выбирает в профиле:
   - тему: <html data-theme="light | dark | auto"> (auto — как в системе);
   - цвет акцента: <html data-accent="violet | blue | ...">;
   - размер текста: <html data-text="normal | large">.
   ========================================================= */

:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --text: #171a2c;
  --muted: #6b7088;
  --border: #e6e8f2;

  /* Три цвета акцента: из них собираются градиент, кнопки и ссылки */
  --g1: #6d4aff;
  --g2: #a855f7;
  --g3: #ec4899;
  --primary: var(--g1);
  --primary-soft: color-mix(in srgb, var(--primary) 13%, var(--surface));
  --primary-shadow: color-mix(in srgb, var(--g1) 32%, transparent);
  --gradient: linear-gradient(135deg, var(--g1) 0%, var(--g2) 55%, var(--g3) 100%);

  --blue: #3b82f6;    --blue-soft: #e7f0ff;
  --violet: #8b5cf6;  --violet-soft: #f1ebff;
  --orange: #f97316;  --orange-soft: #fff1e6;
  --green: #10b981;   --green-soft: #e3f8f0;
  --pink: #ec4899;    --pink-soft: #fde8f3;
  --red: #ef4444;     --red-soft: #fdecec;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(23, 26, 44, 0.04), 0 8px 24px rgba(23, 26, 44, 0.06);
  --shadow-lg: 0 20px 50px var(--primary-shadow);

  /* Шрифт — системный: ничего не грузим со сторонних серверов (меньше вопросов по 152-ФЗ) */
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;
  color-scheme: light;
}

/* ---------- Цвета акцента ---------- */
:root[data-accent="blue"]     { --g1: #2563eb; --g2: #3b82f6; --g3: #06b6d4; }
:root[data-accent="green"]    { --g1: #059669; --g2: #10b981; --g3: #84cc16; }
:root[data-accent="orange"]   { --g1: #ea580c; --g2: #f97316; --g3: #f59e0b; }
:root[data-accent="pink"]     { --g1: #db2777; --g2: #ec4899; --g3: #f43f5e; }
:root[data-accent="graphite"] { --g1: #334155; --g2: #475569; --g3: #64748b; }

/* ---------- Тёмная тема ----------
   Включается, если её выбрали явно, или если выбрано «как в системе»
   и в системе стоит тёмная тема. */
:root[data-theme="dark"] {
    --bg: #0f1020;
    --surface: #181a2e;
    --surface-2: #1e2038;
    --text: #eceefa;
    --muted: #9a9fbe;
    --border: #2a2d4a;
    /* В тёмной теме цвет акцента делаем светлее, чтобы он читался на тёмном фоне */
    --primary: color-mix(in srgb, var(--g1) 65%, white);
    --blue-soft: #1c2a4a;
    --violet-soft: #2a2350;
    --orange-soft: #3a2618;
    --green-soft: #15332b;
    --pink-soft: #3a1a2e;
    --red-soft: #3a1c1f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
      --bg: #0f1020;
      --surface: #181a2e;
      --surface-2: #1e2038;
      --text: #eceefa;
      --muted: #9a9fbe;
      --border: #2a2d4a;
      /* В тёмной теме цвет акцента делаем светлее, чтобы он читался на тёмном фоне */
      --primary: color-mix(in srgb, var(--g1) 65%, white);
      --blue-soft: #1c2a4a;
      --violet-soft: #2a2350;
      --orange-soft: #3a2618;
      --green-soft: #15332b;
      --pink-soft: #3a1a2e;
      --red-soft: #3a1c1f;
      --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
      color-scheme: dark;
  }
}

/* ---------- Крупный текст ---------- */
:root[data-text="large"] { font-size: 112.5%; }

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 0.9375rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 750; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 0.75rem; }

.icon { width: 20px; height: 20px; flex-shrink: 0; }
.muted { color: var(--muted); }
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.62rem 1.1rem;
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 6px 18px var(--primary-shadow); }
.btn-primary:hover { box-shadow: 0 10px 26px color-mix(in srgb, var(--g1) 45%, transparent); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-white { background: #fff; color: var(--g1); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; border-radius: 10px; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-success { background: var(--green-soft); color: var(--green); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-soft { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.btn-soft:hover { color: var(--text); }
.btn-block { width: 100%; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1.05rem; border-radius: 14px; }

form.inline { display: inline-flex; gap: 0.4rem; margin: 0; }

/* ---------- Поля форм ---------- */

.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 600; font-size: 0.9rem; }
.field .hint { font-weight: 400; color: var(--muted); }
.input {
  font: inherit;
  font-weight: 400;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

/* Переключатель «Один раз / Каждую неделю» */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; background: var(--surface-2); padding: 0.3rem; border-radius: 12px; border: 1.5px solid var(--border); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { text-align: center; padding: 0.45rem; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 0.88rem; color: var(--muted); }
.segmented input:checked + span { color: var(--text); }
.segmented label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Сообщения ---------- */

.flash {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--green-soft);
  color: var(--green);
  font-weight: 600;
  margin-bottom: 1.25rem;
}
.alert {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--red-soft);
  color: var(--red);
  font-weight: 600;
}

/* =========================================================
   Каркас приложения: меню слева, контент справа
   ========================================================= */

.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 1rem;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 0.65rem; font-weight: 800; font-size: 1.1rem; color: var(--text); padding: 0 0.5rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 6px 16px var(--primary-shadow);
}

.nav { display: flex; flex-direction: column; gap: 0.25rem; }
.nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); }

.sidebar-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem;
  border-radius: 14px;
  background: var(--surface-2);
}
.sidebar-user .who { flex: 1; min-width: 0; }
.sidebar-user .who b, .sidebar-user .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .who span { color: var(--muted); font-size: 0.8rem; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: none; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface); color: var(--red); }

.main { padding: 2rem 2.5rem 3rem; max-width: 1180px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head p { margin: 0.35rem 0 0; color: var(--muted); }
.back-link { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); font-weight: 600; margin-bottom: 0.75rem; }

/* ---------- Карточки ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-head a { font-weight: 600; font-size: 0.9rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-main { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.25rem; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 1.25rem; }

/* Приветственный баннер на главной */
.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 1.75rem 2rem;
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--shadow-lg);
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.hero-card::before, .hero-card::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}
.hero-card::before { width: 260px; height: 260px; right: -60px; top: -120px; }
.hero-card::after { width: 160px; height: 160px; right: 180px; bottom: -100px; }
.hero-card > * { position: relative; z-index: 1; }
.hero-card h1 { font-size: 1.9rem; }
.hero-card p { margin: 0.4rem 0 0; opacity: 0.9; }

/* Цифры-показатели */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0; }
.stat-value { display: block; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-label { display: block; color: var(--muted); font-size: 0.85rem; }
.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-orange { background: var(--orange-soft); color: var(--orange); }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-pink { background: var(--pink-soft); color: var(--pink); }

/* ---------- Аватарки учеников ---------- */

.avatar {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.avatar.lg { width: 72px; height: 72px; font-size: 1.5rem; border-radius: 22px; }
.av-0 { background: linear-gradient(135deg, #6d4aff, #a855f7); }
.av-1 { background: linear-gradient(135deg, #3b82f6, #06b6d4); }
.av-2 { background: linear-gradient(135deg, #f97316, #f43f5e); }
.av-3 { background: linear-gradient(135deg, #10b981, #84cc16); }
.av-4 { background: linear-gradient(135deg, #ec4899, #f59e0b); }
.av-5 { background: linear-gradient(135deg, #0ea5e9, #6366f1); }

/* ---------- Списки уроков ---------- */

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid transparent;
  flex-wrap: wrap;
}
.row:hover { border-color: var(--border); }
.row .grow { flex: 1; min-width: 120px; }
.row .name { font-weight: 650; color: var(--text); display: block; }
.row .sub { color: var(--muted); font-size: 0.85rem; }
.time-pill {
  min-width: 64px;
  text-align: center;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}
.badge .icon { width: 14px; height: 14px; }
.badge-done { background: var(--green-soft); color: var(--green); }
.badge-missed { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.badge-planned { background: var(--blue-soft); color: var(--blue); }
.chip { font-size: 0.78rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--violet-soft); color: var(--violet); }

.amount-debt { color: var(--orange); font-weight: 750; }
.amount-plus { color: var(--green); font-weight: 750; }

/* Пустое состояние: когда в списке ничего нет */
.empty { text-align: center; padding: 1.75rem 1rem; color: var(--muted); }
.empty .emoji { font-size: 2.2rem; display: block; margin-bottom: 0.4rem; }

/* ---------- Ученики сеткой ---------- */

.students-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.student-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.student-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(23, 26, 44, 0.1); text-decoration: none; }
.student-card .top { display: flex; align-items: center; gap: 0.75rem; }
.student-card .bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 0.8rem; border-top: 1px dashed var(--border); font-size: 0.9rem; }
.student-card.add {
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-weight: 650;
  min-height: 150px;
}
.student-card.add:hover { border-color: var(--primary); color: var(--primary); }

/* Шапка карточки ученика */
.profile-head { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.profile-head .meta { display: flex; gap: 0.5rem; margin-top: 0.4rem; flex-wrap: wrap; }

.invite-box {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85rem;
  word-break: break-all;
  user-select: all;
}

.code-box {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  text-align: center;
  padding: 1rem;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  user-select: all;
}

/* ---------- Расписание ---------- */

.day-group { margin-bottom: 1.5rem; }
.day-title { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; font-weight: 750; }

/* =========================================================
   Страницы входа и регистрации
   ========================================================= */

.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-side {
  position: relative;
  overflow: hidden;
  padding: 3rem;
  background: var(--gradient);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
}
.auth-side::before, .auth-side::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.1); }
.auth-side::before { width: 420px; height: 420px; right: -160px; top: -140px; }
.auth-side::after { width: 300px; height: 300px; left: -120px; bottom: -120px; }
.auth-side > * { position: relative; z-index: 1; }
.auth-side .brand { color: #fff; padding: 0; }
.auth-side .brand-mark { background: rgba(255, 255, 255, 0.2); box-shadow: none; }
.auth-side h2 { font-size: 2.1rem; font-weight: 800; max-width: 440px; }
.auth-points { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; flex-direction: column; gap: 0.85rem; }
.auth-points li { display: flex; gap: 0.75rem; align-items: center; font-weight: 550; }
.auth-points .dot { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, 0.18); }

.auth-main { display: grid; place-items: center; padding: 2rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { margin-bottom: 0.4rem; }
.auth-card > p { color: var(--muted); margin-bottom: 1.5rem; }
.auth-switch { text-align: center; margin-top: 1.25rem; color: var(--muted); }

/* =========================================================
   Стартовая страница (для тех, кто ещё не вошёл)
   ========================================================= */

.landing { overflow-x: hidden; }
.landing-nav { display: flex; justify-content: space-between; align-items: center; max-width: 1180px; margin: 0 auto; padding: 1.25rem 1.5rem; gap: 1rem; }
.landing-nav .actions { display: flex; gap: 0.5rem; }

.landing-hero {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 3rem;
  align-items: center;
}
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.45; z-index: -1; }
.blob-1 { width: 380px; height: 380px; background: #a855f7; top: -40px; right: 8%; }
.blob-2 { width: 300px; height: 300px; background: #3b82f6; bottom: -60px; left: 30%; opacity: 0.3; }
.eyebrow { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 700; font-size: 0.85rem; padding: 0.35rem 0.8rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary); margin-bottom: 1.25rem; }
.landing-hero h1 { font-size: clamp(2.2rem, 4.5vw, 3.4rem); font-weight: 850; letter-spacing: -0.03em; }
.landing-hero .lead { font-size: 1.15rem; color: var(--muted); margin: 1.25rem 0 2rem; max-width: 520px; }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* Макет «экрана» в правой части героя */
.mock {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.25rem;
  box-shadow: 0 30px 70px rgba(23, 26, 44, 0.15);
  transform: rotate(1.5deg);
}
.mock .mock-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.mock .stats { grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 0.9rem; }
.mock .stat { padding: 0.7rem; box-shadow: none; }
.mock .stat-icon { width: 36px; height: 36px; border-radius: 10px; }
.mock .stat-value { font-size: 1.05rem; }
.mock-float {
  position: absolute;
  right: -10px;
  bottom: -26px;
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: rotate(-2deg);
  font-size: 0.9rem;
}
.mock-wrap { position: relative; }

.section { max-width: 1180px; margin: 0 auto; padding: 3rem 1.5rem; }
.section-title { text-align: center; margin-bottom: 2.25rem; }
.section-title h2 { font-size: 2rem; font-weight: 800; }
.section-title p { color: var(--muted); margin-top: 0.6rem; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.feature { padding: 1.5rem; }
.feature .stat-icon { margin-bottom: 1rem; }
.feature h3 { margin-bottom: 0.4rem; }
.feature p { color: var(--muted); margin: 0; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; counter-reset: step; }
.step { position: relative; padding: 1.5rem; padding-top: 3.2rem; }
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: 1.2rem;
  left: 1.5rem;
  font-weight: 850;
  font-size: 1.4rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.step p { color: var(--muted); margin: 0.4rem 0 0; }

.cta {
  text-align: center;
  padding: 3rem 1.5rem;
  border-radius: 28px;
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.cta h2 { font-size: 2rem; font-weight: 800; }
.cta p { opacity: 0.9; margin: 0.75rem 0 1.75rem; }

.footer { text-align: center; color: var(--muted); padding: 2rem 1rem 3rem; font-size: 0.9rem; }

/* Страница ошибки */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.center-page .card { max-width: 440px; text-align: center; }
.center-page .emoji { font-size: 3rem; display: block; margin-bottom: 0.5rem; }

/* =========================================================
   Адаптивность: планшеты и телефоны
   ========================================================= */

@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-main { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  /* Меню переезжает наверх */
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    z-index: 10;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .sidebar .brand-text { display: none; }
  .nav { flex-direction: row; gap: 0.15rem; }
  .nav a { padding: 0.5rem 0.65rem; }
  .nav a span { display: none; }
  .sidebar-user { margin-top: 0; margin-left: auto; padding: 0.3rem; background: transparent; }
  .sidebar-user .who, .sidebar-user .avatar { display: none; }
  .main { padding: 1.25rem 1rem 2.5rem; }

  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 1.5rem; }
  .auth-side h2, .auth-points { display: none; }

  .landing-hero { grid-template-columns: 1fr; padding-top: 2rem; }
  .mock { transform: none; }
  .features, .steps { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  h1 { font-size: 1.45rem; }
  .hero-card { padding: 1.35rem; border-radius: 20px; }
  .hero-card h1 { font-size: 1.45rem; }
  .stats { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .stat { flex-direction: column; align-items: flex-start; gap: 0.5rem; padding: 0.9rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .card { padding: 1.1rem; }
  .landing-nav .btn-ghost { display: none; }
  .mock-float { display: none; }
}

/* =========================================================
   Налоги
   ========================================================= */

.year-switch { display: flex; align-items: center; gap: 0.5rem; }
.year-current { font-weight: 800; font-size: 1.1rem; padding: 0 0.4rem; }

.tax-hero h1 { font-size: 2.2rem; margin: 0.2rem 0; }

.note {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--blue-soft);
  color: var(--text);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.note .icon { color: var(--blue); }
.note.warn { background: var(--orange-soft); }
.note.warn .icon { color: var(--orange); }

.progress { height: 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 999px; background: var(--gradient); }
.progress.warn span { background: linear-gradient(90deg, #f97316, #ef4444); }

.table-wrap { overflow-x: auto; margin: 0 -0.25rem; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.8rem; padding: 0.5rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table tr.past td { color: var(--muted); }
.cap::first-letter { text-transform: uppercase; }
.hint-small { display: block; font-size: 0.75rem; color: var(--muted); }
.small { font-size: 0.85rem; margin-top: 0.75rem; }


.regime-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.regime { position: relative; cursor: pointer; font-weight: 400; }
.regime input { position: absolute; opacity: 0; }
.regime-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  height: 100%;
  padding: 1rem;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.regime-body span { color: var(--muted); font-size: 0.85rem; }
.regime input:checked + .regime-body { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-soft); }
.regime input:focus-visible + .regime-body { outline: 2px solid var(--primary); }

.tax-card { display: flex; align-items: center; gap: 0.9rem; }
.tax-card .grow { flex: 1; }

@media (max-width: 900px) {
  .regime-cards { grid-template-columns: 1fr; }
}

/* Переключатель «Самозанятый / ИП» */
.regime-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1.25rem; }
.card .regime-switch { margin-bottom: 0; }
.regime-switch button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-align: left;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.regime-switch button:hover { border-color: var(--primary); transform: translateY(-1px); }
.regime-switch button.on { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft), var(--shadow); }
.regime-switch .text { display: flex; flex-direction: column; flex: 1; }
.regime-switch .text b { font-size: 1.05rem; }
.regime-switch .text small { color: var(--muted); font-size: 0.82rem; }
.regime-switch .tick { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--gradient); color: #fff; }
.regime-switch .tick .icon { width: 16px; height: 16px; }
.regime-cards.two { grid-template-columns: 1fr 1fr; }

@media (max-width: 640px) {
  .regime-switch { grid-template-columns: 1fr; }
  .regime-cards.two { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   Оформление: кнопка темы, выбор темы и цвета
   ========================================================= */

/* Кнопка солнце/луна: в светлой теме показываем луну, в тёмной — солнце */
.theme-btn .when-dark { display: none; }
:root[data-theme="dark"] .theme-btn .when-light { display: none; }
:root[data-theme="dark"] .theme-btn .when-dark { display: inline; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .theme-btn .when-light { display: none; }
  :root[data-theme="auto"] .theme-btn .when-dark { display: inline; }
}
.theme-btn:hover { color: var(--primary) !important; }

.choice-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; max-width: 560px; }
.mode-card { position: relative; cursor: pointer; font-weight: 600; }
.mode-card input { position: absolute; opacity: 0; }
.mode-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  font-size: 0.88rem;
  text-align: center;
}
.mode-card input:checked + .mode-body { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.mode-card input:focus-visible + .mode-body { outline: 2px solid var(--primary); }

/* Маленькая «картинка» темы: фон, полоска меню и акцентная кнопка */
.mode-preview { display: block; position: relative; height: 54px; border-radius: 9px; overflow: hidden; border: 1px solid var(--border); }
.mode-preview i { position: absolute; display: block; border-radius: 4px; }
.mode-preview i:nth-child(1) { left: 0; top: 0; bottom: 0; width: 26%; }
.mode-preview i:nth-child(2) { left: 34%; top: 12px; width: 50%; height: 8px; }
.mode-preview i:nth-child(3) { left: 34%; top: 28px; width: 30%; height: 12px; background: var(--gradient); }
.mode-light { background: #f4f5fb; }
.mode-light i:nth-child(1) { background: #ffffff; }
.mode-light i:nth-child(2) { background: #e6e8f2; }
.mode-dark { background: #0f1020; }
.mode-dark i:nth-child(1) { background: #181a2e; }
.mode-dark i:nth-child(2) { background: #2a2d4a; }
.mode-auto { background: linear-gradient(90deg, #f4f5fb 50%, #0f1020 50%); }
.mode-auto i:nth-child(1) { background: #ffffff; }
.mode-auto i:nth-child(2) { background: linear-gradient(90deg, #e6e8f2 30%, #2a2d4a 30%); }

.swatches { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.swatch { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; cursor: pointer; width: 76px; font-weight: 500; }
.swatch input { position: absolute; opacity: 0; }
.swatch-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--border);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.swatch:hover .swatch-dot { transform: scale(1.06); }
.swatch input:checked + .swatch-dot { box-shadow: 0 0 0 3px var(--primary); transform: scale(1.06); }
.swatch input:focus-visible + .swatch-dot { outline: 2px solid var(--primary); outline-offset: 3px; }
.swatch-label { font-size: 0.8rem; color: var(--muted); }
.swatch input:checked ~ .swatch-label { color: var(--text); font-weight: 650; }
.sw-violet { background: linear-gradient(135deg, #6d4aff, #a855f7, #ec4899); }
.sw-blue { background: linear-gradient(135deg, #2563eb, #3b82f6, #06b6d4); }
.sw-green { background: linear-gradient(135deg, #059669, #10b981, #84cc16); }
.sw-orange { background: linear-gradient(135deg, #ea580c, #f97316, #f59e0b); }
.sw-pink { background: linear-gradient(135deg, #db2777, #ec4899, #f43f5e); }
.sw-graphite { background: linear-gradient(135deg, #334155, #475569, #64748b); }

@media (max-width: 640px) {
  .choice-row { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
  .swatch { width: 64px; }
}

/* =========================================================
   Доработки: доступность, анимации, новые элементы
   ========================================================= */

/* Ссылка «перейти к содержимому» — видна только при навигации с клавиатуры */
.skip-link { position: absolute; left: 1rem; top: -3rem; z-index: 100; padding: 0.5rem 1rem; border-radius: 10px; background: var(--primary); color: #fff; font-weight: 700; }
.skip-link:focus { top: 1rem; }

/* Заметная рамка фокуса для тех, кто пользуется клавиатурой */
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
.input:focus-visible { outline: none; }

/* Плавное появление содержимого страницы */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.main > *, .auth-card, .landing-hero > div { animation: rise 0.35s ease both; }
.main > *:nth-child(2) { animation-delay: 0.04s; }
.main > *:nth-child(3) { animation-delay: 0.08s; }
.main > *:nth-child(4) { animation-delay: 0.12s; }
.main > *:nth-child(n+5) { animation-delay: 0.16s; }
.card, .stat, .student-card { transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease; }
.stat:hover { transform: translateY(-2px); }

/* Кто попросил в системе «меньше анимации» — анимаций не будет */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.flash { transition: opacity 0.4s ease, transform 0.4s ease; }
.flash.is-hiding { opacity: 0; transform: translateY(-6px); }

/* Кнопка во время отправки формы: крутится индикатор, повторно не нажать */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 1.05em;
  height: 1.05em;
  border-radius: 50%;
  border: 2px solid #fff;
  border-color: #fff #fff transparent transparent;
  animation: spin 0.7s linear infinite;
}
.btn-ghost.is-loading::after, .btn-soft.is-loading::after, .btn-icon.is-loading::after, .btn-success.is-loading::after {
  border-color: var(--primary) var(--primary) transparent transparent;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-icon { padding: 0.35rem; background: transparent; color: var(--muted); border-color: transparent; }
.btn-icon:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-icon.danger:hover { color: var(--red); background: var(--red-soft); }
.btn-icon .icon { width: 17px; height: 17px; }
.lesson-actions { flex-wrap: wrap; align-items: center; }

/* Плашка «следующий урок через …» в приветствии */
.next-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.9rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 0.9rem;
  backdrop-filter: blur(6px);
}
.next-pill:hover { background: rgba(255, 255, 255, 0.28); text-decoration: none; }
.next-pill .icon { width: 17px; height: 17px; }

/* Чек-лист «первые шаги» */
.onboarding { margin-bottom: 1.5rem; }
.card-head h2, details.card > summary h2 { display: flex; align-items: center; gap: 0.5rem; }
.steps-list { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.steps-list li { display: flex; align-items: center; gap: 0.65rem; padding: 0.6rem 0.75rem; border-radius: 12px; background: var(--surface-2); font-weight: 600; }
.steps-list li.done { color: var(--muted); text-decoration: line-through; }
.step-dot { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 0.85rem; }
.steps-list li.done .step-dot { background: var(--green); color: #fff; }
.step-dot .icon { width: 15px; height: 15px; }

/* График дохода: столбики из обычных блоков, без библиотек */
.chart { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.75rem; align-items: end; height: 190px; padding-top: 0.5rem; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0.35rem; height: 100%; }
.bar-fill {
  width: 100%;
  max-width: 48px;
  border-radius: 10px 10px 4px 4px;
  background: color-mix(in srgb, var(--primary) 28%, var(--surface-2));
  transition: height 0.5s ease;
}
.bar.current .bar-fill { background: var(--gradient); box-shadow: 0 8px 18px var(--primary-shadow); }
.bar-value { font-size: 0.72rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.bar.current .bar-value { color: var(--text); }
.bar-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }

/* Поиск учеников */
.search { position: relative; display: block; margin-bottom: 1rem; max-width: 460px; }
.search > .icon { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 2.6rem; padding-right: 2.6rem; background: var(--surface); }
.search kbd {
  position: absolute; right: 0.7rem; top: 50%; transform: translateY(-50%);
  font: 600 0.75rem/1 var(--font); padding: 0.25rem 0.45rem; border-radius: 6px;
  border: 1px solid var(--border); color: var(--muted); background: var(--surface-2);
}
[hidden] { display: none !important; }

/* Раскрывающиеся блоки: «Изменить данные», «Архив», «Дополнительные настройки» */
details.card > summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "›"; font-size: 1.4rem; line-height: 1; color: var(--muted); transition: transform 0.2s ease; }
details.card[open] > summary::after { transform: rotate(90deg); }
details.card[open] > summary { margin-bottom: 1rem; }
.edit-box { margin-bottom: 1.25rem; }
.archive-box { margin-top: 1.5rem; }
.edit-form { display: grid; grid-template-columns: 2fr 2fr 1fr; gap: 1rem; align-items: end; }
.edit-form .alert, .edit-form > div:last-child { grid-column: 1 / -1; }

/* Отменённые уроки — бледные и зачёркнутые */
.row.is-cancelled { opacity: 0.6; }
.row.is-cancelled .name, .row.is-cancelled .time-pill { text-decoration: line-through; }
.badge-cancelled { background: var(--surface); color: var(--muted); border: 1px dashed var(--border); }

.scroll-list { max-height: 460px; overflow-y: auto; padding-right: 0.25rem; }

.password-field { position: relative; display: block; }
.password-field .input { padding-right: 2.8rem; }
.password-field .icon-btn { position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%); }
.password-field .icon-btn[aria-pressed="true"] { color: var(--primary); }

.invite-box { justify-content: space-between; user-select: auto; }
.invite-text { user-select: all; overflow-wrap: anywhere; }

.profile-head .grow { flex: 1; min-width: 200px; }
.note { align-items: center; flex-wrap: wrap; }
.icon-btn.logout-btn:hover { color: var(--red); }

/* ---------- Телефон: меню переезжает вниз экрана, как в приложениях ---------- */
@media (max-width: 900px) {
  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
  }
  .nav a { flex-direction: column; gap: 0.15rem; padding: 0.4rem 0.2rem; font-size: 0.7rem; border-radius: 10px; }
  .nav a span { display: block; }
  .nav a.active { background: transparent; }
  .nav a.active .icon { background: var(--primary-soft); border-radius: 999px; padding: 2px 12px; width: 44px; box-sizing: content-box; height: 20px; }
  .main { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  .steps-list { grid-template-columns: 1fr; }
  .edit-form { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .chart { gap: 0.4rem; height: 160px; }
  .bar-value { font-size: 0.62rem; }
  .row .lesson-actions { width: 100%; justify-content: flex-end; }
  .next-pill { font-size: 0.82rem; }
}

/* Защита от «расползания» на узких экранах: колонки сетки не шире экрана, ряды переносятся */
.app { grid-template-columns: 260px minmax(0, 1fr); }
.grid-main > *, .grid-2 > *, .stack > *, .stats > * { min-width: 0; }
.year-switch, .card-head { flex-wrap: wrap; }
@media (max-width: 900px) { .app { grid-template-columns: minmax(0, 1fr); } }

/* =========================================================
   Календарь (как в Google): день, неделя, месяц, год, список
   ========================================================= */

/* Цвета уроков — по ученику, как у аватарок */
.ev-0 { --ev: #6d4aff; }
.ev-1 { --ev: #0ea5e9; }
.ev-2 { --ev: #f97316; }
.ev-3 { --ev: #10b981; }
.ev-4 { --ev: #ec4899; }
.ev-5 { --ev: #6366f1; }

/* Панель сверху: «Сегодня», стрелки, название периода, выбор вида */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cal-nav { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.cal-title { font-size: 1.4rem; margin-left: 0.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-nav .btn-icon { border: 1px solid var(--border); background: var(--surface); width: 36px; height: 36px; justify-content: center; }
.cal-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

.view-switch { display: inline-flex; padding: 0.25rem; gap: 0.15rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.view-switch a { padding: 0.38rem 0.8rem; border-radius: 9px; color: var(--muted); font-weight: 650; font-size: 0.88rem; }
.view-switch a:hover { color: var(--text); text-decoration: none; }
.view-switch a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Неделя и день ---------- */
.cal-week { padding: 0; overflow: hidden; }
.cal-head, .cal-grid { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr)); }
.cal-head { border-bottom: 1px solid var(--border); background: var(--surface); position: relative; z-index: 2; }
.cal-dayhead { display: flex; flex-direction: column; align-items: center; gap: 0.1rem; padding: 0.55rem 0.25rem; color: var(--muted); border-left: 1px solid var(--border); }
.cal-dayhead span { font-size: 0.75rem; text-transform: uppercase; font-weight: 700; letter-spacing: 0.04em; }
.cal-dayhead b { font-size: 1.35rem; color: var(--text); width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; }
.cal-dayhead:hover { text-decoration: none; background: var(--surface-2); }
.cal-dayhead.today span { color: var(--primary); }
.cal-dayhead.today b { background: var(--gradient); color: #fff; }

.cal-scroll { max-height: min(68vh, 720px); overflow-y: auto; overscroll-behavior: contain; }
.cal-hours { display: flex; flex-direction: column; }
.cal-hours span {
  height: var(--hour);
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
  padding-right: 0.5rem;
  transform: translateY(-0.5em);
  font-variant-numeric: tabular-nums;
}
.cal-hours span:first-child { visibility: hidden; }
.cal-col { position: relative; border-left: 1px solid var(--border); }
.cal-col.today { background: color-mix(in srgb, var(--primary) 4%, transparent); }

/* Клетка одного часа — на неё можно нажать, чтобы добавить урок */
.cal-slot {
  display: block;
  width: 100%;
  height: var(--hour);
  border: none;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.cal-slot:hover { background: var(--primary-soft); }
.cal-slot:hover::after { content: "+"; color: var(--primary); font-weight: 700; font-size: 1.1rem; }

/* Урок в сетке */
.cal-event {
  position: absolute;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.3rem 0.45rem;
  margin: 1px 2px;
  border: none;
  border-left: 4px solid var(--ev);
  border-radius: 8px;
  background: color-mix(in srgb, var(--ev) 18%, var(--surface));
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
  max-width: calc(100% - 4px);
}
.cal-event:hover { background: color-mix(in srgb, var(--ev) 28%, var(--surface)); z-index: 3; }
.cal-event b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Статусы: прошёл — с галочкой, пропуск и отмена — бледные */
.st-done { background: color-mix(in srgb, var(--ev) 9%, var(--surface)); }
.st-done b::before { content: "✓ "; color: var(--green); }
.st-missed, .st-cancelled { opacity: 0.55; }
.st-cancelled b, .st-cancelled .n { text-decoration: line-through; }

/* Красная линия «сейчас» */
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 2; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -6px; top: -5px; width: 12px; height: 12px; border-radius: 50%; background: var(--red); }

/* ---------- Месяц ---------- */
.cal-month { padding: 0; overflow: hidden; }
.cal-month-head, .cal-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-month-head span { padding: 0.55rem; text-align: center; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); }
.cal-cell {
  min-height: 118px;
  padding: 0.35rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  cursor: pointer;
  min-width: 0;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.out { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.cal-cell.out .cal-daynum { color: var(--muted); opacity: 0.6; }
.cal-daynum {
  align-self: center;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
}
.cal-daynum:hover { background: var(--primary-soft); text-decoration: none; }
.cal-cell.today .cal-daynum { background: var(--gradient); color: #fff; }

.cal-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  padding: 0.15rem 0.35rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.76rem;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.cal-chip:hover { background: color-mix(in srgb, var(--ev) 16%, transparent); }
.cal-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ev); flex-shrink: 0; }
.cal-chip .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-chip .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip.st-done .n::before { content: "✓ "; color: var(--green); }
.cal-more { font-size: 0.75rem; font-weight: 700; color: var(--muted); padding-left: 0.35rem; }

/* ---------- Год ---------- */
.cal-year { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.mini { padding: 0.9rem; }
.mini-title { display: block; font-weight: 800; margin-bottom: 0.5rem; color: var(--text); }
.mini-title:hover { color: var(--primary); text-decoration: none; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.mini-wd { font-size: 0.65rem; color: var(--muted); font-weight: 700; padding-bottom: 0.2rem; }
.mini-day {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 0.75rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.mini-day:hover { background: var(--surface-2); text-decoration: none; }
.mini-day.heat-1 { background: color-mix(in srgb, var(--primary) 18%, transparent); }
.mini-day.heat-2 { background: color-mix(in srgb, var(--primary) 40%, transparent); }
.mini-day.heat-3 { background: var(--primary); color: #fff; }
.mini-day.today { box-shadow: 0 0 0 2px var(--primary); font-weight: 800; }
.cal-legend { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.cal-legend .mini-day { width: auto; aspect-ratio: auto; padding: 0.1rem 0.5rem; border-radius: 999px; }

.cal-hint { margin-top: 1rem; }
kbd { font: 600 0.75rem/1 var(--font); padding: 0.18rem 0.4rem; border-radius: 6px; border: 1px solid var(--border); border-bottom-width: 2px; background: var(--surface-2); color: var(--text); }

/* ---------- Всплывающие окна ---------- */
.dialog {
  width: min(440px, calc(100vw - 2rem));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.25rem 1.35rem 1.35rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.dialog::backdrop { background: rgba(15, 16, 32, 0.45); backdrop-filter: blur(3px); }
.dialog[open] { animation: pop 0.18s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.dialog-head h2 { display: flex; align-items: center; gap: 0.5rem; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 1rem; }
.move-form { display: grid; grid-template-columns: 1fr auto; gap: 0.6rem; align-items: end; margin-bottom: 0.9rem; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }

/* ---------- Телефон ---------- */
@media (max-width: 900px) {
  .cal-year { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .cal-title { font-size: 1.1rem; margin-left: 0.25rem; }
  .cal-actions { width: 100%; justify-content: space-between; }
  .view-switch a { padding: 0.35rem 0.5rem; font-size: 0.8rem; }
  /* Неделя на телефоне листается вбок, чтобы столбцы не стали слишком узкими */
  .cal-week[style*="--cols: 7"] .cal-head,
  .cal-week[style*="--cols: 7"] .cal-grid { min-width: 620px; }
  .cal-week[style*="--cols: 7"] { overflow-x: auto; }
  /* В месяце вместо названий — цветные точки, как в календаре на телефоне */
  .cal-cell { min-height: 64px; padding: 0.2rem; gap: 0.1rem; }
  .cal-chip { padding: 0; justify-content: center; }
  .cal-chip .t, .cal-chip .n { display: none; }
  .cal-cell { flex-direction: column; align-items: center; }
  .cal-more { padding: 0; font-size: 0.65rem; }
  .cal-year { grid-template-columns: minmax(0, 1fr); }
  .move-form { grid-template-columns: 1fr; }
  .cal-hint { display: none; }
}

/* =========================================================
   Календарь в стиле Google: панель слева, сплошные цветные уроки,
   перетаскивание, выпадающий выбор вида
   ========================================================= */

.gcal { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.gcal-side { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 1.25rem; }

/* Большая кнопка «Создать» с тенью, как в Google */
.gcal-create {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  align-self: flex-start;
  padding: 0.85rem 1.4rem 0.85rem 1rem;
  border: none;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.15s ease, background 0.15s ease;
}
.gcal-create:hover { box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.1); background: var(--surface-2); }
.gcal-plus { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--gradient); color: #fff; }
.gcal-plus .icon { width: 18px; height: 18px; }

/* Мини-календарь */
.mini-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.35rem; padding-left: 0.4rem; }
.mini-cal-head b { font-size: 0.92rem; }
.mini-cal-head .btn-icon { width: 28px; height: 28px; }
.mini-cal-head .btn-icon .icon { width: 15px; height: 15px; }
.mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; row-gap: 2px; }
.mini-cal-grid .mini-wd { font-size: 0.68rem; color: var(--muted); font-weight: 700; padding: 0.2rem 0; }
.mini-cal-day {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}
.mini-cal-day:hover { background: var(--surface-2); text-decoration: none; }
.mini-cal-day.out { color: var(--muted); opacity: 0.6; }
.mini-cal-day.in-range { background: var(--primary-soft); border-radius: 0; width: 100%; }
.mini-cal-day.picked { background: var(--primary-soft); color: var(--primary); font-weight: 800; border-radius: 50%; width: 28px; }
.mini-cal-day.today { background: var(--primary); color: #fff; border-radius: 50%; width: 28px; }

/* Ученики-«календари» с цветными галочками */
.gcal-people { display: flex; flex-direction: column; gap: 0.1rem; }
.gcal-people > b { font-size: 0.92rem; padding: 0 0.4rem 0.35rem; }
.gcal-person { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0.4rem; border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 0.88rem; }
.gcal-person:hover { background: var(--surface-2); }
.gcal-person input { position: absolute; opacity: 0; pointer-events: none; }
.gcal-check { position: relative; width: 18px; height: 18px; flex-shrink: 0; border-radius: 4px; border: 2px solid var(--ev); background: var(--ev); }
.gcal-check::after { content: ""; position: absolute; left: 4px; top: 0px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.gcal-person input:not(:checked) + .gcal-check { background: transparent; }
.gcal-person input:not(:checked) + .gcal-check::after { display: none; }
.gcal-person input:focus-visible + .gcal-check { outline: 2px solid var(--primary); outline-offset: 2px; }
.gcal-person-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.is-filtered { display: none !important; }

/* Выбор вида — выпадающее меню */
.view-menu { position: relative; }
.view-menu > summary { list-style: none; cursor: pointer; }
.view-menu > summary::-webkit-details-marker { display: none; }
.view-menu .caret { font-size: 0.75rem; color: var(--muted); }
.view-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 180px;
  padding: 0.35rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.view-menu-list a { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.7rem; border-radius: 8px; color: var(--text); font-weight: 550; }
.view-menu-list a:hover { background: var(--surface-2); text-decoration: none; }
.view-menu-list a.on { background: var(--primary-soft); color: var(--primary); }
.mobile-create { display: none; }

/* Уроки как в Google: сплошной цвет и белый текст */
.cal-event {
  background: var(--ev);
  color: #fff;
  border-left: none;
  border-radius: 6px;
  box-shadow: none;
  padding: 0.25rem 0.45rem;
}
.cal-event:hover { background: color-mix(in srgb, var(--ev) 85%, black); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); }
.cal-event span { color: rgba(255, 255, 255, 0.88); }
.cal-event.st-done { background: var(--ev); }
.cal-event.st-done b::before { color: #fff; }
.cal-event.st-missed, .cal-event.st-cancelled {
  opacity: 1;
  background: color-mix(in srgb, var(--ev) 22%, var(--surface));
  color: var(--text);
}
.cal-event.st-missed span, .cal-event.st-cancelled span { color: var(--muted); }

/* Сетка — тоньше и спокойнее, как у Google */
.cal-slot { border-bottom-color: color-mix(in srgb, var(--border) 55%, transparent); }
.cal-dayhead.today b { background: var(--primary); }
.cal-cell.today .cal-daynum { background: var(--primary); }

/* Перетаскивание */
[draggable="true"] { cursor: grab; }
.is-dragging { opacity: 0.4; }
.drop-target { background: var(--primary-soft) !important; }
.drop-ghost {
  position: absolute;
  left: 2px;
  right: 2px;
  z-index: 4;
  border-radius: 6px;
  border: 2px dashed var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  pointer-events: none;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  padding: 0.15rem 0.4rem;
}

@media (max-width: 1100px) {
  .gcal { grid-template-columns: minmax(0, 1fr); }
  .gcal-side { display: none; }
  .mobile-create { display: inline-flex; }
}

/* =========================================================
   Спокойное «продуктовое» оформление (поверх стилей выше)

   Идея: меньше эффектов — больше аккуратности.
   - один сплошной цвет акцента вместо радужных градиентов;
   - тёплый «бумажный» фон и тонкие рамки вместо цветных теней;
   - заголовки крупным шрифтом с засечками, как в журнале;
   - скругления поменьше, без наклонов и размытых пятен.
   ========================================================= */

:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f2f1ed;
  --text: #1c1b18;
  --muted: #6f6c64;
  --border: #e4e2dc;

  /* Акцент по умолчанию — глубокий синий; все три «цвета градиента» одинаковые,
     поэтому старые градиенты превращаются в ровную заливку */
  --g1: #2f4bd8; --g2: var(--g1); --g3: var(--g1);
  --gradient: var(--g1);
  --primary-soft: color-mix(in srgb, var(--primary) 9%, var(--surface));
  --primary-shadow: transparent;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 27, 24, 0.05);
  --shadow-lg: 0 1px 2px rgba(28, 27, 24, 0.05);

  --font-display: "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
}

:root[data-accent="violet"]   { --g1: #2f4bd8; }
:root[data-accent="blue"]     { --g1: #0e6ba8; }
:root[data-accent="green"]    { --g1: #1f7a53; }
:root[data-accent="orange"]   { --g1: #c2410c; }
:root[data-accent="pink"]     { --g1: #b4235a; }
:root[data-accent="graphite"] { --g1: #2b2a27; }
:root[data-accent] { --g2: var(--g1); --g3: var(--g1); }

/* Тёмная тема: тёплый графит вместо фиолетовой ночи */
:root[data-theme="dark"] {
  --bg: #151413; --surface: #1d1c1a; --surface-2: #262522;
  --text: #ecebe6; --muted: #a29f96; --border: #33312d;
  --shadow: none; --shadow-lg: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151413; --surface: #1d1c1a; --surface-2: #262522;
    --text: #ecebe6; --muted: #a29f96; --border: #33312d;
    --shadow: none; --shadow-lg: none;
  }
}

/* Заголовки */
h1, .section-title h2, .cta h2, .auth-side h2 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
}
.landing-hero h1 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.08; }
.gradient-text { background: none; color: var(--primary); font-style: italic; }

/* Кнопки — ровные, без свечения */
.btn { border-radius: 8px; font-weight: 550; transition: background 0.12s ease, border-color 0.12s ease; }
.btn-sm { border-radius: 7px; }
.btn-lg { border-radius: 9px; }
.btn-primary { background: var(--primary); box-shadow: none; }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 86%, black); box-shadow: none; }
.btn-ghost:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--border)); }
.btn-white { color: var(--text); }

/* Карточки и плитки */
.card { box-shadow: none; }
.stat-icon { border-radius: 8px; }
.brand-mark { border-radius: 8px; background: var(--text); color: var(--bg); box-shadow: none; width: 32px; height: 32px; }
.brand { font-weight: 700; letter-spacing: -0.01em; }
.nav a { border-radius: 8px; font-weight: 550; }
.nav a.active { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--primary); }
.sidebar-user { border-radius: 10px; }
.chip, .eyebrow { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.eyebrow { font-weight: 550; border-radius: 6px; }

/* Аватары — спокойные приглушённые цвета вместо ярких градиентов */
.av-0 { background: #4b5bb5; } .av-1 { background: #2f7f86; } .av-2 { background: #b0603a; }
.av-3 { background: #5b7a3a; } .av-4 { background: #9a4a6c; } .av-5 { background: #59606e; }
.avatar.lg { border-radius: 14px; }

/* Приветствие на главной — светлая карточка с полоской акцента, а не цветной баннер */
.hero-card {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: none;
}
.hero-card::before, .hero-card::after { display: none; }
.hero-card p { color: var(--muted); opacity: 1; }
.hero-card .btn-white { background: var(--primary); color: #fff; }

/* Вход и регистрация — тёмная «обложка» слева */
.auth-side { background: #1c1b18; }
.auth-side::before, .auth-side::after { display: none; }
.auth-side .brand-mark { background: #f7f6f3; color: #1c1b18; }
.auth-points .dot { background: rgba(255, 255, 255, 0.08); border-radius: 8px; }

/* Лендинг: без пятен и наклонов */
.blob { display: none; }
.mock { transform: none; border-radius: 14px; box-shadow: 0 24px 60px -30px rgba(28, 27, 24, 0.35); }
.mock-float { transform: none; border-radius: 10px; }
.step::before { background: none; color: var(--muted); font-family: var(--font-display); font-weight: 600; }
.cta { background: #1c1b18; color: #f7f6f3; border-radius: 16px; box-shadow: none; }
.cta .btn-white { background: #f7f6f3; color: #1c1b18; }
.feature, .step { border-radius: var(--radius); }

/* Прогресс, переключатели, образцы цветов */
.progress span { background: var(--primary); }
.regime-switch .tick { background: var(--primary); }
.sw-violet { background: #2f4bd8; } .sw-blue { background: #0e6ba8; } .sw-green { background: #1f7a53; }
.sw-orange { background: #c2410c; } .sw-pink { background: #b4235a; } .sw-graphite { background: #2b2a27; }
.mode-auto { background: linear-gradient(90deg, #f7f6f3 50%, #151413 50%); }

/* Пустые состояния без эмодзи — просто аккуратный текст */
.empty .emoji, .center-page .emoji { display: none; }
.empty { color: var(--muted); }

/* ---------- Абонементы ---------- */
.badge-warn { background: var(--orange-soft); color: var(--orange); }
.packages-card { margin-bottom: 1.25rem; }
.package-row .progress { height: 6px; margin-top: 0.5rem; max-width: 360px; }
.package-row.is-finished { opacity: 0.6; }
.package-form { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: 0.9rem; }
.package-form summary { cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 0.4rem; color: var(--primary); list-style: none; }
.package-form summary::-webkit-details-marker { display: none; }
.package-form[open] summary { margin-bottom: 0.5rem; }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem; }
.badge-package { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* ---------- Деньги ученика: начислено / оплачено / долг / предоплата ---------- */
.money-card { margin-bottom: 1.25rem; }
.money-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: 0; }
.money-grid div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .75rem .9rem; }
.money-grid dt { color: var(--muted); font-size: .85rem; }
.money-grid dd { margin: .25rem 0 0; font-size: 1.15rem; font-weight: 750; }
@media (max-width: 640px) { .money-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.check-line { display: flex; align-items: center; gap: .5rem; font-size: .92rem; margin: .5rem 0; }
.check-line[hidden] { display: none; }
.move-form .check-line { grid-column: 1 / -1; margin: 0; }

/* ---------- Домашние задания ---------- */
.homework-card { margin-bottom: 1.25rem; }
.hw-row { align-items: flex-start; flex-wrap: wrap; }
.hw-row.is-checked { opacity: 0.75; }
.hw-row .sub a { color: inherit; text-decoration: underline; text-decoration-color: var(--border); }
.hw-details { margin: 0.35rem 0 0; font-size: 0.88rem; white-space: pre-line; }
.hw-comment { margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--muted); display: flex; gap: 0.35rem; align-items: center; }
.hw-comment .icon { width: 14px; height: 14px; flex: none; }
.hw-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.hw-check summary { list-style: none; cursor: pointer; }
.hw-check summary::-webkit-details-marker { display: none; }
/* Открытая форма проверки занимает всю ширину строки под кнопками */
.hw-actions:has(.hw-check[open]) { width: 100%; }
.hw-check[open] { flex-basis: 100%; order: 10; display: flex; flex-direction: column; align-items: flex-end; gap: 0.6rem; }
.hw-check-form { width: 100%; display: grid; grid-template-columns: minmax(8rem, 10rem) minmax(0, 1fr) auto; align-items: end; gap: 0.6rem; }
@media (max-width: 640px) { .hw-check-form { grid-template-columns: 1fr; } }
textarea.input { resize: vertical; min-height: 2.6rem; font: inherit; }

/* ---------- Горизонтальные полоски (расходы по категориям, дни недели, предметы) ---------- */
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 9rem) minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.hbar-label { color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-value { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-track { display: block; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.hbar-track.thin { height: 6px; margin-top: 0.4rem; max-width: 260px; }
.hbar-fill { display: block; height: 100%; border-radius: 999px; background: var(--primary); transition: width 0.5s ease; }
.hbar-fill.tone-fill-orange { background: var(--orange); }

/* ---------- Аналитика: 12 месяцев, по два столбика (доход и расходы) ---------- */
.chart-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0.4rem; height: 210px; }
.bar-pair { flex: 1 1 0; min-height: 0; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.bar-pair .bar-fill { max-width: 18px; border-radius: 6px 6px 2px 2px; }
.bar-pair .bar-fill.expense { background: var(--orange); opacity: 0.75; box-shadow: none; }
.legend { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; }
.dot-income { background: var(--primary); }
.dot-expense { background: var(--orange); }
.dot-muted { background: var(--border); }
.dot + .dot, .legend .dot:not(:first-child) { margin-left: 0.5rem; }

.split-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin-bottom: 1rem; }
.split-bar span { display: block; height: 100%; }
.split-bar .part-done { background: var(--primary); }
.split-bar .part-missed { background: var(--orange); }
.split-bar .part-cancelled { background: var(--border); }
.lesson-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lesson-grid dt { display: flex; align-items: center; gap: 0.35rem; }

@media (max-width: 640px) {
  .chart-12 { gap: 0.15rem; height: 170px; }
  .chart-12 .bar-value { display: none; }
  .chart-12 .bar-label { font-size: 0.65rem; }
  .bar-pair { gap: 1px; }
  .hbars li { grid-template-columns: minmax(70px, 6.5rem) minmax(0, 1fr) auto; gap: 0.5rem; }
  .lesson-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Телефон: пунктов меню стало 8 — нижняя панель листается вбок ---------- */
@media (max-width: 900px) {
  .nav {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(68px, 1fr);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
}
.chart-12 .bar-fill:not(.expense) { background: var(--primary); opacity: 0.55; }
.chart-12 .bar.current .bar-fill:not(.expense) { opacity: 1; }
.dot { flex: none; }

/* ---------- Главная: карточки-ссылки с пояснением и быстрые действия ---------- */
a.stat { color: inherit; text-decoration: none; }
a.stat:hover { text-decoration: none; border-color: var(--primary); }
.stat .stat-label { margin-bottom: 0.15rem; }
.stat-sub { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 0.15rem; }
.next-card .row { text-decoration: none; }
.next-card .row:hover { text-decoration: none; }
.quick-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.5rem; padding: 0.9rem 1rem; border: 1px dashed var(--border); border-radius: 14px; }
.quick-actions > span { font-weight: 650; margin-right: 0.25rem; }
.narrow-card { max-width: 520px; }
@media (max-width: 640px) {
  .quick-actions { flex-direction: column; align-items: stretch; }
  .quick-actions .btn { justify-content: center; }
}

/* ---------- Домашка в Telegram ---------- */
.hw-telegram { display: flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }
.hw-telegram:empty { display: none; }
.hw-telegram .icon { width: 13px; height: 13px; flex: none; }
.tg-note { margin-bottom: 1rem; }
.tg-invite { margin-bottom: 1rem; }

/* ---------- Файлы домашки ---------- */
.hw-files { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.45rem; }
.hw-files-label { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.hw-files-label .icon { width: 13px; height: 13px; }
.hw-thumb img { display: block; width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.hw-thumb:hover img { border-color: var(--primary); }
.hw-file { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.82rem; padding: 0.2rem 0.55rem; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-file .icon { width: 13px; height: 13px; flex: none; }
input[type="file"].input { padding: 0.45rem; font-size: 0.85rem; }
