:root {
  --bg: #f8fbff;
  --accent: #4c6fff;
  --accent-alt: #2bc5d9;
  --accent-strong: #3340ff;
  --accent-soft: rgba(76, 111, 255, 0.12);

  --text-main: #0f172a;
  --text-soft: #4b5563;
  --text-muted: #9ca3af;

  --glass-bg: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(255, 255, 255, 0.98);
  --blur: 22px;

  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-btn: 15px;

  --shadow-ink-sm: 0 6px 18px rgba(0, 0, 0, 0.08);
  --shadow-ink-lg: 0 10px 20px rgba(0, 0, 0, 0.15);
  --shadow-glass: 0 8px 24px rgba(31, 38, 135, 0.15);
  --shadow-glass-strong: 0 8px 24px rgba(31, 38, 135, 0.25);

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;

  --container-max: 1320px;
  --content-max: 1040px;

  --app-pad: 14px 10px 14px;
  --app-pad-mobile: 8px 8px 110px;

  --transition-fast: 0.16s ease-out;

  --fs-section-title: 16px;
  --fs-ui: 15px;
  --fs-body-sm: 15px;
  --fs-caption: 14px;
  --fs-meta: 14px;

  --fs-hero-eyebrow: 12px;
  --fs-hero-title: 22px;
  --fs-hero-subtitle: 15px;

  --fs-card-title: 15px;
  --fs-card-sub: 13px;

  --fs-link-sm: 12px;

  --fs-qname: 15px;
  --fs-qtime: 12px;
  --fs-qbadge: 12px;
  --fs-qtext: 14px;

  --fs-avatar: 15px;

  --fs-advisor-question: 18px;
  --fs-advisor-progress: 13px;
  --fs-advisor-option: 15px;
  --fs-advisor-hint: 12px;

  --section-gap: 34px;
}

@media (max-width: 768px) {
  :root {
    --section-gap: 28px;
  }
}

@media (max-width: 480px) {
  :root {
    /* лёгкая адаптация под мобильный */
    --fs-hero-title: 21px; /* было 20px */
    --fs-card-title: 14px; /* было 13px */
    --fs-card-sub: 12px; /* оставили 12px */
    --fs-qname: 14px; /* было 13px */
    --fs-qtext: 14px; /* оставляем комфортный размер */
  }
}

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

html,
body {
  height: 100%;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text-main);
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

/* Контейнеры */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 12px;
}

.container--narrow {
  max-width: var(--content-max);
}

/* Базовый “glass” */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(var(--blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%);
}

/* Секции */
.section {
  margin: var(--section-gap, 34px) 0;
}

.section-title {
  margin: 10px 4px 10px;
  font-size: var(--fs-section-title, 16px);
  font-weight: 600;
  color: #111827;
}

/* Типографика компонентов (единый масштаб для страниц) */
.hero-ask-eyebrow {
  font-size: var(--fs-hero-eyebrow, 12px);
}
.hero-ask-title {
  font-size: var(--fs-hero-title, 22px);
}
.hero-ask-subtitle {
  font-size: var(--fs-hero-subtitle, 15px);
}

.home-quick-action__title {
  font-size: var(--fs-card-title, 15px);
}
.home-quick-action__sub {
  font-size: var(--fs-card-sub, 13px);
}
.home-quick-action__cta {
  font-size: var(--fs-link-sm, 12px);
}
.home-section-link {
  font-size: var(--fs-link-sm, 12px);
}

.qavatar {
  font-size: var(--fs-avatar, 15px);
}
.qname {
  font-size: var(--fs-qname, 15px);
}
.qtime {
  font-size: var(--fs-qtime, 12px);
}
.qstatus {
  font-size: var(--fs-qbadge, 12px);
}
.qtext {
  font-size: var(--fs-qtext, 14px);
}

/* Кнопки */
.btn,
.btn-hero-primary,
.question-button.hero-primary,
.hero-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(255, 255, 255, 0.95);
  background: linear-gradient(130deg, var(--accent), var(--accent-alt));
  color: #fff;
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-glass-strong);
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast), opacity var(--transition-fast);
}

.btn:active,
.btn-hero-primary:active,
.question-button.hero-primary:active,
.hero-primary:active {
  transform: scale(0.96);
  box-shadow: var(--shadow-glass);
}

.btn.outline,
.hero-secondary,
.hero-ask-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(209, 213, 219, 1);
  background: rgba(248, 250, 252, 0.9);
  color: var(--text-main);
  padding: 10px 18px;
  font-size: calc(var(--fs-ui, 15px) - 1px);
  font-weight: 400;
  text-decoration: none;
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast), background var(--transition-fast);
}

.btn.outline:active,
.hero-secondary:active,
.hero-ask-secondary:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-ink-sm);
  background: #eceff1;
}

.btn.link,
.btn-link {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 6px 8px;
  font-size: calc(var(--fs-ui, 15px) - 1px);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

@media (hover: hover) {
  .btn.link:hover,
  .btn-link:hover {
    text-decoration: underline;
  }
}

/* Cookie banner */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  justify-content: center;
  padding: 10px 10px 16px;
  pointer-events: none;
}

.cookie-banner-inner {
  width: 100%;
  max-width: var(--content-max);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
}

.cookie-banner-text {
  font-size: var(--fs-ui, 15px);
  line-height: 1.25;
  color: var(--text-soft);
  margin: 0;
  flex: 1;
  min-width: 0;
}

.cookie-banner-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cookie-banner-actions button {
  border-radius: var(--radius-btn);
  border: 1px solid rgba(209, 213, 219, 1);
  background: rgba(248, 250, 252, 0.9);
  padding: 8px 10px;
  font-size: calc(var(--fs-ui, 15px) - 1px);
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast), background var(--transition-fast);
}

.cookie-banner-actions button:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-ink-sm);
}

@media (max-width: 768px) {
  .container {
    padding: 0 10px;
  }
  .cookie-banner-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .cookie-banner-actions {
    width: 100%;
  }
}

/* === Отступ под фиксированное нижнее меню (mobile-tabbar) === */
@media (max-width: 768px) {
  .main-footer {
    padding-bottom: 80px; /* высота таббара + небольшой запас, чтобы контент не прятался под ним */
  }
}

/* Accessibility */
:focus-visible {
  outline: 2px solid rgba(76, 111, 255, 0.35);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
/* ===== Страница 404 ===== */

.error-page {
  min-height: 100vh;
  padding: 24px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  padding: 18px 18px 16px;
  overflow: hidden;
  text-align: left;
}

/* Используем общий .glass, здесь только декоративный круг */
.error-card::before {
  content: "";
  position: absolute;
  top: -90px;
  right: -90px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(76, 111, 255, 0.26),
    transparent 70%
  );
  opacity: 0.95;
  pointer-events: none;
}

.error-eyebrow {
  position: relative;
  z-index: 1;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: var(--fs-hero-eyebrow, 12px);
  color: var(--accent-strong, #3340ff);
}

.error-code {
  position: relative;
  z-index: 1;
  margin: 0 0 8px;
  font-weight: 800;
  font-size: 52px;
  line-height: 1;
  color: var(--accent, #4c6fff);
}

.error-title {
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  max-width: 80%;
  font-size: var(--fs-hero-title, 22px);
  font-weight: 700;
  color: #111827;
}

.error-text {
  position: relative;
  z-index: 1;
  margin: 0 0 16px;
  max-width: 90%;
  font-size: var(--fs-body-sm, 15px);
  line-height: 1.5;
  color: var(--text-soft, #4b5563);
}

.error-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
}

.error-btn-main {
  min-width: 160px;
  justify-content: center;
}

@media (max-width: 480px) {
  .error-page {
    padding: 18px 12px;
  }

  .error-card {
    padding: 16px 14px 14px;
  }

  .error-code {
    font-size: 44px;
  }

  .error-title,
  .error-text {
    max-width: 100%;
  }

  .error-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .error-btn-main {
    width: 100%;
  }
}
/* === Единый вид панели фильтров на всех страницах "Полезное" === */
.kb-filters-panel,
.tpl-filters-panel,
.cases-filters-panel,
.news-filters-panel,
#questionsFiltersPanel {
  position: relative;
  margin-top: 10px;
  padding: 12px 12px 14px;
  border-radius: var(--radius-md, 16px);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.98));
  background: var(--glass-bg, rgba(255, 255, 255, 0.9));
  box-shadow: var(--shadow-glass, 0 8px 24px rgba(31, 38, 135, 0.15));
  display: none; /* по умолчанию скрыта */
  z-index: 1; /* подложка над фоном, но под остальным контентом */
}

/* Открытие: разные варианты классов, которые уже ставит JS на страницах */
.kb-filters-panel.open,
.tpl-filters-panel.open,
.tpl-filters-panel.tpl-filters-panel--open,
.cases-filters-panel.open,
.news-filters-panel.open,
#questionsFiltersPanel.open,
#questionsFiltersPanel.tpl-filters-panel--open {
  display: block;
}
a {
  text-decoration: none !important;
}
