/* Админка почтовой платформы. Токены → основа → каркас (боковое меню) → компоненты → страницы.
   Без внешних шрифтов и CDN: системные шрифты, иконки — SVG-спрайт в layout.php. */

/* ---------- Токены ---------- */
:root {
    --font: "Inter Variable", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

    --bg: #f5f6fb;
    --bg-glow-1: rgba(124, 108, 255, .16);
    --bg-glow-2: rgba(34, 184, 240, .10);
    --surface: #ffffff;
    --surface-2: #f3f4fa;
    --surface-3: #eceef7;
    --sidebar: rgba(255, 255, 255, .72);
    --border: #e5e7f0;
    --border-strong: #d4d8e6;
    --text: #12142b;
    --text-2: #4b5170;
    --text-3: #80869f;

    --accent: #5b5bf7;
    --accent-2: #7c6cff;
    --accent-3: #22b8f0;
    --accent-text: #4342e0;
    --accent-soft: rgba(91, 91, 247, .10);
    --accent-ring: rgba(91, 91, 247, .28);
    --grad: linear-gradient(135deg, #7c6cff 0%, #5b5bf7 50%, #3b8cf5 100%);

    --ok: #0f9d58;      --ok-soft: rgba(15, 157, 88, .11);    --ok-line: rgba(15, 157, 88, .32);
    --warn: #c26a00;    --warn-soft: rgba(229, 140, 0, .13);  --warn-line: rgba(229, 140, 0, .36);
    --bad: #d93045;     --bad-soft: rgba(217, 48, 69, .10);   --bad-line: rgba(217, 48, 69, .32);
    --info: #1f7ae0;    --info-soft: rgba(31, 122, 224, .10); --info-line: rgba(31, 122, 224, .30);
    --mark: rgba(124, 108, 255, .18);

    --r-xs: 6px;
    --r-sm: 9px;
    --r: 14px;
    --r-lg: 20px;
    --shadow-xs: 0 1px 2px rgba(18, 20, 43, .05);
    --shadow-sm: 0 1px 2px rgba(18, 20, 43, .04), 0 2px 8px -2px rgba(18, 20, 43, .06);
    --shadow: 0 1px 2px rgba(18, 20, 43, .04), 0 12px 32px -12px rgba(18, 20, 43, .16);
    --shadow-pop: 0 20px 50px -12px rgba(18, 20, 43, .28);
    --side-w: 264px;
    --ease: cubic-bezier(.2, .8, .2, 1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0b0d14;
        --bg-glow-1: rgba(124, 108, 255, .16);
        --bg-glow-2: rgba(34, 184, 240, .07);
        --surface: #12151f;
        --surface-2: #181c28;
        --surface-3: #1f2432;
        --sidebar: rgba(14, 17, 26, .78);
        --border: #232838;
        --border-strong: #303749;
        --text: #eceef6;
        --text-2: #a7adc2;
        --text-3: #6f7690;
        --accent: #7b7bff;
        --accent-text: #a5a5ff;
        --accent-soft: rgba(123, 123, 255, .14);
        --accent-ring: rgba(123, 123, 255, .35);
        --ok: #3ccf86;   --ok-soft: rgba(60, 207, 134, .12);   --ok-line: rgba(60, 207, 134, .32);
        --warn: #f0a640; --warn-soft: rgba(240, 166, 64, .13); --warn-line: rgba(240, 166, 64, .34);
        --bad: #ff6b7d;  --bad-soft: rgba(255, 107, 125, .12); --bad-line: rgba(255, 107, 125, .34);
        --info: #5aa8ff; --info-soft: rgba(90, 168, 255, .12); --info-line: rgba(90, 168, 255, .32);
        --mark: rgba(123, 123, 255, .28);
        --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px -2px rgba(0, 0, 0, .35);
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px -14px rgba(0, 0, 0, .6);
        --shadow-pop: 0 24px 60px -12px rgba(0, 0, 0, .7);
    }
}
:root[data-theme="dark"] {
    --bg: #0b0d14;
    --bg-glow-1: rgba(124, 108, 255, .16);
    --bg-glow-2: rgba(34, 184, 240, .07);
    --surface: #12151f;
    --surface-2: #181c28;
    --surface-3: #1f2432;
    --sidebar: rgba(14, 17, 26, .78);
    --border: #232838;
    --border-strong: #303749;
    --text: #eceef6;
    --text-2: #a7adc2;
    --text-3: #6f7690;
    --accent: #7b7bff;
    --accent-text: #a5a5ff;
    --accent-soft: rgba(123, 123, 255, .14);
    --accent-ring: rgba(123, 123, 255, .35);
    --ok: #3ccf86;   --ok-soft: rgba(60, 207, 134, .12);   --ok-line: rgba(60, 207, 134, .32);
    --warn: #f0a640; --warn-soft: rgba(240, 166, 64, .13); --warn-line: rgba(240, 166, 64, .34);
    --bad: #ff6b7d;  --bad-soft: rgba(255, 107, 125, .12); --bad-line: rgba(255, 107, 125, .34);
    --info: #5aa8ff; --info-soft: rgba(90, 168, 255, .12); --info-line: rgba(90, 168, 255, .32);
    --mark: rgba(123, 123, 255, .28);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px -2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px -14px rgba(0, 0, 0, .6);
    --shadow-pop: 0 24px 60px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

/* Плавные переходы между страницами (View Transitions между документами). */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }

/* ---------- Основа ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    font: 15px/1.55 var(--font);
    font-feature-settings: "cv11", "ss01", "ss03";
    color: var(--text);
    background:
        radial-gradient(1100px 520px at 85% -10%, var(--bg-glow-1), transparent 60%),
        radial-gradient(900px 480px at 20% -20%, var(--bg-glow-2), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.012em; font-weight: 650; }
h1 { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.9rem); letter-spacing: -.022em; }
h2 { font-size: 1.08rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 .75rem; }
code, kbd, pre, .mono { font-family: var(--mono); font-size: .86em; }
code { overflow-wrap: anywhere; }
small { font-size: .82em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
::selection { background: var(--mark); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
mark.ip { background: var(--mark); color: inherit; padding: .05em .3em; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--accent-ring); }
.muted { color: var(--text-3); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.i { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }

/* ---------- Каркас: боковое меню + содержимое ---------- */
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: var(--side-w);
    display: flex; flex-direction: column; gap: 1rem;
    padding: 1.15rem .9rem .9rem;
    background: var(--sidebar);
    backdrop-filter: saturate(1.6) blur(18px);
    -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-right: 1px solid var(--border);
}
body:has(> .sidebar) { padding-left: var(--side-w); }
.brand { display: flex; align-items: center; gap: .7rem; color: var(--text); padding: .15rem .45rem; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; flex: none; border-radius: 10px; box-shadow: 0 6px 16px -6px rgba(91, 91, 247, .7); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text b { font-size: 1.02rem; letter-spacing: -.01em; }
.brand-text small { color: var(--text-3); font-family: var(--mono); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-cta { margin: .1rem .2rem .2rem; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .55rem .7rem; border-radius: var(--r-sm);
    color: var(--text-2); font-weight: 520;
    transition: background .15s, color .15s;
    position: relative;
}
.side-link .i { width: 1.2em; height: 1.2em; opacity: .85; }
.side-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-link.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.side-link.is-active::before { content: ""; position: absolute; left: -.9rem; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: .5rem; padding: .7rem .4rem 0; border-top: 1px solid var(--border); }
.me { display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 1; }
.avatar {
    width: 34px; height: 34px; flex: none; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--grad); color: #fff; font-size: .78rem; font-weight: 700; letter-spacing: .02em;
}
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-text b { font-size: .82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--text-3); font-size: .74rem; }
.side-tools { display: flex; gap: 2px; }
.side-tools form { margin: 0; }
[data-theme-toggle] .i { display: none; }
:root:not([data-theme]) [data-theme-toggle] .theme-auto,
:root[data-theme="light"] [data-theme-toggle] .theme-light,
:root[data-theme="dark"] [data-theme-toggle] .theme-dark { display: block; }

.topbar { display: none; }
.scrim { display: none; }

.page { max-width: 1180px; margin: 0 auto; padding: 2rem clamp(1rem, 3vw, 2.5rem) 4rem; }
.page-narrow { max-width: 760px; }

@media (max-width: 960px) {
    body:has(> .sidebar) { padding-left: 0; }
    .sidebar { transform: translateX(-104%); transition: transform .28s var(--ease); box-shadow: var(--shadow-pop); background: var(--surface); }
    body.nav-open .sidebar { transform: none; }
    .scrim { position: fixed; inset: 0; z-index: 35; background: rgba(8, 10, 20, .42); backdrop-filter: blur(2px); }
    body.nav-open .scrim { display: block; }
    .topbar {
        position: sticky; top: 0; z-index: 30;
        display: flex; align-items: center; justify-content: space-between; gap: .5rem;
        padding: .6rem .75rem; padding-top: max(.6rem, env(safe-area-inset-top));
        background: var(--sidebar); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
        border-bottom: 1px solid var(--border);
    }
    .brand-sm { gap: .5rem; }
    .brand-sm .brand-mark { width: 28px; height: 28px; border-radius: 8px; }
    .page { padding-top: 1.25rem; }
}

/* ---------- Заголовок страницы ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.page-head > div:first-child { min-width: 0; flex: 1 1 22rem; }
.page-head h1 { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.page-head .lead { color: var(--text-2); margin: .45rem 0 0; max-width: 62ch; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; font-size: .84rem; color: var(--text-3); margin-bottom: .55rem; }
.crumbs a { color: var(--text-2); }
.crumbs .i { width: .9em; height: .9em; opacity: .6; }
.eyebrow { font-size: .74rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }

/* ---------- Кнопки ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    min-height: 38px; padding: .5rem .95rem;
    font: inherit; font-size: .9rem; font-weight: 600; line-height: 1.2; white-space: nowrap;
    color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
    box-shadow: var(--shadow-xs);
    cursor: pointer; text-decoration: none;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .08s, opacity .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { color: #fff; background: var(--grad); border-color: transparent; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 8px 20px -8px rgba(91, 91, 247, .75); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.07); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-soft { background: var(--accent-soft); border-color: transparent; box-shadow: none; color: var(--accent-text); }
.btn-soft:hover { background: var(--accent-soft); filter: brightness(1.05); }
.btn-danger { color: var(--bad); border-color: var(--bad-line); background: var(--surface); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-ok { color: #fff; background: var(--ok); border-color: transparent; }
.btn-sm { min-height: 30px; padding: .3rem .65rem; font-size: .82rem; border-radius: 8px; }
.btn-lg { min-height: 46px; padding: .7rem 1.25rem; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn .i { width: 1.05em; height: 1.05em; }
.btn.is-busy { pointer-events: none; opacity: .8; }
.btn.is-busy .i { display: none; }
.btn.is-busy::before { content: ""; width: 1em; height: 1em; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
    display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
    color: var(--text-2); background: transparent; border: 0; border-radius: 10px; cursor: pointer;
    transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .i { width: 1.25em; height: 1.25em; }

button.link { display: inline; padding: 0; border: 0; background: none; color: var(--accent-text); font: inherit; font-size: .875rem; cursor: pointer; }
button.link:hover { text-decoration: underline; }
button.link.danger { color: var(--bad); }

/* «Скопировать» */
.copy {
    display: inline-flex; align-items: center; gap: .35rem; flex: none;
    min-height: 30px; padding: .25rem .6rem;
    font: inherit; font-size: .8rem; font-weight: 600; color: var(--accent-text);
    background: var(--accent-soft); border: 1px solid transparent; border-radius: 8px;
    cursor: pointer; transition: background .15s, color .15s, transform .08s;
}
.copy:hover { filter: brightness(1.06); }
.copy:active { transform: scale(.97); }
.copy .i { width: 1em; height: 1em; }
.copy .i-done { display: none; }
.copy.is-done { background: var(--ok-soft); color: var(--ok); }
.copy.is-done .i { display: none; }
.copy.is-done .i-done { display: inline; }
.copy.is-failed { background: var(--warn-soft); color: var(--warn); }
.copy-icon { padding: .25rem; min-width: 30px; justify-content: center; }

/* ---------- Карточки ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
    box-shadow: var(--shadow-sm);
}
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: 1.25rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.card-head h2 { display: flex; align-items: center; gap: .5rem; }
.card-head h2 .i { color: var(--text-3); }
.card-head p { margin: .2rem 0 0; color: var(--text-3); font-size: .86rem; }
.card-body { padding: 1.15rem 1.25rem; }
.card-body > :last-child { margin-bottom: 0; }
.card-foot { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .85rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); }
.card-flush .table { border-radius: 0 0 var(--r) var(--r); }
.card.danger-zone { border-color: var(--bad-line); }
.card.danger-zone .card-head h2 { color: var(--bad); }
.card.glass { background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, transparent), var(--surface)); }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1080px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 680px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.stack { display: flex; flex-direction: column; gap: 1.25rem; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
@media (max-width: 1080px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { position: relative; overflow: hidden; padding: 1.05rem 1.15rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-sm); color: var(--text); display: block; }
a.kpi:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--text-3); font-size: .82rem; font-weight: 550; }
.kpi-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.kpi-icon.ok { background: var(--ok-soft); color: var(--ok); }
.kpi-icon.warn { background: var(--warn-soft); color: var(--warn); }
.kpi-icon.bad { background: var(--bad-soft); color: var(--bad); }
.kpi-value { font-size: 1.85rem; font-weight: 700; letter-spacing: -.03em; margin-top: .35rem; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-value small { font-size: .95rem; color: var(--text-3); font-weight: 600; letter-spacing: 0; }
.kpi-sub { color: var(--text-3); font-size: .82rem; margin-top: .15rem; }

/* Бейджи */
.pill {
    display: inline-flex; align-items: center; gap: .38rem; white-space: nowrap;
    padding: .14rem .55rem .14rem .5rem; border-radius: 999px;
    font-size: .76rem; font-weight: 620; letter-spacing: .005em; line-height: 1.4;
    color: var(--text-2); background: var(--surface-3);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill-ok { color: var(--ok); background: var(--ok-soft); }
.pill-bad { color: var(--bad); background: var(--bad-soft); }
.pill-warn { color: var(--warn); background: var(--warn-soft); }
.pill-info { color: var(--info); background: var(--info-soft); }
.pill-accent { color: var(--accent-text); background: var(--accent-soft); }
.pill-muted { color: var(--text-3); background: var(--surface-3); }
h1 .pill { font-size: .78rem; letter-spacing: 0; }
.tag { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .5rem; border-radius: 7px; font-family: var(--mono); font-size: .76rem; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); }

/* Состояние шага / пункта: кружок */
.state { width: 22px; height: 22px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; }
.state .i { width: 13px; height: 13px; stroke-width: 3; }
.state-ok { background: var(--ok); color: #fff; }
.state-bad { background: var(--bad); color: #fff; }
.state-todo { border: 2px dashed var(--border-strong); }

/* Таблицы */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.table th { position: sticky; top: 0; text-align: left; font-size: .74rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); padding: .65rem 1.25rem; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .8rem 1.25rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions form { display: inline; margin: 0; }
.cell-main { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.cell-main b { font-weight: 600; }
.cell-main small { display: block; color: var(--text-3); }
.row-link { color: var(--text); font-weight: 600; }
.row-link:hover { color: var(--accent-text); }
.tile { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); font-weight: 700; font-size: .8rem; border: 1px solid var(--border); }
.tile-accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 80px; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--grad); }
.meter.warn > span { background: var(--warn); }
.meter.bad > span { background: var(--bad); }

.empty { text-align: center; padding: 2.5rem 1.5rem; color: var(--text-3); }
.empty .tile { margin: 0 auto .9rem; width: 52px; height: 52px; border-radius: 16px; }
.empty .tile .i { width: 1.5em; height: 1.5em; }
.empty h3 { color: var(--text); margin-bottom: .35rem; }
.empty p { max-width: 42ch; margin: 0 auto 1rem; }

/* Список «определений» */
.dl { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: .55rem 1.25rem; margin: 0; font-size: .9rem; }
.dl dt { color: var(--text-3); }
.dl dd { margin: 0; min-width: 0; }
.dl dd .copy, .dl dd .tag, .dl dd .pill { vertical-align: middle; margin: 0 .25rem .2rem 0; }

/* ---------- Формы ---------- */
form { margin: 0; }
.form { display: flex; flex-direction: column; gap: 1.1rem; }
.field { display: flex; flex-direction: column; gap: .4rem; }
.field > label, .label { font-size: .86rem; font-weight: 620; color: var(--text); }
.field .hint { font-size: .8rem; color: var(--text-3); margin: 0; }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number], .field input[type=search], .field select, .field textarea,
input.input, select.input, textarea.input {
    width: 100%; min-height: 40px; padding: .55rem .8rem;
    font: inherit; font-size: .93rem; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
    box-shadow: var(--shadow-xs) inset;
    transition: border-color .15s, box-shadow .15s;
}
textarea.input, .field textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }
.input:hover, .field input:hover, .field select:hover, .field textarea:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-3)); }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--text-3); opacity: .8; }
.field select, select.input { appearance: none; padding-right: 2.2rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2380869f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); transition: border-color .15s, box-shadow .15s; overflow: hidden; }
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.input-group input, .input-group select { border: 0 !important; box-shadow: none !important; border-radius: 0 !important; min-width: 0; flex: 1 1 auto; }
.input-group .addon { display: flex; align-items: center; padding: 0 .8rem; color: var(--text-3); background: var(--surface-2); font-weight: 600; white-space: nowrap; border-left: 1px solid var(--border); }
.input-group .addon:first-child { border-left: 0; border-right: 1px solid var(--border); }
.input-group select { flex: 0 1 auto; max-width: 55%; background-color: var(--surface-2); font-weight: 600; color: var(--text-2); border-left: 1px solid var(--border) !important; }
.row { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1 1 12rem; }
.inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline .input, .inline input[type=text], .inline input[type=email], .inline input[type=search] { flex: 1 1 14rem; width: auto; }
.form-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding-top: .25rem; }

/* Переключатель */
.switch { display: flex; align-items: flex-start; gap: .75rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 40px; height: 24px; flex: none; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; transition: background .2s; margin-top: .05rem; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--accent); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--accent-ring); }
.switch b { display: block; font-size: .9rem; font-weight: 600; }
.switch small { color: var(--text-3); font-size: .8rem; }

/* Сегменты и чипы */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem; border-radius: 8px; font-size: .86rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-ring); }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { padding: .35rem .75rem; border-radius: 999px; font: inherit; font-size: .84rem; font-weight: 600; color: var(--text-2); background: var(--surface); border: 1px solid var(--border-strong); cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--accent); color: var(--accent-text); text-decoration: none; }
.chip.is-on, .chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.radio-row { display: flex; align-items: flex-start; gap: .6rem; padding: .7rem .85rem; border: 1px solid var(--border); border-radius: 11px; cursor: pointer; transition: border-color .15s, background .15s; }
.radio-row:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-row input { margin-top: .25rem; accent-color: var(--accent); }
.radio-row b { display: block; font-size: .9rem; }
.radio-row small { color: var(--text-3); }

/* ---------- Уведомления ---------- */
.callout { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; border-radius: 12px; border: 1px solid var(--info-line); background: var(--info-soft); color: var(--text); font-size: .9rem; }
.callout > .i { color: var(--info); margin-top: .1rem; width: 1.2em; height: 1.2em; }
.callout p:last-child { margin-bottom: 0; }
.callout b { font-weight: 650; }
.callout-ok { border-color: var(--ok-line); background: var(--ok-soft); }
.callout-ok > .i { color: var(--ok); }
.callout-warn { border-color: var(--warn-line); background: var(--warn-soft); }
.callout-warn > .i { color: var(--warn); }
.callout-bad { border-color: var(--bad-line); background: var(--bad-soft); }
.callout-bad > .i { color: var(--bad); }
.callout + .callout, .callout + .card, .card + .callout { margin-top: 1rem; }
.page-head + .callout { margin-bottom: 1.25rem; }
p.alert, p.notice { padding: .8rem 1rem; border-radius: 12px; border: 1px solid var(--bad-line); background: var(--bad-soft); }
p.notice { border-color: var(--info-line); background: var(--info-soft); }

.toasts { position: fixed; top: 1rem; right: 1rem; z-index: 60; display: flex; flex-direction: column; gap: .6rem; width: min(440px, calc(100vw - 2rem)); pointer-events: none; }
.toast {
    pointer-events: auto; display: flex; align-items: flex-start; gap: .65rem;
    padding: .85rem .8rem .85rem 1rem; border-radius: 14px;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop);
    font-size: .9rem; line-height: 1.45;
    animation: toast-in .35s var(--ease) both;
    position: relative; overflow: hidden;
}
.toast::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--info); }
.toast-notice::before { background: var(--ok); }
.toast-warning::before { background: var(--warn); }
.toast-alert::before { background: var(--bad); }
.toast-icon { margin-top: .1rem; width: 1.2em; height: 1.2em; }
.toast-notice .toast-icon { color: var(--ok); }
.toast-warning .toast-icon { color: var(--warn); }
.toast-alert .toast-icon { color: var(--bad); }
.toast .flash { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-x { border: 0; background: none; color: var(--text-3); cursor: pointer; padding: .1rem; border-radius: 6px; display: grid; place-items: center; }
.toast-x:hover { color: var(--text); background: var(--surface-2); }
.toast.is-leaving { animation: toast-out .25s ease-in both; }
.toast[data-autohide]::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--ok); opacity: .45; transform-origin: left; animation: toast-timer 8s linear both; }
.toast[data-autohide]:hover::after { animation-play-state: paused; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }
@keyframes toast-timer { to { transform: scaleX(0); } }
@media (max-width: 960px) { .toasts { top: auto; bottom: max(1rem, env(safe-area-inset-bottom)); right: 1rem; left: 1rem; width: auto; } }

details.more { border-top: 1px solid var(--border); }
details.more > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem; padding: .85rem 1.25rem; font-weight: 600; font-size: .9rem; color: var(--text-2); }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .i { transition: transform .2s; }
details.more[open] > summary .i { transform: rotate(90deg); }
details.more > .card-body { padding-top: 0; }
pre { margin: 0; padding: .85rem 1rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .82rem; line-height: 1.55; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }

/* ---------- Мастер DNS ---------- */
.server-strip {
    display: flex; align-items: center; gap: .6rem 1.25rem; flex-wrap: wrap;
    padding: .8rem 1rem; margin-bottom: 1.25rem;
    border-radius: var(--r); border: 1px solid var(--border);
    background: linear-gradient(120deg, var(--accent-soft), transparent 70%), var(--surface);
    box-shadow: var(--shadow-sm); font-size: .88rem;
}
.server-strip .ss-item { display: flex; align-items: center; gap: .45rem; color: var(--text-2); }
.server-strip .ss-item b { color: var(--text); font-family: var(--mono); font-weight: 600; font-size: .86rem; }
.server-strip .ss-item .i { color: var(--accent-text); }
.server-strip .ss-sep { width: 1px; height: 18px; background: var(--border-strong); }
@media (max-width: 680px) { .server-strip .ss-sep { display: none; } .rec-head { padding: .75rem .9rem; } .fld { padding: .65rem .9rem; } }

.wizard { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 1080px) { .wizard { grid-template-columns: minmax(0, 1fr); } }
.stepper { position: sticky; top: 1.25rem; display: flex; flex-direction: column; gap: 2px; padding: .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-sm); counter-reset: step; }
.step-link { position: relative; display: flex; align-items: center; gap: .75rem; padding: .6rem .65rem; border-radius: 11px; color: var(--text-2); transition: background .15s; }
.step-link:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.step-link.is-current { background: var(--accent-soft); color: var(--text); }
.step-num { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border-strong); font-variant-numeric: tabular-nums; }
.step-link.is-current .step-num { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 14px -6px rgba(91, 91, 247, .8); }
.step-link.is-ok .step-num { background: var(--ok); color: #fff; border-color: transparent; }
.step-link.is-bad .step-num { background: var(--bad); color: #fff; border-color: transparent; }
.step-num .i { width: 14px; height: 14px; stroke-width: 3; }
.step-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.step-text b { font-size: .9rem; font-weight: 620; color: var(--text); }
.step-text small { font-size: .76rem; color: var(--text-3); }
.stepper-foot { padding: .65rem .65rem .3rem; margin-top: .3rem; border-top: 1px solid var(--border); }
.progress-line { display: flex; align-items: center; justify-content: space-between; font-size: .78rem; color: var(--text-3); margin-bottom: .4rem; font-weight: 600; }
@media (max-width: 1080px) {
    .stepper { position: static; flex-direction: row; overflow-x: auto; scroll-snap-type: x mandatory; padding: .4rem; }
    .step-link { flex: none; scroll-snap-align: start; }
    .step-text small { display: none; }
    .stepper-foot { display: none; }
}

.step-card .card-head { padding: 1.25rem 1.5rem; align-items: flex-start; }
.step-card .card-body { padding: 1.25rem 1.5rem; }
.step-card .card-foot { padding: 1rem 1.5rem; justify-content: space-between; }
.step-title { display: flex; align-items: center; gap: .75rem; }
.step-title .tile { width: 44px; height: 44px; border-radius: 13px; background: var(--grad); color: #fff; border: 0; box-shadow: 0 10px 22px -10px rgba(91, 91, 247, .85); }
.step-title .tile .i { width: 1.35em; height: 1.35em; }
.step-title h2 { font-size: 1.25rem; letter-spacing: -.015em; }
.why { color: var(--text-2); font-size: .94rem; max-width: 70ch; }
.why b { color: var(--text); }

.rec { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.rec + .rec { margin-top: 1rem; }
.rec-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .85rem 1.1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.rec-title { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.rec-title h3 { font-size: .96rem; }
.rec-type { font-family: var(--mono); font-size: .74rem; font-weight: 700; padding: .2rem .5rem; border-radius: 6px; background: var(--text); color: var(--surface); letter-spacing: .03em; }
.rec-zone { display: flex; align-items: flex-start; gap: .5rem; padding: .6rem 1.1rem; font-size: .84rem; color: var(--text-2); border-bottom: 1px dashed var(--border); }
.rec-zone .i { color: var(--text-3); flex: none; margin-top: .12rem; }
.rec-zone.is-other { background: var(--warn-soft); color: var(--text); }
.rec-zone.is-other .i { color: var(--warn); }
.fields { list-style: none; margin: 0; padding: .35rem 0; }
.fld { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: .2rem .85rem; align-items: center; padding: .7rem 1.1rem; }
.fld + .fld { border-top: 1px solid var(--border); }
.fld-n { grid-row: span 2; align-self: start; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: .78rem; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); margin-top: .1rem; }
.fld-label { font-size: .78rem; font-weight: 650; color: var(--text-3); letter-spacing: .02em; }
.fld-value { grid-column: 2; min-width: 0; }
.fld-value code { display: block; font-size: .92rem; color: var(--text); background: none; padding: 0; overflow-wrap: anywhere; line-height: 1.5; }
.fld-value code.long { max-height: 7.5em; overflow: auto; font-size: .8rem; padding: .55rem .7rem; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.fld .copy { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
.fld-hint { grid-column: 2 / span 2; font-size: .8rem; color: var(--text-3); }
.fld-hint code { font-size: .78rem; }
@media (max-width: 560px) {
    .fld { grid-template-columns: 26px minmax(0, 1fr); }
    .fld .copy { grid-column: 2; grid-row: auto; justify-self: start; margin-top: .3rem; }
}
.rec-check { padding: .85rem 1.1rem; border-top: 1px solid var(--border); font-size: .88rem; display: flex; flex-direction: column; gap: .45rem; }
.rec-check.is-ok { background: var(--ok-soft); }
.rec-check.is-bad { background: var(--bad-soft); }
.rec-check.is-warn { background: var(--warn-soft); }
.rec-check .line { display: flex; align-items: flex-start; gap: .5rem; }
.rec-check .line > .i { margin-top: .15rem; flex: none; }
.rec-check code { font-size: .8rem; }
.fix { padding: .75rem .85rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.fix-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-weight: 650; margin-bottom: .35rem; }
.fix code { display: block; font-size: .85rem; }

.tips { margin: 0; padding: 0; list-style: none; display: grid; gap: .55rem; }
.tips li { display: flex; gap: .6rem; align-items: flex-start; font-size: .88rem; color: var(--text-2); }
.tips li > .i { color: var(--accent-text); margin-top: .15rem; }
.tips b { color: var(--text); }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: flex-start; gap: .85rem; padding: .85rem 1.25rem; }
.checklist li + li { border-top: 1px solid var(--border); }
.checklist .ck-text { flex: 1; min-width: 0; }
.checklist .ck-text b { display: block; font-weight: 620; }
.checklist .ck-text small { display: block; color: var(--text-3); font-size: .8rem; overflow-wrap: anywhere; }
.checklist .ck-go { font-size: .82rem; white-space: nowrap; align-self: center; }

.score { display: flex; align-items: center; gap: 1rem; }
.ring { --p: 0; --c: var(--accent); width: 76px; height: 76px; flex: none; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; font-weight: 750; font-size: 1.05rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ring.ok { --c: var(--ok); }
.ring.warn { --c: var(--warn); }
.ring.bad { --c: var(--bad); }
.ring-sm { width: 44px; height: 44px; }
.ring-sm::before { inset: 5px; }
.ring-sm span { font-size: .74rem; }

.mini-steps { display: flex; gap: .4rem; flex-wrap: wrap; }
.mini-step { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .6rem .3rem .35rem; border-radius: 999px; border: 1px solid var(--border); font-size: .8rem; font-weight: 600; color: var(--text-2); background: var(--surface); }
.mini-step:hover { text-decoration: none; border-color: var(--border-strong); color: var(--text); }
.mini-step .state { width: 18px; height: 18px; }
.mini-step .state .i { width: 11px; height: 11px; }

/* Таблица всех записей */
.records td { vertical-align: top; }
.records .rv { display: flex; align-items: flex-start; gap: .5rem; }
.records .rv code { flex: 1; min-width: 0; font-size: .8rem; }
.records .rn small { display: block; color: var(--text-3); font-size: .76rem; margin-top: .2rem; }

/* ---------- Ящики ---------- */
.addr-preview { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); font-family: var(--mono); font-size: 1rem; overflow-wrap: anywhere; }
.addr-preview .i { color: var(--accent-text); }
.addr-preview .ph { color: var(--text-3); }
.secret-box { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: 1rem 1.1rem; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border-strong); }
.secret-box code { flex: 1; min-width: 12rem; font-size: 1.15rem; font-weight: 600; letter-spacing: .02em; color: var(--text); }
.hero-ok { display: flex; align-items: center; gap: 1rem; }
.hero-ok .tile { width: 52px; height: 52px; border-radius: 16px; background: var(--ok-soft); color: var(--ok); border: 0; }
.hero-ok .tile .i { width: 1.6em; height: 1.6em; stroke-width: 2.2; }
.folders { display: flex; gap: .5rem; flex-wrap: wrap; }
.folder { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .7rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: .84rem; }
.folder .i { color: var(--text-3); }
.folder b { font-variant-numeric: tabular-nums; }
.folder .unread { color: var(--accent-text); font-weight: 700; }

.timeline { list-style: none; margin: 0; padding: .4rem 0; }
.timeline li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: .2rem .85rem; padding: .6rem 1.25rem; align-items: baseline; position: relative; }
.timeline li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); align-self: center; }
.timeline .tl-what { font-size: .88rem; min-width: 0; overflow-wrap: anywhere; }
.timeline .tl-what code { font-size: .78rem; color: var(--text-2); }
.timeline .tl-when { font-size: .78rem; color: var(--text-3); white-space: nowrap; }
.timeline .tl-who { grid-column: 2; font-size: .78rem; color: var(--text-3); }

/* ---------- Вход ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: min(420px, 100%); padding: 2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); }
.auth-card .brand-mark { width: 48px; height: 48px; border-radius: 14px; margin-bottom: 1.1rem; }
.auth-card h1 { font-size: 1.45rem; margin-bottom: .35rem; }
.auth-card .lead { color: var(--text-2); margin-bottom: 1.4rem; font-size: .93rem; }
.auth-foot { margin-top: 1.25rem; font-size: .8rem; color: var(--text-3); display: flex; gap: .5rem; align-items: flex-start; }
.auth-foot .i { margin-top: .1rem; }
.qr { display: flex; justify-content: center; padding: 1rem; margin: 1rem 0; background: #fff; border-radius: 14px; border: 1px solid var(--border); }
.qr img { width: 200px; height: 200px; display: block; }
.steps-ol { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--text-2); font-size: .92rem; }
.steps-ol li { margin-bottom: .35rem; }

/* Печать и уменьшенная анимация */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
    @view-transition { navigation: none; }
}
