/* Мини-апп: телефон в первую очередь. Всё, что тут есть, должно читаться
   на экране 320 CSS-пикселей и нажиматься пальцем, а не курсором.

   Цвета берутся из темы Telegram (--tg-theme-*). Свои значения — только
   запасные, на случай открытия в обычном браузере. Акценты статусов заданы
   двумя наборами (светлый/тёмный): на тёмном фоне тот же зелёный читается
   плохо. */

:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #14181c);
  --hint: var(--tg-theme-hint-color, #74808a);
  --link: var(--tg-theme-link-color, #2c7fd4);
  --accent: var(--tg-theme-button-color, #2c7fd4);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #f0f2f5);
  --section-bg: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --header-bg: var(--tg-theme-header-bg-color, var(--tg-theme-secondary-bg-color, #f0f2f5));
  --danger: var(--tg-theme-destructive-text-color, #d8392b);

  --ok: #1f8a4c;
  --ok-bg: #e4f4ea;
  --warn: #9a6200;
  --warn-bg: #fbeed2;
  --bad: #c1352a;
  --bad-bg: #fbe4e1;
  --progress: #1d6fb8;
  --progress-bg: #e1eefb;
  --idle: var(--hint);
  --idle-bg: var(--secondary-bg);

  --line: color-mix(in srgb, var(--text) 12%, transparent);
  --line-soft: color-mix(in srgb, var(--text) 7%, transparent);

  --r: 14px;
  --pad: 16px;
  --tap: 48px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-scheme="dark"] {
  --ok: #6fd694;
  --ok-bg: rgba(111, 214, 148, 0.16);
  --warn: #f0bd5c;
  --warn-bg: rgba(240, 189, 92, 0.16);
  --bad: #ff8a7d;
  --bad-bg: rgba(255, 138, 125, 0.16);
  --progress: #7ab8f0;
  --progress-bg: rgba(122, 184, 240, 0.16);
  --line: color-mix(in srgb, var(--text) 18%, transparent);
  --line-soft: color-mix(in srgb, var(--text) 10%, transparent);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--secondary-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}

body { display: flex; flex-direction: column; }

/* ── оболочка ──────────────────────────────────────────────────────── */

#app { display: flex; flex-direction: column; min-height: 100%; }

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px var(--pad);
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--header-bg);
  border-bottom: 1px solid var(--line-soft);
}

.appbar-title { font-size: 17px; font-weight: 650; flex: 1; min-width: 0; }
.appbar-sub { display: block; font-size: 12px; font-weight: 400; color: var(--hint); }
.appbar-title span.appbar-main {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: 12px;
  background: transparent; color: var(--link);
  font-size: 20px; cursor: pointer;
}
.icon-btn:active { background: var(--line-soft); }

main {
  flex: 1;
  padding: 12px var(--pad) 24px;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  background: var(--header-bg);
  border-top: 1px solid var(--line-soft);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1;
  min-height: 56px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--hint);
  font-size: 11px;
}
.tabbar a .tab-ico { font-size: 20px; line-height: 1; }
.tabbar a.is-active { color: var(--link); font-weight: 600; }

/* ── карточки ──────────────────────────────────────────────────────── */

.card {
  background: var(--section-bg);
  border-radius: var(--r);
  padding: var(--pad);
  margin-bottom: 12px;
  border: 1px solid var(--line-soft);
}
.card.tight { padding: 12px var(--pad); }
.card.flat { border: 0; background: transparent; padding: 0; }

.card-head { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.card-title { font-size: 17px; font-weight: 650; margin: 0 0 2px; }
.card-sub { color: var(--hint); font-size: 13px; }

.section-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .04em; color: var(--hint);
  margin: 20px 2px 8px;
}

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.tight { gap: 6px; }
.grow { flex: 1; min-width: 0; }

.lesson-no {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 8px;
  border-radius: 10px;
  background: var(--secondary-bg);
  font-weight: 700; font-size: 15px;
  flex: none;
}

/* ── текст задания ─────────────────────────────────────────────────── */

.prose { font-size: 16px; }
.prose p { margin: 0 0 4px; overflow-wrap: anywhere; }
.prose-gap { height: 10px; }
.modal-text p { margin: 0 0 6px; }

.muted { color: var(--hint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 650; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ── статус одним взглядом ─────────────────────────────────────────── */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  white-space: nowrap;
  background: var(--idle-bg); color: var(--idle);
}
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }
.chip-progress { background: var(--progress-bg); color: var(--progress); }
.chip-progress .chip-dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.deadline {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px;
  background: var(--secondary-bg);
  font-size: 14px; font-weight: 600;
}
.deadline.is-soon { background: var(--warn-bg); color: var(--warn); }
.deadline.is-late { background: var(--bad-bg); color: var(--bad); }
.deadline small { display: block; font-weight: 400; opacity: .85; font-size: 12px; }

.test-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 10px; margin-bottom: 12px;
  background: var(--warn-bg); color: var(--warn);
  font-size: 13.5px; font-weight: 600;
  border: 1px dashed currentColor;
}

/* ── требования по видео ───────────────────────────────────────────── */

.vid { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 10px; background: var(--section-bg); }
.vid-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.vid-title { font-weight: 650; font-size: 15.5px; }
.vid-desc { color: var(--hint); font-size: 14px; margin-top: 4px; overflow-wrap: anywhere; }
.vid-meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--hint); font-size: 12.5px; margin-top: 8px; }
.vid-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.vid[data-status="done"], .vid[data-status="accepted"] { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.vid[data-status="running"], .vid[data-status="queued"], .vid[data-status="uploading"] {
  border-color: color-mix(in srgb, var(--progress) 40%, transparent);
}
.vid[data-status="error"] { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }

/* ── кнопки ────────────────────────────────────────────────────────── */

.btn {
  min-height: var(--tap);
  padding: 0 18px;
  border: 0; border-radius: 12px;
  font-family: inherit; font-size: 15.5px; font-weight: 600;
  cursor: pointer;
  background: var(--accent); color: var(--accent-text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { filter: brightness(.92); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn-wide { width: 100%; }
/* На фоне --secondary-bg такая кнопка сливалась со страницей: рамка нужна,
   чтобы «Попробовать ещё раз» выглядело нажимаемым, а не подписью. */
.btn-secondary { background: var(--section-bg); color: var(--text); border: 1px solid var(--line); }
.btn-ghost { background: transparent; color: var(--link); padding: 0 8px; min-height: 40px; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-small { min-height: 38px; font-size: 14px; padding: 0 12px; border-radius: 10px; }

/* ── формы ─────────────────────────────────────────────────────────── */

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field-hint { display: block; font-size: 12.5px; color: var(--hint); margin-top: 5px; }

.input {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 12px;
  font-family: inherit; font-size: 16px; /* меньше 16px — iOS зумит страницу */
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: -1px; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
.input[type="date"], .input[type="time"] { min-width: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 360px) { .grid-2 { grid-template-columns: 1fr; } }

.toggle { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; cursor: pointer; }
.toggle input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.toggle-body { display: block; }
.toggle-label { font-size: 15px; font-weight: 550; }

.default-mark {
  display: inline-block; margin-left: 6px;
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px;
  background: var(--secondary-bg); color: var(--hint);
  vertical-align: middle;
}

/* ── прогресс ──────────────────────────────────────────────────────── */

.bar { height: 10px; border-radius: 999px; background: var(--secondary-bg); overflow: hidden; }
.bar-fill { height: 100%; background: var(--progress); border-radius: 999px; transition: width .25s ease; }
.upload-box { margin-top: 12px; }
.upload-line { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.upload-pct { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ── метрики разбора ───────────────────────────────────────────────── */

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.metric { background: var(--secondary-bg); border-radius: 12px; padding: 10px 12px; }
.metric-v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-k { font-size: 12px; color: var(--hint); }

.list-reset { margin: 0; padding-left: 20px; }
.list-reset li { margin-bottom: 6px; }
.quote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 12px; margin: 0;
  font-style: italic; color: var(--text);
}

details.fold { border-top: 1px solid var(--line-soft); padding-top: 10px; margin-top: 12px; }
details.fold > summary { cursor: pointer; font-weight: 600; font-size: 14px; list-style: none; min-height: 32px; display: flex; align-items: center; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: " ▾"; color: var(--hint); margin-left: 6px; }
details.fold[open] > summary::after { content: " ▴"; }
.transcript { white-space: pre-wrap; font-size: 14.5px; color: var(--text); margin-top: 8px; overflow-wrap: anywhere; }

/* ── списки-строки ─────────────────────────────────────────────────── */

.tile {
  display: flex; gap: 12px; align-items: center;
  width: 100%; text-align: left;
  background: var(--section-bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 12px var(--pad);
  margin-bottom: 8px;
  min-height: var(--tap);
  color: inherit; font: inherit; cursor: pointer;
}
.tile:active { background: var(--secondary-bg); }
.tile-body { flex: 1; min-width: 0; }
.tile-title { font-weight: 600; font-size: 15.5px; overflow-wrap: anywhere; }
.tile-sub { color: var(--hint); font-size: 13px; margin-top: 2px; }
.tile-chev { color: var(--hint); font-size: 18px; flex: none; }
.tile-right { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* ── состояния ─────────────────────────────────────────────────────── */

.state { text-align: center; padding: 40px 20px; color: var(--hint); }
.state-title { font-size: 17px; font-weight: 650; color: var(--text); margin-bottom: 6px; }
.state-text { font-size: 14.5px; max-width: 34ch; margin: 0 auto 14px; }
.state-detail { font-size: 12px; opacity: .7; margin-bottom: 12px; overflow-wrap: anywhere; }
.state .btn { margin: 0 auto; }

.spinner {
  width: 26px; height: 26px; margin: 0 auto 12px;
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.note { border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin: 10px 0; }
.note-info { background: var(--secondary-bg); color: var(--text); }
.note-warn { background: var(--warn-bg); color: var(--warn); }
.note-bad { background: var(--bad-bg); color: var(--bad); }
.note-ok { background: var(--ok-bg); color: var(--ok); }

/* ── модальное окно и тост ─────────────────────────────────────────── */

.modal-back {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
@media (min-width: 560px) { .modal-back { align-items: center; } }
.modal {
  width: 100%; max-width: 460px;
  background: var(--bg); color: var(--text);
  border-radius: 16px; padding: 18px;
  animation: rise .18s ease-out;
}
@keyframes rise { from { transform: translateY(14px); opacity: .4; } }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.modal-text { font-size: 15px; color: var(--text); }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

.upload-cancel { margin-top: 8px; color: var(--hint); font-weight: 500; }

/* ── запись видео (lib/recorder.js) ────────────────────────────────── */

.rec-back {
  position: fixed; inset: 0; z-index: 70;
  background: #000; color: #fff;
  display: flex; flex-direction: column;
  padding: 12px 12px max(12px, env(safe-area-inset-bottom));
  gap: 10px;
}
.rec-stage { position: relative; flex: 1; min-height: 0; border-radius: 14px; overflow: hidden; background: #111; }
.rec-video { width: 100%; height: 100%; object-fit: contain; background: #111; }
.rec-video.mirror { transform: scaleX(-1); }
.rec-hud {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; justify-content: space-between; pointer-events: none;
  font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 600;
}
.rec-hud > div:not(:empty) { background: rgba(0, 0, 0, .55); border-radius: 8px; padding: 4px 9px; }
.rec-back.is-rec .rec-timer::before { content: "● "; color: #ff4d3d; }
.rec-timer.is-short { color: #f0bd5c; }
.rec-msg:empty { display: none; }
.rec-msg .note { margin: 0; }
.rec-msg .muted { color: #b9c0c7; font-size: 13.5px; }
.rec-quality { display: flex; gap: 6px; }
.rec-quality:empty { display: none; }
.rec-q {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; border-radius: 10px; font: inherit; font-size: 14px;
  background: #1d2125; color: #fff; border: 1px solid #333a40;
}
.rec-q small { font-size: 11.5px; color: #9aa4ad; }
.rec-q.is-on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, #1d2125); }
.rec-q[disabled] { opacity: .5; }
.rec-bar { display: flex; gap: 8px; }
.rec-bar .btn { flex: 1; }
.rec-bar .btn-secondary { background: #1d2125; color: #fff; border-color: #333a40; flex: 0 0 auto; }
.rec-bar .btn-danger { background: #d8392b; color: #fff; border: 0; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 70;
  max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg);
  font-size: 14px; font-weight: 550;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-bad { background: var(--bad); color: #fff; }

/* ── админка ───────────────────────────────────────────────────────── */

.subtabs {
  display: flex; gap: 6px; overflow-x: auto; margin: 0 calc(var(--pad) * -1) 12px;
  padding: 0 var(--pad) 4px;
  scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a {
  flex: none; min-height: 38px; display: inline-flex; align-items: center;
  padding: 0 14px; border-radius: 999px;
  background: var(--secondary-bg); color: var(--text);
  text-decoration: none; font-size: 14px; font-weight: 600; white-space: nowrap;
}
.subtabs a.is-active { background: var(--accent); color: var(--accent-text); }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14.5px; }
.kv:last-child { border-bottom: 0; }
.kv-k { color: var(--hint); }
.kv-v { text-align: right; font-weight: 600; overflow-wrap: anywhere; }

.form-actions {
  position: sticky; bottom: calc(60px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; padding: 10px 0;
  background: linear-gradient(to top, var(--secondary-bg) 70%, transparent);
}
.form-actions .btn { flex: 1; }
.llm-actions { margin: 10px 0 4px; }
.llm-actions .btn { flex: 1; }

.draft-note { font-size: 12.5px; color: var(--hint); padding: 2px 0 8px; }

hr.sep { border: 0; border-top: 1px solid var(--line-soft); margin: 16px 0; }

/* Тёмная тема вне Telegram: внутри Telegram переменные приходят от клиента,
   а в обычном браузере (и в проверке скриншотами) их нужно задать самим. */
[data-scheme="dark"][data-standalone="1"] {
  --bg: #17212b;
  --text: #f2f5f7;
  --hint: #8b9aa8;
  --link: #6ab3f3;
  --accent: #4b8fd0;
  --accent-text: #ffffff;
  --secondary-bg: #0e1621;
  --section-bg: #1b2734;
  --header-bg: #17212b;
  --danger: #ef5b52;
}

/* Узкий экран (320 px и всякие «мини»): в строке-плитке текст важнее
   украшений — стрелку убираем, значку состояния разрешаем перенос,
   иначе заголовку занятия остаётся колонка в три буквы. */
@media (max-width: 400px) {
  .tile {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    column-gap: 10px;
    row-gap: 8px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .tile > .lesson-no { grid-column: 1; grid-row: 1; }
  .tile > .tile-body { grid-column: 2; grid-row: 1; }
  .tile > .tile-right { grid-column: 2; grid-row: 2; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .tile-chev { display: none; }
  .tile-sub { overflow-wrap: anywhere; }
}

/* ── параллельные марафоны, выходные, вложения, лампочка (0.5) ────── */

.program-bar { margin-bottom: 4px; }
.run-picker { margin-bottom: 12px; }

.tile-actions { margin-top: 8px; }
.tile-actions .btn { padding: 6px 12px; min-height: 0; font-size: 13.5px; }

/* Красная лампочка: не сдал открытое занятие к сроку. */
.lamp {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--bad); margin-right: 7px; vertical-align: 1px;
  box-shadow: 0 0 0 3px var(--bad-bg), 0 0 8px var(--bad);
}
.tile.is-missed { border-color: var(--bad); }

.days-off { display: flex; gap: 6px; flex-wrap: wrap; }
.days-off .day {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; height: 38px; padding: 0 8px;
  border: 1px solid var(--line-soft); border-radius: 10px;
  cursor: pointer; font-weight: 600; user-select: none;
}
.days-off .day input { position: absolute; opacity: 0; pointer-events: none; }
.days-off .day.is-off { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }

.lesson-media { display: grid; gap: 10px; margin-top: 14px; }
.media-item { margin: 0; }
.media-item img, .media-item video,
.media-admin-item img, .media-admin-item video {
  display: block; width: 100%; max-height: 420px; object-fit: contain;
  border-radius: 12px; background: var(--secondary-bg);
}
.media-item figcaption { font-size: 13px; color: var(--hint); margin-top: 6px; }
.media-admin { display: grid; gap: 14px; }
.media-admin-item { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: start; }
.media-admin-item img, .media-admin-item video { max-height: 120px; }
@media (max-width: 400px) { .media-admin-item { grid-template-columns: 1fr; } }

/* ── предложение значка на экран телефона ──────────────────────────── */

.home-offer {
  display: flex; align-items: center; gap: 10px;
  margin: 12px var(--pad) 0; padding: 10px 12px;
  border-radius: var(--r); background: var(--section-bg); color: var(--text);
  border: 1px solid var(--line-soft);
  font-size: 14px;
}
.home-offer-text { flex: 1; }
.home-offer-yes { padding: 8px 14px; min-height: 0; }
.home-offer-no {
  border: 0; background: none; color: var(--hint);
  font-size: 16px; padding: 4px 6px; cursor: pointer;
}

/* ── без сети и записи в памяти телефона ───────────────────────────── */

.offline-bar {
  margin: 10px var(--pad) 0; padding: 8px 12px;
  border-radius: 10px; background: var(--warn-bg); color: var(--warn);
  font-size: 13.5px;
}
.offline-bar[hidden] { display: none; }
.saved-rec .saved-line { margin-top: 6px; }
.saved-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.saved-actions .btn { flex: 1 1 auto; text-decoration: none; text-align: center; }

/* ── приложение на экран телефона и вход по коду ───────────────────── */

.pwa-card .card-sub { margin: 6px 0 10px; }
.pwa-steps { margin: 0 0 10px; padding-left: 20px; font-size: 14px; line-height: 1.5; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.pwa-code { margin-top: 10px; }
.pwa-code-digits { font-size: 30px; font-weight: 700; letter-spacing: 4px; font-variant-numeric: tabular-nums; }
.code-form .btn-wide { margin-top: 10px; }
.code-input {
  display: block; max-width: 220px; margin: 0 auto; text-align: center;
  font-size: 28px; letter-spacing: 6px; font-variant-numeric: tabular-nums;
}

/* Загрузка дней файлом: предпросмотр. Описание задания — коротко, в 4 строки,
   целиком оно в тексте поста ниже. */
.import-tasks { margin-top: 10px; }
.import-tasks li { margin-bottom: 8px; }
.import-desc { white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }

/* Карусель ключей Groq */
.groq-keys { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 14px; }
.groq-key { padding: 10px 0; border-top: 1px solid var(--line); gap: 10px; }
.groq-key:first-child { border-top: 0; }
.groq-key .row { gap: 8px; flex-wrap: wrap; align-items: center; }
