/* ==========================================================================
   Кодопедия - дизайн-система Swiss Technical Manual
   ========================================================================== */

/* Локальные self-hosted шрифты (SIL OFL) */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/manrope-600-cyr.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/manrope-600-lat.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/manrope-700-cyr.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/manrope-700-lat.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/assets/fonts/manrope-800-cyr.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/assets/fonts/manrope-800-lat.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/golos-400-cyr.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/golos-400-lat.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/golos-500-cyr.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/golos-500-lat.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/golos-600-cyr.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/golos-600-lat.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/jbmono-600-cyr.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/jbmono-600-lat.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/jbmono-700-cyr.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/jbmono-700-lat.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-alt: #efede7;
  --surface-raised: #fbfaf7;
  --surface-dark: #14181f;
  --surface-dark-2: #1f2530;
  --text: #14181f;
  --text-secondary: #3b4252;
  --muted: #525968;
  --on-dark: #f6f5f1;
  --on-dark-muted: #c8cfd9;
  --border: #ddd9cf;
  --border-strong: #c5c0b4;
  --accent: #0f4c81;
  --accent-hover: #0a355c;
  --accent-soft: #e8f1f8;
  --accent-border: #b7d0e6;
  --ok-bg: #e8f5ee;
  --ok-border: #a9d6bd;
  --ok-text: #0e5234;
  --ok-dot: #22c55e;
  --warn-bg: #fdf4e2;
  --warn-border: #e8c682;
  --warn-text: #7a4405;
  --warn-dot: #f59e0b;
  --high-bg: #fcebea;
  --high-border: #ebb1ae;
  --high-text: #8c1d18;
  --high-dot: #ef4444;
  --danger-bg: #fae5e5;
  --danger-border: #e09696;
  --danger-text: #7d1111;
  --danger-dot: #f43f5e;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 24, 31, 0.05), 0 6px 18px rgba(20, 24, 31, 0.04);
  --shadow-lg: 0 12px 28px rgba(20, 24, 31, 0.12);
  --container: 1200px;
  --font-display: "Manrope", system-ui, -apple-system, sans-serif;
  --font-body: "Golos Text", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

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

::selection {
  background: var(--accent);
  color: #ffffff;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.62;
  color: var(--text);
  background: var(--bg);
  caret-color: var(--accent);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  color: var(--text);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--surface-dark);
  color: var(--on-dark);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  left: 12px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

/* Иконки SVG */
.ui-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.ui-icon--lg {
  width: 24px;
  height: 24px;
}

/* Шапка сайта */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 10px 0;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.025em;
  min-height: 44px;
  white-space: nowrap;
}

.brand-logo:hover {
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-dark);
  color: var(--on-dark);
  border: 1px solid #2d3646;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.brand-mark-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.header-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.header-nav a:hover {
  background: var(--surface-alt);
  color: var(--text);
  text-decoration: none;
}

.header-nav a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Поиск */
.search-widget {
  position: relative;
  width: 100%;
}

.header-search {
  flex: 1 1 220px;
  max-width: 290px;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  min-height: 46px;
  padding-left: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-hero .search-input-wrap {
  min-height: 54px;
  padding-left: 16px;
  border-width: 1.5px;
  box-shadow: var(--shadow);
}

.search-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.14);
}

.search-icon {
  color: var(--muted);
  flex-shrink: 0;
}

.search-input,
.filter-input {
  -webkit-appearance: none;
  appearance: none;
}

.search-input::-webkit-search-decoration,
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-results-button,
.search-input::-webkit-search-results-decoration,
.filter-input::-webkit-search-decoration,
.filter-input::-webkit-search-cancel-button,
.filter-input::-webkit-search-results-button,
.filter-input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.search-input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 10px 8px 10px 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  min-height: 44px;
}

.search-input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.search-hero .search-input {
  padding: 12px 10px 12px 12px;
  font-size: 1.03rem;
}

.search-clear {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.search-clear.is-visible {
  display: inline-flex;
}

.search-clear:hover {
  color: var(--text);
  background: var(--surface-alt);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  max-height: 420px;
  overflow-y: auto;
  display: none;
}

.search-results.is-open {
  display: block;
}

.search-result-item {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  min-height: 44px;
}

.search-result-item:last-child {
  border-bottom: 0;
}

.search-result-item:hover,
.search-result-item.is-highlighted {
  background: var(--accent-soft);
  color: var(--text);
  text-decoration: none;
}

.search-result-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 3px;
}

.search-result-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-dark);
  color: var(--on-dark);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.search-result-meta {
  font-size: 0.84rem;
  color: var(--muted);
}

.search-empty {
  padding: 14px;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

/* Основная область */
.site-main {
  flex: 1 0 auto;
  padding: 24px 0 56px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.breadcrumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 2px 4px;
  color: var(--text-secondary);
  border-radius: 4px;
}

.breadcrumbs a:hover {
  color: var(--accent);
  background: var(--surface-alt);
  text-decoration: none;
}

.breadcrumbs-sep {
  color: var(--muted);
}

/* Hero секции */
.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.hero-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 32px;
}

@media (min-width: 960px) {
  .hero-split {
    grid-template-columns: minmax(0, 1.45fr) 340px;
  }
}

.hero-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.hero h1,
.hero-main h1 {
  margin: 0 0 12px;
  font-size: clamp(1.625rem, 2.8vw, 2.35rem);
  font-weight: 800;
  line-height: 1.18;
}

.hero-lead {
  margin: 0 0 20px;
  color: var(--text-secondary);
  max-width: 66ch;
  font-size: 1.02rem;
}

/* Примеры быстрого поиска в Hero */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.preset-label {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
  margin-right: 4px;
}

.preset-btn {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.preset-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Приборная панель статистики на главной */
.hero-telemetry {
  background: var(--surface-dark);
  color: var(--on-dark);
  border: 1px solid #2a3241;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.telemetry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--on-dark);
  padding-bottom: 12px;
  border-bottom: 1px solid #2a3241;
}

.telemetry-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--on-dark-muted);
  font-weight: 500;
}

.telemetry-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok-dot);
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.telemetry-stat {
  background: var(--surface-dark-2);
  border: 1px solid #2f3848;
  border-radius: var(--radius-md);
  padding: 12px 10px;
}

.telemetry-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.15;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.telemetry-label {
  display: block;
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--on-dark-muted);
}

.telemetry-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.telemetry-actions .btn-cta {
  font-size: 0.84rem;
  padding: 8px 10px;
  min-width: 0;
  gap: 6px;
}

@media (max-width: 420px) {
  .telemetry-actions {
    grid-template-columns: 1fr;
  }
}

.btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #ffffff;
  border: 1px solid #2b6ca3;
  font-weight: 600;
  font-size: 0.94rem;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.btn-cta:hover {
  background: #155c99;
  color: #ffffff;
  text-decoration: none;
}

.btn-cta--secondary {
  background: var(--surface-dark-2);
  color: var(--on-dark);
  border-color: #364154;
}

.btn-cta--secondary:hover {
  background: #2b3344;
  color: #ffffff;
}

/* Секции главной и общих страниц */
.section-block {
  margin-top: 32px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.section-title {
  margin: 0;
  font-size: 1.38rem;
  font-weight: 700;
  line-height: 1.25;
}

.section-note {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Каталог активных разделов (2 колонки, симметрия 2x2 на десктопе) */
.category-catalog {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

@media (min-width: 820px) {
  .category-catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1080px) {
  .category-catalog {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.catalog-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.catalog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.catalog-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 180px;
}

.catalog-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.catalog-title {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 700;
}

.catalog-count {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.catalog-desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.brand-link-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.brand-pill-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.brand-pill-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.brand-pill-count {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Реестр популярных кодов на главной */
.code-index-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 760px) {
  .code-index-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.code-index-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.code-index-row:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
}

.code-index-badge {
  min-width: 64px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-dark);
  color: var(--on-dark);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.code-index-body {
  min-width: 0;
  flex: 1;
}

.code-index-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.96rem;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 4px;
}

.code-index-row:hover .code-index-title {
  color: var(--accent);
}

.code-index-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--muted);
}

/* Полоса планируемых разделов (Волна 3) */
.roadmap-strip {
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
}

@media (min-width: 760px) {
  .roadmap-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.roadmap-item {
  background: var(--surface);
  border: 0;
  padding: 18px 20px;
}

.roadmap-name {
  margin: 0 0 6px;
  font-size: 1.04rem;
  font-weight: 700;
}

.roadmap-desc {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.roadmap-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
}

/* Сетка карточек брендов на странице категории */
.brand-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 720px) {
  .brand-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
}

.card-desc {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-secondary);
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.pill-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-border);
}

.brand-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  align-self: flex-start;
  margin-top: auto;
}

.brand-card-cta:hover {
  background: var(--accent-hover);
  color: #ffffff;
  text-decoration: none;
}

/* Бейджи критичности */
.severity-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 700;
  border: 1px solid transparent;
  line-height: 1.25;
}

.severity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.severity-low {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-color: var(--ok-border);
}
.severity-low .severity-dot { background: var(--ok-dot); }

.severity-medium {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}
.severity-medium .severity-dot { background: var(--warn-dot); }

.severity-high {
  background: var(--high-bg);
  color: var(--high-text);
  border-color: var(--high-border);
}
.severity-high .severity-dot { background: var(--high-dot); }

.severity-critical_gas {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}
.severity-critical_gas .severity-dot { background: var(--danger-dot); }

/* Хаб бренда: панель матрицы кодов и фильтр */
.brand-toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  display: grid;
  gap: 14px;
}

.brand-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-input-wrap {
  position: relative;
  flex: 1 1 240px;
  display: flex;
  align-items: center;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  min-height: 46px;
  padding: 0 12px;
}

.filter-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.14);
}

.filter-input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 9px 6px 9px 8px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  min-height: 44px;
}

.filter-input::placeholder {
  color: var(--muted);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.is-active {
  background: var(--surface-dark);
  color: var(--on-dark);
  border-color: var(--surface-dark);
}

.filter-count {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
}

.filter-empty {
  padding: 18px;
  text-align: center;
  color: var(--text-secondary);
  background: var(--surface-raised);
  border-top: 1px solid var(--border);
  display: none;
}

.filter-empty.is-visible {
  display: block;
}

/* Таблицы (десктоп + адаптивные карточки на телефоне без скролла) */
.table-wrap {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.94rem;
}

th,
td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: var(--surface-alt);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

tr:last-child td {
  border-bottom: 0;
}

tr.is-hidden {
  display: none !important;
}

.table-title-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  font-weight: 600;
  color: var(--text);
}

.table-title-link:hover {
  color: var(--accent);
}

@media (max-width: 767px) {
  .responsive-table thead {
    display: none;
  }
  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }
  .responsive-table tr {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }
  .responsive-table tr:last-child {
    border-bottom: 0;
  }
  .responsive-table td {
    padding: 5px 0;
    border-bottom: 0;
  }
  .responsive-table td[data-label]::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: var(--muted);
    font-size: 0.84rem;
  }
  .responsive-table td[data-label=""]::before {
    content: none;
  }
}

/* Страница карточки ошибки */
.page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

@media (min-width: 1024px) {
  .page-grid {
    grid-template-columns: minmax(0, 1fr) 316px;
  }
}

.article-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}

.article-header {
  margin-bottom: 18px;
}

/* Фирменное приборное табло кода ошибки */
.code-display-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 14px;
}

.code-lcd {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-dark);
  color: #ffffff;
  border: 1px solid #2d3646;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.code-lcd-led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.code-lcd-led--low { background: var(--ok-dot); }
.code-lcd-led--medium { background: var(--warn-dot); }
.code-lcd-led--high { background: var(--high-dot); }
.code-lcd-led--critical_gas { background: var(--danger-dot); }

.article-header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
}

.article-meta {
  font-size: 0.875rem;
  color: var(--muted);
}

.quick-answer {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 14px;
}

.quick-answer-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.quick-answer p {
  margin: 0;
  color: var(--text);
  font-weight: 500;
  max-width: 68ch;
}

.safety-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: var(--radius-md);
  padding: 15px 17px;
  margin-bottom: 16px;
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-text);
}

.safety-box--danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.safety-box-body strong {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-display);
}

/* Якорная навигация внутри карточки */
.toc-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 4px;
}

.toc-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
}

.toc-pill:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.content-block {
  margin-top: 28px;
  scroll-margin-top: 84px;
}

.content-block h2 {
  margin: 0 0 14px;
  font-size: 1.24rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.bullet-list {
  margin: 0;
  padding-left: 20px;
  max-width: 68ch;
}

.bullet-list li {
  margin-bottom: 9px;
  color: var(--text-secondary);
}

/* Вероятность причины */
.prob-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

.prob-badge--high {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.prob-badge--mid {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.prob-badge--low {
  background: var(--surface-alt);
  color: var(--text-secondary);
}

/* Шаги диагностики */
.steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.step-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  background: var(--surface);
}

.step-card--master {
  background: var(--surface-raised);
  border-style: dashed;
  border-color: var(--border-strong);
}

.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.step-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.step-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
}

.step-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
}

.step-tag--diy {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.step-tag--master {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.step-card p {
  margin: 0;
  color: var(--text-secondary);
  max-width: 68ch;
}

/* FAQ */
.faq-list {
  display: grid;
  gap: 10px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary:hover {
  background: var(--surface-raised);
}

.faq-chevron {
  transition: transform 0.18s ease;
  color: var(--muted);
  flex-shrink: 0;
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
}

.faq-item p {
  margin: 0;
  padding: 0 16px 14px;
  color: var(--text-secondary);
  max-width: 68ch;
}

/* Сайдбар */
.sidebar {
  display: grid;
  gap: 16px;
}

@media (min-width: 1024px) {
  .sidebar {
    position: sticky;
    top: 88px;
  }
}

.sidebar-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}

.sidebar-box h3 {
  margin: 0 0 12px;
  font-size: 1.06rem;
  font-weight: 700;
}

.code-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 48px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.code-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.sidebar-all-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  margin-top: 14px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}

.sidebar-all-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

/* Слоты рекламы РСЯ / Adfox: скрыты до подключения кода, при активации держат высоту без CLS */
.ad-slot {
  display: none;
}

.ad-slot--active {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  margin: 20px 0;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}

.ad-slot--sidebar.ad-slot--active {
  min-height: 400px;
  margin: 0;
}

/* Подвал */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 26px 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--text-secondary);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--accent);
}

@media (max-width: 1120px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .header-nav {
    flex-wrap: wrap;
  }

  .header-search {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
  }
}

@media (max-width: 767px) {
  .container {
    padding: 0 16px;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 6px 10px;
    min-height: 56px;
    padding: 8px 0 10px;
  }

  .brand-logo {
    min-height: 38px;
  }

  .header-nav {
    gap: 4px;
  }

  .header-nav a {
    padding: 6px 10px;
    font-size: 0.88rem;
    min-height: 36px;
  }

  .header-search {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
  }

  .hero,
  .hero-main,
  .hero-telemetry,
  .catalog-panel,
  .article-panel {
    padding: 18px 16px;
  }

  .btn-cta {
    white-space: normal;
  }

  .safety-box {
    padding: 14px;
    gap: 10px;
  }

  .filter-btn {
    min-height: 44px;
  }

  .code-chip {
    min-height: 40px;
  }

  .brand-pill-link {
    min-height: 40px;
  }

  .toc-pill {
    min-height: 40px;
  }

  .preset-btn {
    min-height: 44px;
    padding: 8px 14px;
  }
}
