/* Дизайн-макет «Проверка ТН ВЭД — дизайн» (экраны 1–6). Зелёного нет (ОТ-3.3.3):
   синий — информация / нотификация действует, оранжевый — уточнить, красный — входит в 2.19 / недействительна,
   серый — не входит / не требуется. */

/* ---------- Шрифты (локально: система работает в закрытой сети; лицензия — fonts/OFL-Roboto.txt) ---------- */
@font-face { font-family: Roboto; font-style: normal; font-weight: 100 900; font-display: swap; src: url(../fonts/roboto-cyrillic-ext.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: Roboto; font-style: normal; font-weight: 100 900; font-display: swap; src: url(../fonts/roboto-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Roboto; font-style: normal; font-weight: 100 900; font-display: swap; src: url(../fonts/roboto-latin.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: "Roboto Mono"; font-style: normal; font-weight: 100 700; font-display: swap; src: url(../fonts/roboto-mono-cyrillic-ext.woff2) format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Roboto Mono"; font-style: normal; font-weight: 100 700; font-display: swap; src: url(../fonts/roboto-mono-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Roboto Mono"; font-style: normal; font-weight: 100 700; font-display: swap; src: url(../fonts/roboto-mono-latin.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 {
    --primary: #1F4E8C;
    --primary-hover: #163A69;
    --text: #1B2430;
    --text-2: #3A4452;
    --muted: #5A6472;
    --bg: #F4F6F9;
    --surface: #FFFFFF;
    --border: #DDE2EA;
    --border-input: #B8C0CC;
    --row: #EEF1F5;

    --info-bg: #E8F0FB; --info-border: #B9CDEB; --info-text: #17407A; --info-solid: #1F4E8C;
    --warn-bg: #FFF3E0; --warn-border: #F2C88C; --warn-text: #7A4200; --warn-box-text: #6B3A00; --warn-solid: #9A5200;
    --danger-bg: #FDECEA; --danger-border: #F1B7B2; --danger-text: #8E1B1B; --danger-box-text: #7F1717; --danger-solid: #B3261E;
    --neutral-bg: #EEF1F5; --neutral-border: #D3D9E2; --neutral-text: #3A4452; --neutral-box-text: #2E3744; --neutral-solid: #5A6472;

    /* Ширина рабочей области: на всю ширину экрана с полями по бокам. */
    --page-max: 100%;
    --page-pad: 32px;

    --font: Roboto, system-ui, "Segoe UI", sans-serif;
    --mono: "Roboto Mono", Consolas, monospace;
}

html, body { margin: 0; background: var(--bg); }
body { font-family: var(--font); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* FocusOnNavigate переводит фокус на h1 (tabindex=-1) для экранных дикторов — обводка заголовку не нужна. */
h1:focus, h1:focus-visible, [tabindex="-1"]:focus { outline: none; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Шапка ---------- */
.app { font-family: var(--font); color: var(--text); background: var(--bg); min-height: 100vh; }
.app-header { background: var(--primary); color: #FFFFFF; }
.app-header__inner { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--page-pad); box-sizing: border-box; min-height: 64px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
.brand { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; color: #FFFFFF; text-decoration: none; }
.brand:hover { color: #FFFFFF; }
.brand__text { display: flex; flex-direction: column; }
.brand__title { font-size: 18px; font-weight: 500; letter-spacing: .2px; }
.brand__sub { font-size: 12px; opacity: .85; }
.app-menu { display: contents; }
.menu-btn { display: none; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 6px; background: transparent; color: #FFFFFF; }
.menu-btn:hover { background: rgba(255,255,255,.10); }
.app-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.app-nav a { color: #FFFFFF; text-decoration: none; padding: 10px 14px; border-radius: 6px; font-size: 14px; }
.app-nav a:hover { color: #FFFFFF; background: rgba(255,255,255,.10); }
.app-nav a.active { background: rgba(255,255,255,.16); font-weight: 500; }
.app-header__user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.app-header__user form { margin: 0; display: flex; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 6px; background: transparent; color: inherit; }
.icon-btn:hover { background: rgba(255,255,255,.10); }

.lang { display: flex; border-radius: 6px; overflow: hidden; }
.lang a { display: inline-flex; align-items: center; padding: 8px 10px; min-height: 36px; box-sizing: border-box; font: 500 13px var(--font); text-decoration: none; }
.lang--on-dark { border: 1px solid rgba(255,255,255,.5); }
.lang--on-dark a { color: #FFFFFF; background: transparent; }
.lang--on-dark a.on { background: #FFFFFF; color: var(--primary); }
.lang--on-light { border: 1px solid var(--border-input); }
.lang--on-light a { color: var(--text-2); background: #FFFFFF; }
.lang--on-light a.on { background: var(--primary); color: #FFFFFF; }

/* ---------- Страница ---------- */
.page { max-width: var(--page-max); margin: 0 auto; padding: 24px var(--page-pad); display: flex; flex-direction: column; gap: 20px; box-sizing: border-box; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.page-head--stack { flex-direction: column; align-items: flex-start; gap: 6px; }
.page-title { margin: 0; font-size: 24px; font-weight: 500; }
.page-sub { font-size: 14px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.card--gap16 { gap: 16px; }
.card--summary { border: 2px solid var(--primary); gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.panel--pad { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.panel__head { padding: 16px 20px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--row); }
.panel__title { margin: 0; font-size: 17px; font-weight: 500; }
.h2-small { margin: 0; font-size: 16px; font-weight: 500; }

.step-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.step-head__left { display: flex; align-items: center; gap: 12px; }
.step-num { width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--primary); color: #FFFFFF; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.step-title { margin: 0; font-size: 20px; font-weight: 500; }
.step-source { font-size: 13px; }
/* Сворачиваемые Шаги 2 и 3: заголовок — кнопка, в свёрнутом виде рядом краткий итог */
.step-toggle { display: inline-flex; align-items: center; gap: 12px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.step-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 6px; }
.step-toggle__icon { flex: none; color: var(--muted); transition: transform .15s ease; }
.step-toggle[aria-expanded="false"] .step-toggle__icon { transform: rotate(-90deg); }
.step-head__left { flex-wrap: wrap; }
.step-summary { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.step-body { display: contents; }

/* ---------- Поля ---------- */
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row--end { align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .label { font-size: 13px; color: var(--text-2); }
.field .label--strong, .field label.strong { font-weight: 500; }
.field .hint { font-size: 13px; color: var(--muted); }
.input, .select { box-sizing: border-box; width: 100%; height: 44px; border: 1px solid var(--border-input); border-radius: 8px; padding: 0 12px; font: 15px var(--font); color: var(--text); background: #FFFFFF; }
.select { padding: 0 10px; }
.input.mono { font-family: var(--mono); }
.input--lg { height: 48px; padding: 0 14px; font-size: 16px; }
.input--code { height: 52px; border: 2px solid var(--primary); padding: 0 44px 0 14px; font: 500 22px var(--mono); letter-spacing: 1px; }
.input--mask { height: 48px; font: 500 18px var(--mono); letter-spacing: 2px; }
.input-wrap { position: relative; }
.input-wrap > svg { position: absolute; right: 14px; top: 16px; pointer-events: none; }
.readonly-box { min-height: 52px; box-sizing: border-box; display: flex; align-items: center; padding: 8px 14px; background: var(--bg); border-radius: 8px; font-size: 14px; color: var(--text-2); }

.suggest { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: #FFFFFF; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(27,36,48,.12); max-height: 320px; overflow-y: auto; }
.suggest button { display: flex; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 6px; background: transparent; font: 14px var(--font); color: var(--text); }
.suggest button:hover, .suggest button:focus-visible { background: var(--info-bg); }
.suggest .mono { flex: none; color: var(--primary); font-weight: 500; }
.suggest .name { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 8px; font: 500 14px var(--font); text-decoration: none; box-sizing: border-box; white-space: nowrap; }
.btn--primary { border: 0; background: var(--primary); color: #FFFFFF; }
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); color: #FFFFFF; }
.btn--outline { border: 1px solid var(--primary); background: #FFFFFF; color: var(--primary); }
.btn--outline:hover:not(:disabled) { background: var(--info-bg); color: var(--primary); }
.btn--wide { padding: 0 28px; font-size: 15px; letter-spacing: .3px; }
.btn--search { padding: 0 24px; }
.btn--sm { height: 40px; padding: 0 16px; }
.btn--block { width: 100%; height: 48px; font-size: 15px; }
.link-btn { border: 0; background: none; padding: 10px 4px; font: 14px var(--font); color: var(--primary); text-decoration: underline; }
.link-btn:hover { color: var(--primary-hover); }

.seg { display: flex; border: 1px solid var(--border-input); border-radius: 8px; overflow: hidden; }
.seg button { min-height: 44px; padding: 0 16px; border: 0; font: 500 14px var(--font); background: #FFFFFF; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--border-input); }
.seg button.on { background: var(--primary); color: #FFFFFF; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px dashed var(--border); }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; font: 14px var(--font); background: #FFFFFF; border: 1px solid var(--border-input); color: var(--text-2); }
.chip.on { background: var(--info-bg); border-color: var(--primary); color: var(--info-text); font-weight: 500; }

/* ---------- Статусы ---------- */
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.pill--lg { padding: 4px 12px; }
.pill--wrap { white-space: normal; }
.pill.soft-info { background: var(--info-bg); color: var(--info-text); }
.pill.soft-warn { background: var(--warn-bg); color: var(--warn-text); }
.pill.soft-danger { background: var(--danger-bg); color: var(--danger-text); }
.pill.soft-neutral { background: var(--neutral-bg); color: var(--neutral-text); }
.pill.solid-info { background: var(--info-solid); color: #FFFFFF; }
.pill.solid-warn { background: var(--warn-solid); color: #FFFFFF; }
.pill.solid-danger { background: var(--danger-solid); color: #FFFFFF; }
.pill.solid-neutral { background: var(--neutral-solid); color: #FFFFFF; }
.pill.box-info { background: var(--info-bg); border: 1px solid var(--info-border); color: var(--info-text); }
.pill.box-danger { background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger-box-text); }
.pill.box-warn { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-box-text); }

.tone-info { background: var(--info-bg); border: 1px solid var(--info-border); color: var(--info-text); }
.tone-warn { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-box-text); }
.tone-danger { background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger-box-text); }
.tone-neutral { background: var(--neutral-bg); border: 1px solid var(--neutral-border); color: var(--neutral-box-text); }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 8px; font-size: 14px; }
.alert > svg { flex: none; margin-top: 1px; }
.alert.tone-warn { color: var(--warn-text); }
.status-msg { padding: 14px 16px; border-radius: 8px; font-size: 15px; line-height: 1.45; font-weight: 500; white-space: pre-line; }
.result-box { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 8px; }
.result-box__head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.result-box__title { font-size: 17px; }
.result-box p { margin: 0; font-size: 14px; line-height: 1.5; white-space: pre-line; }
.result-items { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.result-items li { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; padding: 8px 12px; background: rgba(255,255,255,.7); border-radius: 6px; }
.result-items strong { min-width: 64px; }
.result-items .mono { color: var(--text-2); }

.note { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-2); padding: 10px 14px; background: var(--bg); border-radius: 8px; }
.note--info { padding: 12px 14px; background: var(--info-bg); }
.note > svg { flex: none; margin-top: 1px; }

.registry-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.registry-line strong { color: var(--text); }
.registry-line .pill { gap: 6px; padding: 4px 10px; font-weight: 400; }

/* ---------- Шаг 2 ---------- */
.hier { margin: 0; padding: 14px 16px; list-style: none; background: var(--bg); border-radius: 8px; display: flex; flex-direction: column; gap: 6px; }
.hier li { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; color: var(--text-2); }
.hier li.leaf { color: var(--text); font-weight: 500; }
.hier .code { display: inline-block; min-width: 150px; font: 500 13px var(--mono); color: var(--primary); }

/* Справочники: найденные коды «из» в Разделе 2.19 и кнопка-пометка в поиске ТН ВЭД */
.code-hit { background: var(--info-bg); color: var(--info-text); font-weight: 600; border-radius: 4px; padding: 0 3px; }
.pill--btn { border: 0; cursor: pointer; font-family: inherit; }
.pill--btn:hover { text-decoration: underline; }
/* Шаг 1 в форме (Enter — проверка); раскладку задают ряды внутри, сама форма в ней не участвует */
.check-form { display: contents; }

.spec-cols { display: flex; flex-wrap: wrap; gap: 16px; }
.spec-col { flex: 1 1 380px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.spec-card { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.spec-card__head { padding: 10px 16px; background: var(--row); font-size: 13px; font-weight: 500; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; }
.spec-card--product { border-color: var(--info-border); }
.spec-card--product .spec-card__head { background: var(--info-bg); color: var(--info-text); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; text-transform: none; letter-spacing: 0; }
.spec-card--product .spec-card__head .caps { text-transform: uppercase; letter-spacing: .4px; }
.spec-list { margin: 0; padding: 8px 16px 14px; }
.spec-list > div { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 8px 0; border-bottom: 1px solid var(--row); }
.spec-list dt { flex: 0 0 150px; font-size: 13px; color: var(--muted); }
.spec-list dd { margin: 0; flex: 1 1 200px; font-size: 14px; }
.empty { font-size: 14px; color: var(--muted); padding: 12px 16px; }

/* ---------- Шаг 4 ---------- */
.notif-cols { display: flex; flex-wrap: wrap; gap: 16px; }
.notif-card { flex: 2 1 520px; border: 1px solid var(--border); border-radius: 8px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.notif-card--mask { flex: 1 1 320px; gap: 12px; }
.notif-card__head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.notif-no { font: 500 22px var(--mono); }
.notif-grid { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; }
.notif-grid dt { font-size: 12px; color: var(--muted); }
.notif-grid dd { margin: 2px 0 0; font-size: 14px; }
.notif-match { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--row); }
.caption-strong { font-size: 13px; font-weight: 500; color: var(--text-2); }
.mask { font: 500 18px var(--mono); letter-spacing: 2px; }

.bits { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
.bits > div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 6px; background: var(--row); color: var(--muted); }
.bits > div.on { background: var(--primary); color: #FFFFFF; }
.bits small { font-size: 11px; }
.bits .v { font: 500 14px var(--mono); }
.bits--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.bits--6 > div { padding: 8px 0; }
.bits--6 .v { font-size: 15px; }

/* ---------- Итог ---------- */
.summary-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.summary-head span { font-size: 13px; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.tile { padding: 14px; background: var(--bg); border-radius: 8px; display: flex; flex-direction: column; gap: 4px; }
.tile__label { font-size: 12px; color: var(--muted); }
.tile__text { font-size: 13px; }
.tile__action { font-size: 14px; }
.summary-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.summary-foot .disclaimer { font-size: 13px; color: var(--muted); flex: 1 1 400px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.sources { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--muted); padding: 4px 0 24px; }

.progress { height: 4px; border-radius: 2px; background: var(--info-bg); overflow: hidden; position: relative; }
.progress::after { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: var(--primary); animation: progress 1.1s ease-in-out infinite; }
@keyframes progress { from { left: -30%; } to { left: 100%; } }

/* ---------- Таблицы ---------- */
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px; display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead tr { background: var(--row); text-align: left; color: var(--text-2); }
.table th { padding: 12px 16px; font-weight: 500; }
.table td { padding: 12px 16px; vertical-align: top; }
.table tbody tr { border-top: 1px solid var(--row); }
.table--compact td { padding: 11px 16px; }
.table--wide th, .table--wide td { padding-left: 20px; padding-right: 20px; }
.table--wide th { padding-top: 10px; padding-bottom: 10px; }
.table--wide td { padding-top: 11px; padding-bottom: 11px; }
.table .nowrap { white-space: nowrap; }
.table .num { color: var(--muted); }
.table .right { text-align: right; }
.table .code { font-family: var(--mono); color: var(--primary); }
.table .stack { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.table-empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 14px; }

.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.pager__buttons { display: flex; gap: 6px; }
.pager button { width: 40px; height: 40px; border: 1px solid var(--border-input); background: #FFFFFF; border-radius: 8px; color: var(--text-2); font: 14px var(--font); }
.pager button.on { border-color: var(--primary); background: var(--info-bg); color: var(--info-text); font-weight: 500; }

/* ---------- Справочники ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs button { min-height: 44px; padding: 0 18px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--text-2); font: 14px var(--font); }
.tabs button[aria-selected="true"] { border-bottom-color: var(--primary); color: var(--primary); font-weight: 500; }
.ref-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.ref-main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.ref-aside { flex: 1 1 340px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cat-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.cat-list li { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid var(--row); font-size: 14px; }
.cat-list .n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--row); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 500; font-size: 13px; }
.cat-list .t { padding-top: 4px; }

/* ---------- Администрирование ---------- */
.db-cards { display: flex; flex-wrap: wrap; gap: 16px; }
.db-card { flex: 1 1 340px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.db-card__head { display: flex; flex-direction: column; gap: 4px; }
.db-card__src { font-size: 13px; color: var(--muted); }
.db-card__stats { display: flex; flex-wrap: wrap; gap: 24px; }
.db-card__stats > div { display: flex; flex-direction: column; gap: 2px; }
.db-card__stats span { font-size: 12px; color: var(--muted); }
.db-card__stats .big { font-size: 22px; font-weight: 500; }
.db-card__stats .mid { font-size: 15px; font-weight: 500; }
.db-card__mode { font-size: 13px; color: var(--text-2); }
.db-card__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.user-form { padding: 16px 20px; border-bottom: 1px solid var(--row); display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; background: #FAFBFC; }

/* Администрирование: вкладки журналов и учётных записей */
.admin-tabs__list { padding: 0 12px; }
.admin-tabs__panel { display: flex; flex-direction: column; }
.admin-tabs__panel[hidden] { display: none; }
.admin-tabs__panel > .tab-tools__note { padding: 14px 20px 0; }
.tab-tools { padding: 14px 20px; display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; justify-content: space-between; border-bottom: 1px solid var(--row); }
.tab-tools > form.row { display: flex; flex-wrap: wrap; }
.tab-tools__note { font-size: 13px; color: var(--muted); }
.tab-pager { padding: 14px 20px; border-top: 1px solid var(--row); }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; color: var(--text-2); }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.form-msg { font-size: 14px; padding: 10px 14px; border-radius: 8px; }

/* ---------- Вход ---------- */
.login { font-family: var(--font); color: var(--text); background: var(--bg); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 16px; box-sizing: border-box; }
.login__col { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; }
.login__brand { display: flex; align-items: center; gap: 12px; justify-content: center; }
.login__brand .t { font-size: 20px; font-weight: 500; }
.login__brand .s { font-size: 13px; color: var(--muted); }
.login__card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 18px; margin: 0; }
.login__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.login__head h1 { margin: 0; font-size: 22px; font-weight: 500; }
.login .field label { font-weight: 500; }
.login__hint { font-size: 13px; color: var(--muted); text-align: center; }
.login__foot { font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- Окно потери связи (Blazor Server) ---------- */
#components-reconnect-modal { display: none; position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; padding: 16px; background: rgba(27,36,48,.45); font-family: var(--font); }
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected { display: flex; }
.reconnect__box { width: 100%; max-width: 420px; background: var(--surface); border-radius: 12px; padding: 24px; box-shadow: 0 16px 40px rgba(27,36,48,.25); }
.reconnect__box h2 { margin: 0 0 8px; font-size: 18px; font-weight: 500; color: var(--text); }
.reconnect__box p { margin: 0 0 16px; font-size: 14px; color: var(--text-2); }
.reconnect__box .progress { margin-bottom: 16px; }
.reconnect__state { display: none; }
.components-reconnect-show .reconnect__state--retrying,
.components-reconnect-retrying .reconnect__state--retrying,
.components-reconnect-failed .reconnect__state--failed,
.components-reconnect-rejected .reconnect__state--rejected { display: block; }

/* ---------- Адаптив ---------- */

/* Планшет и уже: меню шапки — по кнопке. */
@media (max-width: 1023px) {
    :root { --page-pad: 20px; }
    .app-header__inner { flex-wrap: nowrap; gap: 12px; position: relative; }
    .brand { min-width: 0; }
    .brand__title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .menu-btn { display: inline-flex; flex: none; }
    .app-menu { display: none; }
    .app-menu.open {
        display: flex; flex-direction: column; gap: 12px;
        position: absolute; z-index: 50; left: 0; right: 0; top: 100%;
        padding: 8px var(--page-pad) 16px; background: var(--primary); box-shadow: 0 12px 24px rgba(27,36,48,.25);
    }
    .app-menu.open .app-nav { flex-direction: column; gap: 2px; }
    .app-menu.open .app-nav a { padding: 12px 14px; font-size: 15px; }
    .app-menu.open .app-header__user { flex-wrap: wrap; justify-content: space-between; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.2); }
    .ref-aside { flex-basis: 100%; }
}

/* Телефон. */
@media (max-width: 720px) {
    :root { --page-pad: 16px; }
    .page { padding-top: 16px; padding-bottom: 16px; gap: 16px; }
    .app-header__inner { min-height: 56px; }
    .brand__sub { display: none; }
    .page-title { font-size: 20px; }
    .card { padding: 16px; gap: 16px; }
    .step-title { font-size: 17px; }
    .step-num { width: 28px; height: 28px; font-size: 14px; }
    .panel__head { padding: 14px 16px; }
    .db-card { padding: 16px; }

    .input--code { font-size: 20px; }
    .readonly-box { min-height: 44px; }
    .notif-card { padding: 14px; }
    .notif-no { font-size: 18px; }
    .notif-grid { grid-template-columns: minmax(0, 1fr); }
    .bits { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .hier .code { min-width: 0; }
    .hier li { padding-left: 0 !important; }
    .spec-list dt { flex-basis: 100%; }
    .result-box { padding: 14px; }

    /* Кнопки действий — во всю ширину; панель «Проверить» прилипает к низу экрана. */
    .check-actions { position: sticky; bottom: 0; z-index: 2; margin: 0 -16px; padding: 10px 16px; background: #FFFFFF; box-shadow: 0 -6px 12px rgba(27,36,48,.06); }
    .check-actions .seg { width: 100%; }
    .check-actions .seg button { flex: 1 1 0; padding: 0 8px; }
    .actions { width: 100%; }
    .actions > .btn { flex: 1 1 160px; }
    .summary-foot .disclaimer { flex-basis: 100%; }
    .page-head > .btn, .filters > .btn, .db-card__actions > .btn { width: 100%; }
    .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
    .chips > span { flex: none; }
    .chip { flex: none; }

    .tabs { flex-wrap: nowrap; overflow-x: auto; }
    .tabs button { flex: none; }
    .filters { padding: 14px; }
    .user-form { padding: 14px 16px; }
    .user-form .actions > .btn { flex: 1 1 0; }
    .pager { justify-content: center; text-align: center; }

    /* Таблицы-карточки: каждая строка — блок «подпись: значение». */
    .table--stack { min-width: 0 !important; }
    .table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; }
    .table--stack tbody tr { padding: 10px 16px; border-top: 1px solid var(--border); }
    .table--stack tbody tr:first-child { border-top: 0; }
    .table--stack td, .table--compact.table--stack td, .table--wide.table--stack td { display: flex; gap: 12px; padding: 5px 0; white-space: normal; text-align: left; }
    .table--stack td::before { content: attr(data-label); flex: 0 0 38%; font-size: 12px; color: var(--muted); padding-top: 2px; }
    .table--stack td[data-label=""]::before { display: none; }
    .table--stack td.right { justify-content: flex-end; }
    .table--stack .pill { white-space: normal; }
}

/* Узкий телефон. */
@media (max-width: 400px) {
    .brand__title { font-size: 16px; }
    .seg button { font-size: 13px; }
    .tiles { grid-template-columns: minmax(0, 1fr); }
    .login__card { padding: 20px; }
    .login__head { flex-wrap: wrap; }
}

/* Тех. описание из открытых источников (Шаг 2) */
.osrc { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.osrc .spec-card__head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; }
.osrc__sub { font-size: 13px; color: var(--text-2); }
.osrc__links { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.osrc__links li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.osrc__links a { font-weight: 500; }
.osrc__links span { font-size: 12px; color: var(--muted); }
.osrc__info { display: flex; flex-direction: column; gap: 8px; }
.osrc__facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.osrc__facts dt { color: var(--muted); }
.osrc__facts dd { margin: 0; }
.osrc__text { white-space: pre-wrap; font-family: inherit; font-size: 13px; max-height: 260px; overflow: auto; margin: 8px 0 0; padding: 10px; background: var(--row); border-radius: 6px; }
.osrc__form { display: flex; flex-direction: column; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
@media (max-width: 640px) { .osrc__facts { grid-template-columns: 1fr; } }
