/* =========================================================================
   work-system — единая дизайн-система
   Источник истины: templates/admin_dashboard.html (эталон нового дизайна).
   Правило: страницы НЕ определяют :root и не копируют компоненты.
   Специфика страницы -> {% block head %} в её шаблоне.
   ========================================================================= */

/* ── Токены ───────────────────────────────────────────────────────────── */
:root {
    --brand-blue: #0b1475;
    --brand-blue-hover: #18239a;
    --brand-blue-soft: rgba(11, 20, 117, .07);
    --brand-peach: #f58a65;

    --bg: #f5f6f8;
    --card-bg: #ffffff;
    --surface-muted: #fafbfc;

    --text: #16181d;
    --text-soft: #5c6270;
    --muted: #6b7280;

    --border: #e6e8ec;
    --border-strong: #d8dbe2;

    --success-bg: #eefbf3;
    --success-text: #067647;
    --success-border: rgba(6, 118, 71, .16);
    --error-bg: #fff1ed;
    --error-text: #b42318;
    --error-border: rgba(180, 35, 24, .16);
    --warn-bg: #fff7ed;
    --warn-text: #9a3412;
    --warn-border: rgba(154, 52, 18, .18);

    --shadow-card: 0 1px 2px rgba(11, 20, 117, .04);
    --shadow-hover: 0 10px 24px rgba(11, 20, 117, .08);
    --shadow-modal: 0 24px 60px rgba(15, 23, 42, .3);

    --radius-sm: 9px;
    --radius: 13px;
    --radius-lg: 15px;
    --radius-pill: 999px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --page-max: 1240px;
}

/* ── База ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-blue); }
a:hover { color: var(--brand-blue-hover); }

h1, h2, h3, h4 { letter-spacing: -.2px; text-wrap: pretty; }

.page {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 0 24px 56px;
}
.page-narrow { --page-max: 1040px; }
.page-wide   { --page-max: 1600px; }

/* Топбар и quicknav — соседи .page, а не потомки: модификатор ширины со .page
   до них не докатывается, и лого уезжает от левого края контента. Поднимаем
   --page-max на body по фактическому модификатору страницы — тогда все три
   полосы (шапка, quicknav, контент) выравниваются по одной левой границе,
   и в новых страницах достаточно поставить класс на .page, как раньше. */
body:has(.page-narrow) { --page-max: 1040px; }
body:has(.page-wide)   { --page-max: 1600px; }

/* ── Топбар ───────────────────────────────────────────────────────────── */
.topbar {
    border-bottom: 1px solid var(--border);
    background: #fff;
}
.topbar-sticky { position: sticky; top: 0; z-index: 20; }

.topbar-inner {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand > div { display: flex; flex-direction: column; justify-content: center; }

.brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    flex-shrink: 0;
}

.brand-title {
    margin: 0;
    font-size: 19px;
    letter-spacing: -.2px;
    line-height: 1.2;
    color: var(--brand-blue);
    font-weight: 700;
}

.brand-subtitle {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.3;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Заголовок раздела ────────────────────────────────────────────────── */
.hero {
    padding: 34px 0 26px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.hero h2 {
    margin: 0 0 7px;
    color: var(--text);
    font-size: 30px;
    letter-spacing: -.5px;
    font-weight: 700;
}

.hero p {
    margin: 0;
    color: var(--muted);
    font-size: 14.5px;
    line-height: 1.55;
    max-width: 640px;
    text-wrap: pretty;
}

.hero-count {
    font-size: 13px;
    color: var(--muted);
    border: 1px solid var(--border);
    background: #fff;
    border-radius: var(--radius-pill);
    padding: 7px 14px;
    white-space: nowrap;
    font-weight: 600;
}

/* ── Группы разделов ──────────────────────────────────────────────────── */
.group { margin-bottom: 34px; }
.group-hdr { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }

.group-title {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .9px;
    text-transform: uppercase;
    color: var(--text-soft);
}

.group-count {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-soft);
    background: #eef0f3;
    border-radius: var(--radius-pill);
    min-width: 20px;
    text-align: center;
    padding: 2px 7px;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(316px, 1fr)); gap: 12px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); }

/* ── Карточка-панель ──────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px;
}
.card-tight { padding: 14px 18px; }
.card > h2, .card > h3 { margin-top: 0; color: var(--brand-blue); }
.card > h2 { font-size: 19px; }
.card > h3 { font-size: 17px; }

/* ── Карточка-ссылка (сетка разделов админки) ─────────────────────────── */
.nav-card {
    position: relative;
    display: grid;
    grid-template-columns: 50px 1fr;
    gap: 15px;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 17px;
    text-decoration: none;
    color: inherit;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.nav-card:hover {
    transform: translateY(-2px);
    border-color: #c7ccdb;
    box-shadow: var(--shadow-hover);
    color: inherit;
}

.icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-blue-soft);
    color: var(--brand-blue);
    flex-shrink: 0;
    transition: background .16s ease;
}

.icon svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon.indigo { background: #e6e8fb; color: #3b45c9; }
.icon.sky    { background: #dff0fb; color: #1c7fb8; }
.icon.teal   { background: #d8f2ec; color: #14806c; }
.icon.lime   { background: #e6f4d9; color: #4d7c19; }
.icon.amber  { background: #fdeecd; color: #a1670a; }
.icon.coral  { background: #fde3d8; color: #bf4d26; }
.icon.rose   { background: #fbe0e8; color: #b1345c; }
.icon.violet { background: #eee2fb; color: #7738b8; }
.icon.slate  { background: #e8eaee; color: #566072; }

.nav-card:hover .icon { filter: saturate(1.15) brightness(.97); }

.card-body { min-width: 0; display: block; }
.card-top { display: block; margin-bottom: 5px; }

.title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.1px;
    color: var(--text);
    line-height: 1.3;
}

.desc {
    display: block;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
    text-wrap: pretty;
}

.go {
    position: absolute;
    right: 14px;
    bottom: 12px;
    font-size: 14px;
    color: #c3c7d1;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity .16s ease, transform .16s ease;
}

.nav-card:hover .go { opacity: 1; transform: translateX(0); color: var(--brand-blue); }

/* ── Кнопки ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.btn-primary { background: var(--brand-blue); color: #fff; }
.btn-primary:hover { background: var(--brand-blue-hover); color: #fff; }

.btn-secondary, .logout, .back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 15px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
}
.btn-secondary:hover, .logout:hover, .back-link:hover {
    background: #f7f8fa;
    border-color: #c3c7d1;
    color: var(--text);
}

.btn-danger { background: #b42318; color: #fff; }
.btn-danger:hover { background: #9f1f16; color: #fff; }

.btn-sm { height: 34px; padding: 0 11px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Формы ────────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.align-end { align-items: end; }

.field { min-width: 0; }

.field label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand-blue);
    margin-bottom: 7px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    height: 42px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { height: auto; min-height: 88px; padding: 10px 12px; }

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: rgba(11, 20, 117, .35);
    box-shadow: 0 0 0 3px rgba(11, 20, 117, .08);
}

.field-hint { margin: 7px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

/* ── Таблицы ──────────────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}
.table-wrap.is-tall { max-height: 70vh; overflow-y: auto; }

.table-wrap table { width: 100%; border-collapse: collapse; background: #fff; }

.table-wrap th,
.table-wrap td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
}

.table-wrap th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-muted);
    color: var(--brand-blue);
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: inset 0 -1px 0 var(--border);
}

.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:hover { background: #fcfcfd; }

.inline-form { display: grid; gap: 8px; align-items: center; }
.inline-form input, .inline-form select {
    height: 36px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 13px;
    width: 100%;
    background: #fff;
}
.actions { display: flex; gap: 8px; align-items: center; }

.empty { padding: 16px 0 2px; color: var(--muted); font-size: 14px; }

/* ── Плашки и бейджи ──────────────────────────────────────────────────── */
.pill {
    display: inline-block;
    padding: 6px 11px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    background: #f2f4f7;
    color: #344054;
}
.pill-neutral, .type-base { background: #f2f4f7; color: #344054; }
.pill-info, .type-format { background: #e0f2fe; color: #026aa2; }
.pill-warn, .type-store { background: var(--warn-bg); color: var(--warn-text); }
.pill-violet, .type-personal { background: #f4ebff; color: #6941c6; }
.pill-success { background: var(--success-bg); color: var(--success-text); }
.pill-danger { background: var(--error-bg); color: var(--error-text); }
.pill-peach { background: rgba(245, 138, 101, .14); color: #8f3e20; }

.row-personal { background: #fcfaff; }
.row-store { background: #fffdf8; }
.row-format { background: #f8fcff; }

.chip {
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    background: #f1f3f7;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 5px 11px;
}

/* ── Проблемный реквизит ──────────────────────────────────────────────── */
/* Подсветка красным «в 10% яркости»: карточка видна как проблемная, но текст
   на ней читается — сплошная заливка сделала бы список нечитаемым. */
.req-card-bad { background: rgba(255, 0, 0, .07); border-color: var(--error-border); }
.req-problems { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 0; }

/* ── Попап смены без плана (_no_plan_popup.html) ──────────────────────── */
.np-modal { max-width: 440px; }
.np-body { padding: 0 20px 4px; }
.np-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}
.np-row .k { color: var(--muted); }
.np-row .v { font-weight: 700; color: var(--text); text-align: right; }
.np-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 20px 20px; }

/* Кликабельная ячейка смены без плана: подсказываем, что по ней можно нажать. */
.no-plan-hours[data-np-cell] { cursor: pointer; text-decoration: underline dotted; }
.no-plan-hours[data-np-cell]:hover { filter: brightness(.94); }

/* ── Скрытие строк «смена без плана» ──────────────────────────────────── */
/* Класс вешает ui.js по кнопке [data-toggle-rows]. Чисто визуально: суммы под
   таблицей считаются на сервере и остаются прежними — поэтому кнопка
   показывает, сколько строк спрятано. */
.rows-hidden tr[data-no-plan] { display: none; }

/* ── Строка поиска над списком ────────────────────────────────────────── */
/* Поле тянется, кнопки прижаты справа. Нужна и на /admin/rates,
   и на /economist/rates — поэтому здесь, а не в block head каждой. */
.search-row input[type="text"] { flex: 1 1 360px; min-width: 220px; }

/* ── Вкладки-фильтры ──────────────────────────────────────────────────── */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.tab {
    padding: 8px 13px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--brand-blue);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.tab:hover { background: #f7f8fa; color: var(--brand-blue); }
.tab.is-active { background: var(--brand-blue); color: #fff; border-color: var(--brand-blue); }
.tab.is-active:hover { color: #fff; }

/* ── Сообщения ────────────────────────────────────────────────────────── */
.alert, .msg, .err, .error {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.45;
    margin: 14px 0 0;
    border: 1px solid transparent;
}
.alert-success, .msg { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.alert-error, .err, .error { background: var(--error-bg); color: var(--error-text); border-color: var(--error-border); }
.alert-warn { background: var(--warn-bg); color: var(--warn-text); border-color: var(--warn-border); }

.alert-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

/* ── Быстрая навигация (кабинет) ──────────────────────────────────────── */
.quicknav { background: #fff; border-bottom: 1px solid var(--border); }
.quicknav-sticky { position: sticky; top: 73px; z-index: 19; }

.quicknav-inner {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 0 15px;
    text-decoration: none;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    transition: background .15s ease, border-color .15s ease;
}
.nav-btn:hover { background: #f7f8fa; border-color: #c3c7d1; color: var(--text); }
.nav-btn svg { width: 18px; height: 18px; stroke: var(--brand-blue); stroke-width: 2; fill: none; flex-shrink: 0; }

/* ── Вход (страницы авторизации) ──────────────────────────────────────── */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-wrap { width: 100%; max-width: 420px; }

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    padding: 32px 30px 28px;
}

.auth-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-logo img { width: 88px; height: 88px; object-fit: contain; display: block; border-radius: 14px; }

.auth-title {
    margin: 0;
    text-align: center;
    font-size: 25px;
    line-height: 1.15;
    letter-spacing: -.4px;
    color: var(--brand-blue);
    font-weight: 700;
}

.accent-line { width: 48px; height: 4px; border-radius: var(--radius-pill); background: var(--brand-peach); margin: 14px auto 0; }

.auth-sub { margin: 12px 0 24px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; }

.footer-note { text-align: center; margin-top: 18px; font-size: 12px; color: var(--muted); }

/* ── Плитки документов ────────────────────────────────────────────────── */
.docs-hdr { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; user-select: none; }
.docs-attn { font-size: 12.5px; color: var(--warn-text); font-weight: 600; }
.docs-attn b { color: #c2410c; font-weight: 800; }
.docs-chev { display: inline-flex; color: #9ca3af; transition: transform .15s; }

.docs-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 16px 2px 4px;
    max-height: 240px;
    overflow-y: hidden;
    opacity: 1;
    transition: max-height .28s ease, opacity .2s ease, padding .28s ease;
}
.docs-row.collapsed { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; overflow: hidden; }

.tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    background: none;
    border: none;
    padding: 5px 0 0;
    cursor: pointer;
    flex: 0 0 auto;
    font-family: inherit;
}

.frame {
    width: 42px;
    height: 52px;
    border: 2.5px solid;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform .16s ease, filter .16s ease;
}
.tile:hover .frame { transform: translateY(-2px); filter: brightness(.97); }

.doc-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    color: #fff;
    font-size: 9px;
    line-height: 15px;
    text-align: center;
    font-weight: 700;
    box-shadow: 0 0 0 2px #fff;
}

.tile-label {
    font-size: 8.5px;
    line-height: 1.15;
    color: #374151;
    text-align: center;
    font-weight: 600;
    min-height: 20px;
    max-width: 50px;
}

@keyframes tileIn { from { opacity: 0; transform: translateY(6px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes pulseBad { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); } 50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, .18); } }
@keyframes pulseWarn { 0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); } 50% { box-shadow: 0 0 0 4px rgba(249, 115, 22, .16); } }

.docs-row:not(.collapsed) .tile { animation: tileIn .34s ease both; }
.docs-row .tile:nth-child(1)  { animation-delay: .00s; }
.docs-row .tile:nth-child(2)  { animation-delay: .03s; }
.docs-row .tile:nth-child(3)  { animation-delay: .06s; }
.docs-row .tile:nth-child(4)  { animation-delay: .09s; }
.docs-row .tile:nth-child(5)  { animation-delay: .12s; }
.docs-row .tile:nth-child(6)  { animation-delay: .15s; }
.docs-row .tile:nth-child(7)  { animation-delay: .18s; }
.docs-row .tile:nth-child(8)  { animation-delay: .21s; }
.docs-row .tile:nth-child(9)  { animation-delay: .24s; }
.docs-row .tile:nth-child(10) { animation-delay: .27s; }
.docs-row .tile:nth-child(11) { animation-delay: .30s; }
.docs-row .tile:nth-child(12) { animation-delay: .33s; }

.tile[data-status="expired"] .frame,
.tile[data-status="missing"] .frame { animation: pulseBad 2.4s ease-in-out infinite; }
.tile[data-status="expiring_soon"] .frame { animation: pulseWarn 2.8s ease-in-out infinite; }

/* ── Модальное окно ───────────────────────────────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}
/* Открыть модалку можно двумя способами: классом (предпочтительно) или
   инлайновым display:flex — так делает карусель QR в кабинете. Оба должны
   работать, иначе поведение зависит от того, кто писал страницу. */
.overlay.open { display: flex; }

.modal {
    background: #fff;
    border-radius: var(--radius);
    width: 100%;
    max-width: 380px;
    overflow: hidden;
    box-shadow: var(--shadow-modal);
}

.m-hdr { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 20px 14px; }
.m-kicker { font-size: 11px; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: .4px; }
.m-title { font-size: 17px; font-weight: 800; color: var(--brand-blue); margin-top: 3px; line-height: 1.2; }

.m-x {
    background: #f1f3f7;
    border: none;
    border-radius: 8px;
    width: 30px;
    height: 30px;
    font-size: 17px;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
    flex: 0 0 auto;
}

.m-prev {
    margin: 0 20px;
    height: 150px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background-image: repeating-linear-gradient(45deg, #eef1f4 0 8px, #f7f9fb 8px 16px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.m-prev span { font-family: var(--font-mono); font-size: 11px; color: #94a3b8; text-align: center; padding: 10px; }
.m-prev img { max-width: 100%; max-height: 148px; object-fit: contain; }

.m-body { padding: 16px 20px 4px; }
.m-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1f3f7; }
.m-row:last-child { border-bottom: none; align-items: center; }
.m-row .k { font-size: 12.5px; color: var(--muted); }
.m-row .v { font-size: 12.5px; font-weight: 600; color: var(--text); text-align: right; }
.m-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; border-radius: var(--radius-pill); padding: 5px 11px; }

.m-btn {
    display: block;
    margin: 6px 20px 20px;
    width: calc(100% - 40px);
    background: var(--brand-blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.m-btn:hover { background: var(--brand-blue-hover); }

@keyframes ovIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes mIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.overlay[style*="flex"],
.overlay.open { animation: ovIn .14s ease; }
.overlay[style*="flex"] .modal,
.overlay.open .modal { animation: mIn .2s cubic-bezier(.2, .8, .3, 1); }

/* ── QR-пропуска ──────────────────────────────────────────────────────── */
.qr-thumbs { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }

.qr-thumb {
    flex: 0 0 auto;
    padding: 4px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    line-height: 0;
}
.qr-thumb img { width: 72px; height: 72px; object-fit: contain; display: block; }
.qr-thumb-item { display: flex; flex-direction: column; align-items: center; gap: 4px; line-height: normal; border: 1px solid var(--border); }
.qr-cap { font-size: 11px; color: var(--muted); max-width: 84px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.qr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .6);
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    z-index: 120;
}
.qr-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr-large-cap { color: #fff; font-size: 15px; font-weight: 600; text-align: center; }

.qr-nav {
    background: rgba(255, 255, 255, .16);
    color: #fff;
    border: none;
    font-size: 38px;
    line-height: 1;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.qr-overlay img {
    max-width: 78vw;
    max-height: 82vh;
    width: auto;
    height: auto;
    background: #fff;
    padding: 12px;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(15, 23, 42, .35);
}

/* ── Утилиты ──────────────────────────────────────────────────────────── */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row-between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-14 { margin-top: 14px; } .mt-20 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-14 { margin-bottom: 14px; } .mb-20 { margin-bottom: 20px; }
.text-right { text-align: right; }
.hours { font-weight: 700; color: var(--brand-blue); }
.attention-row, .attention-row .hours { color: var(--error-text); font-weight: 700; }

/* Страница без .hero: заголовок раздела живёт в топбаре, и контент иначе
   прилипает к его нижней границе. */
.page-pad-top { padding-top: 20px; }

.warn-btn {
    border: none;
    background: var(--error-bg);
    color: var(--error-text);
    border-radius: var(--radius-pill);
    padding: 4px 9px;
    cursor: pointer;
    font-weight: 700;
    font-family: inherit;
}

/* ── Печать и экспорт (html2canvas / PDF) ─────────────────────────────── */
.print-only { display: none; }

/* Кнопки партиала _export_buttons.html. Он подключается на несколько страниц,
   поэтому оформление живёт здесь, а не в block head каждой из них.
   .export-row (выравнивание ряда) у страниц разное — оно остаётся локальным. */
.export-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.export-btn {
    border: 1px solid rgba(11, 20, 117, .12);
    background: #fff;
    color: var(--brand-blue);
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
}
.export-btn:hover { background: #f4f5ff; }
.export-btn:disabled { opacity: .6; cursor: default; }

/* html2canvas снимает таблицу целиком: липкие ячейки на время съёмки отпускаем,
   иначе они впечатываются в кадр не на своём месте. */
.capturing th,
.capturing .left { position: static !important; }

@media print {
    .no-print { display: none !important; }
    .print-only { display: block !important; }

    body { background: #fff; }
    .topbar, .quicknav { position: static; box-shadow: none; }
    .card { box-shadow: none; border-color: #d5d8de; break-inside: avoid; }
    .table-wrap { overflow: visible !important; max-height: none !important; border-color: #d5d8de; }
    .table-wrap th { position: static; }
    a { text-decoration: none; color: var(--text); }
}

/* ── Предпросмотр рассылок ────────────────────────────────────────────── */
/* Общее для admin_email_unplanned / admin_email_planning_bp /
   admin_email_reconciliation — блоки писем там совпадают дословно. */
.counters { display: flex; gap: 24px; flex-wrap: wrap; }
.counter { font-size: 14px; color: var(--muted); }
.counter b { display: block; color: var(--brand-blue); font-size: 20px; }

.letter { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.letter-head { background: var(--surface-muted); padding: 14px 18px; border-bottom: 1px solid var(--border); }
.letter-tk { font-weight: 700; color: var(--brand-blue); }
.letter-subject { font-size: 13px; margin-top: 6px; word-break: break-word; }
.letter-to { font-size: 13px; color: var(--success-text); margin-top: 6px; }
.letter-body { padding: 16px 18px; }
.letter-body summary { cursor: pointer; color: var(--brand-blue); font-weight: 700; font-size: 13px; }
.letter-html { margin-top: 10px; border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 12px; }

.no-contacts { border: 1px solid var(--error-border); border-radius: var(--radius-sm); overflow: hidden; }
.no-contacts-head { padding: 12px 16px; background: var(--error-bg); color: var(--error-text); font-size: 13px; font-weight: 700; }
.no-contacts-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--error-border); font-size: 13px; }

/* ── Адаптив ──────────────────────────────────────────────────────────── */
@media (max-width: 980px) {
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topbar-inner { flex-direction: column; align-items: flex-start; }
    .topbar-actions { width: 100%; }
}

@media (max-width: 720px) {
    .page { padding: 0 16px 40px; }
    .topbar-inner { padding: 14px 16px; }
    .quicknav-inner { padding: 10px 16px; }
    .hero { padding: 26px 0 20px; }
    .hero h2 { font-size: 25px; }
    .grid, .grid-2 { grid-template-columns: 1fr; }
    .form-grid, .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; }
    .card { padding: 16px; border-radius: var(--radius); }
    .nav-btn { flex: 1 1 auto; justify-content: center; }
    .auth-card { padding: 26px 20px 22px; }
}

@media (prefers-reduced-motion: reduce) {
    .nav-card, .icon, .go, .docs-row, .tile, .frame, .overlay, .modal { transition: none !important; animation: none !important; }
    .nav-card:hover { transform: none; }
}

/* ── 001. Вращение логотипа (1 раз за сессию, 2 с) ────────────────────── */
@keyframes logoSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.brand img, .auth-logo img { transition: transform .2s ease; }
.brand img.is-spinning,
.auth-logo img.is-spinning { animation: logoSpin 2s cubic-bezier(.35, 0, .25, 1) 1; }

/* ── 004. Рябь по экрану (каждые 120 с) ───────────────────────────────── */
.ripple-layer {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 200;
}

.ripple {
    position: absolute;
    width: 60vmin;
    height: 60vmin;
    margin: 0;
    border-radius: 50%;
    border: 1.5px solid #cdd3e4;
    background: radial-gradient(circle, rgba(255, 255, 255, 0) 62%, rgba(11, 20, 117, .05) 84%, rgba(255, 255, 255, 0) 100%);
    mix-blend-mode: multiply;
    transform: translate(-50%, -50%) scale(0);
    animation: rippleOut 3.2s cubic-bezier(.16, .8, .3, 1) both;
}

@keyframes rippleOut {
    from { transform: translate(-50%, -50%) scale(.02); }
    to   { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

@media print { .ripple-layer { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
    .ripple-layer { display: none !important; }
    .brand img.is-spinning, .auth-logo img.is-spinning { animation: none !important; }
}
