/* Мини-приложение «Сетевого города».
   Повторяет официальное приложение: синяя шапка с датой и стрелками,
   карточки уроков, цветные полосы у заданий, оценки в рамках, пять вкладок
   внизу и экраны поверх вкладок со стрелкой «назад». */

/* ─────────────────────────── Палитра ─────────────────────────── */

:root {
  --head: #4a6fae;
  --head-2: #3b5d99;
  --bar: #5b80bf;
  --bg: #eef1f6;
  --card: #fff;
  --card-2: #f4f6fa;
  --text: #1d2430;
  --text2: #6b7585;
  --border: #dde2ea;
  --primary: #3b6fc4;
  --green: #7cc36a;
  --yellow: #f2c94c;
  --red: #e5484d;
  --mark-bg: #f6f8fb;

  /* В полноэкранном Telegram сверху его кнопки «закрыть» и «…»:
     их высоту даёт appearance.js в --tg-top. */
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-bottom, 0px));
  --topbar-h: calc(52px + var(--safe-top));
  --header-h: calc(var(--topbar-h) + 64px);
  --nav-h: calc(58px + var(--safe-bottom));
  --ease: cubic-bezier(.2, .8, .3, 1);
  --radius: 12px;
}

[data-theme="dark"] {
  --head: #3f63a3;
  --head-2: #2f4d85;
  --bar: #4668a6;
  --bg: #141a22;
  --card: #1e2633;
  --card-2: #252f3e;
  --text: #e3e8ef;
  --text2: #8e99aa;
  --border: #2d3748;
  --primary: #6f9be0;
  --mark-bg: #151b25;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --head: #3f63a3;
    --head-2: #2f4d85;
    --bar: #4668a6;
    --bg: #141a22;
    --card: #1e2633;
    --card-2: #252f3e;
    --text: #e3e8ef;
    --text2: #8e99aa;
    --border: #2d3748;
    --primary: #6f9be0;
    --mark-bg: #151b25;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { background: var(--bg); }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-top: var(--header-h);
  padding-bottom: calc(var(--nav-h) + 12px);
  overscroll-behavior-y: contain;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: inherit; }

/* hidden всегда побеждает display у любого компонента. */
[hidden] { display: none !important; }

/* ──────────────────────────── Шапка ──────────────────────────── */

/* Шапка и полоса вкладки — одно целое, закреплённое сверху. */
.app-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  background: var(--head);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
  transition: background-color .3s;
}
.topbar {
  height: var(--topbar-h);
  padding: var(--safe-top) 6px 0;
  display: flex;
  align-items: center;
}
.subbar { animation: fade .2s ease; }
.topbar-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-btn { width: 44px; height: 44px; color: #fff; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: background .15s, transform .15s; }
.topbar-btn:active { background: rgba(255, 255, 255, .18); transform: scale(.92); }
.icon { display: block; flex: none; }

.date-bar {
  display: flex;
  align-items: center;
  background: linear-gradient(180deg, var(--bar), var(--head-2));
  color: #fff;
  padding: 8px 4px;
}
.date-arrow { width: 44px; height: 44px; color: #fff; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: background .15s, transform .15s; }
.date-arrow:active { background: rgba(255, 255, 255, .18); transform: scale(.9); }
.date-title { transition: transform .15s; }
.date-title:active { transform: scale(.96); }
.date-title { flex: 1; display: flex; flex-direction: column; align-items: center; color: #fff; }
.date-label { font-size: 17px; font-weight: 600; }
.date-sub { font-size: 12px; opacity: .8; }

.filter-bar {
  background: linear-gradient(180deg, var(--bar), var(--head-2));
  padding: 10px 12px;
  color: #fff;
}
.segment-title { font-weight: 600; text-align: center; margin-bottom: 8px; }
.filter-bar .segment-title:last-child { margin-bottom: 0; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(0, 0, 0, .18);
  color: rgba(255, 255, 255, .7);
}
.search input { flex: 1; padding: 9px 0; border: 0; background: none; color: #fff; font: inherit; outline: none; }
.search input::placeholder { color: rgba(255, 255, 255, .6); }

.pull-indicator {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  z-index: 15;
  text-align: center;
  font-size: 12px;
  color: var(--text2);
  padding: 6px;
  transform: translateY(-100%);
  opacity: 0;
  transition: .15s;
}
.pull-indicator.show { transform: none; opacity: 1; }

/* Баннер — всплывающее уведомление над всем, в том числе над экранами. */
.banner {
  position: fixed;
  left: 12px; right: 12px;
  top: calc(var(--header-h) + 8px);
  z-index: 70;
  padding: 11px 14px;
  border-radius: var(--radius);
  background: #e8f5e9;
  color: #1b5e20;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
  animation: drop .3s var(--ease);
}
@keyframes drop { from { transform: translateY(-20px); opacity: 0; } }
.banner.error { background: #ffebee; color: #b71c1c; }

/* ─────────────────────────── Вкладки ─────────────────────────── */

.panel { display: none; padding: 12px 12px 20px; }
.panel.active { display: block; animation: panel-in .25s var(--ease); }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } }

/* Карточки въезжают лесенкой — список «собирается», а не появляется разом. */
.list > *, .screen-body > *, .totals-table > .tt-row { animation: rise-in .35s var(--ease) both; }
.list > :nth-child(2), .screen-body > :nth-child(2), .totals-table > :nth-child(2) { animation-delay: .03s; }
.list > :nth-child(3), .screen-body > :nth-child(3), .totals-table > :nth-child(3) { animation-delay: .06s; }
.list > :nth-child(4), .screen-body > :nth-child(4), .totals-table > :nth-child(4) { animation-delay: .09s; }
.list > :nth-child(5), .screen-body > :nth-child(5), .totals-table > :nth-child(5) { animation-delay: .12s; }
.list > :nth-child(6), .screen-body > :nth-child(6), .totals-table > :nth-child(6) { animation-delay: .15s; }
.list > :nth-child(7), .totals-table > :nth-child(7) { animation-delay: .18s; }
.list > :nth-child(n+8), .totals-table > :nth-child(n+8) { animation-delay: .21s; }
@keyframes rise-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* Отклик на касание: всё нажимаемое чуть «проседает». */
.lesson-card, .hw-card, .mail-card, .ann-card, .task-block, .tile, .tt-cell, .chip,
.btn, .sched-toggle, .drawer-link, .recipient, .nav-item, .swatch, .cal-day {
  transition: transform .15s var(--ease), filter .15s, background-color .2s;
}
.lesson-card:active, .hw-card:active, .mail-card:active, .ann-card:active,
.task-block:active, .recipient:active { transform: scale(.97); }
.tile:active, .tt-cell:active, .chip:active, .btn:active, .swatch:active, .cal-day:active { transform: scale(.92); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

.list.slide-left { animation: slide-left .22s ease; }
.list.slide-right { animation: slide-right .22s ease; }
@keyframes slide-left { from { transform: translateX(30%); opacity: 0; } }
@keyframes slide-right { from { transform: translateX(-30%); opacity: 0; } }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.card-title { font-weight: 600; margin-bottom: 10px; }
.muted { color: var(--text2); }
.small { font-size: 12px; }
.empty { text-align: center; color: var(--text2); padding: 24px 12px; }
.empty.big { padding: 48px 12px; font-size: 16px; }
.link { color: var(--primary); text-decoration: underline; }

.btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  border-radius: 10px;
  background: var(--head);
  color: #fff;
  font-weight: 600;
  text-align: center;
}
.btn.outline { background: transparent; border: 1.5px solid var(--head); color: var(--primary); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  font-size: 13px;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.skeleton {
  height: 14px;
  margin: 10px 0;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--card-2), var(--border), var(--card-2));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ───────────────────────── Карточка урока ───────────────────────── */

.lesson-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
}
.lesson-card:active { filter: brightness(1.08); }
.lc-marks .mark-box { animation: pop .4s var(--ease) both; animation-delay: .15s; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.12); } }
.lc-top { display: flex; align-items: flex-start; gap: 8px; }
.lc-num { color: var(--text); font-size: 17px; }
.lc-subject { flex: 1; font-size: 17px; color: var(--text); }
.lc-marks { display: flex; gap: 6px; }
.lc-meta { display: flex; flex-direction: column; gap: 3px; margin: 6px 0 0 25px; color: var(--text2); font-size: 13px; }
.lesson-progress-label { margin-top: 9px; font-size: 12px; color: var(--primary); }
.lesson-progress { height: 4px; margin-top: 5px; background: var(--border); border-radius: 4px; overflow: hidden; }
.lesson-progress span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.lc-badges { display: flex; gap: 6px; margin-top: 8px; }
.lc-bottom {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text2);
}

.hw-badge {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 6px;
  border: 1.5px solid var(--text2);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}
.hw-badge.clip { padding: 1px 4px; vertical-align: middle; }
.hw-badge .icon { display: inline-block; vertical-align: -3px; }

.mark-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 30px;
  padding: 0 6px;
  border: 1.5px solid var(--text2);
  border-radius: 7px;
  background: var(--mark-bg);
  font-size: 18px;
  font-weight: 600;
}
.mark-box.big { min-width: 44px; height: 44px; font-size: 22px; }

/* ───────────────────────── Экраны поверх ───────────────────────── */

.screen {
  position: fixed;
  inset: 0 0 var(--nav-h) 0;
  z-index: 30;
  background: var(--bg);
  overflow-y: auto;
  animation: screen-in .2s ease;
}
@keyframes screen-in { from { transform: translateX(30%); opacity: 0; } }
.screen { box-shadow: -8px 0 24px rgba(0, 0, 0, .25); animation-timing-function: var(--ease); }
.screen-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  min-height: var(--topbar-h);
  padding: var(--safe-top) 6px 6px;
  background: var(--head);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
}
.screen-back { width: 44px; height: 44px; color: #fff; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.screen-back:active { background: rgba(255, 255, 255, .18); }
.screen-titles { flex: 1; text-align: center; margin-right: 44px; padding-top: 6px; }
.screen-title { font-size: 17px; font-weight: 600; }
.screen-subtitle { font-size: 12px; opacity: .8; }
.screen-body { padding: 12px; }

.lesson-head .lesson-title { display: flex; gap: 8px; font-size: 18px; }

.info-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -12px 10px;
  padding: 0 12px;
  scrollbar-width: none;
}
.info-strip::-webkit-scrollbar { display: none; }
.info-card {
  flex: none;
  max-width: 80%;
  background: var(--card);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.info-label { font-size: 12px; color: var(--text2); }
.info-value { font-weight: 600; font-size: 14px; }

.task-block {
  display: block;
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  border-left: 5px solid var(--yellow);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.task-block.task-mark { border-left-color: var(--green); }
.task-head { display: flex; align-items: center; gap: 8px; }
.task-kind { flex: 1; color: var(--text2); font-weight: 600; }
.task-go { display: block; margin-top: 8px; color: var(--primary); font-size: 13px; font-weight: 600; }

.detail h2 { font-size: 24px; margin-bottom: 8px; }
.detail-label { font-size: 13px; color: var(--text2); margin-top: 10px; }
.detail-row { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 13px; }
.detail-text { font-size: 16px; margin: 4px 0 8px; white-space: pre-wrap; word-break: break-word; }
.grade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 10px 12px;
  border: 1.5px solid var(--green);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--green) 18%, var(--card));
}
.grade-row.absence { border-color: var(--text2); background: var(--card); }

.attach {
  display: block;
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--card-2);
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
}

/* ─────────────────────────── Расписание ─────────────────────────── */

.sched-card.current { outline: 2px solid var(--primary); background: color-mix(in srgb, var(--primary) 18%, var(--card)); }
.sched-top { display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.sched-day { font-size: 18px; }
.sched-range { color: var(--text2); }
.sched-toggle { display: block; margin-top: 8px; color: var(--primary); font-size: 14px; }
.sched-list { margin-top: 6px; }
.sched-lesson { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 16px; }

/* ───────────────────────────── Д/З ───────────────────────────── */

.hw-card { cursor: pointer; }
.hw-subject { font-size: 18px; color: var(--text); margin-bottom: 6px; }
.hw-observed { margin-top: 8px; color: var(--text2); font-size: 12px; }
.hw-text { font-size: 15px; margin-bottom: 10px; word-break: break-word; }
.hw-foot { display: flex; justify-content: space-between; align-items: center; }

/* ───────────────────────────── Итоги ───────────────────────────── */

.totals-table { margin: 0 -12px; }
.tt-row {
  display: flex;
  align-items: center;
  min-height: 52px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.tt-head { background: var(--card-2); font-size: 12px; font-weight: 600; min-height: 44px; position: sticky; top: var(--header-h); z-index: 5; }
.tt-subject { flex: 1; min-width: 0; padding: 6px 10px; font-size: 14px; }
.tt-cell { width: 52px; flex: none; text-align: center; font-size: 14px; padding: 14px 0; }
.tt-cell.now { color: var(--primary); }
.tt-cell.official { font-weight: 700; }
.class-avg { margin: -6px 0 8px; text-align: right; }
.year-pill { margin-left: 6px; padding: 2px 6px; border-radius: 5px; background: var(--primary); color: #fff; font-size: 11px; }

.subject-title { font-size: 22px; margin-bottom: 10px; }
.progress { display: flex; gap: 3px; margin-bottom: 6px; }
.seg { flex: 1; height: 8px; border-radius: 2px; background: var(--border); }
.seg.done { background: var(--green); animation: seg-in .4s var(--ease) both; }
.seg.done:nth-child(n) { animation-delay: calc(var(--i, 0) * 20ms); }
@keyframes seg-in { from { transform: scaleY(.2); opacity: 0; } }
.progress-caption { display: flex; justify-content: space-between; font-size: 12px; color: var(--text2); }
.avg-line { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 10px; }
.avg-line strong { font-size: 26px; }
.dist { display: flex; height: 36px; border-radius: 4px; overflow: hidden; margin-bottom: 8px; animation: grow .6s var(--ease) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.dist-part { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; }
.dist-part.d5 { background: var(--head-2); }
.dist-part.d4 { background: var(--bar); }
.dist-part.d3 { background: #d8a33a; }
.dist-part.d2 { background: var(--red); }
.empty-dist { align-items: center; justify-content: center; color: var(--text2); background: var(--card-2); font-size: 13px; }
.tiles { display: flex; flex-wrap: wrap; gap: 12px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--text2); }
.tile .mark-box { border-color: var(--green); background: color-mix(in srgb, var(--green) 25%, var(--card)); }
.tile.absence .mark-box { border-color: var(--border); background: color-mix(in srgb, var(--green) 45%, #fff); color: var(--text2); }

/* ──────────────────────────── Почта ──────────────────────────── */

.mail-card { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.avatar {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 18px;
}
.mail-main { flex: 1; min-width: 0; }
.mail-author, .mail-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-author { font-weight: 600; font-size: 16px; }
.mail-subject { font-size: 14px; }
.mail-date { flex: none; align-self: flex-start; font-size: 12px; color: var(--text2); }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 6px; vertical-align: middle; }

.ann-card { cursor: pointer; }
.ann-title { font-weight: 600; font-size: 16px; margin-bottom: 6px; }
.ann-text { font-size: 14px; color: var(--text2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ann-card.open .ann-text { display: block; -webkit-line-clamp: unset; }
.ann-foot { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text2); }

/* ──────────────────────── Нижняя навигация ──────────────────────── */

.bottom-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  height: var(--nav-h);
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, .15);
  transition: background-color .3s;
  display: flex;
  background: var(--head-2);
}
.nav-item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  color: rgba(255, 255, 255, .75);
  text-align: center;
}
.nav-item .ico { display: flex; }
.nav-item.active { color: #fff; }
.nav-item.active .ico { animation: bounce .45s var(--ease); }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 6px;
  width: 44px; height: 30px;
  border-radius: 15px;
  background: rgba(255, 255, 255, .16);
  animation: fade .25s ease;
}
@keyframes bounce { 40% { transform: translateY(-4px) scale(1.12); } }

/* ──────────────────────────── Меню ☰ ──────────────────────────── */

.drawer { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.drawer-shade { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity .2s; }
.drawer-panel {
  position: absolute;
  inset: 0 auto 0 0;
  width: min(86vw, 340px);
  padding: calc(16px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
  background: var(--card);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .22s ease;
}
.drawer.open { pointer-events: auto; }
.drawer.open .drawer-shade { opacity: 1; }
.drawer.open .drawer-panel { transform: none; }
.drawer-section { padding: 12px 0; border-bottom: 1px solid var(--border); }
.drawer-heading { font-weight: 700; font-size: 17px; margin-bottom: 8px; }
.drawer-name { font-size: 15px; }
.drawer-children { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.drawer-link { display: flex; align-items: center; gap: 8px; color: var(--primary); font-size: 16px; font-weight: 600; padding: 4px 0; }
.drawer-option { display: flex; align-items: center; gap: 10px; padding: 7px 0; color: var(--primary); }
.drawer-option input { width: 20px; height: 20px; accent-color: var(--primary); }
.drawer-option.static { color: var(--text); }
.drawer-option .check { color: var(--primary); font-size: 18px; }
.drawer-foot { padding-top: 12px; }

/* ─────────────────────── Нижняя шторка ─────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: flex-end;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: rise .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes rise { from { transform: translateY(100%); } }
.sheet-grip { width: 40px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: var(--text2); opacity: .6; }
.sheet-head { display: flex; align-items: center; padding: 6px 12px; }
.sheet-head h3 { flex: 1; font-size: 16px; }
.sheet-close { width: 36px; height: 36px; border-radius: 50%; background: var(--card-2); display: flex; align-items: center; justify-content: center; }
.sheet-body { overflow-y: auto; padding: 0 12px 16px; }

.cal-head { display: flex; align-items: center; justify-content: space-between; text-align: center; margin-bottom: 10px; }
.cal-arrow { width: 44px; height: 44px; font-size: 26px; text-align: center; }
.cal-month { font-size: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 6px; text-align: center; }
.cal-dow { font-size: 12px; color: var(--text2); padding-bottom: 6px; }
.cal-day { width: 40px; height: 40px; margin: 0 auto; border-radius: 50%; text-align: center; font-size: 16px; }
.cal-day.other { color: var(--text2); opacity: .6; }
.cal-day.weekend { color: var(--primary); }
.cal-day.today { background: var(--card-2); box-shadow: inset 0 0 0 1.5px var(--primary); }
.cal-day.selected { background: #4caf50; color: #fff; }

.error-card p { margin-bottom: 4px; }

/* ───────────────────── Калькулятор и строки ───────────────────── */

.row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.row:last-child { border-bottom: 0; }
.label { color: var(--text2); }
.calc-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.calc-label { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.calc-input {
  width: 56px;
  padding: 7px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  font: inherit;
  text-align: center;
}
.calc-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--card-2); text-align: center; font-size: 18px; }
.calc-result { margin-top: 12px; font-size: 15px; }
.calc-result strong { font-size: 20px; }
.avg { display: inline-block; min-width: 44px; padding: 2px 8px; border-radius: 8px; color: #fff; text-align: center; background: var(--primary); }
.avg.g5 { background: #4caf50; }
.avg.g3 { background: #d8a33a; }
.avg.g2 { background: var(--red); }
.task-icon { color: var(--text2); display: flex; }
.clip { display: flex; color: var(--text2); }
.tile-weight, .tile-date { line-height: 1.2; }

/* ─────────────────────────── Новое ─────────────────────────── */

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(var(--nav-h) + 18px);
  z-index: 25;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--head);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
  animation: pop .4s var(--ease) both .2s;
  transition: transform .15s var(--ease);
}
.fab:active { transform: scale(.9); }
.panel:not(.active) .fab { display: none; }

.field {
  display: block;
  width: 100%;
  margin: 4px 0 10px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  font: inherit;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.field-label { display: block; font-size: 13px; color: var(--text2); margin-top: 8px; }
.field-label input[type=range] { width: 100%; accent-color: var(--head); }
.to-field {
  display: flex; flex-wrap: wrap; gap: 6px;
  width: 100%; min-height: 46px;
  margin: 4px 0 10px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-2);
  text-align: left;
}
.compose-files { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.compose-file { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--card-2); }
.compose-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-file-x { color: var(--text2); padding: 2px 6px; }
.attach-btn { margin-bottom: 10px; cursor: pointer; background: var(--card-2); color: var(--text); }
.to-chip { padding: 3px 10px; border-radius: 14px; background: var(--head); color: #fff; font-size: 13px; animation: pop .3s var(--ease); }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn.loading { opacity: .6; pointer-events: none; }
.btn.loading::after { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.recipient { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.recipient-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.recipient .check { color: var(--primary); font-weight: 700; width: 20px; }
.recipient.on { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.avatar.small { width: 34px; height: 34px; font-size: 14px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; }
.switch {
  appearance: none;
  flex: none;
  width: 46px; height: 28px;
  border-radius: 14px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background .2s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .25s var(--ease);
}
.switch:checked { background: var(--head); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: .6; }

.drawer-sub { display: flex; align-items: center; gap: 6px; margin: 12px 0 8px; font-weight: 600; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  position: relative;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .15);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  cursor: pointer;
}
.swatch.on { border-color: var(--text); transform: scale(1.1); }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.howto { padding-left: 18px; font-size: 14px; line-height: 1.5; }
.howto li { margin-bottom: 6px; }
.demo-badge { margin: -4px 0 8px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--head) 20%, transparent); color: var(--primary); font-size: 13px; font-weight: 600; text-align: center; }
.demo-box .drawer-heading { display: flex; align-items: center; gap: 6px; }
.attach { display: flex; align-items: center; gap: 8px; }
