/* Фирменные цвета клиники «ЗубСервис» (zubservis.ru):
   синий сайта #0073aa, тёмно-синий логотипа #0d3d6b, оранжевый логотипа #f89808 */
:root {
  --primary: #0073aa;
  --primary-dark: #005a86;
  --primary-soft: #e3f1f8;
  --navy: #0d3d6b;
  --accent: #f89808;
  --accent-dark: #d97f00;
  --accent-soft: #fdeed7;   /* подложка активной вкладки */
  --accent-ink: #b36b00;    /* иконка/подпись на подложке */
  --bg: #f3f7fa;
  --card: #ffffff;
  --text: #14293b;
  --muted: #62788a;
  --line: #e2eaf0;
  --danger: #d64545;
  --ok: #2f9e44;
  --warn: #b8860b;
  --radius: 16px;
  --tabbar-h: 62px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #2f9fd6;
    --primary-dark: #0073aa;
    --primary-soft: #10293a;
    --navy: #10426f;
    --accent-soft: #3a2a10;
    --accent-ink: #f5b04d;
    --bg: #0d151c;
    --card: #152230;
    --text: #e7eef4;
    --muted: #8da2b5;
    --line: #223547;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; color: inherit; }

/* ---------- top bar ----------
   Логотип по центру: в установленном PWA (status-bar black-translucent +
   viewport-fit=cover) шапка заходит под статус-бар, и зубик оказывается
   ровно под Dynamic Island — остров выглядит частью шапки. */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding-top: max(env(safe-area-inset-top), 8px);
}
.topbar-inner {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  padding: 2px 16px 8px;
}
.brand { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 3px;
}
.brand-logo svg { width: 20px; height: 20px; }
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--muted); }
.topbar-call {
  position: absolute; right: 16px; bottom: 12px;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
}

/* ---------- main ---------- */
.main { padding: 16px; max-width: 560px; margin: 0 auto; }
.section-title {
  font-size: 20px; font-weight: 700; margin: 20px 0 10px;
}
.section-title:first-child { margin-top: 4px; }
.section-title.with-ic { display: flex; align-items: center; gap: 8px; }
.section-title.with-ic .ic { color: var(--primary); }
.muted { color: var(--muted); font-size: 14px; }

/* inline-иконки (Tabler) в тексте и заголовках */
.ic { flex: none; vertical-align: -3px; }
.with-ic { display: flex; align-items: center; gap: 6px; }
.with-ic .ic { vertical-align: 0; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
}
.card h3 { font-size: 16px; margin-bottom: 6px; }
.card p { font-size: 14px; color: var(--muted); white-space: pre-wrap; }
.card img.news-img {
  width: calc(100% + 32px); margin: -16px -16px 12px;
  border-radius: var(--radius) var(--radius) 0 0;
  display: block; max-height: 220px; object-fit: cover;
}

/* promo */
.promo-scroll {
  display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 8px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
.promo-card {
  min-width: 260px; max-width: 280px; scroll-snap-align: start;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff; border-radius: var(--radius); padding: 16px;
}
.promo-card .badge {
  display: inline-block; background: rgba(255,255,255,.22);
  border-radius: 999px; padding: 2px 10px; font-size: 12px; margin-bottom: 8px;
}
.promo-card h3 { font-size: 16px; margin-bottom: 6px; }
.promo-card p { font-size: 13px; opacity: .92; white-space: pre-wrap; }

/* hero CTA */
.hero {
  background: linear-gradient(135deg, var(--primary), var(--navy));
  border-radius: var(--radius); color: #fff;
  padding: 20px 16px; margin-bottom: 16px;
}
.hero h2 { font-size: 19px; margin-bottom: 6px; }
.hero p { font-size: 14px; opacity: .92; margin-bottom: 14px; }

/* buttons */
.btn {
  display: block; width: 100%;
  border: none; border-radius: 14px;
  padding: 14px; font-size: 16px; font-weight: 600;
  background: var(--primary); color: #fff; cursor: pointer;
}
.btn:active { opacity: .85; }
.btn.secondary { background: var(--primary-soft); color: var(--primary-dark); }
.btn.with-ic-btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn.ghost { background: transparent; color: var(--primary-dark); }
.btn.white { background: #fff; color: var(--primary-dark); }
.btn[disabled] { opacity: .5; }
.btn + .btn { margin-top: 10px; }

/* list rows */
.row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; margin-bottom: 10px;
  width: 100%; text-align: left; font-size: 15px; cursor: pointer;
}
.row:active { background: var(--primary-soft); }
.row .row-icon {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: var(--primary-soft); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.row .row-main { flex: 1; min-width: 0; }
.row .row-title { display: block; font-weight: 600; }
.row .row-sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.row .chev { color: var(--muted); flex: none; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 9px 14px; font-size: 14px; cursor: pointer;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--text);
  padding: 13px; font-size: 16px; font-family: inherit;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--primary);
}
.consent {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13px; color: var(--muted); margin: 14px 0;
}
.consent input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--primary); }
.consent a { color: var(--primary-dark); }

/* wizard */
.steps { display: flex; gap: 6px; margin-bottom: 16px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--primary); }
.wizard-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.back-btn {
  border: none; background: var(--card); border: 1px solid var(--line);
  width: 36px; height: 36px; border-radius: 50%; font-size: 16px; cursor: pointer;
}
.wizard-title { font-size: 18px; font-weight: 700; }

/* status badges */
.badge-status {
  display: inline-block; border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 600;
}
.badge-status.new { background: #fdf3d7; color: var(--warn); }
.badge-status.taken { background: #dcf3e2; color: var(--ok); }
.badge-status.cancelled { background: #fbe3e3; color: var(--danger); }
@media (prefers-color-scheme: dark) {
  .badge-status.new { background: #3a3113; }
  .badge-status.taken { background: #14321c; }
  .badge-status.cancelled { background: #3a1a1a; }
}

/* success screen */
.success { text-align: center; padding: 40px 10px; }
.success .big { font-size: 56px; margin-bottom: 12px; }
.success .big-ic { color: var(--accent); margin-bottom: 12px; }
.success h2 { margin-bottom: 8px; }
.success p { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.success .card p { margin-bottom: 0; }

/* loyalty card */
.bonus-card {
  background: linear-gradient(135deg, var(--navy), var(--primary));
  color: #fff; border-radius: var(--radius);
  padding: 18px 16px; margin-bottom: 12px;
}
.bonus-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; opacity: .9; margin-bottom: 14px;
}
.bonus-brand { font-weight: 700; letter-spacing: .4px; }
.bonus-balance { font-size: 30px; font-weight: 800; }
.bonus-sub { font-size: 13px; opacity: .85; margin-top: 6px; }
.op-plus { color: var(--ok); }
.op-minus { color: var(--danger); }

/* doctors: фото из crm3, при отсутствии/ошибке — инициалы на фирменном фоне */
.doc-avatar {
  position: relative; overflow: hidden;
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  background: var(--primary-soft); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; letter-spacing: .5px;
}
.doc-avatar img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
}

/* prices table */
.price-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.price-row:last-child { border-bottom: none; }
.price-row .p { font-weight: 600; white-space: nowrap; color: var(--primary-dark); }

/* tab bar: линейные иконки, активная вкладка — «таблетка» мягкого оранжевого */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10.5px; color: var(--muted); padding: 2px 0;
}
.tab .tab-pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 14px; border-radius: 999px;
  transition: background .15s;
}
.tab .tab-pill svg { width: 22px; height: 22px; }
.tab.active { color: var(--accent-ink); font-weight: 600; }
.tab.active .tab-pill { background: var(--accent-soft); }

/* Центральная кнопка «Запись» — приподнятый оранжевый круг (вариант 2) */
.tab-book { justify-content: flex-end; }
.tab-book .tab-fab {
  display: flex; align-items: center; justify-content: center;
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--accent); color: #fff;
  margin-top: -24px; margin-bottom: 2px;
  box-shadow: 0 4px 12px rgba(248,152,8,.45);
}
.tab-book .tab-fab svg { width: 24px; height: 24px; }
.tab-book.active { color: var(--accent-ink); font-weight: 600; }
.tab-book.active .tab-fab { background: var(--accent-dark); }

/* toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg);
  border-radius: 12px; padding: 12px 18px; font-size: 14px;
  z-index: 50; max-width: 90%;
}

/* skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--line), var(--card), var(--line));
  background-size: 200% 100%; animation: sk 1.2s infinite;
  border-radius: var(--radius); height: 72px; margin-bottom: 10px;
}
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }
.empty .big { font-size: 40px; display: block; margin-bottom: 8px; }
.empty .ic { display: block; margin: 0 auto 10px; color: var(--line); }
.empty .ic { stroke: var(--muted); opacity: .55; }
