/* ============================================================================
   MedQueue 5.56.0: общий стиль публичных страниц.
   Запись на приём, талон, согласие, политика, правила. Один язык
   оформления: шапка, карточки, кнопки, поля, подвал. Без внешних шрифтов
   и библиотек, страница работает и в локальной сети без интернета.
   Раскладка от телефона (360 px) к планшету (768) и ПК (1024+).
   ============================================================================ */

:root {
  --bg: #f4f2ec;
  --surface: #fffefb;
  --surface-2: #f7f5f0;
  --surface-3: #efece4;
  --line: #ded9cd;
  --line-2: #ebe7de;
  --ink: #1b1d1a;
  --ink-2: #3d423c;
  --muted: #676c62;

  --brand-900: #0e2f26;
  --brand-800: #143f33;
  --brand-700: #1a5040;
  --brand-600: #1f5d4c;
  --brand-500: #2a7361;
  --brand-400: #4d9583;
  --brand-200: #bfd9cf;
  --brand-100: #e3efe9;
  --brand-050: #f0f7f3;
  --accent: #c47f17;
  --accent-bg: #fbf1df;

  --ok: #1f6b4f;
  --ok-bg: #e3f1ea;
  --warn: #8a5f12;
  --warn-bg: #fbf1dd;
  --danger: #a3231d;
  --danger-bg: #f9e7e5;
  --info: #1f4f7a;
  --info-bg: #e8f0f7;

  --font: "PT Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Liberation Sans", Arial, sans-serif;
  --serif: "PT Serif", Georgia, "Times New Roman", serif;

  --r-1: 8px;
  --r-2: 12px;
  --r-3: 16px;
  --r-4: 22px;
  --sh-1: 0 1px 2px rgba(20, 40, 32, .05);
  --sh-2: 0 1px 2px rgba(20, 40, 32, .04), 0 8px 24px rgba(20, 40, 32, .07);
  --sh-3: 0 2px 8px rgba(20, 40, 32, .08), 0 24px 60px rgba(20, 40, 32, .16);
  --focus: 0 0 0 3px rgba(42, 115, 97, .28);
  --tap: 48px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); font-size: 16px; line-height: 1.5;
  color: var(--ink); background: var(--bg);
  background-image: radial-gradient(900px 380px at 0% -8%, #e2efe8 0, transparent 62%),
                    radial-gradient(700px 300px at 100% -10%, #efe9da 0, transparent 60%);
  background-repeat: no-repeat;
}
img { max-width: 100%; }
a { color: var(--brand-700); }
a:hover { color: var(--brand-900); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; letter-spacing: -.01em; margin: 0; }
p { margin: 0 0 12px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: none; box-shadow: var(--focus); }
/* Заголовки получают фокус программно (для читалки экрана): без рамки. */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; box-shadow: none; }
.ic { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 26px; height: 26px; }

/* ---------- каркас ---------- */
.pg { max-width: 1160px; margin: 0 auto; padding: 0 20px 48px; }
.pg-narrow { max-width: 680px; }

/* ---------- шапка ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255, 254, 251, .92);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line-2); }
.topbar .in { max-width: 1160px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; text-decoration: none; color: inherit; }
.brand img { width: 44px; height: 44px; object-fit: contain; border-radius: 12px; background: #fff;
  box-shadow: var(--sh-1); padding: 3px; flex: none; }
.brand .bt { min-width: 0; }
.brand b { display: block; font-family: var(--serif); font-size: 17px; line-height: 1.2; color: var(--brand-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-acts { display: flex; gap: 8px; align-items: center; flex: none; }
.tb-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--brand-800); font: inherit; font-weight: 700; font-size: 15px;
  text-decoration: none; cursor: pointer; white-space: nowrap; box-shadow: var(--sh-1); }
.tb-btn:hover { border-color: var(--brand-400); color: var(--brand-900); }
.tb-btn.solid { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.tb-btn.solid:hover { background: var(--brand-800); color: #fff; }
.tb-btn .cnt { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: #fff; color: var(--brand-800); font-size: 12px; font-weight: 800; }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap);
  padding: 10px 18px; border-radius: var(--r-2); border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-weight: 700; font-size: 16px; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, transform .06s; -webkit-tap-highlight-color: transparent; }
.btn:hover { border-color: var(--brand-400); color: var(--brand-900); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: .6; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand-700); }
.btn-ghost:hover { background: var(--brand-050); border-color: transparent; }
.btn-soft { background: var(--brand-050); border-color: var(--brand-100); color: var(--brand-800); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #8a1c17; border-color: #8a1c17; color: #fff; }
.btn-danger-soft { background: #fff; border-color: #e7c3bf; color: var(--danger); }
.btn-danger-soft:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn-sm { min-height: 40px; padding: 7px 14px; font-size: 15px; border-radius: 10px; }
.btn-lg { min-height: 56px; padding: 14px 24px; font-size: 17px; }
.btn-block { width: 100%; }
.btn-back { padding-left: 10px; }
.btn.is-busy::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor;
  border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; padding: 6px 2px; min-height: 36px; color: var(--brand-700); font: inherit;
  font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- карточки ---------- */
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-3); box-shadow: var(--sh-2); }
.card-b { padding: 22px; }
.card-h { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line-2); }
.card-h h2 { font-size: 21px; flex: 1; min-width: 0; }
.card-h .sub { color: var(--muted); font-size: 14px; font-family: var(--font); font-weight: 400; display: block; margin-top: 2px; letter-spacing: 0; }
.card-f { display: flex; gap: 10px; align-items: center; padding: 14px 22px; border-top: 1px solid var(--line-2);
  background: var(--surface); border-radius: 0 0 var(--r-3) var(--r-3); }
.card-f .grow { flex: 1; min-width: 0; }
.card-f .what { font-size: 14px; color: var(--muted); line-height: 1.3; }
.card-f .what b { display: block; color: var(--ink); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- поля ---------- */
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fgrid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.field label .opt { font-weight: 400; color: var(--muted); }
.input { width: 100%; min-height: 52px; padding: 12px 14px; border-radius: var(--r-2); border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-size: 17px; transition: border-color .12s, box-shadow .12s; }
.input:hover { border-color: #cbc5b6; }
.input:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--focus); }
.field .hint { display: block; margin-top: 5px; font-size: 13.5px; color: var(--muted); }
.field.bad .input { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(163, 35, 29, .14); }
.field .err { display: none; margin-top: 5px; font-size: 14px; color: var(--danger); font-weight: 700; }
.field.bad .err { display: block; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-2);
  background: var(--surface-2); border: 1px solid var(--line-2); cursor: pointer; line-height: 1.45; font-size: 15px; }
.check input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--brand-600); cursor: pointer; }
.check.bad { border-color: var(--danger); background: var(--danger-bg); }
.check + .check { margin-top: 10px; }

/* ---------- сообщения ---------- */
.alert { padding: 12px 16px; border-radius: var(--r-2); border: 1px solid var(--line-2); background: var(--surface-2);
  line-height: 1.45; font-size: 15px; }
.alert b { font-weight: 700; }
.alert-info { background: var(--info-bg); border-color: #cddcea; color: #17344f; }
.alert-ok { background: var(--ok-bg); border-color: #c4e0d2; color: #16402f; }
.alert-warn { background: var(--warn-bg); border-color: #ecd6a8; color: #5b3f0c; }
.alert-danger { background: var(--danger-bg); border-color: #edc6c2; color: #6f1712; }
.alert .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px;
  font-weight: 700; background: var(--brand-050); color: var(--brand-800); border: 1px solid var(--brand-100); white-space: nowrap; }
.chip-warn { background: var(--warn-bg); color: var(--warn); border-color: #ecd6a8; }
.chip-danger { background: var(--danger-bg); color: var(--danger); border-color: #edc6c2; }
.chip-muted { background: var(--surface-2); color: var(--muted); border-color: var(--line-2); }

/* ---------- подвал ---------- */
.foot { margin-top: 36px; padding: 20px 0 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px;
  display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; }
.foot a { color: var(--brand-700); }
.foot b { color: var(--ink-2); }

/* ---------- реклама ---------- */
.promo { display: grid; gap: 10px; align-content: start; padding: 16px; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-3); box-shadow: var(--sh-1); }
.promo .pimg { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-2); display: block; background: var(--surface-2); }
.promo h3 { font-size: 17px; }
.promo p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.45; white-space: pre-line; }
.promo .pacts { display: flex; flex-wrap: wrap; gap: 8px; }
.promo .pnote { font-size: 12px; color: var(--muted); line-height: 1.35; }
.promo-tag { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.promo-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

/* ---------- скелет загрузки ---------- */
.skel { border-radius: var(--r-2); background: linear-gradient(90deg, var(--surface-2), #fff, var(--surface-2));
  background-size: 200% 100%; animation: sk 1.2s infinite linear; min-height: 52px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- боковая панель «Мои записи» ---------- */
.drawer-back { position: fixed; inset: 0; z-index: 60; background: rgba(14, 30, 24, .45); display: flex; justify-content: flex-end;
  animation: fade .15s ease-out; }
.drawer { width: min(500px, 100%); height: 100%; background: var(--bg); box-shadow: -12px 0 40px rgba(0, 0, 0, .2);
  display: flex; flex-direction: column; animation: slide .2s ease-out; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(48px); opacity: .5; } }
.drawer > header { display: flex; align-items: center; gap: 12px; padding: 14px 16px 14px 20px; background: var(--surface);
  border-bottom: 1px solid var(--line-2); }
.drawer > header h2 { flex: 1; font-size: 21px; }
.drawer .scroll { flex: 1; overflow: auto; padding: 16px; display: grid; gap: 14px; align-content: start; overscroll-behavior: contain; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); cursor: pointer; flex: none; }
.icon-btn:hover { border-color: var(--brand-400); color: var(--brand-900); }

/* ---------- запись, талон: общие куски ---------- */
.sum { display: grid; grid-template-columns: max-content 1fr auto; gap: 10px 16px; align-items: baseline; margin: 0; }
.sum dt { color: var(--muted); font-size: 15px; }
.sum dd { margin: 0; font-weight: 700; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; }
.deadline { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-2);
  background: var(--accent-bg); border: 1px solid #ecd6a8; line-height: 1.45; font-size: 15px; }
.deadline .ic { color: var(--accent); margin-top: 2px; }
.deadline.off { background: var(--surface-2); border-color: var(--line-2); color: var(--muted); }
.deadline.off .ic { color: var(--muted); }

@media (max-width: 640px) {
  .pg { padding: 0 14px 32px; }
  .topbar .in { padding: 8px 14px; gap: 10px; }
  .brand img { width: 38px; height: 38px; }
  .brand b { font-size: 15px; }
  .brand small { display: none; }
  .tb-btn { padding: 8px 12px; font-size: 14px; }
  .tb-btn .lbl { display: none; }
  .card-b { padding: 16px; }
  .card-h { padding: 12px 16px; }
  .card-h h2 { font-size: 19px; }
  .card-f { padding: 12px 16px; }
  .fgrid { grid-template-columns: 1fr; }
  .sum { grid-template-columns: max-content 1fr; }
  .sum .link-btn { grid-column: 2; justify-self: start; margin-top: -8px; }
  .drawer { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .topbar, .foot, .no-print { display: none !important; } body { background: #fff; } }
