:root {
  --bg: #f4f5f7; --card: #fff; --line: #e2e5ea; --ink: #1f2430; --muted: #8a92a3;
  --accent: #2f6fed; --ok: #16a34a; --no: #dc2626; --warn: #d97706;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px; line-height: 1.5; letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); font-size: .85em; }

/* Шапка */
.topbar {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 11px 18px; position: sticky; top: 0; z-index: 10;
  box-shadow: 0 1px 0 rgba(0,0,0,.02), 0 4px 16px rgba(20,30,55,.04);
}
.brand {
  font-weight: 750; font-size: 17px; letter-spacing: -0.02em;
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.nav { display: flex; flex-wrap: nowrap; gap: 4px; align-items: center; min-width: 0; }
.nav a {
  padding: 8px 13px; border-radius: 9px; background: transparent; font-weight: 550;
  font-size: 14px; color: var(--ink); white-space: nowrap; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .14s, color .14s;
}
.nav a:hover { background: #eef1f6; }
.nav a.active { background: var(--accent); color: #fff; }
.nav a.logout {
  background: transparent; color: var(--muted); margin-left: auto;
  border: 1px solid var(--line);
}
.nav a.logout:hover { background: #fdecec; color: var(--no); border-color: #f3c9c9; }
.nav .nav-sep { width: 1px; align-self: stretch; background: var(--line); margin: 4px 6px; }
.badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 2px;
  background: var(--no); color: #fff; border-radius: 10px; font-size: 12px;
  font-weight: 700; text-align: center; line-height: 18px;
}
.container { padding: 20px 24px; max-width: 1600px; margin: 0 auto; }
h1 { font-size: 23px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 18px; }
h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; margin-top: 26px; }

/* Кнопки */
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line);
  background: #eef1f6; color: var(--ink); padding: 8px 12px; border-radius: 8px;
}
button:hover, .btn:hover { background: #e3e8f2; }
.btn-ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn-no { background: #fdecec; color: var(--no); border-color: #f3c9c9; }

/* Новые заявки / карточки */
.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.card.inactive { opacity: .55; }
.card-main { flex: 1 1 200px; }
.card-actions { display: flex; gap: 8px; }
.edit-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex: 1 1 240px; }
.faq-card { flex-direction: column; align-items: stretch; }
.faq-card form:first-child { display: flex; flex-direction: column; gap: 6px; }

input, textarea, select {
  font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); max-width: 100%;
}
input[name="name"], input[name="title"] { flex: 1 1 140px; }
.chk { display: flex; align-items: center; gap: 6px; }
.addform { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.addform.col { flex-direction: column; align-items: stretch; max-width: 520px; }
.addform.col label { display: flex; flex-direction: column; gap: 4px; }
.grid2 label { display: flex; flex-direction: column; gap: 4px; }
/* Кнопка в строчной форме с колоночными label (интервалы): к нижней линии полей */
.addform.grid2 { align-items: flex-end; }
.addform.grid2 > button[type="submit"] { margin-bottom: 1px; }

/* Навигация по неделям */
.week-nav { display: flex; gap: 8px; margin: 14px 0; align-items: center; flex-wrap: wrap; }
.week-nav .add-booking { margin-left: auto; }
a.btn-ok { color: #fff; }
a.btn-ok:hover { background: #128a3f; }

/* Сетка расписания — горизонтальный скролл на телефоне */
.grid-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; }
table.grid { border-collapse: collapse; width: max-content; min-width: 100%; background: var(--card); }
table.grid th, table.grid td {
  border: 1px solid var(--line); padding: 4px; vertical-align: top;
  min-width: 110px; height: 52px;
}
table.grid thead th { background: #eef1f6; position: sticky; top: 0; font-size: 13px; }
table.grid th.day, table.grid th.corner {
  position: sticky; left: 0; background: #eef1f6; min-width: 64px; z-index: 1; text-align: center;
}
.today-row th.day { background: #dbe7ff; }
.chip {
  display: block; font-size: 12px; padding: 3px 6px; border-radius: 6px;
  margin: 2px 0; background: #eef1f6; border-left: 3px solid var(--muted);
}
.s-new { background: #fff7e6; border-left-color: var(--warn); }
.s-confirmed { background: #e7f6ec; border-left-color: var(--ok); }
.s-done { background: #e8eefc; border-left-color: var(--accent); }
.s-rejected, .s-cancelled { background: #f1f1f3; border-left-color: var(--muted); }
.legend { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.legend .chip { display: inline-block; }

.error { background: #fdecec; color: var(--no); padding: 8px 10px; border-radius: 8px; margin-bottom: 8px; }

/* Вход */
.login-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 24px; width: 320px; display: flex; flex-direction: column; gap: 10px;
}
.login-card h1 { margin: 0; font-size: 20px; }
.login-card button { background: var(--accent); color: #fff; border-color: var(--accent); padding: 10px; }

@media (min-width: 720px) {
  .brand { display: inline-block; margin-right: 16px; margin-bottom: 0; }
  .topbar { display: flex; align-items: center; }
}

/* ---- Тёмная тема ---- */
[data-theme="dark"] {
  --bg: #15171c; --card: #1e2128; --line: #2c313b; --ink: #e6e8ec; --muted: #8b94a6;
  --accent: #4d8bff;
}
[data-theme="dark"] .nav a:hover { background: #262b34; }
[data-theme="dark"] .nav a.active { background: var(--accent); color: #fff; }
[data-theme="dark"] .nav a.logout { background: transparent; border-color: var(--line); }
[data-theme="dark"] .nav a.logout:hover { background: #3a2326; color: #ff9a9a; border-color: #5a2e33; }
[data-theme="dark"] button, [data-theme="dark"] .btn { background: #262b34; color: var(--ink); }
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select {
  background: #14161b; color: var(--ink);
}
[data-theme="dark"] table.grid thead th,
[data-theme="dark"] table.grid th.day,
[data-theme="dark"] table.grid th.corner,
[data-theme="dark"] table.month thead th { background: #262b34; }
[data-theme="dark"] .today-row th.day { background: #25324d; }
[data-theme="dark"] .s-new { background: #3a3320; }
[data-theme="dark"] .s-confirmed { background: #1d3326; }
[data-theme="dark"] .s-done { background: #21304d; }
[data-theme="dark"] .btn-ok { background: var(--ok); color: #fff; }
[data-theme="dark"] .btn-no { background: #3a2326; color: #ff9a9a; }

.theme-btn { padding: 6px 10px; border-radius: 8px; }

/* ---- Тосты (всплывающие уведомления) ---- */
.toasts {
  position: fixed; right: 14px; bottom: 14px; z-index: 50;
  display: flex; flex-direction: column; gap: 8px; max-width: 92vw;
}
.toast {
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); opacity: 0; transform: translateY(12px);
  transition: opacity .35s, transform .35s; max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.t-new { border-left-color: var(--ok); }
.toast.t-cancel { border-left-color: var(--no); }
.toast.t-reschedule { border-left-color: var(--warn); }

/* чип-ссылка в сетке */
a.chip { text-decoration: none; color: inherit; }
a.chip:hover { filter: brightness(.97); }

/* ---- Подсветка открытых для записи ячеек на сетке недели ---- */
td.open-cell { background: rgba(47,111,237,.06); }
[data-theme="dark"] td.open-cell { background: rgba(77,139,255,.12); }
.legend-open {
  display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 12px;
  background: repeating-linear-gradient(135deg,
    rgba(47,111,237,.10) 0 7px, rgba(47,111,237,.18) 7px 14px);
  border-left: 3px solid var(--accent);
}

/* ---- Календарь месяца (карточки дней) ---- */
table.month { border-collapse: separate; border-spacing: 7px; width: 100%; table-layout: fixed; }
table.month thead th {
  color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .04em;
  text-transform: uppercase; padding: 2px 0; text-align: center; background: none; border: none;
}
.mcell {
  height: 104px; vertical-align: top; padding: 9px; position: relative;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  transition: transform .08s, box-shadow .12s;
}
.mcell.out { opacity: .4; }
.mcell.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.mcell:hover { box-shadow: 0 4px 14px rgba(0,0,0,.10); }
.mtop { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 2; pointer-events: none; }
.mday { font-size: 15px; font-weight: 600; }
.mcount {
  background: var(--accent); color: #fff; border-radius: 999px; min-width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
  font-weight: 700; padding: 0 8px;
}
.mcell a.mfill { position: absolute; inset: 0; border-radius: 14px; z-index: 1; }
.mnew { position: absolute; left: 10px; bottom: 9px; z-index: 2; font-size: 11px; color: var(--warn); font-weight: 600; pointer-events: none; }
.mcell.load-1 { background: rgba(47,111,237,.10); }
.mcell.load-2 { background: rgba(47,111,237,.20); }
.mcell.load-3 { background: rgba(47,111,237,.34); }
.chip.load-1 { background: rgba(47,111,237,.12); }
.chip.load-2 { background: rgba(47,111,237,.22); }
.chip.load-3 { background: rgba(47,111,237,.34); }

/* ---- Таймлайн расписания (минутная точность) ---- */
.tl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.tl { min-width: max-content; }
.tl-head { display: flex; position: sticky; top: 0; z-index: 3; background: var(--card); border-bottom: 1px solid var(--line); }
.tl-corner { width: 70px; flex: 0 0 70px; position: sticky; left: 0; z-index: 4; background: var(--card);
  border-right: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.tl-axis { position: relative; height: 26px; }
.tl-tick { position: absolute; top: 5px; font-size: 12px; color: var(--muted); transform: translateX(3px); }
.tl-row { display: flex; border-top: 1px solid var(--line); }
.tl-row.today .tl-day { background: #dbe7ff; }
[data-theme="dark"] .tl-row.today .tl-day { background: #25324d; }
.tl-day { width: 70px; flex: 0 0 70px; position: sticky; left: 0; z-index: 2; background: var(--card);
  border-right: 1px solid var(--line); text-align: center; font-size: 13px; padding: 6px 2px; }
.tl-track { position: relative; height: 66px; }
.tl-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); opacity: .55; }
.tl-open { position: absolute; top: 0; bottom: 0;
  background: repeating-linear-gradient(135deg,
    rgba(47,111,237,.05) 0 9px, rgba(47,111,237,.11) 9px 18px); }
[data-theme="dark"] .tl-open {
  background: repeating-linear-gradient(135deg,
    rgba(77,139,255,.08) 0 9px, rgba(77,139,255,.16) 9px 18px); }
.tl-block { position: absolute; top: 4px; bottom: 4px; border-radius: 7px; padding: 3px 7px; font-size: 12px;
  line-height: 1.2; overflow: hidden; text-decoration: none; color: inherit; border-left: 3px solid var(--muted);
  box-shadow: 0 1px 3px rgba(0,0,0,.10); white-space: nowrap; }
.tl-block b { display: block; font-size: 11px; }
.tl-block:hover { filter: brightness(.97); z-index: 5; box-shadow: 0 3px 10px rgba(0,0,0,.18); white-space: normal; }

/* ---- Иконки (инлайн SVG) ---- */
.ic { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.22em; flex: none; }
.brand .ic { width: 1.35em; height: 1.35em; color: var(--accent); }
.nav .ic { width: 1.15em; height: 1.15em; }
.theme-btn { display: inline-flex; align-items: center; }
.toast { display: flex; align-items: center; gap: 8px; }
.toast .ic { width: 1.3em; height: 1.3em; }
/* В кнопках иконка крупнее и с отступом от текста */
button, .btn { display: inline-flex; align-items: center; gap: 7px; }
button .ic, .btn .ic { width: 1.35em; height: 1.35em; vertical-align: middle; }
.btn-ok .ic, .btn-no .ic { stroke-width: 2.1; }
/* Кнопки-иконки без текста (удалить и т.п.) — крупнее */
.btn-no .ic:only-child, .icon-btn .ic { width: 1.5em; height: 1.5em; }

/* ---- Меню в одну строку + только иконки на узких экранах ---- */
.topbar { transition: transform .25s ease; }
.nav .lbl { white-space: nowrap; }
/* Подписи прячем там, где меню не помещается → остаются только иконки */
@media (max-width: 820px) {
  .nav .lbl { display: none; }
  .nav a { padding: 8px 10px; }
  .nav .nav-sep { margin: 4px 3px; }
  .nav a.logout { border: none; }
}

/* ---- Плавающий док (появляется при прокрутке) ---- */
.dock {
  position: fixed; right: 12px; top: 50%; transform: translateY(-50%) translateX(20px);
  display: flex; flex-direction: column; gap: 6px; z-index: 60;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 8px; box-shadow: 0 10px 34px rgba(20,30,55,.20);
  opacity: 0; pointer-events: none; transition: opacity .22s ease, transform .22s ease;
}
.is-scrolled .dock { opacity: 1; pointer-events: auto; transform: translateY(-50%) translateX(0); }
.is-scrolled .topbar { transform: translateY(-100%); }
.dock a, .dock .theme-btn {
  position: relative; width: 44px; height: 44px; padding: 0; border: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; background: transparent; color: var(--ink); cursor: pointer;
  transition: background .14s, color .14s;
}
.dock a:hover, .dock .theme-btn:hover { background: #eef1f6; }
.dock a.active { background: var(--accent); color: #fff; }
.dock a.logout:hover { background: #fdecec; color: var(--no); }
.dock .ic { width: 1.45em; height: 1.45em; }
.dock .dot .badge {
  position: absolute; top: 5px; right: 5px; margin: 0; min-width: 16px;
  height: 16px; line-height: 16px; font-size: 11px; padding: 0 4px;
}
[data-theme="dark"] .dock a:hover, [data-theme="dark"] .dock .theme-btn:hover { background: #262b34; }
[data-theme="dark"] .dock a.active { background: var(--accent); color: #fff; }
[data-theme="dark"] .dock a.logout:hover { background: #3a2326; color: #ff9a9a; }

/* На совсем узких экранах док чуть компактнее */
@media (max-width: 480px) {
  .dock { right: 8px; padding: 6px; gap: 4px; }
  .dock a, .dock .theme-btn { width: 40px; height: 40px; }
}

/* Низкие экраны (телефон в альбомной ориентации) — док максимально компактный,
   чтобы все иконки помещались по высоте */
@media (max-height: 560px) {
  .dock { padding: 5px; gap: 3px; border-radius: 12px; }
  .dock a, .dock .theme-btn { width: 34px; height: 34px; border-radius: 9px; }
  .dock .ic { width: 1.2em; height: 1.2em; }
  .dock .dot .badge { top: 2px; right: 2px; min-width: 13px; height: 13px; line-height: 13px; font-size: 9px; padding: 0 3px; }
}

/* ==== Публичный клиентский виджет записи (/book) ==== */
.client-wrap { max-width: 1500px; margin: 0 auto; padding: 18px 24px 40px; }
/* Форма записи — комфортной ширины; график занятости — во всю ширину (как в админке) */
.client-card-form { max-width: 640px; }
.client-card-wide { width: 100%; }
body.embed { background: transparent; }
body.embed .client-wrap { padding-top: 6px; }
.client-h1 { font-size: 22px; font-weight: 750; letter-spacing: -0.02em; margin: 4px 0 16px;
  display: flex; align-items: center; gap: 8px; }
.client-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; margin-bottom: 16px; box-shadow: 0 4px 16px rgba(20,30,55,.04);
}
.client-card h2 { margin: 0 0 12px; font-size: 16px; font-weight: 650; }
.client-step { margin: 14px 0; display: block; }
.client-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.client-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.client-chip {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  padding: 9px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--card);
  color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; line-height: 1.25;
  transition: border-color .14s, background .14s, box-shadow .14s;
}
.client-chip:hover { border-color: var(--accent); }
.client-chip input { position: absolute; opacity: 0; pointer-events: none; }
.client-chip:has(input:checked), .client-chip.is-selected {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(47,111,237,.30);
}
.client-chip:has(input:checked) .muted, .client-chip.is-selected .muted { color: #e6eefc; }
.client-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.client-grid2 label, .client-step > label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.client-form input[type="text"], .client-form input[type="tel"], .client-form input:not([type]) {
  padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink);
}
.client-submit { margin-top: 6px; font-size: 15px; padding: 11px 18px; }
.client-consent { margin: 8px 2px 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.client-consent a { color: var(--muted); text-decoration: underline; }
.policy-text { white-space: normal; line-height: 1.6; font-size: 14px; }
.client-result-box { margin-top: 12px; }
.client-success {
  background: rgba(22,163,74,.10); border: 1px solid rgba(22,163,74,.35);
  color: var(--ok); border-radius: 10px; padding: 12px 14px; font-weight: 600;
}
[data-theme="dark"] .client-success { color: #6ee7a0; }
.client-error {
  background: #fdecec; color: var(--no); border: 1px solid #f3c9c9;
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
}
[data-theme="dark"] .client-error { background: #3a2326; color: #ff9a9a; border-color: #5a2e33; }
/* honeypot — увести за пределы экрана, не type=hidden */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 560px) { .client-grid2 { grid-template-columns: 1fr; } }

/* Занятое время на анонимном расписании — красная штриховка */
.tl-busy { position: absolute; top: 4px; bottom: 4px; border-radius: 7px;
  border-left: 3px solid #dc2626;
  background: repeating-linear-gradient(135deg,
    rgba(220,38,38,.18) 0 7px, rgba(220,38,38,.32) 7px 14px); }
[data-theme="dark"] .tl-busy { border-left-color: #ff6b6b;
  background: repeating-linear-gradient(135deg,
    rgba(255,107,107,.16) 0 7px, rgba(255,107,107,.30) 7px 14px); }
.chip.s-busy { display: inline-block; background: repeating-linear-gradient(135deg,
    rgba(220,38,38,.16) 0 6px, rgba(220,38,38,.30) 6px 12px); border-left: 3px solid #dc2626; }

/* ==== Клиенты / чёрный список ==== */
.client-row { justify-content: space-between; text-decoration: none; color: inherit; }
.client-row:hover { background: #f6f8fc; }
[data-theme="dark"] .client-row:hover { background: #20242d; }
.client-metrics { display: flex; gap: 12px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.badge-block { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700;
  color: #fff; background: var(--no); border-radius: 8px; padding: 1px 7px; margin-left: 6px; }
.chip.s-no_show { background: #fde2e2; border-left-color: var(--no); }
[data-theme="dark"] .chip.s-no_show { background: #3a2326; }

/* ==== Статистика ==== */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 8px 0 18px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.stat-card b { display: block; font-size: 28px; font-weight: 750; letter-spacing: -0.02em; }
.stat-card span { color: var(--muted); font-size: 13px; }
.bars { display: flex; flex-direction: column; gap: 6px; max-width: 720px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-lbl { width: 34px; font-size: 13px; color: var(--muted); text-align: right; flex: none; }
.bar { flex: 1; height: 18px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
[data-theme="dark"] .bar { background: #20242d; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 6px; min-width: 2px; }
.bar-val { width: 32px; font-size: 13px; font-weight: 600; flex: none; }

/* ==== Подменю настроек (вкладки) ==== */
.subnav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 18px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.subnav-tab { display: inline-flex; align-items: center; gap: 6px; font: inherit; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px;
  color: var(--ink); }
.subnav-tab:hover { background: #eef1f6; }
.subnav-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.subnav-sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 4px; }
[data-theme="dark"] .subnav-tab:hover { background: #262b34; }
.tab-panel { display: none; }
.tab-panel.show { display: block; }

/* ==== Кнопка обзора месяца под расписанием ==== */
.month-link { margin: 18px 0 6px; }

/* ==== Масштаб графика (зум-панель) ==== */
.tl-zoombar { display: flex; gap: 6px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.tl-zoombar .btn { padding: 5px 10px; min-width: 40px; }
.tl-zoombar .tlz-reset { min-width: 58px; font-variant-numeric: tabular-nums; }
.tlz-hint { font-size: 12px; }
@media (max-width: 560px) { .tlz-hint { display: none; } }

/* ==== Выбор даты по месяцам (клиентский виджет) ==== */
.day-month { flex-basis: 100%; width: 100%; margin: 6px 0 2px; font-weight: 700; font-size: 14px; color: var(--muted); }
.day-row { flex-basis: 100%; width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }

/* Широкая подпись для баров источников (Telegram/MAX/Сайт/Вручную) */
.bar-lbl-wide { width: 78px; text-align: right; }

/* ==== Mini App: вкладки «Мои записи» и «Инфо» ==== */
.client-month { flex-basis: 100%; width: 100%; margin: 8px 0 2px; font-weight: 700;
  font-size: 14px; color: var(--muted); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.prewrap { white-space: pre-wrap; }
.info-list { margin: 4px 0 8px; padding-left: 18px; }
.info-list li { margin: 3px 0; }
.faq-item { border-top: 1px solid var(--line); padding: 8px 0; }
.faq-item summary { cursor: pointer; font-weight: 600; }
.faq-item .prewrap { margin-top: 6px; color: var(--muted); }
.client-note { border-radius: 8px; padding: 8px 11px; margin: 0 0 12px; font-size: 14px; }
.client-note.ok { background: rgba(22,163,74,.12); color: var(--ok); }
.client-note.err { background: rgba(220,53,69,.12); color: var(--no); }
.my-item { border-top: 1px solid var(--line); padding: 12px 0; }
.my-item:first-of-type { border-top: 0; }
.my-item-head span { font-size: 14px; }
.my-status { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 10px;
  font-size: 12px; font-weight: 700; }
.my-status-new { background: rgba(234,179,8,.18); color: #a16207; }
.my-status-confirmed { background: rgba(22,163,74,.15); color: var(--ok); }
.my-item-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.tg-phone-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: -4px; }
.tg-phone-row .muted { font-size: 13px; }

/* ============================================================
   РЕДИЗАЙН НАСТРОЕК (портирован из YaponaMama): рельс разделов +
   карточки + переключатели. Без yapona-темы — только базовые vars.
   ============================================================ */
.settings-top { margin: 2px 0 20px; }
.settings-top h1 { margin: 0; }
.settings-sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; max-width: 60ch; }

/* Правый отступ резервирует место под плавающий док (.dock, fixed right:12px ~72px),
   чтобы он не наезжал на right-aligned контролы карточек. Только десктоп — на мобайле
   дока-наезда нет, отступ обнуляется в @media ниже. */
.settings-grid { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 28px; align-items: start; padding-right: 76px; }

/* Рельс разделов (десктоп — слева, липкий) */
.settings-rail { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 2px; }
.srail-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 12px; border: none; background: transparent; color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 550; border-radius: var(--radius-sm);
  cursor: pointer; white-space: nowrap; transition: background .14s, color .14s;
}
.srail-item:hover { background: #eef1f6; }
.srail-item.active { background: var(--accent); color: #fff; }
.srail-item .ic { width: 1.15em; height: 1.15em; flex: none; }
.srail-div { height: 1px; background: var(--line); margin: 9px 6px; }
[data-theme="dark"] .srail-item:hover { background: #262b34; }
[data-theme="dark"] .srail-item.active { color: #fff; }

/* Карточка раздела настроек */
.scard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); margin-bottom: 18px; overflow: hidden;
}
.scard-head { padding: 18px 22px 15px; border-bottom: 1px solid var(--line); }
.scard-head h2 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.scard-head p { margin: 5px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.scard-foot {
  padding: 15px 22px; border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 55%, var(--card)); display: flex; gap: 10px;
}

/* Подзаголовок группы внутри карточки */
.srow-head {
  padding: 16px 22px 4px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); border-top: 1px solid var(--line);
}
.scard-head + .srow-head, .srow-head:first-child { border-top: none; }
.srow-head + .srow, .srow-head + .sfield { border-top: none; }

/* Строка-настройка: текст слева, контрол справа */
.srow {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 15px 22px; border-top: 1px solid var(--line);
}
.scard-head + .srow { border-top: none; }
.srow-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.srow-label { font-size: 14.5px; font-weight: 550; color: var(--ink); }
.srow-help { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* Поле во всю ширину (тексты, многострочные) */
.sfield { display: flex; flex-direction: column; gap: 7px; padding: 15px 22px; border-top: 1px solid var(--line); }
.scard-head + .sfield { border-top: none; }
.sfield-label { font-size: 14.5px; font-weight: 550; color: var(--ink); }
.sfield-help { font-size: 13px; color: var(--muted); line-height: 1.4; margin: -2px 0 2px; }

/* Поля ввода в настройках */
.s-input {
  width: 100%; padding: 10px 13px; border-radius: var(--radius); font: inherit;
  font-size: 14.5px; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  transition: border-color .14s, box-shadow .14s, background .14s;
}
textarea.s-input { resize: vertical; min-height: 62px; line-height: 1.45; }
.s-input:focus { outline: none; border-color: var(--accent); background: var(--card); box-shadow: var(--ring); }
.srow .s-input { flex: none; width: 116px; text-align: right; }
.srow .s-input[type=time] { width: 138px; text-align: left; }
[data-theme="dark"] .s-input { background: #14161b; }
[data-theme="dark"] .s-input:focus { background: var(--card); }

/* Тумблер (изолированная разметка .switch → .switch-track, без конфликтов) */
.switch { position: relative; flex: none; width: 44px; height: 26px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch-track {
  display: block; width: 100%; height: 100%; border-radius: 999px;
  background: var(--line); transition: background .18s; pointer-events: none;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.28); transition: transform .18s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }

/* FAQ внутри карточки «Информация» */
.faq-item { padding: 16px 22px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.faq-item .faq-edit { display: flex; flex-direction: column; gap: 8px; }
.faq-item .faq-actions { display: flex; justify-content: flex-end; }
.faq-add { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }

/* Подсказка-сниппет (iframe/ICS) — моноширинный, только для чтения */
.snippet { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; background: var(--bg); }

/* Мобайл: рельс превращается в горизонтальную ленту над контентом */
@media (max-width: 860px) {
  .settings-grid { grid-template-columns: 1fr; gap: 14px; padding-right: 0; }
  .settings-rail {
    position: static; flex-direction: row; gap: 6px; overflow-x: auto;
    padding-bottom: 10px; border-bottom: 1px solid var(--line);
    scrollbar-width: thin; -webkit-overflow-scrolling: touch;
  }
  .srail-item { width: auto; flex: none; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; }
  .srail-div { width: 1px; height: auto; align-self: stretch; margin: 4px 2px; }
}
@media (max-width: 560px) {
  .srow { flex-direction: column; align-items: stretch; gap: 10px; }
  .srow .s-input, .srow .s-input[type=time] { width: 100%; text-align: left; }
  .switch { align-self: flex-start; }
}
