/* ===== Theme tokens ===== */
:root {
  --bg: #eef2fe;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f7ff;
  --text: #131a2b;
  --muted: #5b6479;
  --border: #e3e8f7;
  --primary: #2f6bff;
  --primary-600: #1f57e6;
  --primary-soft: #e2ebff;
  --green: #17b26a;
  --green-soft: #d9f6e6;
  --warn: #e5a400;
  --crit: #e5484d;
  --shadow: 0 18px 40px -18px rgba(37, 62, 130, 0.35);
  --shadow-sm: 0 8px 20px -12px rgba(37, 62, 130, 0.3);
  --radius: 20px;
  --radius-sm: 14px;
}

html[data-theme="dark"] {
  --bg: #0c1122;
  --bg-alt: #0f1630;
  --surface: #141c37;
  --surface-2: #1a2344;
  --text: #eaeefc;
  --muted: #9aa4c2;
  --border: #263153;
  --primary: #5b8bff;
  --primary-600: #4a7bf5;
  --primary-soft: #1c2c56;
  --green: #33cc82;
  --green-soft: #133a2b;
  --crit: #ff6b6f;
  --shadow: 0 22px 48px -20px rgba(0, 0, 0, 0.7);
  --shadow-sm: 0 10px 24px -14px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
p { margin: 0; }
img, svg { display: block; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px;
}
.container--narrow { max-width: 820px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.accent { color: var(--primary); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 15px; border: 0; cursor: pointer;
  padding: 11px 20px; border-radius: 999px; transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--lg { padding: 14px 26px; font-size: 16px; }
.btn--primary { background: var(--primary); color: #fff; box-shadow: 0 10px 22px -10px var(--primary); }
.btn--primary:hover { background: var(--primary-600); }
.btn--soft { background: var(--primary-soft); color: var(--primary); }
.btn--soft:hover { filter: brightness(.97); }
.btn--ghost { background: transparent; color: var(--text); }
.btn--ghost:hover { background: var(--surface-2); }

/* ===== Header ===== */
.header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header__inner { display: flex; align-items: center; gap: 24px; height: 70px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-size: 19px; color: var(--text); }
.logo__mark { color: var(--primary); display: inline-flex; }
.logo__text strong { color: var(--primary); font-weight: 800; }
.logo__text { font-weight: 600; }

.nav { display: flex; gap: 26px; margin-left: 14px; }
.nav a { color: var(--muted); font-weight: 600; font-size: 15px; transition: color .2s; }
.nav a:hover { color: var(--text); }

.header__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: background .2s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }

.burger { display: none; flex-direction: column; gap: 5px; width: 42px; height: 42px; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; cursor: pointer; align-items: center; justify-content: center; }
.burger span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: .25s; }

/* ===== Hero ===== */
.hero { padding: 64px 0 0; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -30% 40% auto -10%; height: 620px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--primary) 30%, transparent), transparent);
  filter: blur(20px); z-index: 0; opacity: .55;
}
.hero__inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
.badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: var(--primary-soft); color: var(--primary); margin-bottom: 18px;
}
.badge--soft { background: var(--surface); border: 1px solid var(--border); }
.hero h1 { font-size: clamp(34px, 5vw, 54px); font-weight: 800; }
.hero__lead { margin-top: 18px; font-size: 18px; color: var(--muted); max-width: 540px; }
.hero__cta { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero__perks { list-style: none; display: flex; flex-wrap: wrap; gap: 18px; padding: 0; margin: 26px 0 0; }
.hero__perks li { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; color: var(--muted); }
.hero__perks svg { color: var(--green); }

/* Hero floating cards */
.hero__card { position: relative; display: grid; gap: 16px; }
.mini-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.mini-card--appt { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.mini-card__row { display: flex; align-items: center; gap: 12px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dot--blue { background: var(--primary); box-shadow: 0 0 0 5px var(--primary-soft); }
.mini-card__title { font-weight: 700; }
.mini-card__sub { font-size: 13px; color: var(--muted); }
.mini-card__btn { background: var(--primary); color: #fff; padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.mini-card__btn--green { background: var(--green); }
.mini-card__head { font-weight: 700; margin-bottom: 12px; }
.result-line { display: flex; justify-content: space-between; font-size: 14px; padding: 5px 0; color: var(--muted); }
.result-line b { color: var(--text); }
.result-line .ok { color: var(--green); }
.result-line .warn { color: var(--warn); }
.result-line .crit { color: var(--crit); }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; margin: 10px 0 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--green)); border-radius: 999px; }
.mini-card__foot { font-size: 12px; color: var(--muted); }
.mini-card--pay { display: flex; align-items: center; justify-content: space-between; }
.mini-card__amount { font-size: 24px; font-weight: 800; }
.mini-card__free { font-size: 16px; font-weight: 800; margin-top: 2px; }

/* Stats */
.stats { margin-top: 64px; }
.stats__inner {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-sm);
}
.stat { text-align: center; }
.stat b { display: block; font-size: 30px; font-weight: 800; color: var(--primary); }
.stat span { font-size: 14px; color: var(--muted); }

/* ===== Sections ===== */
.section { padding: 84px 0; }
.section--alt { background: var(--bg-alt); }
.section__head { text-align: center; max-width: 620px; margin: 0 auto 48px; }
.section__head h2 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 800; margin-top: 10px; }
.section__head p { color: var(--muted); margin-top: 12px; font-size: 17px; }

.grid { display: grid; gap: 20px; }
.grid--services { grid-template-columns: repeat(3, 1fr); }
.grid--doctors { grid-template-columns: repeat(4, 1fr); }
.grid--steps { grid-template-columns: repeat(3, 1fr); }

/* Feature cards */
.feature {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.feature__icon {
  width: 52px; height: 52px; border-radius: 15px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); margin-bottom: 16px;
}
.feature h3 { font-size: 19px; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: 15px; }

/* Cabinet */
.cabinet { display: grid; grid-template-columns: 1fr 1fr; gap: 52px; align-items: center; }
.cabinet__text h2 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 800; margin: 10px 0 14px; }
.cabinet__text > p { color: var(--muted); font-size: 17px; }
.check-list { list-style: none; padding: 0; margin: 22px 0 28px; display: grid; gap: 12px; }
.check-list li { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.check-list svg { color: var(--green); flex: none; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 22px; box-shadow: var(--shadow); }
.panel__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel__user { display: flex; align-items: center; gap: 12px; }
.avatar { width: 46px; height: 46px; border-radius: 14px; background: var(--primary); color: #fff; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.panel__name { font-weight: 700; }
.panel__id { font-size: 13px; color: var(--muted); }
.panel__badge { font-size: 12px; font-weight: 700; color: var(--green); background: var(--green-soft); padding: 6px 12px; border-radius: 999px; }
.panel__tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.tile { border-radius: 16px; padding: 16px; color: #fff; }
.tile--blue { background: linear-gradient(135deg, var(--primary), var(--primary-600)); }
.tile--green { background: linear-gradient(135deg, var(--green), #0f9d5b); }
.tile__label { font-size: 12px; opacity: .9; }
.tile__value { display: block; font-size: 22px; font-weight: 800; margin: 4px 0 2px; }
.tile__meta { font-size: 12px; opacity: .9; }
.panel__list { display: grid; gap: 10px; }
.pl-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.pl-ic { width: 34px; height: 34px; border-radius: 10px; flex: none; background: var(--primary-soft); position: relative; }
.pl-ic::after { content: ""; position: absolute; inset: 9px; border-radius: 4px; background: var(--primary); opacity: .85; }
.ic-rx::after { background: var(--warn); }
.ic-pay::after { background: var(--green); }
.pl-main { flex: 1; }
.pl-main b { display: block; font-size: 14px; }
.pl-main span { font-size: 12px; color: var(--muted); }
.pl-tag { font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 5px 10px; border-radius: 999px; }
.pl-tag--muted { color: var(--muted); background: var(--surface); border: 1px solid var(--border); }
.pl-tag--green { color: var(--green); background: var(--green-soft); }

/* Doctors / specialties */
.spec {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; text-align: center; transition: transform .2s, box-shadow .2s;
}
.spec:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.spec__ic { font-size: 34px; display: block; margin-bottom: 10px; }
.spec h4 { font-size: 17px; }
.spec__meta { font-size: 13px; color: var(--muted); }

/* Steps */
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.step__num { width: 44px; height: 44px; border-radius: 14px; background: var(--primary); color: #fff; font-weight: 800; font-size: 20px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.step h3 { font-size: 19px; margin-bottom: 8px; }
.step p { color: var(--muted); }

/* CTA */
.cta { padding: 20px 0 84px; }
.cta__inner {
  background: linear-gradient(135deg, var(--primary), var(--primary-600));
  border-radius: 28px; padding: 44px; color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 30px; flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.cta__text h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; }
.cta__text p { opacity: .92; margin-top: 8px; }
.cta__form { display: flex; gap: 10px; flex-wrap: wrap; }
.cta__form input {
  border: 0; border-radius: 999px; padding: 14px 20px; font-size: 16px; min-width: 240px;
  font-family: inherit; background: #fff; color: #131a2b;
}
.cta__form input:focus { outline: 3px solid rgba(255,255,255,.5); }
.cta__form .btn--primary { background: #fff; color: var(--primary); }
.cta__form .btn--primary:hover { background: #f0f4ff; }

/* FAQ */
.faq { display: grid; gap: 12px; }
.faq__item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 20px; }
.faq__item summary { list-style: none; cursor: pointer; font-weight: 700; padding: 16px 0; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after { content: "+"; font-size: 22px; color: var(--primary); font-weight: 700; transition: transform .2s; }
.faq__item[open] summary::after { transform: rotate(45deg); }
.faq__item p { color: var(--muted); padding: 0 0 18px; }

/* Footer */
.footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 56px 0 28px; }
.footer__inner { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; }
.footer__brand p { color: var(--muted); font-size: 14px; margin-top: 14px; max-width: 320px; }
.footer__col h5 { font-size: 15px; margin-bottom: 14px; }
.footer__col a, .footer__col p { display: block; color: var(--muted); font-size: 14px; margin-bottom: 9px; transition: color .2s; }
.footer__col a:hover { color: var(--primary); }
.footer__bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.footer__links { display: flex; gap: 20px; }
.footer__links a:hover { color: var(--primary); }
.footer__link-btn {
  display: block; background: none; border: 0; padding: 0; font: inherit;
  color: var(--muted); font-size: 14px; margin-bottom: 9px; cursor: pointer; text-align: left;
  transition: color .2s;
}
.footer__link-btn:hover { color: var(--primary); }

button.mini-card__btn {
  border: 0; cursor: pointer; font-family: inherit;
}

/* ===== Auth modal ===== */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; pointer-events: none; opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
  overflow-y: auto;
}
.modal.is-open { pointer-events: auto; opacity: 1; visibility: visible; }
.modal__overlay {
  position: absolute; inset: 0; background: rgba(10, 16, 35, .55);
  backdrop-filter: blur(6px);
}
.modal__dialog {
  position: relative; width: 100%; max-width: 440px;
  max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; padding: 28px; box-shadow: var(--shadow);
  transform: translateY(16px) scale(.98);
  transition: transform .25s ease;
}
.modal.is-open .modal__dialog { transform: translateY(0) scale(1); }
.modal__close {
  position: absolute; top: 16px; right: 16px;
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.modal__close:hover { background: var(--primary-soft); }
.modal__head { text-align: center; margin-bottom: 22px; }
.modal__logo { color: var(--primary); display: inline-flex; margin-bottom: 12px; }
.modal__head h2 { font-size: 24px; font-weight: 800; }
.modal__head p { color: var(--muted); font-size: 14px; margin-top: 8px; }
.modal__tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 5px; margin-bottom: 22px;
}
.modal__tab {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-weight: 700; font-size: 14px;
  padding: 11px 12px; border-radius: 10px; cursor: pointer;
  transition: background .2s, color .2s;
}
.modal__tab.is-active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.modal__form { display: grid; gap: 14px; }
.modal__form.is-hidden { display: none; }

.social-login {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn--social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
}
.btn--social:hover {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}
.btn--social:active {
  transform: translateY(1px);
}
.btn--social svg {
  width: 24px;
  height: 24px;
  flex: none;
}

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input[type="text"],
.field input[type="tel"],
.field input[type="password"] {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 15px;
  padding: 13px 16px; border-radius: 14px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
.field--check {
  display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--muted);
}
.field--check input { margin-top: 3px; accent-color: var(--primary); }
.field--check a { color: var(--primary); }
.btn--block { width: 100%; }
.modal__link {
  border: 0; background: none; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--primary); cursor: pointer; padding: 4px 0; text-align: center;
}
.modal__link:hover { text-decoration: underline; }
body.modal-open { overflow: hidden; }

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .nav { display: none; position: absolute; top: 70px; left: 0; right: 0; flex-direction: column; gap: 0; background: var(--bg-alt); border-bottom: 1px solid var(--border); padding: 8px 22px 16px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .burger { display: inline-flex; }
  .hero__inner { grid-template-columns: 1fr; gap: 40px; }
  .cabinet { grid-template-columns: 1fr; gap: 40px; }
  .grid--services, .grid--steps { grid-template-columns: repeat(2, 1fr); }
  .grid--doctors { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .header__actions .btn--ghost { display: none; }
  .header__actions .btn--primary { padding: 9px 16px; font-size: 14px; }
  .stats__inner { grid-template-columns: repeat(2, 1fr); gap: 22px; padding: 20px; }
  .grid--services, .grid--steps { grid-template-columns: 1fr; }
  .grid--doctors { grid-template-columns: repeat(2, 1fr); }
  .section { padding: 50px 0; }
  .cta__inner { padding: 28px; }
  .cta__form input { min-width: 100%; }
  .cta__form { width: 100%; }
  .cta__form .btn { flex: 1; }
  .footer__inner { grid-template-columns: 1fr 1fr; gap: 28px; }
}
@media (max-width: 480px) {
  .header__inner { gap: 12px; }
  .logo { font-size: 17px; }
  .hero__cta { flex-direction: column; }
  .hero__cta .btn { width: 100%; }
  .hero__perks { flex-direction: column; gap: 12px; }
  .mini-card--appt, .mini-card--pay { flex-direction: column; align-items: flex-start; gap: 14px; }
  .mini-card__btn { width: 100%; text-align: center; }
  .stats__inner { gap: 16px; padding: 16px; }
  .stat b { font-size: 24px; }
  .grid--doctors { grid-template-columns: 1fr; }
  .panel__tiles { grid-template-columns: 1fr; }
  .footer__inner { grid-template-columns: 1fr; gap: 24px; }
  .footer__bottom { flex-direction: column; align-items: flex-start; gap: 12px; }
  .modal__dialog { padding: 20px; }
  .btn--social { font-size: 14px; padding: 10px 14px; }
}
