/* =====================================================================
   Портал 1С · стили
   Палитра прежнего портала; тёмная тема — по настройке системы.
   ===================================================================== */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('../fonts/inter-cyrillic-wght-normal.woff2?v=5.3.0') format('woff2-variations');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('../fonts/inter-latin-wght-normal.woff2?v=5.3.0') format('woff2-variations');
    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: 'JetBrains Mono';
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url('../fonts/jetbrains-mono-cyrillic-400-normal.woff2?v=5.3.0') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url('../fonts/jetbrains-mono-latin-400-normal.woff2?v=5.3.0') 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 {
    color-scheme: light;
    --bg: #F7F6F2;
    --surface: #FDFDFB;
    --surface-2: #F1F0EB;
    --border: #E5E3DC;
    --border-strong: #D4D1CA;
    --text: #28251D;
    --muted: #6B6A64;
    --faint: #A3A29C;
    --accent: #01696F;
    --accent-hover: #0C4E54;
    --accent-text: #FFFFFF;
    --accent-soft: rgba(1, 105, 111, 0.09);
    --ok: #437A22;
    --ok-soft: rgba(67, 122, 34, 0.14);
    --warn: #9A4A12;
    --warn-soft: rgba(154, 74, 18, 0.10);
    --danger: #B3261E;
    --danger-soft: rgba(179, 38, 30, 0.09);
    --brand: #FFC553;
    --copy: #8A8983;
    --new: #C9971E;
    --backdrop: rgba(25, 23, 18, 0.45);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;

    --shadow-sm: 0 1px 2px rgba(40, 37, 29, 0.05);
    --shadow: 0 4px 16px rgba(40, 37, 29, 0.08);
    --shadow-lg: 0 16px 48px rgba(40, 37, 29, 0.16);
    --r-sm: 8px;
    --r: 10px;
    --r-lg: 14px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg: #161512;
        --surface: #1F1E1A;
        --surface-2: #272621;
        --border: #34322C;
        --border-strong: #46433B;
        --text: #ECEAE3;
        --muted: #A8A59B;
        --faint: #6F6C63;
        --accent: #4DB6BC;
        --accent-hover: #74CACE;
        --accent-text: #0D1B1C;
        --accent-soft: rgba(77, 182, 188, 0.13);
        --ok: #86C35E;
        --ok-soft: rgba(134, 195, 94, 0.16);
        --warn: #E59A62;
        --warn-soft: rgba(229, 154, 98, 0.14);
        --danger: #F08A80;
        --danger-soft: rgba(240, 138, 128, 0.13);
        --copy: #9C9A92;
        --new: #E0B24A;
        --backdrop: rgba(0, 0, 0, 0.6);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
        --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    }
}

/* ─────────────── Основа ─────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.92em; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 28px; }
.main { flex: 1; padding-top: 24px; padding-bottom: 40px; }

/* ─────────────── Шапка ─────────────── */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-badge {
    flex: none;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: var(--r);
    background: var(--brand);
    color: #28251D;
    font-weight: 700;
    font-size: 14px;
}
.brand-text { min-width: 0; }
.brand-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; flex: none; }
.server-time { font-family: var(--mono); font-size: 13px; color: var(--muted); }

.status-pill {
    display: flex; align-items: center; gap: 7px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
}
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.status-pill.connected { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.status-pill.connected .dot { background: var(--ok); }
.status-pill.disconnected { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.status-pill.disconnected .dot { background: var(--danger); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

/* ─────────────── Заголовки и разделы ─────────────── */

.intro {
    display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap;
    gap: 12px 24px;
    margin-bottom: 22px;
}
.intro h1 { font-size: 28px; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 4px; }
.intro p { color: var(--muted); }

.section { margin-bottom: 28px; }
.section-head {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 12px;
}
.section-head h2 { font-size: 18px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.section-note { color: var(--muted); font-size: 13px; width: 100%; }
.section-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.count {
    display: inline-block;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}
.count:empty { display: none; }
.placeholder { padding: 28px; text-align: center; color: var(--muted); font-size: 14px; }

.search {
    width: 240px;
    max-width: 100%;
    padding: 7px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
}
.search:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* ─────────────── Кнопки ─────────────── */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
}
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-text); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); color: #fff; }
.btn-warning { background: var(--warn); color: #fff; }
.btn-warning:hover { filter: brightness(0.92); color: #fff; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft:hover { background: var(--danger); color: #fff; }
.btn-warning-soft { background: var(--warn-soft); color: var(--warn); }
.btn-warning-soft:hover { background: var(--warn); color: #fff; }
@media (prefers-color-scheme: dark) {
    .btn-danger, .btn-warning, .btn-danger-soft:hover, .btn-warning-soft:hover { color: #1A1612; }
}
.btn:disabled, .btn.disabled { opacity: 0.55; cursor: not-allowed; filter: none; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    border: 2px solid currentColor;
    border-color: var(--accent-text) transparent var(--accent-text) transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.btn-secondary.loading::after { border-color: var(--text) transparent var(--text) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 32px; height: 32px;
    border: none; border-radius: var(--r-sm);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.link-btn {
    padding: 0; border: none; background: none;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.link-btn:hover { color: var(--accent-hover); }

/* ─────────────── Значки ─────────────── */

.flag {
    display: inline-flex; align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.flag-danger { background: var(--danger-soft); color: var(--danger); }
.flag-warn { background: var(--warn-soft); color: var(--warn); }
.flag-muted { background: var(--surface-2); color: var(--muted); }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--ok-soft);
    color: var(--ok);
    font-size: 12px;
    font-weight: 600;
}
.live-dot {
    display: inline-block;
    width: 7px; height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 3px var(--ok-soft);
    vertical-align: 1px;
}
.chip .live-dot { margin-right: 0; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-danger { background: var(--danger); }

.badge {
    flex: none;
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: var(--r);
    background: var(--accent);
    color: var(--accent-text);
    font: 700 12px var(--mono);
    letter-spacing: 0.02em;
}
.badge-sm { width: 30px; height: 30px; font-size: 10px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); }

/* ─────────────── Рабочие базы: карточки одной высоты ─────────────── */

.prod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.base-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 200ms var(--ease);
}
.base-card:hover { box-shadow: var(--shadow); }
.card-top { display: flex; align-items: flex-start; gap: 12px; }
.card-head { min-width: 0; }
.card-title {
    font-size: 16px;
    line-height: 1.3;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-status {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 6px 8px;
    margin-top: 12px;
    font-size: 13.5px;
}
.card-status:empty { display: none; }
/* Кнопки прижаты к низу: карточки в ряду одной высоты, кнопки на одной линии */
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 14px; }
.card-actions > :first-child { flex: 1; }

/* ─────────────── Копии: таблица ─────────────── */

.table {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.list-head, .base-row {
    display: grid;
    grid-template-columns: 30px minmax(0, 1.6fr) minmax(0, 1.1fr) 76px minmax(0, 1fr) 92px;
    align-items: center;
    gap: 14px;
    padding: 0 14px;
}
.list-head {
    min-height: 34px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}
.right { text-align: right; }
.base-row { min-height: 46px; cursor: pointer; }
.base-row + .base-row { border-top: 1px solid var(--border); }
.base-row:hover { background: var(--surface-2); }
.row-name { min-width: 0; display: flex; flex-direction: column; }
.row-title {
    padding: 0; border: none; background: none;
    font-weight: 600;
    text-align: left;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    cursor: pointer;
}
.row-title:hover { color: var(--accent); }
.row-sub { display: none; font-size: 12.5px; color: var(--muted); }
.row-sys { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-size { color: var(--muted); font-size: 13.5px; text-align: right; font-variant-numeric: tabular-nums; }
.row-status { display: flex; flex-wrap: wrap; gap: 4px 6px; min-width: 0; }
.row-actions { display: flex; justify-content: flex-end; }
.row-noweb { font-size: 12.5px; white-space: nowrap; }

/* ─────────────── Подробности базы: панель справа ─────────────── */

dialog.sheet {
    position: fixed;
    inset: 0 0 0 auto;
    margin: 0;
    width: min(540px, 100vw);
    height: 100%;
    max-height: 100%;
    padding: 0;
    border: none;
    border-left: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
}
dialog.sheet::backdrop { background: var(--backdrop); }
dialog.sheet[open] { animation: slide-in 200ms var(--ease); }
@keyframes slide-in { from { opacity: 0; transform: translateX(32px); } }
.sheet-head {
    position: sticky; top: 0; z-index: 1;
    display: flex; align-items: flex-start; gap: 12px;
    padding: 16px 16px 14px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.sheet-title-wrap { flex: 1; min-width: 0; }
.sheet-head h2 { font-size: 18px; line-height: 1.3; }
.sheet-body { display: flex; flex-direction: column; gap: 22px; padding: 16px 20px 28px; }
.sheet-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet-quick > :first-child { flex: 1; }
.sheet-body > .card-status { margin-top: -10px; }
.manage { display: flex; flex-wrap: wrap; gap: 8px; }

.d-block { min-width: 0; }
.d-block h4 {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
}
.d-block > .btn { margin-top: 10px; }

.sessions { list-style: none; margin: 0; padding: 0; }
.sessions li {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--border);
}
.sessions li:last-child { border-bottom: none; }
.s-user { font-weight: 600; }
.s-count { font: 600 11px var(--mono); color: var(--accent); }
.s-meta { color: var(--muted); font-size: 13px; }

.lock-line {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "dot name btns" ". state btns";
    align-items: center;
    gap: 0 10px;
    padding: 8px 0;
}
.lock-line + .lock-line, .kv-compact + .lock-line { border-top: 1px dashed var(--border); }
.lock-line .dot { grid-area: dot; }
.lock-name { grid-area: name; font-weight: 600; }
.lock-state { grid-area: state; color: var(--muted); font-size: 13px; }
.lock-btns { grid-area: btns; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv-compact { margin: 2px 0 8px 18px; font-size: 13px; }

/* ─────────────── Сервер ─────────────── */

.server-panel summary {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px;
    list-style: none;
    cursor: pointer;
    padding: 4px 0 14px;
}
.server-panel summary::-webkit-details-marker { display: none; }
.server-panel summary h2 { font-size: 18px; }
.server-summary { color: var(--muted); font-size: 13px; }
.server-panel[open] .server-summary { display: none; }
.server-panel .chevron {
    width: 8px; height: 8px;
    margin-left: auto;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 200ms var(--ease);
}
.server-panel[open] .chevron { transform: rotate(-135deg); }

.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.metric {
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}
.metric-label { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.metric-value { margin: 2px 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric-value small { margin-left: 3px; font-size: 13px; font-weight: 500; color: var(--muted); }
.metric-detail { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.metric-note { margin-top: 4px; color: var(--warn); cursor: help; }

.bar { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar-lg { height: 8px; border-radius: 4px; margin: 12px 0 6px; }
.bar-fill { height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width 600ms var(--ease); }
.bar-fill.high { background: var(--warn); }
.bar-fill.critical { background: var(--danger); }

/* ─────────────── Подвал и уведомления ─────────────── */

.foot { border-top: 1px solid var(--border); padding: 18px 0; color: var(--muted); font-size: 13px; }
.foot-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 20px; }

.toasts {
    position: fixed;
    right: 20px; bottom: 20px;
    z-index: 200;
    display: flex; flex-direction: column; gap: 8px;
    max-width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}
.toast {
    padding: 12px 16px;
    border-radius: var(--r);
    background: var(--text);
    color: var(--bg);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 250ms var(--ease), transform 250ms var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast-error { background: var(--danger); color: #fff; }

/* ─────────────── Окна ─────────────── */

dialog.modal {
    width: min(520px, calc(100vw - 24px));
    max-height: calc(100vh - 40px);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    overflow: auto;
}
dialog.modal-wide { width: min(680px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: pop 180ms var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }

.modal-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 18px 20px 0 24px;
}
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
    display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px;
    padding: 14px 24px 20px;
}
.modal-body h3 { font-size: 15px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; font-weight: 500; }
.field input, .field select, .dt-picker input, .dt-picker select {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
}
.field input:focus, .field select:focus, .dt-picker input:focus, .dt-picker select:focus {
    border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
.field-hint { font-size: 12.5px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
.field-row > * { min-width: 0; }
.dt-picker { display: flex; align-items: center; gap: 4px; }
.dt-picker input { flex: 1 1 auto; min-width: 0; max-width: 200px; }
.dt-picker select { flex: none; width: auto; padding-right: 4px; }
.lock-extra { display: flex; flex-direction: column; gap: 12px; }

.form-error {
    display: none;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 14px;
}
.form-error.show { display: block; }
.warn-box {
    padding: 10px 12px;
    border-radius: var(--r-sm);
    background: var(--warn-soft);
    color: var(--warn);
    font-size: 14px;
}
.hint { color: var(--muted); font-size: 13.5px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }

.choice { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.choice legend { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.choice label {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
}
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.cat-dot { width: 9px; height: 9px; border-radius: 50%; }
.cat-dot.production { background: var(--accent); }
.cat-dot.copy { background: var(--copy); }
.cat-dot.new { background: var(--new); }

.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.help-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.help-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px 6px 0; }
.help-table td { padding: 7px 8px 7px 0; border-top: 1px solid var(--border); }

.reveal-result {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px;
    border-radius: var(--r);
    background: var(--accent-soft);
}
.reveal-result .mono { font-size: 24px; letter-spacing: 0.15em; color: var(--accent); }

/* Мастер копирования */
.wiz-dots { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.wiz-dots li { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-2); }
.wiz-dots li.done { background: var(--accent); opacity: 0.5; }
.wiz-dots li.active { background: var(--accent); }
.wiz-page { display: flex; flex-direction: column; gap: 12px; }
.radio-list {
    max-height: 340px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--r);
}
.radio-row {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
}
.radio-row + .radio-row { border-top: 1px solid var(--border); }
.radio-row:has(input:checked) { background: var(--accent-soft); }
.radio-row input { margin-top: 4px; }
.radio-row .muted { display: block; font-size: 13px; }
.wiz-plan { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.wiz-progress { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wiz-progress li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.wiz-progress li::before {
    content: '';
    width: 16px; height: 16px;
    border: 2px solid var(--border-strong);
    border-radius: 50%;
}
.wiz-progress li.doing { color: var(--text); }
.wiz-progress li.doing::before { border-color: var(--accent) transparent; animation: spin 0.9s linear infinite; }
.wiz-progress li.done { color: var(--text); }
.wiz-progress li.done::before { content: '✓'; display: grid; place-items: center; font-size: 10px; border-color: var(--ok); background: var(--ok); color: #fff; }
.wiz-progress li.error { color: var(--danger); }
.wiz-progress li.error::before { content: '✕'; display: grid; place-items: center; font-size: 10px; border-color: var(--danger); background: var(--danger); color: #fff; }

/* ─────────────── Телефон ─────────────── */

@media (max-width: 720px) {
    .wrap { padding: 0 16px; }
    .main { padding-top: 22px; }
    .brand-sub, .server-time { display: none; }
    .section-tools { width: 100%; }
    .section-tools .search { flex: 1; width: auto; }
    .intro { align-items: flex-start; }
    .intro h1 { font-size: 24px; }
    .list-head { display: none; }
    .base-row {
        grid-template-columns: 30px minmax(0, 1fr) auto;
        grid-template-areas: "badge name actions" "badge status status";
        gap: 4px 12px;
        padding: 9px 12px;
    }
    .base-row .badge { grid-area: badge; align-self: start; }
    .row-name { grid-area: name; }
    .row-sub { display: block; }
    .row-sys, .row-size { display: none; }
    .row-status { grid-area: status; }
    .row-status:empty { display: none; }
    .row-actions { grid-area: actions; }
    .sheet-body { padding: 14px 16px 24px; }
    .lock-line { grid-template-areas: "dot name" ". state" ". btns"; grid-template-columns: auto minmax(0, 1fr); }
    .lock-btns { justify-content: flex-start; margin-top: 6px; }
    .metrics { grid-template-columns: 1fr 1fr; }
    .toasts { left: 16px; right: 16px; bottom: 16px; max-width: none; }
    .modal-head { padding: 16px 14px 0 18px; }
    .modal-body { padding: 14px 18px; }
    .modal-foot { padding: 12px 18px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
