/* Палитра: спокойный тёмно-бирюзовый (доверие, медицина) + тёплый песочный фон + янтарный акцент.
   Все цвета — токены, тёмная тема переопределяет их. */
:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #eef4f3;
  --text: #1b2627;
  --muted: #5a6a6c;
  --line: #dfe3df;
  --primary: #0e6e6b;
  --primary-strong: #0a5250;
  --primary-soft: #e3f0ee;
  --accent: #e08a2e;
  --accent-soft: #fdf0e1;
  --accent-text: #8a4a0c;  /* янтарный для текста: 6:1 на --accent-soft */
  --focus: #a85a0c;        /* рамка фокуса: ≥4,3:1 на светлых фонах */
  --field-line: #7d8a88;   /* граница полей ввода: ≥3:1 на белом и на --bg */
  --on-primary: #ffffff;   /* текст на кнопках с фоном --primary */
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --ok: #2e7d4f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 40, 40, .05), 0 4px 16px rgba(20, 40, 40, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-head: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111717;
    --surface: #182121;
    --surface-2: #1d2a29;
    --text: #e5ecea;
    --muted: #9aaba9;
    --line: #2a3837;
    --primary: #4fb7ae;
    --primary-strong: #7dd0c7;
    --primary-soft: #1b3331;
    --accent: #f0a457;
    --accent-soft: #3a2a17;
    --accent-text: #f0a457;
    --focus: #f0a457;
    --field-line: #5f7472;
    --on-primary: #0b1f1e;
    --danger: #f28b82;
    --danger-soft: #3b1f1d;
    --ok: #6cc58f;
    --shadow: none;
    color-scheme: dark;
  }
}
/* Тёмная тема, выбранная вручную переключателем в шапке (те же значения, что выше) */
:root[data-theme="dark"] {
  --bg: #111717;
  --surface: #182121;
  --surface-2: #1d2a29;
  --text: #e5ecea;
  --muted: #9aaba9;
  --line: #2a3837;
  --primary: #4fb7ae;
  --primary-strong: #7dd0c7;
  --primary-soft: #1b3331;
  --accent: #f0a457;
  --accent-soft: #3a2a17;
  --accent-text: #f0a457;
  --focus: #f0a457;
  --field-line: #5f7472;
  --on-primary: #0b1f1e;
  --danger: #f28b82;
  --danger-soft: #3b1f1d;
  --ok: #6cc58f;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.65 var(--font); }
img { max-width: 100%; height: auto; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-strong); }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin: .2em 0 .4em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); margin: 1.8em 0 .6em; }
h3 { font-size: 1.18rem; margin: 1.5em 0 .4em; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 600; color: var(--primary); margin: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.header-row { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.main-nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.main-nav a { color: var(--text); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .95rem; }
.main-nav a:hover, .main-nav a[aria-current] { background: var(--primary-soft); color: var(--primary-strong); }
.header-search input { width: 200px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--field-line); background: var(--bg); color: var(--text); font: inherit; font-size: .95rem; }
.nav-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; margin-left: auto; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; border-radius: 2px; }
@media (max-width: 1040px) {
  .header-search { display: none; }
  .nav-toggle { display: block; }
  .main-nav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--surface); flex-direction: column; padding: 8px 16px 16px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 12px 10px; }
  .nav-search { display: flex; gap: 8px; margin: 0 0 8px; }
  .nav-search input { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--field-line); background: var(--bg); font-size: 1rem; }
}
@media (min-width: 1041px) { .nav-search { display: none; } }

/* Buttons, forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--primary); color: var(--on-primary); border: 0; border-radius: 10px; padding: 11px 20px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--primary-strong); color: var(--on-primary); }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary-strong); }
.btn-small { padding: 7px 14px; font-size: .9rem; }
input, select, textarea { font: inherit; color: var(--text); }
.search-big { display: flex; gap: 8px; margin: 20px 0; max-width: 560px; }
.search-big input { flex: 1; min-width: 0; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--field-line); background: var(--surface); font-size: 1rem; }

/* Hero */
.hero { background: linear-gradient(180deg, var(--primary-soft), var(--bg)); padding: 48px 0 24px; }
.hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); }
.hero-lead { font-size: 1.15rem; color: var(--muted); max-width: 46ch; }
.hero-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hero-facts li { background: var(--surface); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); border-left: 4px solid var(--primary); }
.hero-facts strong { display: block; }
.hero-facts span { color: var(--muted); font-size: .92rem; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; gap: 16px; } .hero { padding-top: 28px; } }

/* Blocks & cards */
.block { margin: 40px 0; }
.block-tint { background: var(--surface-2); border-radius: var(--radius); padding: 24px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.block-head h2 { margin: 0 0 14px; }
.paths { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.path { position: relative; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 44px 20px 20px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.path:hover { border-color: var(--primary); transform: translateY(-1px); color: var(--text); }
.path-title { display: block; font-weight: 700; font-size: 1.1rem; color: var(--primary-strong); }
.path-text { display: block; color: var(--muted); font-size: .94rem; margin-top: 4px; }
.path-arrow { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--accent); font-size: 1.3rem; }
@media (max-width: 760px) { .paths { grid-template-columns: 1fr; } }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 16px 0; }
.cards-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cards-list { grid-template-columns: 1fr; }
.cards-sm { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card { position: relative; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--text); transition: border-color .15s, box-shadow .15s; }
a.card:hover { border-color: var(--primary); box-shadow: var(--shadow); color: var(--text); }
.card-title { font-weight: 650; line-height: 1.3; color: var(--text); text-decoration: none; }
a.card-title:hover { color: var(--primary); }
.card-text { color: var(--muted); font-size: .92rem; line-height: 1.5; }
.card-eyebrow { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); font-weight: 600; }
.card-drug { border-top: 3px solid var(--primary); }
.card-tool { border-top: 3px solid var(--accent); }
.card-static { gap: 10px; }
.badge { align-self: flex-start; background: var(--accent-soft); color: var(--accent-text); font-size: .75rem; border-radius: 6px; padding: 2px 8px; }
.link-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: .95rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; text-decoration: none; color: var(--text); font-size: .94rem; }
.chip:hover { border-color: var(--primary); color: var(--primary-strong); }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.steps li { counter-increment: s; }
.steps a { display: block; height: 100%; padding: 16px 18px 16px 58px; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.steps a::before { content: counter(s); position: absolute; left: 16px; top: 14px; width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-strong); font-weight: 700; display: grid; place-items: center; }
.steps a:hover { border-color: var(--primary); }
.step-title { display: block; font-weight: 650; }
.step-text { display: block; color: var(--muted); font-size: .9rem; margin-top: 4px; }

/* Breadcrumbs */
.crumbs { font-size: .88rem; color: var(--muted); padding: 16px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--muted); }
.crumbs .sep { opacity: .6; }

/* Article */
.section-head { margin: 8px 0 8px; }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px; }
.article-layout.has-toc { grid-template-columns: minmax(0, 760px) 280px; justify-content: space-between; }
.article { min-width: 0; max-width: 760px; }
.article-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: .9rem; margin: 0 0 20px; }
.reviewed { color: var(--ok); }
.prose > :first-child { margin-top: 0; }
.prose > p:first-child { font-size: 1.12rem; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .3em 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose blockquote { margin: 1.2em 0; padding: 4px 18px; border-left: 4px solid var(--line); color: var(--muted); }
.prose code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.prose pre { background: var(--surface-2); padding: 14px; border-radius: 10px; overflow-x: auto; }
.table-wrap { overflow-x: auto; margin: 1.2em 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .94rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: var(--surface-2); font-weight: 650; }
tbody tr:last-child td { border-bottom: 0; }
.callout { margin: 1.4em 0; padding: 14px 18px; border-radius: 12px; border-left: 4px solid var(--primary); background: var(--primary-soft); }
.callout > :last-child { margin-bottom: 0; }
.callout p { margin: .4em 0; }
.callout-title { font-weight: 700; margin-top: 0 !important; }
.callout-warning { border-left-color: var(--danger); background: var(--danger-soft); }
.callout-tip { border-left-color: var(--accent); background: var(--accent-soft); }
.callout-doctor { border-left-color: var(--ok); }
.drug-card { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0 0 24px; }
.drug-card div { background: var(--surface); padding: 12px 16px; }
.drug-card dt { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.drug-card dd { margin: 2px 0 0; font-weight: 600; }
.drug-card .drug-status dd { color: var(--danger); }
.toc ol { margin: 0; padding-left: 1.2em; font-size: .93rem; }
.toc li { margin: .35em 0; }
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover, .toc a.active { color: var(--primary); }
.toc-inline { display: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 0 0 24px; }
.toc-inline summary { font-weight: 650; cursor: pointer; }
.toc-inline ol { margin-top: 10px; }
.sidebar { position: relative; }
.toc-side { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; padding: 4px 0 4px 18px; border-left: 2px solid var(--line); }
.toc-title { font-weight: 700; margin: 0 0 8px; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
@media (max-width: 1040px) {
  .article-layout.has-toc { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .toc-inline { display: block; }
  .toc-inline li { margin: 0; }
  .toc-inline a { display: block; padding: 7px 0; }
}
.disclaimer { margin: 32px 0; padding: 14px 18px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: .92rem; }
.disclaimer p { margin: 0; }
.related { margin: 40px 0; }
.related h2 { font-size: 1.25rem; }
.home-text { max-width: 820px; }
.notfound { padding: 40px 16px 60px; }

/* Ads */
.ad { margin: 20px auto; text-align: center; }
.ad-in { margin: 28px 0; }
.ad-side { margin-top: 24px; position: sticky; top: 84px; }
.ad-banner { line-height: 0; }
.ad-banner a { display: inline-block; max-width: 100%; }
.ad-banner img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.ad-label { margin: 6px 0 0; font-size: .75rem; line-height: 1.4; color: var(--muted); text-align: center; overflow-wrap: anywhere; }
@media (max-width: 760px) { .only-desktop { display: none !important; } }
@media (min-width: 761px) { .only-mobile { display: none !important; } }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); margin-top: 60px; padding: 36px 0 20px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 32px; }
.footer-grid nav { display: flex; flex-direction: column; gap: 6px; font-size: .94rem; }
.footer-grid nav a { color: var(--text); text-decoration: none; }
.footer-grid nav a:hover { color: var(--primary); }
.footer-name { font-weight: 700; font-size: 1.1rem; margin: 0 0 6px; }
.footer-h { font-weight: 700; margin: 0 0 4px; }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 16px; }
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .footer-grid nav { gap: 0; }
  .footer-grid nav a { padding: 8px 0; }
}

.cookie { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0,0,0,.15); border-radius: 14px; padding: 14px 16px; display: flex; gap: 14px; align-items: center; z-index: 60; font-size: .9rem; }
.cookie[hidden] { display: none; }
.cookie p { margin: 0; }

/* Tools */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 24px 0; box-shadow: var(--shadow); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); }
.field input, .field select { padding: 10px 12px; border: 1px solid var(--field-line); border-radius: 10px; background: var(--bg); font-size: 1rem; color: var(--text); }
.seg { display: flex; border: 1px solid var(--field-line); border-radius: 10px; overflow: hidden; }
.seg label { flex: 1; text-align: center; padding: 9px 6px; cursor: pointer; color: var(--text); font-size: .95rem; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--primary); color: var(--on-primary); }
.seg label:has(input:focus-visible) { box-shadow: inset 0 0 0 3px var(--focus), inset 0 0 0 5px var(--surface); }
.tool-actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.result { margin-top: 18px; padding: 16px; border-radius: 12px; background: var(--surface-2); }
.result:empty { display: none; }
.result-big { font-size: 2rem; font-weight: 700; color: var(--primary-strong); line-height: 1.1; }
.result p { margin: .4em 0; }
.scale { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 12px 0 4px; }
.scale span { flex: 1; }
.scale-marker { position: relative; height: 14px; }
.scale-marker i { position: absolute; top: 0; width: 2px; height: 14px; background: var(--text); }
.diary-table td input { width: 100%; min-width: 70px; padding: 6px 8px; border: 1px solid var(--field-line); border-radius: 6px; background: var(--bg); }
.chart { width: 100%; height: 220px; margin-top: 12px; }
.checklist { list-style: none; padding: 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checklist input { margin-top: 6px; width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
@media print {
  .site-header, .site-footer, .crumbs, .sidebar, .toc, .disclaimer, .related, .cookie, .ad, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .tool { box-shadow: none; border: 0; padding: 0; }
}
