/* Розклад пар — неофіційний прототип. Mobile-first, без залежностей. */

:root {
  /* Кожен колір — light-dark(світлий, темний). Яку половину взяти, вирішує color-scheme:
     «light dark» — як у системі; вибрану в налаштуваннях тему ставить на <html> js/theme.js. */
  color-scheme: light dark;
  --bg: light-dark(#f4f5f7, #101318);
  --surface: light-dark(#ffffff, #171b22);
  --surface-2: light-dark(#f8f9fb, #1c212a);
  --text: light-dark(#16202e, #e4e6ea);
  --muted: light-dark(#5f6b7a, #9aa3b0);
  --border: light-dark(#e3e6eb, #2a303a);
  --accent: light-dark(#3e5c86, #93acd0);
  --accent-text: light-dark(#ffffff, #101318);
  --accent-soft: light-dark(#e6ebf2, #252f3f);
  --warn: light-dark(#b45309, #fbbf24);
  --warn-soft: light-dark(#fef3c7, #3a2a0c);
  --info-soft: light-dark(#eceff4, #1f2632);
  --danger: light-dark(#b91c1c, #f87171);
  --now: light-dark(#16a34a, #4ade80);
  --now-soft: light-dark(#dcfce7, #143322);

  --c-lecture: light-dark(#44659a, #a5bad8);
  --c-lecture-soft: light-dark(#e4eaf3, #232d3d);
  --c-lab: light-dark(#047857, #6ee7b7);
  --c-lab-soft: light-dark(#d1fae5, #123b31);
  --c-practice: light-dark(#b45309, #fcd34d);
  --c-practice-soft: light-dark(#fef3c7, #3b2e0f);
  --c-control: light-dark(#b91c1c, #fca5a5);
  --c-control-soft: light-dark(#fee2e2, #3f1a1a);
  --c-other: light-dark(#475569, #cbd2dc);
  --c-other-soft: light-dark(#e2e8f0, #262c36);
  --c-reserved: light-dark(#6d28d9, #c4b5fd);
  --c-reserved-soft: light-dark(#ede9fe, #2c2350);

  --radius: 14px;
  --topbar-h: 56px;
  --tabbar-h: 60px;
  --shadow: 0 1px 2px light-dark(rgb(15 23 42 / 6%), transparent), 0 1px 1px light-dark(rgb(15 23 42 / 4%), transparent);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--font);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.block { display: block; }
.big { font-size: 1.25rem; }

.icon { display: inline-flex; width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.15em; }
.icon svg { width: 100%; height: 100%; }

/* ---------- Каркас ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  height: var(--topbar-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-text { min-width: 0; flex: 1; }
.topbar-actions { flex: none; display: flex; gap: 8px; }
.topbar-actions:empty { display: none; }
.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.view-switch:hover { border-color: var(--accent); color: var(--accent); }
.topbar h1 { font-size: 1.15rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1 a { color: inherit; text-decoration: none; }
.topbar p { font-size: 0.8rem; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.view { display: block; outline: none; }
.view-inner { max-width: 760px; margin: 0 auto; padding: 12px 16px 24px; }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1 1 0;
  max-width: 190px;
  height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.72rem;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.is-active { color: var(--accent); font-weight: 600; }
body.is-setup .tabbar { display: none; }
body.is-setup { padding-bottom: env(safe-area-inset-bottom); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  transform: translate(-50%, 20px);
  width: max-content;
  max-width: min(420px, calc(100% - 32px));
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgb(15 23 42 / 25%);
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 40;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.has-action { pointer-events: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-right: 8px; }
.toast-action {
  border: 0;
  background: none;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  min-height: 40px;
  padding: 0 8px;
  flex: none;
  cursor: pointer;
}

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}
.btn-small { min-height: 36px; padding: 0 12px; font-size: 0.9rem; border-radius: 10px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-danger { color: var(--danger); }
.btn-block { width: 100%; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); font-weight: 600; }
.btn-quiet:hover, .btn-quiet:focus-visible { color: var(--text); border-color: var(--border); }
.btn-online { margin-top: 8px; color: var(--accent); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  flex: none;
}
.icon-btn .icon { width: 20px; height: 20px; }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.segmented button {
  min-height: 36px;
  min-width: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.segmented button.is-active { background: light-dark(var(--surface), var(--accent-soft)); color: var(--text); box-shadow: var(--shadow); }
.segmented-wide { display: flex; }
.segmented-wide button { flex: 1; min-height: 44px; font-size: 1.05rem; }

/* ---------- Панель дат ---------- */

.toolbar {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  z-index: 10;
  margin: -12px -16px 12px;
  padding: 6px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.datenav { display: flex; align-items: center; gap: 8px; }
.datenav-label { flex: 1; text-align: center; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.datenav-label strong { font-size: 1.02rem; }
.datenav-label strong::first-letter { text-transform: uppercase; }
.datenav-sub { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 0.85rem; min-height: 22px; }
.today-btn {
  border: 0;
  border-radius: 999px;
  min-height: 26px;
  padding: 0 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

/* ---------- Сповіщення ---------- */

.notices { display: grid; gap: 8px; margin-bottom: 12px; }
.notices:empty { display: none; }
.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  background: var(--info-soft);
}
.notice .icon { margin-top: 2px; }
.notice-warn { background: var(--warn-soft); }
.notice-warn .icon { color: var(--warn); }
.notice p + p { margin-top: 6px; }
.error-box { margin-top: 24px; }
.error-box .btn { margin-top: 10px; }

.hidden-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  padding: 8px 8px 8px 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ---------- День ---------- */

.day { display: grid; gap: 10px; }
.slot { display: grid; grid-template-columns: 3.2rem 1fr; gap: 10px; align-items: start; }
.slot-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.slot-num {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.slot.is-now .slot-num { background: var(--now); border-color: var(--now); color: var(--surface); }
.slot.is-past { opacity: 0.6; }
.slot-body { display: grid; gap: 8px; min-width: 0; }
.slot.is-free .slot-body { align-self: center; }
.free { padding: 12px; border-radius: var(--radius); border: 1px dashed var(--border); color: var(--muted); font-size: 0.9rem; }
.gap { margin-left: calc(3.2rem + 10px); padding: 2px 12px; font-size: 0.82rem; color: var(--muted); border-left: 3px dotted var(--border); }

/* ---------- Картка пари ---------- */

.lesson {
  --tone: var(--c-other);
  --tone-soft: var(--c-other-soft);
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--tone);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.tone-lecture { --tone: var(--c-lecture); --tone-soft: var(--c-lecture-soft); }
.tone-lab { --tone: var(--c-lab); --tone-soft: var(--c-lab-soft); }
.tone-practice { --tone: var(--c-practice); --tone-soft: var(--c-practice-soft); }
.tone-control { --tone: var(--c-control); --tone-soft: var(--c-control-soft); }
.tone-reserved { --tone: var(--c-reserved); --tone-soft: var(--c-reserved-soft); }
.tone-none { --tone: var(--border); }

.lesson.is-now { border-color: var(--now); border-left-color: var(--tone); box-shadow: 0 0 0 2px var(--now-soft); }
.lesson.is-foreign { opacity: 0.75; border-style: dashed; border-left-style: solid; background: var(--surface-2); }
.lesson.has-replacement { border-color: var(--danger); border-left-color: var(--tone); }

.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.6;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge-type { background: var(--tone-soft); color: var(--tone); border-color: transparent; }
.badge-aud.aud-subgroup { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-aud.aud-external, .badge-aud.aud-language, .badge-aud.aud-section-mine { background: var(--c-reserved-soft); color: var(--c-reserved); border-color: transparent; }
.badge-foreign { border-style: dashed; }
.badge-alert { background: var(--c-control-soft); color: var(--danger); border-color: transparent; }
.badge-online { background: var(--c-lecture-soft); color: var(--c-lecture); border-color: transparent; }
.badge-hint { margin-left: 6px; vertical-align: 1px; }

.lesson-title { font-size: 1.02rem; font-weight: 650; line-height: 1.3; overflow-wrap: break-word; }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 0.9rem; color: var(--muted); }
.meta-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  min-height: 28px;
}
.meta-link:hover, .meta-link:focus-visible { color: var(--accent); text-decoration: underline; }
.meta-text { display: inline-block; padding: 3px 0; }
.note { margin-top: 6px; font-size: 0.88rem; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.note-alert { background: var(--c-control-soft); }
.known-issue { margin-top: 6px; font-size: 0.75rem; }
.known-issue summary {
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px; list-style: none;
  padding: 1px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-weight: 600; opacity: 0.85;
}
.known-issue summary:hover, .known-issue[open] summary { opacity: 1; }
.known-issue summary svg { width: 12px; height: 12px; }
.known-issue summary::-webkit-details-marker { display: none; }
.known-issue[open] { padding: 8px 10px; border-radius: 10px; background: var(--warn-soft); font-size: 0.84rem; }
.known-issue[open] summary { padding: 0; background: none; }
.known-issue p { margin: 4px 0 6px; color: var(--text); }
.badge-issue { background: var(--warn-soft); color: var(--warn); border-color: transparent; gap: 4px; }
.badge-kind { gap: 4px; margin-bottom: 8px; background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.issues-intro { margin: 4px 0 14px; }
.card > p { line-height: 1.5; }
.lesson-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 6px; min-height: 24px; }
.lesson-status { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 700; color: var(--now); white-space: nowrap; }
.progress { flex: 1; height: 4px; border-radius: 4px; background: var(--now-soft); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--now); }
.lesson-actions { margin-left: auto; display: flex; gap: 8px; }
.lesson-actions .btn-quiet { margin: -6px -8px -6px 0; }

/* Повне ПІБ на широких екранах, «Прізвище І. П.» — на телефоні. */
.name-short { display: none; }
@media (max-width: 520px) {
  .lesson .name-full { display: none; }
  .lesson .name-short { display: inline; }
}

/* Компактна картка (тиждень) */
.lesson.is-compact { display: flex; gap: 10px; padding: 8px 10px; box-shadow: none; }
.lesson.is-compact .lesson-time { flex: none; width: 3.6rem; font-size: 0.85rem; font-variant-numeric: tabular-nums; color: var(--muted); padding-top: 1px; }
.lesson.is-compact .lesson-time b { color: var(--text); }
.lesson.is-compact .lesson-main { min-width: 0; flex: 1; }
.lesson.is-compact .lesson-title { font-size: 0.95rem; }
.lesson.is-compact .lesson-meta { font-size: 0.82rem; gap: 2px 10px; align-items: center; margin-top: 2px; }
.lesson.is-compact .lesson-meta .badge { font-size: 0.7rem; line-height: 1.5; }
.lesson.is-compact .meta-link { min-height: 24px; }
.lesson.is-compact.is-past { opacity: 0.6; }
.lesson.is-compact.is-now { box-shadow: 0 0 0 2px var(--now-soft); }

/* ---------- Тиждень ---------- */

.week { display: grid; gap: 14px; }
.week-day-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 2px 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}
.week-day-name { font-weight: 700; }
.week-day-head .count { margin-left: auto; font-size: 0.8rem; color: var(--muted); }
.week-day.is-today .week-day-name { color: var(--accent); }
.week-day.is-today .week-day-head { border-bottom: 2px solid var(--accent); }
.week-day-body { display: grid; gap: 6px; }

/* Сітка тижня (лише десктоп): стовпці — дні, рядки — пари. */
.week-grid, .week-grid-empty { display: none; }
.week-grid {
  grid-template-columns: 4rem repeat(var(--days), minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}
.wg-day {
  display: grid;
  gap: 1px;
  padding: 6px 8px 8px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 2px solid var(--border);
  font-size: 0.9rem;
}
.wg-day:hover .wg-day-name { color: var(--accent); }
.wg-day .muted { font-size: 0.8rem; }
.wg-day-name { font-weight: 700; }
.wg-day.is-today { border-bottom-color: var(--accent); }
.wg-day.is-today .wg-day-name { color: var(--accent); }
.wg-time { display: grid; justify-items: center; align-content: start; gap: 2px; padding-top: 6px; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.wg-time .slot-num { width: 26px; height: 26px; font-size: 0.85rem; }
.wg-cell { display: grid; gap: 6px; align-content: start; min-width: 0; min-height: 3.5rem; padding: 3px; border-radius: 10px; }
.wg-cell.is-today { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.wg-cell.is-nodata { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--surface-2) 6px 12px); }
.wg-cell .lesson.is-compact { display: block; padding: 7px 9px; }
.wg-cell .lesson.is-compact .lesson-title { font-size: 0.88rem; line-height: 1.25; }
.wg-cell .lesson.is-compact .lesson-meta { font-size: 0.78rem; }

/* ---------- Порожні стани, підвал ---------- */

.empty { padding: 28px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty p + p { margin-top: 6px; }
.next-hint { margin-top: 12px; display: flex; justify-content: center; }
.data-footer { margin-top: 20px; text-align: center; font-size: 0.78rem; color: var(--muted); }

/* ---------- Пошук і списки ---------- */

.search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.search > .icon { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.search-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px 0 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1rem;
}
.search-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.results > .notice, .results + .notice { margin-bottom: 12px; }
.list-heading { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 16px 4px 6px; }
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list li + li { border-top: 1px solid var(--border); }
.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 8px 12px;
  background: none;
  border: 0;
  text-align: left;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.list-row:hover { background: var(--surface-2); }
.list-row.is-selected { background: var(--accent-soft); }
.list-row > .icon { color: var(--muted); }
.list-main { flex: 1; min-width: 0; }
.list-main .muted { font-size: 0.85rem; }
.count { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.status { display: inline-block; font-size: 0.75rem; padding: 1px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); white-space: nowrap; margin-top: 4px; }
.status-empty { background: var(--surface-2); color: var(--muted); }

.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; margin-bottom: 8px; text-decoration: none; font-weight: 600; }
.object-head { display: flex; align-items: center; gap: 12px; margin: 2px 0 20px; }
.object-head-text { min-width: 0; }
.object-head h2 { font-size: 1.1rem; line-height: 1.3; }

.intro { margin: 8px 0 16px; }
.intro h2 { font-size: 1.4rem; margin-bottom: 6px; }
.intro p { color: var(--muted); }

/* ---------- Налаштування ---------- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card-title { font-size: 1.05rem; margin-bottom: 4px; }
.card > .muted.small { margin-bottom: 10px; }
.card > .btn { margin-top: 10px; }
.card > .notice { margin-top: 10px; }
.section-title { font-size: 1.1rem; margin: 4px 0 12px; }
.row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.choice-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.choice-list + .choice-list { margin-top: 10px; }
.choice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  min-height: 48px;
}
.choice.is-checked { border-color: var(--accent); background: var(--accent-soft); }
.choice input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.choice-text { min-width: 0; }
.choice-block { padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.choice-block .chips { padding-left: 0; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 4px 2px 44px; }
.chip {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  cursor: pointer;
}
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.orphan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.sticky-actions {
  position: sticky;
  bottom: 0;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 6px 0 0; font-size: 0.9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* ---------- Ширші екрани ---------- */

@media (min-width: 700px) {
  .slot { grid-template-columns: 4rem 1fr; }
  .gap { margin-left: calc(4rem + 10px); }
}

/* Десктоп: вкладки переходять у верхню панель, нижньої панелі немає. */
@media (min-width: 960px) {
  body { padding-bottom: 0; }
  .topbar-inner { max-width: 1120px; gap: 20px; }
  .tabbar {
    position: static;
    order: 0;
    flex: none;
    gap: 4px;
    background: none;
    border: 0;
    padding: 0;
  }
  .tabbar a {
    flex: none;
    max-width: none;
    height: 40px;
    flex-direction: row;
    gap: 8px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 0.92rem;
    color: var(--muted);
  }
  .tabbar a:hover { color: var(--text); background: var(--surface-2); }
  .tabbar a.is-active { color: var(--accent); background: var(--accent-soft); }
  .tabbar svg { width: 20px; height: 20px; }
  .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
}
/* Десктоп: тиждень сіткою замість списку, і ширший контейнер під неї. */
@media (min-width: 960px) {
  .week-wrap > .week { display: none; }
  .week-grid { display: grid; }
  .week-grid-empty { display: block; }
  .view-inner:has(.week-grid) { max-width: 1120px; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
