/* Domain Prices — панель управления.
   Порядок: токены → каркас → типографика → компоненты → утилиты → адаптив.
   Сборки нет: файл подключается напрямую из layout.blade.php. */

/* ============================================================
   1. Токены
   ============================================================ */

:root {
    color-scheme: light dark;

    --bg:        #eceff5;
    --surface:   #ffffff;
    --surface-2: #f6f7fa;
    --surface-3: #eceff5;
    --line:      #dfe3ec;
    --line-soft: #ebeef4;

    --text:  #171a21;
    --dim:   #49505f;
    --muted: #6a7182;

    --accent:      #4f46e5;
    --accent-ink:  #4338ca;
    --accent-wash: rgba(79, 70, 229, .09);
    --on-accent:   #ffffff;

    --ok:        #157f52;
    --ok-wash:   rgba(21, 127, 82, .10);
    --warn:      #96650a;
    --warn-wash: rgba(150, 101, 10, .12);
    --err:       #c4324a;
    --err-wash:  rgba(196, 50, 74, .10);

    /* Заливка числовых колонок — «разлиновка» прайса. */
    --wash:      rgba(105, 118, 150, .05);
    --row-hover: rgba(105, 118, 150, .07);
    --shadow:    0 1px 2px rgba(20, 26, 40, .05), 0 1px 3px rgba(20, 26, 40, .04);
    --shadow-lg: 0 12px 32px rgba(20, 26, 40, .14);

    --sidebar: 244px;
    --gutter: 28px;
    --r-sm: 6px;
    --r: 10px;
    --r-lg: 14px;

    --ui: "Segoe UI Variable Text", "Segoe UI", -apple-system, Roboto, Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:        #0d0f15;
        --surface:   #14171e;
        --surface-2: #1a1e27;
        --surface-3: #212632;
        --line:      #262b36;
        --line-soft: #1f242e;

        --text:  #e7eaf1;
        --dim:   #a8b0c0;
        --muted: #868ea0;

        --accent:      #7b78f5;
        --accent-ink:  #a5a2ff;
        --accent-wash: rgba(123, 120, 245, .14);
        --on-accent:   #0d0f15;

        --ok:        #4cc38a;
        --ok-wash:   rgba(76, 195, 138, .13);
        --warn:      #e0a53f;
        --warn-wash: rgba(224, 165, 63, .13);
        --err:       #f4707f;
        --err-wash:  rgba(244, 112, 127, .13);

        --wash:      rgba(140, 155, 195, .045);
        --row-hover: rgba(140, 155, 195, .06);
        --shadow:    none;
        --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
    }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.55 var(--ui);
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   2. Каркас: боковое меню + рабочая область
   ============================================================ */

.app {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    min-height: 100vh;
}

/* ---------- боковое меню ---------- */

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 60px;
    padding: 0 18px;
    flex: none;
    color: var(--text);
    font-size: 15.5px;
    font-weight: 600;
    letter-spacing: -.01em;
    text-decoration: none;
    border-bottom: 1px solid var(--line);
}
.sidebar__brand:hover { color: var(--text); }
.sidebar__mark {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex: none;
    border-radius: 8px;
    /* Знак не зависит от темы: на светлом акценте белые буквы теряются. */
    background: #4f46e5;
    color: #fff;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -.02em;
}
.sidebar__brand b { font-weight: 600; }
.sidebar__brand span { color: var(--muted); font-weight: 400; }

.sidebar__nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 10px 20px;
}

.nav-group + .nav-group { margin-top: 18px; }
.nav-group__title {
    margin: 0 0 6px;
    padding: 0 10px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--r-sm);
    color: var(--dim);
    font-size: 13.5px;
    text-decoration: none;
}
.nav-link + .nav-link { margin-top: 1px; }
.nav-link .ico { color: var(--muted); flex: none; }
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link:hover .ico { color: var(--dim); }
.nav-link.is-active {
    background: var(--accent-wash);
    color: var(--accent-ink);
    font-weight: 500;
}
.nav-link.is-active .ico { color: var(--accent); }
.nav-link.is-active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    width: 3px;
    height: 18px;
    margin-top: -9px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}
.nav-link__count {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.sidebar__foot {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--line);
}
.sidebar__user { min-width: 0; line-height: 1.3; }
.sidebar__user b { display: block; font-size: 13px; font-weight: 500; }
.sidebar__user span {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar__foot .btn { margin-left: auto; }

/* ---------- шапка для узких экранов ---------- */

.topbar { display: none; }

.nav-toggle {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--dim);
    cursor: pointer;
}
.nav-toggle:hover { background: var(--surface-3); color: var(--text); }

.nav-scrim { display: none; }

/* ---------- рабочая область ---------- */

.main { min-width: 0; padding: 0 var(--gutter) 56px; }
.limit { max-width: 1360px; margin: 0 auto; }

.page-head {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
    padding: 28px 0 22px;
}
.page-head__text { flex: 1 1 340px; min-width: 0; }
.page-head__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.eyebrow {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.lede {
    margin: 7px 0 0;
    max-width: 78ch;
    color: var(--muted);
    font-size: 13.5px;
}
.lede code { color: var(--dim); }

.foot {
    padding: 26px 0 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

/* ---------- экран входа ---------- */

.auth {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}
.auth__box { width: 100%; max-width: 372px; }
.auth__brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 20px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -.01em;
}
.auth__brand span { color: var(--muted); font-weight: 400; }

/* ============================================================
   3. Типографика
   ============================================================ */

h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.018em; line-height: 1.22; }
h2 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: -.005em; }
h3 { margin: 22px 0 9px; font-size: 13px; font-weight: 600; color: var(--dim); }
h3:first-child { margin-top: 0; }
p { margin: 0 0 11px; }
p:last-child { margin-bottom: 0; }

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

code, .mono { font-family: var(--mono); font-size: .92em; }
code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--surface-3);
    color: var(--dim);
}

.hint { margin: 7px 0 0; color: var(--muted); font-size: 12.5px; }
.hint code { font-size: .9em; }

pre.code {
    margin: 0 0 12px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}
pre.code:last-child { margin-bottom: 0; }

/* Доменная зона: точка — акцент, имя — моноширинным. */
.zone {
    font-family: var(--mono);
    font-size: 12.8px;
    font-weight: 500;
    white-space: nowrap;
}
.zone::before { content: "."; color: var(--accent); }

.key {
    display: inline-block;
    padding: 3px 8px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    font-family: var(--mono);
    font-size: 12px;
    word-break: break-all;
}

/* ============================================================
   4. Компоненты
   ============================================================ */

/* ---------- карточка ---------- */

.card {
    margin-bottom: 18px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow);
}
.card:last-child { margin-bottom: 0; }

.card__head {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 13px 18px;
    border-bottom: 1px solid var(--line);
}
.card__head > h2 { flex: 1 1 auto; min-width: 0; }
.card__tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}
.card__count {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.card__body { padding: 18px; }
.card__body > .table-wrap { margin: 0 -18px -18px; border-radius: 0 0 var(--r) var(--r); }
.card__foot {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 13px 18px;
    background: var(--surface-2);
    border-top: 1px solid var(--line);
    border-radius: 0 0 var(--r) var(--r);
}

/* Таблица во всю карточку, без .card__body — в том числе внутри формы
   массового сохранения, которая обёрнута вокруг таблицы. */
.card > .table-wrap,
.card > form > .table-wrap { border-radius: 0 0 var(--r) var(--r); }

/* ---------- сетки ---------- */

.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid:last-child { margin-bottom: 0; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; }
.grid > .card { margin-bottom: 0; }
.grid--2 > .card, .grid--3 > .card { align-self: start; }

/* ---------- показатель ---------- */

.stat {
    padding: 13px 15px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow);
}
.stat__value {
    display: block;
    font-family: var(--mono);
    font-size: 25px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}
.stat__label {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}
.stat--warn { border-color: rgba(150, 101, 10, .35); background: var(--warn-wash); }
.stat--warn .stat__value { color: var(--warn); }

/* ---------- таблицы ---------- */

.table-wrap { overflow: auto; }
.table-wrap--tall { max-height: calc(100vh - 300px); }

table.data {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
table.data th,
table.data td {
    padding: 9px 12px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--line-soft);
}
table.data thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    white-space: nowrap;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--row-hover); }

/* Числовые колонки: моноширинные, выключка вправо, лёгкая разлиновка. */
table.data .num {
    text-align: right;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
table.data tbody td.num { background: var(--wash); }
table.data tbody tr:hover td.num { background: transparent; }
table.data thead th.num { text-align: right; }
table.data .act { text-align: right; white-space: nowrap; }
table.data td.act > * + * { margin-left: 6px; }

.table-wrap table.data tbody td:first-child,
.table-wrap table.data thead th:first-child { padding-left: 18px; }
.table-wrap table.data tbody td:last-child,
.table-wrap table.data thead th:last-child { padding-right: 18px; }

/* Плотный вариант для строк с полями ввода. */
table.data--edit td { padding-top: 6px; padding-bottom: 6px; }

/* ---------- пустое состояние ---------- */

.empty {
    padding: 30px 18px;
    text-align: center;
    color: var(--muted);
}
.empty b { display: block; margin-bottom: 4px; color: var(--dim); font-weight: 500; }

/* ---------- формы ---------- */

label { display: block; }

.field { display: block; margin-bottom: 13px; }
.field:last-child { margin-bottom: 0; }
.field > span,
.field__label {
    display: block;
    margin-bottom: 5px;
    color: var(--dim);
    font-size: 12.5px;
    font-weight: 500;
}

/* max-width здесь не задаём: при box-sizing:border-box он излишен, а по
   специфичности (0-1-1) перебивал бы узкие .cell-* в ячейках таблиц. */
input[type=text], input[type=password], input[type=number], input[type=email],
input[type=datetime-local], input[type=file], select, textarea {
    width: 100%;
    padding: 7px 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--text);
    font: inherit;
}
input[type=file] { padding: 6px 10px; font-size: 13px; }
input::placeholder { color: var(--muted); opacity: .8; }
input[type=number], input[type=datetime-local] { font-variant-numeric: tabular-nums; }
select {
    appearance: none;
    padding-right: 28px;
    background-image: linear-gradient(45deg, transparent 50%, currentcolor 50%),
                      linear-gradient(135deg, currentcolor 50%, transparent 50%);
    background-position: right 13px center, right 8px center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
textarea {
    min-height: 260px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.6;
    resize: vertical;
}
/* Короткое поле для обычного текста, а не для JSON. */
textarea.short {
    min-height: 74px;
    font-family: var(--ui);
    font-size: 14px;
    line-height: 1.55;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-wash);
}
input[type=checkbox] { width: auto; accent-color: var(--accent); }

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 13px;
    color: var(--dim);
    font-size: 13px;
    cursor: pointer;
}
.check:last-child { margin-bottom: 0; }
.check input { flex: none; margin: 0; }

/* Горизонтальный ряд полей. */
.form-row {
    display: flex;
    align-items: flex-end;
    gap: 11px;
    flex-wrap: wrap;
}
.form-row > .field { margin-bottom: 0; }
.form-row > .check { margin-bottom: 7px; }
.form-row .btn { margin-bottom: 0; }

.w-xs { flex: 0 0 84px; width: 84px; }
.w-sm { flex: 0 0 116px; width: 116px; }
.w-md { flex: 0 0 156px; width: 156px; }
.w-lg { flex: 0 0 200px; width: 200px; }
.w-fill { flex: 1 1 170px; min-width: 0; }

/* Значения в таблицах-редакторах. Селекторы с input/select — чтобы наверняка
   пережить правило по типу поля выше. */
input.cell-input { width: 104px; text-align: right; font-family: var(--mono); }
select.cell-cur { width: 88px; }
input.cell-name { width: 132px; font-family: var(--mono); }
input.cell-sort { width: 74px; }

/* ---------- сворачиваемая панель (без JS) ---------- */

details.panel {
    margin-bottom: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow);
}
details.panel > summary {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 18px;
    color: var(--dim);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    border-radius: var(--r);
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before {
    content: "";
    width: 7px;
    height: 7px;
    flex: none;
    border-right: 1.6px solid var(--muted);
    border-bottom: 1.6px solid var(--muted);
    transform: rotate(-45deg);
    transition: transform .15s ease;
}
details.panel[open] > summary::before { transform: rotate(45deg); }
details.panel > summary:hover { color: var(--text); }
details.panel[open] > summary {
    border-bottom: 1px solid var(--line);
    border-radius: var(--r) var(--r) 0 0;
}
details.panel__body,
.panel__body { padding: 16px 18px 18px; }

/* ---------- кнопки ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    background: var(--accent);
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    color: var(--on-accent);
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; color: var(--on-accent); }
.btn:active { filter: brightness(.96); }

.btn--ghost {
    background: var(--surface);
    border-color: var(--line);
    color: var(--dim);
}
.btn--ghost:hover { background: var(--surface-3); color: var(--text); filter: none; }

.btn--subtle {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}
.btn--subtle:hover { background: var(--surface-3); color: var(--text); filter: none; }

.btn--ok { background: var(--ok); color: #fff; }
.btn--danger { background: transparent; border-color: transparent; color: var(--err); }
.btn--danger:hover { background: var(--err-wash); color: var(--err); filter: none; }

.btn--sm { padding: 4px 9px; font-size: 12.5px; }
.btn--icon { padding: 4px 7px; }
.btn--block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

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

/* Формы-обёртки вокруг кнопок не должны рвать поток.
   Во flex-контейнерах форма «растворяется», и кнопка сама становится элементом
   раскладки — так работает gap. В ячейках таблицы это ломало бы колонки,
   поэтому там форма остаётся инлайновым блоком. */
form { margin: 0; }
.actions > form,
.card__tools > form,
.card__foot > form,
.page-head__actions > form,
.savebar > form,
.sidebar__foot > form { display: contents; }
td form { display: inline-flex; vertical-align: middle; }

/* ---------- поиск по длинному списку (select[data-search]) ---------- */

.combo { position: relative; }

/* Сам select остаётся в форме и несёт значение, но с глаз убран.
   display:none нельзя: тогда до него не доберётся валидация браузера. */
.combo__native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

/* Повторяет вид select, включая стрелку. */
.combo__button {
    display: block;
    width: 100%;
    padding: 7px 28px 7px 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--text);
    font: inherit;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                      linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: right 13px center, right 8px center;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
.combo__button:hover { border-color: var(--muted); }
.combo__button.is-empty { color: var(--muted); }
.combo__button[aria-expanded="true"] { border-color: var(--accent); }

/* Панель вынесена в body: карточки обрезают содержимое по overflow,
   поэтому положение считает JS, а не поток документа. */
.combo__panel {
    position: fixed;
    z-index: 60;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
    overflow: hidden;
}

.combo__search {
    flex: 0 0 auto;
    margin: 0;
    padding: 9px 11px;
    background: var(--surface-2);
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0;
    color: var(--text);
    font: inherit;
}
.combo__search:focus { outline: none; }

.combo__list {
    flex: 1 1 auto;
    margin: 0;
    padding: 4px;
    list-style: none;
    overflow-y: auto;
}

.combo__option {
    padding: 6px 9px;
    border-radius: var(--r-sm);
    font-family: var(--mono);
    font-size: 12.8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.combo__option.is-active { background: var(--row-hover); }
.combo__option.is-current { color: var(--accent-ink); font-weight: 600; }

.combo__empty {
    margin: 0;
    padding: 12px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

/* ---------- значки состояний ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
}
.badge--ok   { background: var(--ok-wash);   border-color: transparent; color: var(--ok); }
.badge--warn { background: var(--warn-wash); border-color: transparent; color: var(--warn); }
.badge--err  { background: var(--err-wash);  border-color: transparent; color: var(--err); }
.badge--accent { background: var(--accent-wash); border-color: transparent; color: var(--accent-ink); }
.badge--dot::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentcolor;
}

/* ---------- уведомления ---------- */

.flash {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    padding: 11px 14px;
    border: 1px solid transparent;
    border-radius: var(--r);
    font-size: 13.5px;
}
.flash__mark { flex: none; font-weight: 700; }
.flash > div { min-width: 0; }
.flash b { font-weight: 600; }
.flash--ok   { background: var(--ok-wash);   border-color: rgba(21, 127, 82, .3);  color: var(--ok); }
.flash--warn { background: var(--warn-wash); border-color: rgba(150, 101, 10, .3); color: var(--warn); }
.flash--err  { background: var(--err-wash);  border-color: rgba(196, 50, 74, .3);  color: var(--err); }

@media (prefers-color-scheme: dark) {
    .flash--ok   { border-color: rgba(76, 195, 138, .28); }
    .flash--warn { border-color: rgba(224, 165, 63, .28); }
    .flash--err  { border-color: rgba(244, 112, 127, .28); }
}

/* ---------- пагинация (resources/views/vendor/pagination/panel) ---------- */

.pager {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.pager__total {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.pagination {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style: none;
}
.page-link {
    display: block;
    padding: 5px 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--dim);
    font-size: 13px;
    text-decoration: none;
}
.page-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.page-item.active .page-link {
    background: var(--accent);
    border-color: transparent;
    color: var(--on-accent);
}
.page-item.disabled .page-link { opacity: .45; }

/* ---------- иконки ---------- */

.ico {
    width: 17px;
    height: 17px;
    flex: none;
    fill: none;
    stroke: currentcolor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.ico--sm { width: 14px; height: 14px; }

/* ============================================================
   5. Утилиты
   ============================================================ */

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mb-md { margin-bottom: 14px; }
.mb-lg { margin-bottom: 20px; }
.tnum { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.break { word-break: break-all; }
/* Вертикальная колонка блоков с тем же ритмом, что и .grid. */
.stack { display: flex; flex-direction: column; gap: 18px; align-self: start; }
.stack > .card,
.stack > details.panel { margin-bottom: 0; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

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

/* ============================================================
   6. Адаптив
   ============================================================ */

@media (max-width: 1000px) {
    :root { --gutter: 18px; }

    .app { grid-template-columns: minmax(0, 1fr); }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 30;
        display: flex;
        align-items: center;
        gap: 12px;
        height: 56px;
        padding: 0 var(--gutter);
        background: var(--surface);
        border-bottom: 1px solid var(--line);
    }
    .topbar .sidebar__brand { height: auto; padding: 0; border: 0; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 50;
        width: 272px;
        max-width: 84vw;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow-lg);
    }
    .nav-open .sidebar { transform: none; }

    .nav-open .nav-scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 40;
        background: rgba(9, 11, 16, .5);
    }

    .page-head { padding-top: 22px; }
    .table-wrap--tall { max-height: none; }
}

@media (max-width: 620px) {
    h1 { font-size: 20px; }
    .card__body, details.panel__body, .panel__body { padding: 14px; }
    .card__head, .card__foot, .savebar { padding: 11px 14px; }
    .card__body > .table-wrap { margin: 0 -14px -14px; }
    .table-wrap table.data tbody td:first-child,
    .table-wrap table.data thead th:first-child { padding-left: 14px; }
    .table-wrap table.data tbody td:last-child,
    .table-wrap table.data thead th:last-child { padding-right: 14px; }
    .grid--stats { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
    .stat__value { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
    .sidebar, .topbar, .nav-scrim, .page-head__actions { display: none !important; }
    .app { grid-template-columns: 1fr; }
    body { background: #fff; }
}
