/* ═══════════════════════════════════════════════════════════════════════
   core.css — VeteranX • Obsidian / VS Code Dark Theme
   Тёмный минимализм, редакторная эстетика, чёткие границы, моноширинный код
   ═══════════════════════════════════════════════════════════════════════ */

/* ── CSS Переменные (Obsidian Dark Palette) ────── */
:root {
  color-scheme: dark;

  /* Фоны */
  --c-bg:            #1e1e1e;
  --c-bg-secondary:  #252526;
  --c-bg-card:       #2d2d30;
  --c-bg-input:      #1e1e1e;
  --c-bg-hover:      #37373d;

  /* Текст */
  --c-text:           #d4d4d4;
  --c-text-secondary: #858585;
  --c-text-muted:     #6a6a6a;

  /* Границы */
  --c-border:        #3c3c3c;
  --c-border-focus:  #007acc;

  /* Акцент */
  --c-accent:        #007acc;
  --c-accent-hover:  #1177bb;
  --c-accent-light:  #1a3040;

  /* Семантика */
  --c-success:       #4ec07a;
  --c-success-bg:    #1a3020;
  --c-warning:       #d89f5c;
  --c-warning-bg:    #302820;
  --c-danger:        #e0556a;
  --c-danger-bg:     #301a1e;
  --c-info:          #5a9cba;
  --c-info-bg:       #1a2830;

  /* Тени (едва заметные в тёмной теме) */
  --c-shadow:    0 1px 2px rgba(0,0,0,.3);
  --c-shadow-lg: 0 4px 12px rgba(0,0,0,.4);
  --c-overlay:   rgba(0,0,0,.6);

  /* Типографика */
  --font:       -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:  "Consolas", "Monaco", "SF Mono", "Fira Code", monospace;
  --fs-xs:   0.75rem;
  --fs-sm:   0.8125rem;
  --fs-base: 0.9375rem;
  --fs-lg:   1.0625rem;
  --fs-xl:   1.25rem;
  --fs-2xl:  1.5rem;
  --fs-3xl:  1.875rem;
  --fs-hero: clamp(2rem, 5vw, 3rem);
  --lh-tight:  1.2;
  --lh-normal: 1.6;
  --lh-relaxed:1.75;

  /* Размеры */
  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 8px;
  --radius-xl: 10px;
  --touch-target: 44px;
  --max-width:    1200px;
  --content-width:780px;

  /* Анимации */
  --tr-fast:   0.12s ease;
  --tr-normal: 0.18s ease;
  --tr-slow:   0.25s ease;

  /* Z-index */
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  300;
  --z-modal:    400;
  --z-toast:    500;
  --z-tooltip:  600;
}

/* Системная тема = всегда тёмная (Obsidian-стиль) */
[data-theme="system"] {
  /* наследует :root — уже тёмный */
}

/* Явная тёмная тема — идентична :root */
[data-theme="dark"] {}

/* Светлая тема — не используется по умолчанию, но пусть будет */
[data-theme="light"] {
  --c-bg:            #ffffff;
  --c-bg-secondary:  #f3f3f3;
  --c-bg-card:       #ffffff;
  --c-bg-input:      #f0f0f0;
  --c-bg-hover:      #e8e8e8;
  --c-text:           #1a1a1a;
  --c-text-secondary: #666666;
  --c-text-muted:     #999999;
  --c-border:         #d4d4d4;
  --c-border-focus:   #007acc;
  --c-accent:         #007acc;
  --c-accent-hover:   #005a9e;
  --c-accent-light:   #e6f3ff;
  --c-success:        #22863a;
  --c-success-bg:     #e6ffed;
  --c-warning:        #b08800;
  --c-warning-bg:     #fffbe6;
  --c-danger:         #cb2431;
  --c-danger-bg:      #ffeef0;
  --c-info:           #0366d6;
  --c-info-bg:        #f1f8ff;
  --c-shadow:    0 1px 3px rgba(0,0,0,.08);
  --c-shadow-lg: 0 6px 16px rgba(0,0,0,.1);
  --c-overlay:   rgba(0,0,0,.4);
}


/* ═══════════════════════════════════════════════════════════════════════
   БАЗОВЫЕ СТИЛИ
   ═══════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ── Scrollbar (WebKit) ────────────────────────── */
::-webkit-scrollbar            { width: 8px; height: 8px; }
::-webkit-scrollbar-track      { background: transparent; }
::-webkit-scrollbar-thumb      { background: #424242; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ── Skip link ─────────────────────────────────── */
.skip-link {
  position: absolute; top: -100px; left: 8px;
  z-index: var(--z-tooltip); padding: 8px 16px;
  background: var(--c-accent); color: #fff;
  border-radius: var(--radius-sm); font-weight: 600;
  text-decoration: none; font-size: var(--fs-sm);
}
.skip-link:focus { top: 8px; }


/* ═══════════════════════════════════════════════════════════════════════
   ТИПОГРАФИКА
   ═══════════════════════════════════════════════════════════════════════ */
h1, h2, h3, h4 {
  line-height: var(--lh-tight);
  font-weight: 600;
  color: var(--c-text);
}
h1 { font-size: var(--fs-3xl); padding-bottom: .25em; border-bottom: 1px solid var(--c-border); margin-bottom: .5em; }
h2 { font-size: var(--fs-2xl); padding-bottom: .2em; border-bottom: 1px solid var(--c-border); margin-bottom: .75em; }
h3 { font-size: var(--fs-xl); margin-bottom: .5em; font-weight: 600; }
h4 { font-size: var(--fs-lg); margin-bottom: .25em; }

a {
  color: var(--c-accent);
  text-decoration: none;
  transition: color var(--tr-fast);
}
a:hover { text-decoration: underline; color: var(--c-accent-hover); }

p { margin-bottom: .75em; }
ul, ol { margin-bottom: .75em; padding-left: 1.5em; }
li { margin-bottom: .25em; }

strong { font-weight: 600; color: var(--c-text); }

code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--c-bg-input);
  color: var(--c-accent);
  padding: .15em .45em;
  border-radius: 3px;
  border: 1px solid var(--c-border);
}

pre {
  font-family: var(--font-mono);
  background: var(--c-bg-input);
  color: var(--c-text);
  padding: 1em;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  overflow-x: auto;
  line-height: 1.5;
  font-size: var(--fs-sm);
}

blockquote {
  border-left: 3px solid var(--c-accent);
  padding: .5em 1em;
  margin: 1em 0;
  color: var(--c-text-secondary);
  background: var(--c-bg-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
}

hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 1.5em 0;
}

/* ── Визуально скрытые ─────────────────────────── */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}


/* ═══════════════════════════════════════════════════════════════════════
   КНОПКИ
   ═══════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .5em 1em; font-size: var(--fs-sm); font-weight: 500;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  cursor: pointer; transition: all var(--tr-fast); line-height: 1.4;
  min-height: 36px; white-space: nowrap;
  font-family: var(--font); letter-spacing: .01em;
  background: var(--c-bg-card); color: var(--c-text);
}
.btn:hover { background: var(--c-bg-hover); border-color: var(--c-text-muted); }
.btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 1px; }

.btn--primary {
  background: var(--c-accent); color: #fff; border-color: var(--c-accent);
  font-weight: 600;
}
.btn--primary:hover { background: var(--c-accent-hover); border-color: var(--c-accent-hover); }

.btn--ghost {
  background: transparent; border-color: transparent; color: var(--c-text-secondary);
}
.btn--ghost:hover { background: var(--c-bg-hover); color: var(--c-text); }

.btn--outline {
  background: transparent; color: var(--c-accent); border-color: var(--c-accent);
}
.btn--outline:hover { background: var(--c-accent); color: #fff; }

.btn--icon {
  padding: .4em; min-width: 36px; min-height: 36px;
  font-size: var(--fs-lg); background: transparent; border-color: transparent;
  color: var(--c-text-secondary); border-radius: var(--radius-sm);
}
.btn--icon:hover { background: var(--c-bg-hover); color: var(--c-text); }

.btn--sm { padding: .3em .65em; font-size: var(--fs-xs); min-height: 28px; }


/* ═══════════════════════════════════════════════════════════════════════
   ШАПКА + МЕГА-МЕНЮ
   ═══════════════════════════════════════════════════════════════════════ */
.site-header {
  background: var(--c-bg-secondary);
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; z-index: var(--z-sticky);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--max-width); margin: 0 auto;
  padding: .35rem .75rem; gap: .75rem;
}
.logo-link { display: flex; align-items: center; flex-shrink: 0; }
.logo { height: 28px; width: auto; }

/* Офлайн-бейдж */
.offline-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 99px;
  font-weight: 600; letter-spacing: .02em;
  border: 1px solid var(--c-border);
}
.offline-badge--online  { background: var(--c-success-bg); color: var(--c-success); border-color: transparent; }
.offline-badge--offline { background: var(--c-warning-bg); color: var(--c-warning); border-color: transparent; }

/* Тема */
.theme-toggle {
  background: none; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  padding: 3px 7px; cursor: pointer; font-size: 1rem; line-height: 1;
  min-height: 34px; min-width: 34px; color: var(--c-text-secondary);
  transition: all var(--tr-fast);
}
.theme-toggle:hover { border-color: var(--c-accent); color: var(--c-accent); }
.header-actions { display: flex; align-items: center; gap: .4em; flex-shrink: 0; }

/* ── Мега-меню ─────────────────────────────────── */
.megamenu { position: relative; flex: 1; min-width: 0; }
.megamenu__toggle {
  display: none; background: none; border: none; cursor: pointer;
  padding: 6px 7px; flex-direction: column; gap: 5px; z-index: 101;
  border-radius: var(--radius-sm); transition: background var(--tr-fast);
}
.megamenu__toggle:hover { background: var(--c-bg-hover); }
.burger-line {
  display: block; width: 20px; height: 2px;
  background: var(--c-text); border-radius: 2px;
  transition: all .2s ease;
}
.megamenu__toggle.is-open .burger-line:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.megamenu__toggle.is-open .burger-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
.megamenu__toggle.is-open .burger-line:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

.megamenu__list {
  display: flex; gap: 1px; list-style: none; margin: 0; padding: 0;
  flex-wrap: wrap; align-items: center;
}
.megamenu__home {
  font-weight: 600; font-size: var(--fs-sm); padding: .4em .65em;
  color: var(--c-accent); text-decoration: none; border-radius: var(--radius-sm);
  transition: all var(--tr-fast);
}
.megamenu__home:hover { background: var(--c-accent-light); text-decoration: none; }

.megamenu__item { position: relative; }
.megamenu__item > a,
.megamenu__cat {
  display: block; padding: .35em .55em; font-size: 12px;
  color: var(--c-text-secondary); cursor: pointer; white-space: nowrap;
  border-radius: var(--radius-sm); transition: all .15s ease;
  text-decoration: none; font-weight: 500;
}
.megamenu__item > a:hover,
.megamenu__cat:hover {
  background: var(--c-bg-hover); color: var(--c-text); text-decoration: none;
}
.megamenu__cat { position: relative; padding-right: 1.1em; }
.megamenu__cat::after {
  content: ''; position: absolute; right: .35em; top: 50%;
  width: 5px; height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-75%) rotate(45deg);
  transition: transform .15s ease; opacity: .6;
}
.megamenu__item.has-submenu:hover .megamenu__cat::after {
  transform: translateY(-35%) rotate(-135deg); opacity: 1;
}

.megamenu__sub {
  display: none; position: absolute; top: calc(100% + 3px); left: 0;
  background: var(--c-bg-secondary); border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--c-shadow-lg);
  min-width: 240px; max-height: 400px; overflow-y: auto;
  z-index: var(--z-dropdown); list-style: none; padding: .35em 0;
  animation: menuIn .12s ease;
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.megamenu__item.has-submenu:hover .megamenu__sub,
.megamenu__item.has-submenu:focus-within .megamenu__sub { display: block; }

.megamenu__sub a {
  display: block; padding: .45em .85em; font-size: 12px;
  color: var(--c-text); text-decoration: none;
  transition: all .1s ease;
  border-left: 2px solid transparent;
}
.megamenu__sub a:hover {
  background: var(--c-bg-hover); color: var(--c-accent);
  border-left-color: var(--c-accent);
}

/* ── Мобильное меню ────────────────────────────── */
@media (max-width: 768px) {
  .megamenu__toggle { display: flex; }
  .megamenu__list {
    display: none; position: fixed; top: 46px; left: 0; right: 0; bottom: 0;
    background: var(--c-bg); z-index: 100; flex-direction: column;
    align-items: stretch; overflow-y: auto; padding: .5em; gap: 0;
  }
  .megamenu__list.is-open { display: flex; }
  .megamenu__item { border-bottom: 1px solid var(--c-border); }
  .megamenu__item > a,
  .megamenu__cat { padding: .75em 1em; font-size: var(--fs-base); border-radius: 0; }
  .megamenu__cat { padding-right: 2.5em; }
  .megamenu__cat::after { right: 1em; width: 7px; height: 7px; }
  .megamenu__sub {
    display: none; position: static; box-shadow: none; border: none;
    max-height: none; background: var(--c-bg-secondary); border-radius: 0;
    padding: 0; animation: none;
  }
  .megamenu__item.has-submenu.open .megamenu__sub { display: block; }
  .megamenu__sub a { padding: .6em 1.5em; }
  .megamenu__sub a:hover { border-left-color: transparent; }
  body.menu-open { overflow: hidden; }
  .header-inner { padding: .25em .5em; }
  .header-actions { gap: .2em; }
  .offline-badge { font-size: 10px; padding: 1px 5px; }
}


/* ═══════════════════════════════════════════════════════════════════════
   ХЛЕБНЫЕ КРОШКИ
   ═══════════════════════════════════════════════════════════════════════ */
.breadcrumbs {
  max-width: var(--max-width); margin: .6em auto 0; padding: 0 1em;
  font-size: var(--fs-xs); color: var(--c-text-muted);
}
.breadcrumbs a { color: var(--c-text-muted); }
.breadcrumbs a:hover { color: var(--c-accent); text-decoration: none; }
.breadcrumbs span { color: var(--c-text-secondary); }


/* ═══════════════════════════════════════════════════════════════════════
   ОСНОВНОЙ КОНТЕНТ
   ═══════════════════════════════════════════════════════════════════════ */
.page { max-width: var(--max-width); margin: 0 auto; padding: 0 1em 3em; }
.page__head { margin: 1.5em 0 1em; }
.page__head h1 { border-bottom: 1px solid var(--c-border); padding-bottom: .3em; margin-bottom: .3em; }
.lead { font-size: var(--fs-lg); color: var(--c-text-secondary); max-width: var(--content-width); }
.meta { font-size: var(--fs-xs); color: var(--c-text-muted); margin-top: .4em; }


/* ═══════════════════════════════════════════════════════════════════════
   КАЛЬКУЛЯТОР — СЕТКА И КАРТОЧКИ
   ═══════════════════════════════════════════════════════════════════════ */
.calc { margin: 1.5em 0; }
.calc__grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.25em;
  align-items: start;
}

.calc-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25em;
}


/* ═══════════════════════════════════════════════════════════════════════
   ФОРМА
   ═══════════════════════════════════════════════════════════════════════ */
.calc__fieldset { border: none; }
.calc__legend {
  font-size: var(--fs-base); font-weight: 600; margin-bottom: 1em;
  padding-bottom: .5em; border-bottom: 1px solid var(--c-border);
  width: 100%; display: block; color: var(--c-text);
}
.calc__field { margin-bottom: 1.1em; }
.calc__label {
  display: block; font-size: var(--fs-sm); font-weight: 500;
  color: var(--c-text-secondary); margin-bottom: .3em;
}
.calc__hint {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; font-size: 10px; font-weight: 700;
  border-radius: 50%; border: 1px solid var(--c-border);
  background: var(--c-bg-hover); color: var(--c-text-muted);
  cursor: pointer; margin-left: 3px; vertical-align: middle;
  transition: all var(--tr-fast);
}
.calc__hint:hover { background: var(--c-accent-light); color: var(--c-accent); border-color: var(--c-accent); }

.calc__input {
  width: 100%; padding: .5em .65em; font-size: var(--fs-base);
  font-family: var(--font); border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); background: var(--c-bg-input);
  color: var(--c-text); transition: all var(--tr-fast);
  min-height: 38px;
}
.calc__input:focus {
  border-color: var(--c-accent); outline: none;
  box-shadow: 0 0 0 2px rgba(0,122,204,.2);
}
.calc__input.is-invalid,
.calc__input[aria-invalid="true"] {
  border-color: var(--c-danger);
  box-shadow: 0 0 0 2px rgba(224,85,106,.2);
}

.calc__input-affix { position: relative; display: flex; align-items: center; }
.calc__input-affix .calc__input { padding-right: 2.5em; }
.calc__input-suffix {
  position: absolute; right: .7em; font-size: var(--fs-sm);
  color: var(--c-text-muted); pointer-events: none; font-weight: 500;
}
.calc__term-unit {
  position: absolute; right: .2em; font-size: var(--fs-sm);
  border: 1px solid var(--c-border); background: var(--c-bg-hover);
  color: var(--c-text); padding: 3px 5px; border-radius: var(--radius-sm);
  cursor: pointer; font-family: var(--font);
}
.calc__term-unit:hover { background: var(--c-bg-card); }

/* Segmented control */
.calc__segmented {
  display: inline-flex; border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--c-bg-input);
}
.calc__seg-btn {
  padding: .4em .9em; font-size: var(--fs-sm); font-weight: 500;
  border: none; background: transparent; color: var(--c-text-secondary);
  cursor: pointer; transition: all var(--tr-fast); font-family: var(--font);
  min-height: 34px; border-right: 1px solid var(--c-border);
}
.calc__seg-btn:last-child { border-right: none; }
.calc__seg-btn.is-active { background: var(--c-accent); color: #fff; }
.calc__seg-btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: -2px; }

/* Slider */
.calc__slider {
  width: 100%; margin-top: .4em; -webkit-appearance: none; appearance: none;
  height: 4px; background: var(--c-border); border-radius: 2px; outline: none;
}
.calc__slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--c-accent); cursor: pointer; border: 2px solid var(--c-bg-card);
}
.calc__slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--c-accent); cursor: pointer; border: 2px solid var(--c-bg-card);
}

/* Presets */
.calc__presets { display: flex; gap: .35em; margin-top: .4em; flex-wrap: wrap; }
.calc__preset {
  padding: .2em .65em; font-size: var(--fs-xs); font-weight: 500;
  border: 1px solid var(--c-border); border-radius: 99px;
  background: var(--c-bg-hover); color: var(--c-text-secondary);
  cursor: pointer; transition: all var(--tr-fast); font-family: var(--font);
}
.calc__preset:hover { background: var(--c-accent-light); color: var(--c-accent); border-color: var(--c-accent); }

/* Checkbox */
.calc__checkbox {
  display: flex; align-items: center; gap: .4em; cursor: pointer;
  font-size: var(--fs-sm); color: var(--c-text-secondary);
}

/* Actions row */
.calc__actions-row { display: flex; gap: .6em; margin-top: 1.25em; flex-wrap: wrap; }

/* Error */
.calc__error { font-size: var(--fs-xs); color: var(--c-danger); margin-top: .2em; min-height: 1.2em; }

/* Advanced */
.calc__advanced { margin-top: .85em; border-top: 1px solid var(--c-border); padding-top: .5em; }
.calc__advanced-summary {
  font-size: var(--fs-sm); font-weight: 500; color: var(--c-text-secondary);
  cursor: pointer; padding: .35em 0; user-select: none;
}
.calc__advanced-summary:hover { color: var(--c-accent); }

/* Modes (tabs) */
.calc__modes { display: flex; gap: 0; margin-bottom: 1em; border-bottom: 1px solid var(--c-border); }
.calc__mode-btn {
  padding: .45em .9em; font-size: var(--fs-sm); font-weight: 500;
  border: none; border-bottom: 2px solid transparent;
  background: transparent; color: var(--c-text-secondary);
  cursor: pointer; transition: all var(--tr-fast); font-family: var(--font);
  margin-bottom: -1px;
}
.calc__mode-btn:hover { color: var(--c-text); }
.calc__mode-btn.is-active { color: var(--c-accent); border-bottom-color: var(--c-accent); }

/* Tooltip */
.calc__tooltip {
  position: absolute; z-index: var(--z-tooltip);
  background: var(--c-bg-card); color: var(--c-text);
  font-size: var(--fs-xs); border: 1px solid var(--c-border);
  padding: .5em .75em; border-radius: var(--radius-sm); max-width: 280px;
  box-shadow: var(--c-shadow-lg); line-height: var(--lh-normal); margin-top: 4px;
}


/* ═══════════════════════════════════════════════════════════════════════
   РЕЗУЛЬТАТ
   ═══════════════════════════════════════════════════════════════════════ */
.result-hero {
  text-align: center; padding: 1.25em 0;
  border-bottom: 1px solid var(--c-border); margin-bottom: .85em;
}
.result-hero__value {
  display: block; font-size: var(--fs-hero); font-weight: 700;
  color: var(--c-accent); line-height: 1.1; font-family: var(--font-mono);
  letter-spacing: -.02em;
}
.result-hero__label {
  display: block; font-size: var(--fs-sm); color: var(--c-text-secondary);
  margin-top: .2em; font-weight: 500;
}

.result-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: .6em; margin-bottom: .85em;
}
.result-metric {
  background: var(--c-bg-secondary); border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); padding: .65em; text-align: center;
}
.result-metric__value { display: block; font-size: var(--fs-xl); font-weight: 600; font-family: var(--font-mono); }
.result-metric__label { display: block; font-size: 11px; color: var(--c-text-muted); margin-top: .1em; }

.result-error {
  background: var(--c-danger-bg); color: var(--c-danger);
  padding: .85em; border-radius: var(--radius-sm); text-align: center;
  font-weight: 500; border: 1px solid var(--c-danger); font-size: var(--fs-sm);
}


/* ═══════════════════════════════════════════════════════════════════════
   BREAKDOWN (РАСШИФРОВКА)
   ═══════════════════════════════════════════════════════════════════════ */
.breakdown__list { list-style: none; counter-reset: step; }
.breakdown__step {
  counter-increment: step; padding: .85em; margin-bottom: .6em;
  background: var(--c-bg-secondary); border-radius: var(--radius-sm);
  border-left: 3px solid var(--c-accent);
  font-size: var(--fs-sm);
}
.breakdown__step::before {
  content: counter(step); display: inline-block;
  width: 20px; height: 20px; background: var(--c-accent); color: #fff;
  border-radius: 50%; text-align: center; line-height: 20px;
  font-size: 11px; font-weight: 700; margin-right: .4em;
  font-family: var(--font-mono);
}
.breakdown__formula   { font-size: var(--fs-xs); color: var(--c-text-muted); margin-top: .2em; font-family: var(--font-mono); }
.breakdown__substitution { font-size: var(--fs-sm); margin-top: .2em; }
.breakdown__result    { font-size: var(--fs-base); margin-top: .2em; font-weight: 600; color: var(--c-accent); }


/* ═══════════════════════════════════════════════════════════════════════
   INSIGHTS (ВЫВОДЫ)
   ═══════════════════════════════════════════════════════════════════════ */
.insight {
  padding: .75em .9em; border-radius: var(--radius-sm); margin-bottom: .6em;
  border-left: 3px solid; font-size: var(--fs-sm);
}
.insight--ok     { background: var(--c-success-bg); border-color: var(--c-success); }
.insight--info   { background: var(--c-info-bg);   border-color: var(--c-info); }
.insight--warn   { background: var(--c-warning-bg); border-color: var(--c-warning); }
.insight--danger { background: var(--c-danger-bg);  border-color: var(--c-danger); }
.insight__title  { display: block; margin-bottom: .15em; font-weight: 600; }
.insight__text   { color: var(--c-text-secondary); line-height: var(--lh-relaxed); }
.insight__action { display: inline-block; margin-top: .4em; font-size: var(--fs-sm); font-weight: 600; }


/* ═══════════════════════════════════════════════════════════════════════
   ТАБЛИЦА
   ═══════════════════════════════════════════════════════════════════════ */
.calc-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.calc-table {
  width: 100%; border-collapse: collapse; font-size: var(--fs-sm);
  font-family: var(--font-mono);
}
.calc-table th, .calc-table td {
  padding: .4em .6em; text-align: right; border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.calc-table th {
  font-weight: 600; color: var(--c-text-secondary);
  background: var(--c-bg-secondary); position: sticky; top: 0;
  border-bottom: 2px solid var(--c-border);
}
.calc-table td:first-child, .calc-table th:first-child { text-align: left; }
.calc-table tr:hover td { background: var(--c-bg-hover); }
.calc-table__totals { margin-top: .85em; }


/* ═══════════════════════════════════════════════════════════════════════
   ГРАФИК
   ═══════════════════════════════════════════════════════════════════════ */
.chart-container {
  width: 100%; aspect-ratio: 16/10; max-height: 400px;
  position: relative; margin: .85em 0;
}
.chart-container svg { width: 100%; height: 100%; display: block; }


/* ═══════════════════════════════════════════════════════════════════════
   ДЕЙСТВИЯ
   ═══════════════════════════════════════════════════════════════════════ */
.calc__actions {
  display: flex; gap: .35em; justify-content: center;
  margin-top: .85em; flex-wrap: wrap;
}


/* ═══════════════════════════════════════════════════════════════════════
   СЕКЦИИ / SEO / FAQ / RELATED
   ═══════════════════════════════════════════════════════════════════════ */
.section { margin: 2em 0; }
.section.is-empty { display: none; }

/* SEO content */
.seo-content { font-size: var(--fs-base); line-height: var(--lh-relaxed); }
.seo-content h2 { margin-top: 1.25em; }
.seo-content h3 { margin-top: 1em; color: var(--c-text); }
.seo-content ul, .seo-content ol { color: var(--c-text-secondary); }

/* Category listing */
.cat-listing {
  list-style: none; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .4em;
}
.cat-listing li { margin: 0; }
.cat-listing a {
  display: block; padding: .45em .75em; border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); color: var(--c-text);
  font-size: var(--fs-sm); transition: all var(--tr-fast);
  text-decoration: none;
}
.cat-listing a:hover {
  border-color: var(--c-accent); background: var(--c-accent-light);
  color: var(--c-accent); text-decoration: none;
}

/* ── FAQ ───────────────────────────────────────── */
.faq-item {
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  padding: .75em .9em; margin-bottom: .5em;
  background: var(--c-bg-secondary);
  transition: border-color var(--tr-fast);
}
.faq-item:hover { border-color: var(--c-text-muted); }
.faq-item h3 {
  font-size: var(--fs-base); font-weight: 600; margin-bottom: .3em;
  color: var(--c-text);
}
.faq-item p {
  font-size: var(--fs-sm); color: var(--c-text-secondary);
  line-height: var(--lh-relaxed); margin: 0;
}

/* ── Related calculators ───────────────────────── */
.related-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .6em;
}
.related-card {
  display: block; padding: .75em .9em;
  background: var(--c-bg-card); border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); transition: all var(--tr-fast);
  text-decoration: none; color: var(--c-text);
}
.related-card:hover {
  border-color: var(--c-accent); background: var(--c-accent-light);
  text-decoration: none;
}
.related-card__title { font-weight: 600; font-size: var(--fs-sm); display: block; }
.related-card__desc  { font-size: var(--fs-xs); color: var(--c-text-muted); margin-top: .15em; display: block; }


/* ═══════════════════════════════════════════════════════════════════════
   СКЕЛЕТОНЫ / LOADING
   ═══════════════════════════════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--c-bg-card) 25%, var(--c-bg-hover) 50%, var(--c-bg-card) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm);
}
.skeleton--result { height: 200px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }


/* ═══════════════════════════════════════════════════════════════════════
   РЕКЛАМА
   ═══════════════════════════════════════════════════════════════════════ */
.ad-slot {
  position: relative; margin: 1.25em auto; text-align: center;
  background: var(--c-bg-secondary); border: 1px dashed var(--c-border);
  border-radius: var(--radius-sm); overflow: hidden;
  transition: max-height var(--tr-slow);
}
.ad-slot__label {
  font-size: 9px; color: var(--c-text-muted); text-transform: uppercase;
  letter-spacing: .08em; padding: 3px 0; display: block;
}
.ad-slot--top { min-height: 100px; }
.ad-slot--inc { min-height: 250px; }
.ad-slot--side { min-height: 250px; }
.ad-slot--footer { min-height: 250px; }
.ad-slot--floor { min-height: 50px; position: fixed; bottom: 0; left: 0; right: 0; z-index: var(--z-sticky); margin: 0; }
.ad-slot[data-loaded="false"] { max-height: 0; border: none; }


/* ═══════════════════════════════════════════════════════════════════════
   ДИСКЛЕЙМЕР
   ═══════════════════════════════════════════════════════════════════════ */
.disclaimer {
  font-size: var(--fs-xs); color: var(--c-text-muted); padding: .75em .9em;
  background: var(--c-bg-secondary); border-radius: var(--radius-sm);
  margin: 1.25em 0; border-left: 3px solid var(--c-warning);
  line-height: var(--lh-relaxed);
}


/* ═══════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════ */
.calc-toast {
  position: fixed; bottom: 1.5em; left: 50%; transform: translateX(-50%);
  background: var(--c-bg-card); color: var(--c-text); border: 1px solid var(--c-border);
  padding: .6em 1.25em; border-radius: var(--radius); font-size: var(--fs-sm);
  font-weight: 500; z-index: var(--z-toast); opacity: 0; pointer-events: none;
  transition: opacity var(--tr-normal); box-shadow: var(--c-shadow-lg);
}
.calc-toast.is-visible { opacity: 1; }


/* ═══════════════════════════════════════════════════════════════════════
   ПОДВАЛ
   ═══════════════════════════════════════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--c-border); padding: 1.5em 1em;
  text-align: center; font-size: var(--fs-xs); color: var(--c-text-muted);
  max-width: var(--max-width); margin: 0 auto;
  background: var(--c-bg-secondary);
}
.site-footer nav { display: flex; gap: 1em; justify-content: center; flex-wrap: wrap; margin: .75em 0; }
.site-footer a { color: var(--c-text-secondary); }
.site-footer a:hover { color: var(--c-accent); }


/* ═══════════════════════════════════════════════════════════════════════
   АДАПТИВ
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  html { font-size: 14px; }
  .calc__grid { grid-template-columns: 1fr; }
  h1 { font-size: var(--fs-2xl); }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 0 .6em 2em; }
  .calc-card { padding: 1em; border-radius: var(--radius-sm); }
  .result-hero__value { font-size: var(--fs-3xl); }
}

@media (max-width: 480px) {
  .result-grid { grid-template-columns: 1fr 1fr; gap: .4em; }
  .result-metric__value { font-size: var(--fs-lg); }
  .calc__actions { gap: .2em; }
  .btn--icon { padding: .3em; font-size: var(--fs-base); min-width: 32px; min-height: 32px; }
  .calc__segmented { flex-wrap: wrap; }
  .calc__seg-btn { flex: 1; text-align: center; padding: .35em .6em; font-size: var(--fs-xs); }
  .breakdown__step { padding: .6em; }
  .related-grid { grid-template-columns: 1fr; }
  .cat-listing { grid-template-columns: 1fr; }
}


/* ═══════════════════════════════════════════════════════════════════════
   ПЕЧАТЬ
   ═══════════════════════════════════════════════════════════════════════ */
@media print {
  .site-header, .breadcrumbs, .ad-slot, .calc__actions, .site-footer,
  #calc-actions, .skip-link, .theme-toggle, .offline-badge { display: none !important; }
  .calc__grid { display: block; }
  .calc-card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  body { font-size: 12pt; color: #000; background: #fff; }
  a { color: #000; }
  .result-hero__value { color: #000; }
}


/* ═══════════════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
