/* ============================================================
   avtobardak — стили веб-интерфейса на основе Pimenov UI Kit
   (docs/ui-kit.html): графит как основа, красный как единственный
   акцент, прямые углы, табличные цифры, светлая и тёмная темы.
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
    --ink-50: #F6F7F8; --ink-100: #ECEEF1; --ink-200: #D7DBE0; --ink-300: #B4BAC2; --ink-400: #8A919B;
    --ink-500: #606771; --ink-600: #3D4652; --ink-700: #2A323C; --ink-800: #1B222A; --ink-900: #11161C; --ink-950: #0B0F13;
    --red-50: #FEF3F4; --red-300: #F7989F; --red-400: #F06470; --red-500: #E83341;
    --red-600: #D50F1F; --red-700: #B80D1B;
    --green-600: #2F7D4F; --green-50: #EEF6F1; --amber-600: #A86A0B; --amber-50: #FBF4E8;

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

    --r-1: 2px; --r-2: 4px; --r-full: 999px; --cut: 12px;
    --h-s: 28px; --h-m: 36px; --h-l: 44px; --cell-y: 10px;
    --dur-1: 120ms; --dur-2: 200ms; --dur-3: 280ms; --ease: cubic-bezier(.2, .8, .2, 1);
    --side-w: 248px;

    --bg: var(--ink-50); --surface: #fff; --surface-2: var(--ink-100); --surface-3: var(--ink-200);
    --border: var(--ink-200); --border-strong: var(--ink-300);
    --text: var(--ink-900); --text-2: var(--ink-500); --text-3: var(--ink-400);
    --primary: var(--ink-900); --primary-hover: var(--ink-700); --on-primary: #fff;
    --accent: var(--red-600); --accent-hover: var(--red-700); --on-accent: #fff;
    --accent-soft: var(--red-50); --accent-text: var(--red-700);
    --danger: var(--red-700); --success: var(--green-600); --success-soft: var(--green-50);
    --warning: var(--amber-600); --warning-soft: var(--amber-50); --info: var(--ink-600); --info-soft: var(--ink-100);
    --ring: rgba(213, 15, 31, .2); --overlay: rgba(11, 15, 19, .55);
    --shadow-1: 0 4px 16px rgba(17, 22, 28, .10), 0 1px 3px rgba(17, 22, 28, .08);
    --shadow-2: 0 16px 48px rgba(17, 22, 28, .18), 0 2px 6px rgba(17, 22, 28, .08);
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: var(--ink-950); --surface: var(--ink-900); --surface-2: var(--ink-800); --surface-3: var(--ink-700);
        --border: var(--ink-700); --border-strong: var(--ink-600);
        --text: var(--ink-50); --text-2: var(--ink-400); --text-3: var(--ink-500);
        --primary: var(--ink-50); --primary-hover: var(--ink-200); --on-primary: var(--ink-900);
        --accent: var(--red-500); --accent-hover: var(--red-400); --accent-soft: #2A0C10; --accent-text: var(--red-300);
        --danger: var(--red-400); --success: #5DBB84; --success-soft: #13261B; --warning: #E0A43A; --warning-soft: #2A2010;
        --info: var(--ink-300); --info-soft: var(--ink-800); --ring: rgba(232, 51, 65, .3); --overlay: rgba(0, 0, 0, .65);
        --shadow-1: 0 4px 16px rgba(0, 0, 0, .45); --shadow-2: 0 16px 48px rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: var(--ink-950); --surface: var(--ink-900); --surface-2: var(--ink-800); --surface-3: var(--ink-700);
    --border: var(--ink-700); --border-strong: var(--ink-600);
    --text: var(--ink-50); --text-2: var(--ink-400); --text-3: var(--ink-500);
    --primary: var(--ink-50); --primary-hover: var(--ink-200); --on-primary: var(--ink-900);
    --accent: var(--red-500); --accent-hover: var(--red-400); --accent-soft: #2A0C10; --accent-text: var(--red-300);
    --danger: var(--red-400); --success: #5DBB84; --success-soft: #13261B; --warning: #E0A43A; --warning-soft: #2A2010;
    --info: var(--ink-300); --info-soft: var(--ink-800); --ring: rgba(232, 51, 65, .3); --overlay: rgba(0, 0, 0, .65);
    --shadow-1: 0 4px 16px rgba(0, 0, 0, .45); --shadow-2: 0 16px 48px rgba(0, 0, 0, .6);
    color-scheme: dark;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 14px/22px var(--font);
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--text-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }

.t-h1 { font-size: 28px; line-height: 36px; font-weight: 700; letter-spacing: -.01em; }
.t-h2 { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -.01em; }
.t-h3 { font-size: 16px; line-height: 24px; font-weight: 600; }
.t-small { font-size: 12px; line-height: 18px; font-weight: 500; }
.overline { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.link { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.link:hover { color: var(--accent); }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 2px 6px; border-radius: var(--r-1); overflow-wrap: anywhere; }
pre { margin: 0; padding: 14px 16px; overflow-x: auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-2); line-height: 20px; }
pre code { background: none; padding: 0; overflow-wrap: normal; }

/* ---------- 3. Buttons ---------- */
.btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: var(--h-m); padding: 0 16px; border: 1px solid transparent; border-radius: var(--r-1);
    font-weight: 500; font-size: 14px; line-height: 1; white-space: nowrap; cursor: pointer;
    text-decoration: none; user-select: none;
    transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1), transform var(--dur-1);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn--accent { background: var(--accent); color: var(--on-accent); }
.btn--accent:hover:not(:disabled) { background: var(--accent-hover); }
.btn--outline { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn--outline:hover:not(:disabled) { border-color: var(--text); background: var(--surface-2); }
.btn--ghost { background: transparent; color: var(--text); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover:not(:disabled) { background: var(--accent-soft); }
.btn--sm { height: var(--h-s); padding: 0 10px; font-size: 13px; gap: 6px; }
.btn--sm .i { width: 16px; height: 16px; }
.btn--lg { height: var(--h-l); padding: 0 22px; font-size: 15px; }
.btn--icon { width: var(--h-m); padding: 0; }
.btn--sm.btn--icon { width: var(--h-s); }
.btn--block { width: 100%; }

/* ---------- 4. Fields ---------- */
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.label { font-size: 13px; font-weight: 500; line-height: 18px; display: flex; justify-content: space-between; gap: 8px; }
.label .opt { color: var(--text-3); font-weight: 400; }
.hint { font-size: 12px; line-height: 18px; color: var(--text-2); }
.control {
    display: flex; align-items: center; height: var(--h-m); min-width: 0;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-1);
    transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.control:hover { border-color: var(--text-3); }
.control:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.control input, .control select {
    flex: 1; min-width: 0; height: 100%; border: 0; background: none; padding: 0 12px; outline: none;
}
.control input::placeholder { color: var(--text-3); }
.control > .i { margin-left: 10px; color: var(--text-3); }
.control > .i + input { padding-left: 8px; }
.control input[type="date"] { font-variant-numeric: tabular-nums; }
.control input[type="date"]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
.control .in-btn { border: 0; background: none; color: var(--text-2); height: 100%; padding: 0 10px; display: flex; align-items: center; cursor: pointer; }
.control .in-btn:hover { color: var(--text); }
.control--lg { height: var(--h-l); font-size: 15px; }
.control--select { position: relative; }
.control--select select { appearance: none; padding-right: 36px; cursor: pointer; }
.control--select::after {
    content: ""; position: absolute; right: 13px; top: 50%; width: 7px; height: 7px;
    border-right: 1.75px solid var(--text-2); border-bottom: 1.75px solid var(--text-2);
    transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.control select option { background: var(--surface); color: var(--text); }
.control.is-readonly { background: var(--surface-2); border-style: dashed; }
.control.is-readonly input { font-family: var(--mono); font-size: 13px; }

.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: var(--r-2); gap: 2px; }
.seg a {
    display: inline-flex; align-items: center; height: calc(var(--h-s) - 4px); padding: 0 12px;
    border-radius: var(--r-1); color: var(--text-2); font-size: 13px; font-weight: 500; text-decoration: none;
}
.seg a:hover { color: var(--text); }
.seg a[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(17, 22, 28, .12); }

/* ---------- 5. Badges / avatars ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
    border-radius: var(--r-1); font-size: 12px; font-weight: 500; white-space: nowrap;
    background: var(--surface-2); color: var(--text);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.badge--plain::before { display: none; }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--success::before { background: var(--success); }
.badge--dark { background: var(--primary); color: var(--on-primary); }
.badge--dark::before { background: var(--accent); }
.badge--outline { background: none; border: 1px solid var(--border-strong); color: var(--text-2); }
.avatar {
    position: relative; display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
    border-radius: 50%; background: var(--surface-3); color: var(--text); font-size: 12px; font-weight: 600;
}
.avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.avatar--dark { background: var(--primary); color: var(--on-primary); }

/* ---------- 6. App shell ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px; padding: 12px;
    background: var(--ink-900); color: var(--ink-300);
}
:root[data-theme="dark"] .side { background: var(--ink-950); border-right: 1px solid var(--ink-800); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .side { background: var(--ink-950); border-right: 1px solid var(--ink-800); } }
.side-brand {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px 18px;
    color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .01em; text-decoration: none;
}
.brand-mark {
    display: grid; place-items: center; width: 28px; height: 28px; flex: none;
    background: #fff; color: var(--ink-900); font-weight: 700; font-size: 15px;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.brand-dot { color: var(--red-500); }
.side-group { display: grid; gap: 2px; }
.side-group-toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    padding: 14px 10px 6px; border: 0; background: none; cursor: pointer; color: var(--ink-500); text-align: left;
}
.side-group-toggle:hover { color: var(--ink-300); }
.side-group-toggle .i { width: 14px; height: 14px; transition: transform var(--dur-2) var(--ease); }
.side-group.is-collapsed .side-group-toggle .i { transform: rotate(-90deg); }
.side-group.is-collapsed .side-links { display: none; }
.side-links { display: grid; gap: 2px; }
.side a.side-link {
    position: relative; display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 7px 10px;
    border-radius: var(--r-1); color: var(--ink-300); text-decoration: none; font-weight: 500; line-height: 20px;
}
.side a.side-link .i { color: var(--ink-500); }
.side a.side-link:hover { background: var(--ink-800); color: #fff; }
.side a.side-link:hover .i { color: var(--ink-300); }
.side a.side-link.is-active { background: var(--ink-800); color: #fff; }
.side a.side-link.is-active .i { color: #fff; }
.side a.side-link.is-active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; background: var(--red-500); }
.side .grow { flex: 1; min-height: 16px; }
.side-user {
    display: flex; align-items: center; gap: 10px; padding: 12px 6px 4px 10px; border-top: 1px solid var(--ink-800);
}
.side-user .avatar { background: var(--ink-700); color: #fff; }
.side-user .who { flex: 1; min-width: 0; display: grid; line-height: 18px; }
.side-user .who b { color: #fff; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who small { color: var(--ink-500); font-size: 12px; }
.side-user form { margin: 0; }
.side-user .btn { color: var(--ink-400); }
.side-user .btn:hover { background: var(--ink-800); color: #fff; }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-header {
    position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px;
    height: 56px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.app-header .sp { flex: 1; }
.menu-toggle { display: none; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0; margin: 0; list-style: none; font-size: 13px; color: var(--text-2); min-width: 0; }
.crumbs li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.crumbs li + li::before { content: "/"; color: var(--text-3); }
.crumbs [aria-current] { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }

.page { padding: 28px 32px 64px; display: grid; gap: 20px; align-content: start; min-width: 0; max-width: 1440px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.page-head p { margin-top: 4px; color: var(--text-2); max-width: 720px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.side-backdrop { display: none; }
@media (max-width: 960px) {
    .app { grid-template-columns: 1fr; }
    .side {
        position: fixed; left: 0; top: 0; z-index: 300; width: 272px;
        transform: translateX(-100%); transition: transform var(--dur-3) var(--ease), visibility var(--dur-3);
        visibility: hidden;
    }
    .side.is-open { transform: none; visibility: visible; box-shadow: var(--shadow-2); }
    .crumbs { flex-wrap: nowrap; }
    .crumbs li:not(:last-child), .crumbs li + li::before { display: none; }
    .side-backdrop.is-on { display: block; position: fixed; inset: 0; z-index: 250; background: var(--overlay); }
    .menu-toggle { display: inline-flex; }
    .app-header { padding: 0 16px; }
    .page { padding: 20px 16px 48px; }
}

/* ---------- 7. Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-2); }
.card-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-b { padding: 20px; }
.card-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg); }

/* ---------- 8. Filters ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; padding: 16px 20px; }
.filters .field { width: 168px; }
.filters .field--wide { width: 240px; }
.filters .filters-submit { margin-left: auto; display: flex; gap: 8px; }
.filters-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 20px 16px; margin-top: -4px; }
@media (max-width: 640px) {
    .filters .field { width: calc(50% - 8px); }
    .filters .field--wide { width: 100%; }
    .filters .filters-submit { width: 100%; margin-left: 0; }
    .filters .filters-submit .btn { flex: 1; }
}

/* ---------- 9. Stats strip ---------- */
.stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    background: var(--surface); border: 1px solid var(--border); border-width: 1px 0 0 1px;
    border-radius: var(--r-2); overflow: hidden;
}
.stat { position: relative; display: grid; gap: 2px; align-content: start; min-width: 0; padding: 14px 18px; box-shadow: inset -1px -1px 0 var(--border); }
.stat:first-child::before { content: ""; position: absolute; left: 0; top: 0; width: 24px; height: 2px; background: var(--accent); }
.stat-v { font-size: 24px; line-height: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere; }
.stat-v small { font-size: 15px; font-weight: 600; color: var(--text-2); margin-left: 4px; }
.stat-l { font-size: 13px; color: var(--text-2); }

/* ---------- 10. Table ---------- */
.table-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-2); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.table th {
    position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left;
    font-size: 12px; font-weight: 600; color: var(--text-2); padding: 9px 12px; line-height: 18px;
    border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: bottom;
}
.table td { padding: var(--cell-y) 12px; border-bottom: 1px solid var(--border); background: var(--surface); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--bg); }
.table tfoot td { background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--border); border-bottom: 0; }
.table .r { text-align: right; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table .wrap { overflow-wrap: anywhere; min-width: 220px; }
.table .url { overflow-wrap: anywhere; color: var(--text-2); min-width: 200px; }
.table.fixed .wrap, .table.fixed .url { min-width: 0; }
.table .chain { color: var(--text-2); white-space: pre-line; min-width: 280px; font-size: 13px; line-height: 20px; }
.table .actions { display: flex; justify-content: flex-end; gap: 6px; }
.table .actions form { margin: 0; }
.table.fixed { table-layout: fixed; }
.table.fixed td { overflow-wrap: anywhere; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-stack { display: grid; line-height: 20px; }
.cell-stack small { color: var(--text-2); font-size: 12px; line-height: 18px; }

/* Tree report rows */
.tree td.source { padding-left: calc(12px + var(--depth, 0) * 22px); }
.tree .source-cell { display: flex; align-items: flex-start; gap: 6px; }
.tree .toggle {
    display: grid; place-items: center; width: 22px; height: 22px; flex: none; padding: 0; margin-top: -1px;
    border: 0; border-radius: var(--r-1); background: none; color: var(--text-2); cursor: pointer;
}
.tree .toggle:hover { background: var(--surface-3); color: var(--text); }
.tree .toggle .i { width: 16px; height: 16px; transition: transform var(--dur-2) var(--ease); }
.tree .toggle[aria-expanded="true"] .i { transform: rotate(90deg); }
.tree .toggle-spacer { display: inline-block; width: 22px; flex: none; }
.tree tr.collapsed-row { display: none; }
.tree tr.depth-0 td { font-weight: 600; }
.tree tr.depth-0 td.landing { font-weight: 500; }

/* ---------- 11. Pager ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.pages { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pages a, .pages span.cur {
    min-width: var(--h-m); height: var(--h-m); padding: 0 8px; display: grid; place-items: center;
    border-radius: var(--r-1); font-weight: 500; color: var(--text-2); text-decoration: none; font-variant-numeric: tabular-nums;
}
.pages a:hover { background: var(--surface-2); color: var(--text); }
.pages span.cur { background: var(--primary); color: var(--on-primary); }
.pages .gap { color: var(--text-3); padding: 0 4px; }
.pages .i { width: 18px; height: 18px; }

/* ---------- 12. Feedback ---------- */
.alert {
    display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 12px 16px;
    border: 1px solid var(--border); border-left: 3px solid var(--info); border-radius: var(--r-1); background: var(--info-soft);
}
.alert > .i { color: var(--info); margin-top: 1px; }
.alert b { display: block; margin-bottom: 2px; }
.alert p { color: var(--text-2); }
.alert--success { border-left-color: var(--success); background: var(--success-soft); }
.alert--success > .i { color: var(--success); }
.alert--error { border-left-color: var(--danger); background: var(--accent-soft); }
.alert--error > .i { color: var(--danger); }
.empty { display: grid; justify-items: center; gap: 10px; padding: 48px 16px; text-align: center; }
.empty .ico { width: 56px; height: 56px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.empty .ico .i { width: 26px; height: 26px; }
.empty p { color: var(--text-2); max-width: 420px; }

/* ---------- 13. Forms ---------- */
.form { display: grid; gap: 16px; }
.form-card { max-width: 520px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.inline-form > .btn { margin-top: 24px; }
.inline-form .field { flex: 1 1 280px; }

/* ---------- 14. API docs ---------- */
.doc { line-height: 22px; }
.doc h3 { margin-top: 24px; font-size: 14px; line-height: 20px; font-weight: 600; }
.doc h3:first-child { margin-top: 0; }
.doc div.form { gap: 10px; }
.doc div.form + div.form, .doc div + div.form { margin-top: 8px; }
.doc ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.doc .table-wrap { margin-top: 12px; }
.endpoint { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.endpoint code { font-size: 13px; background: none; padding: 0; }
.secret-row { display: flex; flex-wrap: wrap; gap: 8px; }
.secret-row .control { flex: 1 1 320px; }

/* ---------- 15. Login ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.login-art {
    position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
    padding: 40px 48px; background: var(--ink-900); color: var(--ink-50);
}
.login-art::after {
    content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px;
    border: 1px solid var(--ink-700); transform: rotate(45deg);
}
.login-art::before {
    content: ""; position: absolute; right: 48px; bottom: 96px; width: 96px; height: 96px;
    background: var(--red-600); clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.login-art .side-brand { padding: 0; }
.login-art h1 { position: relative; z-index: 1; max-width: 440px; font-size: 40px; line-height: 46px; font-weight: 700; letter-spacing: -.02em; }
.login-art p { position: relative; z-index: 1; margin-top: 16px; max-width: 400px; color: var(--ink-400); }
.login-art .foot { position: relative; z-index: 1; color: var(--ink-500); font-size: 12px; }
.login-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login-form form { width: min(360px, 100%); display: grid; gap: 18px; }
.login-form .head { display: grid; gap: 4px; }
.login-form .head p { color: var(--text-2); }
.login-form .mobile-brand { display: none; }
@media (max-width: 860px) {
    .login { grid-template-columns: 1fr; }
    .login-art { display: none; }
    .login-form .mobile-brand { display: flex; color: var(--text); padding: 0; }
    .login-form .mobile-brand .brand-mark { background: var(--primary); color: var(--on-primary); }
}

/* ---------- 16. Error ---------- */
.error-page { display: grid; place-items: center; min-height: 60vh; }
.error-page .card { width: min(480px, 100%); }
