/* ==========================================================================
   РЭС — корпоративная дизайн-система
   Один файл: токены, сброс, типографика, каркас, шапка, меню, футер,
   компоненты (кнопки, плитки, карточки, формы, документы, таблицы),
   адаптив, доступность, печать.
   ========================================================================== */

/* ---------- Шрифты (Montserrat, OFL; кириллица + латиница) ---------- */
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/montserrat/montserrat-cyrillic-400-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/montserrat/montserrat-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/montserrat/montserrat-cyrillic-600-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/montserrat/montserrat-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(../fonts/montserrat/montserrat-cyrillic-700-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(../fonts/montserrat/montserrat-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- Токены ---------- */
:root {
  --font-sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Montserrat", var(--font-sans);

  --c-bg: #ffffff;
  --c-surface: #f5f6f8;
  --c-surface-2: #eceef2;
  --c-line: #dfe3e8;
  --c-line-strong: #c3c9d2;

  --c-ink: #1b1f24;
  --c-ink-2: #4a5260;
  --c-ink-3: #6b7480;
  --c-ink-inverse: #ffffff;

  --c-brand: #c4302b;
  --c-brand-dark: #9e2521;
  --c-brand-soft: #fbeceb;
  --c-steel: #8f9297;

  --c-graphite: #22262b;
  --c-graphite-2: #2c3138;
  --c-graphite-line: rgba(255, 255, 255, 0.12);

  --c-ok: #1f7a4d;
  --c-warn: #b7791f;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-2: 0 8px 24px rgba(16, 24, 40, 0.12);

  --container: 1200px;
  --gutter: 24px;
  --section: 56px;

  --fs-base: 16px;
  --lh-base: 1.6;
}

/* ---------- Сброс ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  font-size: var(--fs-base);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: var(--lh-base);
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--c-brand); text-decoration: none; }
a:hover { color: var(--c-brand-dark); text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul, ol { margin: 0; padding: 0; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--c-line); margin: 32px 0; }
:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.2;
  color: var(--c-ink);
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h1, .h1 { font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem); }
h2, .h2 { font-size: clamp(1.45rem, 1.1rem + 1vw, 1.9rem); }
h3, .h3 { font-size: 1.3rem; }
h4, .h4 { font-size: 1.1rem; }
h5, h6 { font-size: 1rem; }

.muted { color: var(--c-ink-3); }
.small { font-size: 0.875rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 1000;
  padding: 10px 16px; background: var(--c-graphite); color: #fff; border-radius: var(--radius);
}
.skip-link:focus { top: 8px; }

/* ---------- Каркас ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.container--narrow { max-width: calc(880px + var(--gutter) * 2); }
.site-main { flex: 1 0 auto; }
.section { padding: var(--section) 0; }
.section--tight { padding: 32px 0; }
.section--surface { background: var(--c-surface); }
.section__head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 24px; padding-bottom: 12px; border-bottom: 2px solid var(--c-ink);
}
.section__head h2 { margin: 0; }
.section__head .section__link { white-space: nowrap; font-weight: 600; }

/* ---------- Шапка ---------- */
.site-header { position: relative; z-index: 50; background: var(--c-bg); }
.topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-line);
  font-size: 0.8125rem;
  color: var(--c-ink-2);
}
.topbar .container {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 36px;
}
.topbar__region { font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--c-ink-2); }
.topbar__links { display: flex; align-items: center; gap: 20px; }
.topbar__links a, .topbar__links button {
  color: var(--c-ink-2); background: none; border: 0; padding: 0; display: inline-flex; align-items: center; gap: 6px;
}
.topbar__links a:hover, .topbar__links button:hover { color: var(--c-brand); text-decoration: none; }
.topbar__links .fa { font-size: 0.95em; }
.topbar__logout { display: inline-flex; margin: 0; }
.topbar__links button { cursor: pointer; font: inherit; }

.header-main .container {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 84px;
}
.brand { display: flex; align-items: center; gap: 14px; color: var(--c-ink); }
.brand:hover { text-decoration: none; color: var(--c-ink); }
.brand__logo { height: 44px; width: auto; }
.brand__text {
  font-family: var(--font-head); font-weight: 700; font-size: 0.95rem; line-height: 1.2;
  letter-spacing: 0.01em; text-transform: uppercase; max-width: 260px;
}
.brand__text small { display: block; font-family: var(--font-sans); font-weight: 400; text-transform: none; color: var(--c-ink-3); font-size: 0.8rem; letter-spacing: 0; margin-top: 2px; }

.header-tools { display: flex; align-items: center; gap: 12px; }
.search {
  display: flex; align-items: center; border: 1px solid var(--c-line-strong); border-radius: var(--radius);
  background: var(--c-bg); overflow: hidden; height: 42px;
}
.search:focus-within { border-color: var(--c-ink-2); }
.search__input { border: 0; outline: 0; padding: 0 12px; width: 220px; min-width: 0; background: transparent; }
.search__btn { border: 0; background: var(--c-surface-2); height: 100%; width: 42px; color: var(--c-ink-2); display: grid; place-items: center; }
.search__btn:hover { background: var(--c-brand); color: #fff; }
.account-link {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px;
  border: 1px solid var(--c-line-strong); border-radius: var(--radius); color: var(--c-ink); font-weight: 600; font-size: 0.9rem; white-space: nowrap;
}
.account-link:hover { border-color: var(--c-brand); color: var(--c-brand); text-decoration: none; }
/* Несколько ЛК заявителя (например, у Хабаровска) — выпадающий список */
.account-menu { position: relative; }
.account-menu__toggle { background: var(--c-bg); cursor: pointer; }
.account-menu__toggle .fa-chevron-down { font-size: 0.7rem; }
.account-menu__list {
  list-style: none; display: none; position: absolute; right: 0; top: calc(100% + 6px); min-width: 300px; z-index: 60;
  background: var(--c-bg); border: 1px solid var(--c-line); border-top: 3px solid var(--c-brand); box-shadow: var(--shadow-2); padding: 8px 0;
}
.account-menu:hover .account-menu__list, .account-menu:focus-within .account-menu__list { display: block; }
.account-menu__list a { display: block; padding: 10px 18px; color: var(--c-ink); font-size: 0.9rem; }
.account-menu__list a:hover { background: var(--c-surface); color: var(--c-brand); text-decoration: none; }

.nav-toggle {
  display: none; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 1px solid var(--c-line-strong); border-radius: var(--radius); background: var(--c-bg); color: var(--c-ink);
}
.nav-toggle .fa-times { display: none; }
.nav-open .nav-toggle .fa-bars { display: none; }
.nav-open .nav-toggle .fa-times { display: inline; }

/* ---------- Навигация ---------- */
.navbar { background: var(--c-graphite); border-top: 3px solid var(--c-brand); }
.nav { list-style: none; display: flex; flex-wrap: wrap; align-items: stretch; margin: 0 -12px; }
.nav__item { position: relative; display: flex; align-items: stretch; }
.nav__link, .nav__caret {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 12px;
  color: rgba(255, 255, 255, 0.88); font-size: 0.875rem; font-weight: 600; letter-spacing: 0.01em;
  background: none; border: 0;
}
.nav__link:hover, .nav__caret:hover, .nav__item.is-active > .nav__link { color: #fff; background: var(--c-graphite-2); text-decoration: none; }
.nav__item.is-active > .nav__link { box-shadow: inset 0 -3px 0 var(--c-brand); }
.nav__caret { padding: 0 10px 0 4px; margin-left: -8px; }
.nav__caret .fa { transition: transform 0.2s; font-size: 0.75rem; }
.nav__sub {
  list-style: none; position: absolute; left: 0; top: 100%; min-width: 260px; z-index: 60;
  background: var(--c-bg); border: 1px solid var(--c-line); border-top: 3px solid var(--c-brand);
  box-shadow: var(--shadow-2); padding: 8px 0; display: none;
}
.nav__item:hover > .nav__sub, .nav__item:focus-within > .nav__sub, .nav__item.is-open > .nav__sub { display: block; }
.nav__item.is-open > .nav__caret .fa { transform: rotate(180deg); }
.nav__sub a { display: block; padding: 10px 18px; color: var(--c-ink); font-size: 0.9rem; }
.nav__sub a:hover { background: var(--c-surface); color: var(--c-brand); text-decoration: none; }

/* ---------- Хлебные крошки ---------- */
.breadcrumbs { font-size: 0.8125rem; color: var(--c-ink-3); padding: 14px 0; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--c-line-strong); }
.breadcrumbs a { color: var(--c-ink-2); }
.breadcrumbs a:hover { color: var(--c-brand); }
.breadcrumbs [aria-current] { color: var(--c-ink); }

/* ---------- Заголовочная полоса страницы ---------- */
.page-head { background: var(--c-surface); border-bottom: 1px solid var(--c-line); padding: 36px 0 32px; }
.page-head h1 { margin: 0; }
.page-head__meta { margin-top: 10px; color: var(--c-ink-3); font-size: 0.9rem; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.page-head__meta .fa { margin-right: 6px; }
.page-head--image { position: relative; color: #fff; background: var(--c-graphite) center / cover no-repeat; padding: 72px 0; }
.page-head--image::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(20, 23, 27, 0.88), rgba(20, 23, 27, 0.55)); }
.page-head--image .container { position: relative; }
.page-head--image h1, .page-head--image .page-head__meta { color: #fff; }

/* ---------- Hero (главная) ---------- */
.hero { background: var(--c-graphite); color: #fff; position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; right: -8%; top: -30%; width: 55%; height: 160%;
  background: radial-gradient(closest-side, rgba(196, 48, 43, 0.28), transparent 70%);
  pointer-events: none;
}
.hero .container { position: relative; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 48px; align-items: center; padding-top: 64px; padding-bottom: 64px; }
.hero__text h1, .hero__text h2, .hero__text h3, .hero__text h4 { color: #fff; }
/* В админке текст hero часто набран заголовками h2–h4 (без h1) — показываем их как главный заголовок */
.hero__text > h1, .hero__text > h2, .hero__text > h3, .hero__text > h4 { font-size: clamp(1.9rem, 1.3rem + 2vw, 2.9rem); margin-bottom: 0.25em; }
.hero__text > h1 + h1, .hero__text > h2 + h2, .hero__text > h3 + h3, .hero__text > h4 + h4 { margin-top: -0.15em; }
.hero__text > :is(h1, h2, h3, h4) + p { margin-top: 0.9em; }
.hero__text p { color: rgba(255, 255, 255, 0.82); font-size: 1.05rem; max-width: 60ch; }
.hero__text p:last-child { margin-bottom: 0; }
.hero__text a:not(.btn) { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.hero__aside { border-left: 1px solid var(--c-graphite-line); padding-left: 40px; }
.hero__aside h3 { color: #fff; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px; }
.hero__aside p { color: rgba(255, 255, 255, 0.82); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
/* Названия ЛК бывают длинными («…Сов. гавань, Ванино, Солнечный») — кнопкам в hero разрешён перенос */
.hero__actions .btn { white-space: normal; text-align: left; max-width: 100%; line-height: 1.25; padding-top: 10px; padding-bottom: 10px; }

/* Уведомление (важное сообщение на главной) */
.notice {
  border: 1px solid var(--c-line); border-left: 4px solid var(--c-brand); background: var(--c-bg);
  padding: 20px 24px; border-radius: var(--radius); box-shadow: var(--shadow-1);
}
.notice h2, .notice h3, .notice h4 { font-size: 1.15rem; margin-bottom: 8px; }
.notice p:last-child { margin-bottom: 0; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 22px; border-radius: var(--radius);
  font-weight: 600; font-size: 0.95rem; line-height: 1; white-space: nowrap;
  border: 1px solid transparent; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--c-brand); color: #fff; }
.btn--primary:hover { background: var(--c-brand-dark); color: #fff; }
.btn--secondary { background: transparent; color: var(--c-ink); border-color: var(--c-line-strong); }
.btn--secondary:hover { border-color: var(--c-ink); color: var(--c-ink); }
.btn--light { background: #fff; color: var(--c-ink); }
.btn--light:hover { background: var(--c-surface-2); color: var(--c-ink); }
.btn--outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.btn--outline-light:hover { border-color: #fff; color: #fff; }
.btn--block { width: 100%; }

/* ---------- Плитки услуг ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.tile { grid-column: span 1; }
.tile--lg { grid-column: span 2; }
.tile__link {
  display: flex; flex-direction: column; height: 100%; background: var(--c-bg);
  border: 1px solid var(--c-line); border-radius: var(--radius-lg); overflow: hidden; color: var(--c-ink);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.tile__link:hover { text-decoration: none; color: var(--c-ink); box-shadow: var(--shadow-2); border-color: var(--c-line-strong); transform: translateY(-2px); }
.tile__media { aspect-ratio: 16 / 9; background: var(--c-surface-2) center / cover no-repeat; }
.tile--lg .tile__media { aspect-ratio: 21 / 9; }
.tile__body { display: flex; align-items: center; gap: 14px; padding: 18px 20px; flex: 1; }
.tile__icon {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: var(--radius);
  display: grid; place-items: center; background: var(--c-brand-soft); color: var(--c-brand); font-size: 1.2rem;
}
.tile__title { font-family: var(--font-head); font-weight: 700; font-size: 1rem; line-height: 1.3; }
.tile__arrow { margin-left: auto; color: var(--c-ink-3); }
.tile__link:hover .tile__arrow { color: var(--c-brand); }
.tile--text .tile__link { padding: 24px; justify-content: center; background: var(--c-surface); }
.tile--text .tile__link h2, .tile--text .tile__link h3 { font-size: 1.25rem; }
.tile--text .tile__link p:last-child { margin: 0; }

/* ---------- Карточки (разделы, новости, поиск) ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.card {
  display: flex; flex-direction: column; background: var(--c-bg); border: 1px solid var(--c-line);
  border-radius: var(--radius-lg); overflow: hidden; color: var(--c-ink); height: 100%;
  transition: box-shadow 0.2s, transform 0.2s;
}
a.card:hover { text-decoration: none; color: var(--c-ink); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.card__media { aspect-ratio: 16 / 9; background: var(--c-surface-2) center / cover no-repeat; }
.card__body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card__kicker { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-brand); font-weight: 700; }
.card__title { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; line-height: 1.35; margin: 0; }
.card__text { color: var(--c-ink-2); font-size: 0.925rem; margin: 0; }
.card__meta { margin-top: auto; padding-top: 10px; font-size: 0.8125rem; color: var(--c-ink-3); display: flex; gap: 14px; align-items: center; }
.card__meta .fa { margin-right: 5px; }
.card__more { color: var(--c-brand); font-weight: 600; font-size: 0.875rem; margin-left: auto; }

.list-cards { display: grid; gap: 12px; }
.list-card { display: block; padding: 18px 22px; border: 1px solid var(--c-line); border-radius: var(--radius); background: var(--c-bg); color: var(--c-ink); }
.list-card:hover { border-color: var(--c-brand); text-decoration: none; color: var(--c-ink); }
.list-card__title { font-weight: 700; font-family: var(--font-head); }
.list-card__text { color: var(--c-ink-2); font-size: 0.925rem; margin: 4px 0 0; }

.empty { padding: 40px 24px; text-align: center; border: 1px dashed var(--c-line-strong); border-radius: var(--radius-lg); color: var(--c-ink-3); }

/* ---------- Текстовый контент (richtext / StreamField) ---------- */
.prose { font-size: 1.0625rem; max-width: 76ch; }
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: 1.9rem; margin-top: 1.6em; }
.prose h2 { font-size: 1.5rem; margin-top: 1.6em; }
.prose h3 { font-size: 1.25rem; margin-top: 1.4em; }
.prose h4, .prose h5, .prose h6 { font-size: 1.05rem; margin-top: 1.3em; }
.prose p, .prose ul, .prose ol, .prose blockquote { margin-bottom: 1.1em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: 0.35em; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose blockquote { margin-left: 0; padding: 12px 20px; border-left: 4px solid var(--c-brand); background: var(--c-surface); color: var(--c-ink-2); border-radius: 0 var(--radius) var(--radius) 0; }
.prose hr { margin: 2em 0; }
.prose img { border-radius: var(--radius); }
.prose table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 0.95rem; }
.prose th, .prose td { border: 1px solid var(--c-line); padding: 10px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--c-surface); font-weight: 600; }
.prose .rich-text > :last-child { margin-bottom: 0; }
.prose--wide { max-width: none; }

.article { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
.article__body { min-width: 0; }
.stream > * + * { margin-top: 24px; }

.figure { margin: 0; }
.figure img { width: 100%; border-radius: var(--radius); border: 1px solid var(--c-line); }
.figure figcaption { font-size: 0.85rem; color: var(--c-ink-3); margin-top: 8px; }

/* Документы */
.doc {
  display: flex; align-items: center; gap: 16px; padding: 14px 18px;
  border: 1px solid var(--c-line); border-radius: var(--radius); background: var(--c-bg); color: var(--c-ink);
}
.doc:hover { border-color: var(--c-brand); text-decoration: none; color: var(--c-ink); box-shadow: var(--shadow-1); }
.doc__icon {
  flex: 0 0 auto; width: 44px; height: 52px; border-radius: 4px; position: relative;
  background: var(--c-surface-2); color: var(--c-ink-2); display: grid; place-items: end center;
  padding-bottom: 6px; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.doc__icon::before { content: ""; position: absolute; top: 0; right: 0; width: 14px; height: 14px; background: linear-gradient(225deg, var(--c-bg) 50%, var(--c-line-strong) 50%); border-radius: 0 4px 0 0; }
.doc__icon--pdf { background: var(--c-brand-soft); color: var(--c-brand); }
.doc__icon--doc { background: #e8eefb; color: #2b4ea2; }
.doc__icon--xls { background: #e6f4ec; color: #1f7a4d; }
.doc__icon--page { background: var(--c-graphite); color: #fff; place-items: center; padding-bottom: 0; font-size: 1.1rem; }
.doc__icon--page::before { display: none; }
.doc__body { display: block; flex: 1; min-width: 0; }
.doc__name { display: block; font-weight: 600; line-height: 1.35; }
.doc__meta { display: block; font-size: 0.8125rem; color: var(--c-ink-3); margin-top: 2px; }
.prose a.doc { text-decoration: none; }
.doc__dl { margin-left: auto; color: var(--c-ink-3); flex: 0 0 auto; }
.doc:hover .doc__dl { color: var(--c-brand); }

/* ---------- Формы ---------- */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field__label { font-weight: 600; font-size: 0.9rem; }
.field__label .req { color: var(--c-brand); }
.field__help { font-size: 0.8125rem; color: var(--c-ink-3); }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.field select, .field textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--c-line-strong);
  border-radius: var(--radius); background: var(--c-bg); transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--c-ink); box-shadow: 0 0 0 3px rgba(27, 31, 36, 0.12); }
.field input[type="file"] { padding: 8px 0; }
.field .errorlist { list-style: none; color: var(--c-brand); font-size: 0.85rem; }
.field--check { grid-template-columns: auto 1fr; align-items: start; gap: 10px; }
.form__actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; padding-top: 6px; }
.form__note { font-size: 0.8125rem; color: var(--c-ink-3); }
.alert { padding: 14px 18px; border-radius: var(--radius); border: 1px solid; font-size: 0.95rem; }
.alert--error { border-color: #f1b8b5; background: var(--c-brand-soft); color: var(--c-brand-dark); }
.alert--ok { border-color: #bfe3cf; background: #e6f4ec; color: var(--c-ok); }

/* Панель */
.panel { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius-lg); padding: 28px; }
.panel h2, .panel h3 { margin-top: 0; }
.panel--white { background: var(--c-bg); }
.panel--center { text-align: center; padding: 56px 28px; }
.two-col { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 40px; align-items: start; }

/* Контакты (richtext в панели) */
.contact-info h1, .contact-info h2, .contact-info h3, .contact-info h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-ink-3); margin: 1.4em 0 0.4em; }
.contact-info > :first-child, .contact-info .rich-text > :first-child { margin-top: 0; }
.contact-info p { margin-bottom: 0.5em; }
.contact-info a { font-weight: 600; }

/* ---------- Личный кабинет ---------- */
.page-account .header-tools .account-link, .page-account .nav__mobile-tools .account-link,
.page-account .header-tools .account-menu, .page-account .nav__mobile-tools .account-menu { display: none; }
.account-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.account-head__user { display: flex; align-items: center; gap: 20px; }
.account-head__avatar {
  flex: 0 0 auto; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c-graphite); color: #fff; font-family: var(--font-head); font-weight: 700; font-size: 1.5rem;
}
.account-head__kicker { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--c-brand); font-weight: 700; margin-bottom: 4px; }
.account-head h1 { font-size: clamp(1.4rem, 1rem + 1.2vw, 2rem); }
.account-head__welcome { margin: 4px 0 0; color: var(--c-ink-2); }
.account-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 600px) { .account-head__avatar { width: 48px; height: 48px; font-size: 1.1rem; } }

/* Вход для сотрудников */
.login { display: flex; align-items: center; min-height: 60vh; }
.login .container { width: 100%; }
.login__panel { max-width: 440px; margin: 0 auto; }
.login__title { font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2rem); margin: 4px 0 8px; }
.login__hint { margin-bottom: 24px; }
.account-head__actions form { display: inline-flex; margin: 0; }

/* ---------- Таблицы ---------- */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--c-line); border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--c-line); text-align: left; vertical-align: middle; white-space: nowrap; }
.table th { background: var(--c-surface); font-weight: 700; font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--c-ink-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfc; }
.table td.is-self { background: var(--c-surface-2); }
.table .num { text-align: center; }
.table .total { font-weight: 700; color: var(--c-brand); }

/* Таблицы с длинным текстом (реестры): перенос строк, выравнивание по верху */
.table--text th, .table--text td { white-space: normal; vertical-align: top; }
.table--text th { text-transform: none; letter-spacing: 0; font-size: 0.8125rem; line-height: 1.35; }
.table__actions { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: 0.85rem; }
.btn--danger { color: var(--c-brand); }
.btn--danger:hover { border-color: var(--c-brand); color: var(--c-brand-dark); }
.btn--primary.btn--danger { color: #fff; }

/* ---------- Реестр заявлений о доступе к инфраструктуре ---------- */
.registry__intro { margin-bottom: 24px; }
.registry__note { margin-top: 20px; font-size: 0.925rem; }
.registry__table { min-width: 900px; }
.registry__table--lk { min-width: 960px; }
.registry__colnum td { padding: 4px 14px; text-align: center; font-size: 0.75rem; color: var(--c-ink-3); background: var(--c-surface); border-bottom: 2px solid var(--c-line-strong); }
.registry__number, .registry__date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.registry__empty { text-align: center; color: var(--c-ink-3); padding: 36px 16px !important; }
.registry__meta { font-size: 0.8125rem; line-height: 1.35; }
.registry__col-region { width: 12%; } .registry__col-number { width: 9%; } .registry__col-date { width: 12%; }
.registry__col-applicant { width: 20%; } .registry__col-facility { width: 32%; } .registry__col-start { width: 15%; }
.registry__dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0 0 24px; }
.registry__dl dt { color: var(--c-ink-3); font-size: 0.875rem; }
.registry__dl dd { margin: 0; }
.registry-add { margin-bottom: 32px; padding: 0; overflow: hidden; }
.registry-add__summary { cursor: pointer; padding: 18px 28px; font-weight: 700; font-family: var(--font-head); font-size: 1.05rem; list-style: none; display: flex; align-items: center; gap: 10px; }
.registry-add__summary::-webkit-details-marker { display: none; }
.registry-add__summary::after { content: "\f107"; font-family: FontAwesome; margin-left: auto; color: var(--c-ink-3); transition: transform 0.15s; }
.registry-add[open] .registry-add__summary::after { transform: rotate(180deg); }
.registry-add[open] .registry-add__summary { border-bottom: 1px solid var(--c-line); }
.registry-add__form { padding: 24px 28px 28px; }
.registry-add__form .form__actions { margin-top: 18px; }

/* Переключатель (реестры филиалов) */
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.pill { display: inline-flex; align-items: center; min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--c-line-strong); font-weight: 600; font-size: 0.9rem; color: var(--c-ink-2); }
.pill:hover { text-decoration: none; border-color: var(--c-ink); color: var(--c-ink); }
.pill.is-active { background: var(--c-graphite); border-color: var(--c-graphite); color: #fff; }

/* Форма в две колонки */
.form--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form--grid .field--full { grid-column: 1 / -1; }
.messages { display: grid; gap: 10px; margin-bottom: 24px; }

/* Бейджи */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--c-surface-2); color: var(--c-ink-2); }
.badge--ok { background: #e6f4ec; color: var(--c-ok); }
.badge--warn { background: #fdf3e2; color: var(--c-warn); }
.badge--brand { background: var(--c-brand-soft); color: var(--c-brand); }

/* ---------- Карта ---------- */
.map-embed { border: 1px solid var(--c-line); border-radius: var(--radius-lg); overflow: hidden; background: var(--c-surface); min-height: 380px; }
.map-embed > * { width: 100% !important; }

/* ---------- Галерея слайдов ---------- */
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.gallery__item { margin: 0; border: 1px solid var(--c-line); border-radius: var(--radius-lg); overflow: hidden; background: var(--c-surface); }
.gallery__item img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.gallery__item figcaption { padding: 10px 14px; font-size: 0.875rem; color: var(--c-ink-2); }

/* ---------- Пагинация ---------- */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 32px; }
.pagination a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border: 1px solid var(--c-line-strong); border-radius: var(--radius); color: var(--c-ink); font-weight: 600; }
.pagination a:hover { border-color: var(--c-brand); color: var(--c-brand); text-decoration: none; }

/* ---------- Футер ---------- */
.site-footer { background: var(--c-graphite); color: rgba(255, 255, 255, 0.78); margin-top: auto; font-size: 0.9rem; }
.site-footer a { color: rgba(255, 255, 255, 0.85); }
.site-footer a:hover { color: #fff; }
.footer-main { padding: 48px 0 40px; border-bottom: 1px solid var(--c-graphite-line); }
.footer-main .container { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; }
.footer__brand { display: flex; align-items: center; gap: 14px; color: #fff; margin-bottom: 16px; }
.footer__brand img { height: 40px; }
.footer__brand span { font-family: var(--font-head); font-weight: 700; text-transform: uppercase; font-size: 0.85rem; line-height: 1.25; max-width: 240px; }
.footer__text p { margin-bottom: 0.6em; }
.footer__text p:last-child { margin: 0; }
.footer__title { color: #fff; font-family: var(--font-head); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 14px; }
.footer__links { list-style: none; display: grid; gap: 8px; }
.footer__contacts { list-style: none; display: grid; gap: 12px; }
.footer__contacts b { display: block; color: #fff; font-weight: 600; }
.footer__contacts span { color: rgba(255, 255, 255, 0.6); font-size: 0.8125rem; }
.footer-bottom { padding: 18px 0; font-size: 0.8125rem; color: rgba(255, 255, 255, 0.55); }
.footer-bottom .container { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* ---------- Модальное окно изображений ---------- */
.image-modal { position: fixed; inset: 0; z-index: 2000; display: none; }
.image-modal.active { display: block; }
.image-modal-overlay { position: absolute; inset: 0; background: rgba(15, 17, 20, 0.92); display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 32px; }
.image-modal-content { max-width: 100%; max-height: 85vh; object-fit: contain; border-radius: var(--radius); box-shadow: var(--shadow-2); }
.image-modal-caption { color: #fff; margin-top: 12px; font-size: 0.9rem; }
.image-modal-close { position: absolute; top: 16px; right: 24px; color: #fff; font-size: 40px; line-height: 1; cursor: pointer; }
.image-block-clickable { cursor: zoom-in; }

/* ---------- Версия для слабовидящих ---------- */
html.a11y { --fs-base: 20px; }
html.a11y body { font-family: Arial, Helvetica, sans-serif; }
html.a11y * { font-family: Arial, Helvetica, sans-serif !important; letter-spacing: 0.02em; }
html.a11y img:not(.brand__logo), html.a11y .tile__media, html.a11y .card__media, html.a11y .page-head--image { filter: grayscale(1) contrast(1.1); }
html.a11y a { text-decoration: underline; }
html.a11y .hero::after { display: none; }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile--lg { grid-column: span 2; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search__input { width: 160px; }
}
@media (max-width: 900px) {
  :root { --section: 40px; --gutter: 16px; }
  .hero .container { grid-template-columns: 1fr; gap: 32px; padding-top: 44px; padding-bottom: 44px; }
  .hero__aside { border-left: 0; padding-left: 0; border-top: 1px solid var(--c-graphite-line); padding-top: 28px; }
  .two-col { grid-template-columns: 1fr; }
  .footer-main .container { grid-template-columns: 1fr 1fr; gap: 32px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .header-main .container { min-height: 68px; gap: 12px; }
  .brand__logo { height: 36px; }
  .brand__text { font-size: 0.8rem; max-width: 200px; }
  .header-tools .search, .header-tools .account-link, .header-tools .account-menu { display: none; }
  .nav-toggle { display: inline-flex; }

  .navbar { display: none; border-top: 0; }
  .nav-open .navbar { display: block; }
  .nav { flex-direction: column; margin: 0; padding: 8px 0 16px; }
  .nav__item { flex-wrap: wrap; }
  .nav__link { flex: 1; min-height: 46px; }
  .nav__caret { margin: 0; width: 46px; justify-content: center; }
  .nav__sub { position: static; display: none; width: 100%; box-shadow: none; border: 0; border-top: 0; background: var(--c-graphite-2); padding: 4px 0 8px; }
  .nav__item:hover > .nav__sub, .nav__item:focus-within > .nav__sub { display: none; }
  .nav__item.is-open > .nav__sub { display: block; }
  .nav__sub a { color: rgba(255, 255, 255, 0.85); padding-left: 28px; }
  .nav__sub a:hover { background: transparent; color: #fff; }
  .nav__mobile-tools { padding: 12px 12px 4px; display: grid; gap: 10px; }
  .nav__mobile-tools .search { display: flex; }
  .nav__mobile-tools .search__input { width: 100%; flex: 1; }
  .nav__mobile-tools .account-link { display: inline-flex; color: #fff; border-color: rgba(255, 255, 255, 0.35); }
  .nav__mobile-tools .account-link:hover { color: #fff; border-color: #fff; }
  .nav__mobile-tools .account-menu__toggle { display: none; }
  .nav__mobile-tools .account-menu__list { display: grid; gap: 10px; position: static; min-width: 0; background: none; border: 0; box-shadow: none; padding: 0; }
  .nav__mobile-tools .account-menu__list a { display: inline-flex; align-items: center; min-height: 42px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: var(--radius); color: #fff; font-weight: 600; }
}
@media (max-width: 600px) {
  .tiles, .cards, .gallery { grid-template-columns: 1fr; }
  .tile--lg { grid-column: span 1; }
  .tile--lg .tile__media { aspect-ratio: 16 / 9; }
  /* .topbar__links a задаёт display: inline-flex — селекторы ниже должны быть специфичнее */
  .topbar__region, .topbar__links .topbar__regions, .topbar__links .topbar__user, .topbar__links .topbar__admin { display: none; }
  .topbar .container { justify-content: flex-end; }
  .brand__text { display: none; }
  .page-head { padding: 24px 0; }
  .page-head--image { padding: 44px 0; }
  .panel { padding: 20px; }
  .footer-main .container { grid-template-columns: 1fr; }
  .section__head { flex-direction: column; align-items: flex-start; }
  .form--grid { grid-template-columns: 1fr; }
  .registry-add__summary, .registry-add__form { padding-left: 20px; padding-right: 20px; }
  .registry__dl { grid-template-columns: 1fr; gap: 2px 0; }
  .registry__dl dd { margin-bottom: 10px; }
}
@media (min-width: 901px) {
  .nav__mobile-tools { display: none; }
}

/* ---------- Печать ---------- */
@media print {
  .site-header, .site-footer, .breadcrumbs, .nav-toggle, .skip-link, .hero::after { display: none !important; }
  body { color: #000; }
  a { color: #000; text-decoration: underline; }
  .prose { max-width: none; }
}
