/* ==========================================================================
   QR Redirect — Vercel/Linear-style design
   Минималистично, тонкие линии, много воздуха, монохром + один акцент
   ========================================================================== */

:root {
    --bg: #fafafa;
    --bg-card: #ffffff;
    --bg-subtle: #f5f5f5;
    --bg-nav: #ffffff;
    --bg-hover: #f5f5f5;

    --text: #0a0a0a;
    --text-secondary: #525252;
    --text-muted: #a3a3a3;

    --border: #ededed;
    --border-strong: #dcdcdc;
    --border-focus: #0a0a0a;

    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #eff6ff;

    --success: #16a34a;
    --success-soft: #f0fdf4;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --warning: #d97706;

    --radius: 6px;
    --radius-lg: 8px;

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

    --transition: 120ms ease;
}

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

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: var(--font);
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

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

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

/* === Navigation === */

.navbar {
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 32px;
}
.navbar-brand svg { width: 18px; height: 18px; }

.navbar-links {
    display: flex;
    list-style: none;
    gap: 2px;
    flex: 1;
}

.navbar-links a {
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
}
.navbar-links a:hover { background: var(--bg-hover); color: var(--text); }
.navbar-links a.active { background: var(--bg-hover); color: var(--text); }

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-logout {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: all var(--transition);
}
.btn-logout:hover { background: var(--bg-hover); color: var(--text); }

/* === Layout === */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.page-header .subtitle {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 400;
    margin-left: 6px;
}

/* === Cards === */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
    font-size: 13px;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 18px;
}

.card + .card { margin-top: 16px; }

/* === Stats === */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.stat-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
    margin-top: 4px;
}

/* === Buttons === */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    background: var(--bg-card);
    color: var(--text);
    line-height: 1.4;
    white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text); }

.btn-primary {
    background: var(--text);
    color: white;
    border-color: var(--text);
}
.btn-primary:hover { background: #333; border-color: #333; color: white; }

.btn-accent {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: white; }

.btn-danger { color: var(--danger); }
.btn-danger:hover {
    background: var(--danger-soft);
    border-color: #fca5a5;
    color: var(--danger);
}

.btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-sm { padding: 4px 8px; font-size: 12px; }
.btn-xs { padding: 2px 6px; font-size: 11px; }

.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* === Forms === */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-label .hint-icon {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    cursor: help;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.5;
}
.form-hint code {
    background: var(--bg-subtle);
    padding: 1px 4px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-card);
    transition: all var(--transition);
    outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--text);
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.08);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:disabled, .form-input[readonly] {
    background: var(--bg-subtle);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.form-inline {
    display: flex;
    gap: 8px;
    align-items: end;
}

.form-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 400;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 14px;
    height: 14px;
    accent-color: var(--text);
    cursor: pointer;
}

/* Radio group (UTM mode toggle) */
.radio-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.radio-option {
    flex: 1;
    min-width: 220px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: start;
    gap: 10px;
}
.radio-option:hover { border-color: var(--border-strong); }
.radio-option input[type="radio"] {
    margin-top: 2px;
    accent-color: var(--text);
}
.radio-option input[type="radio"]:checked ~ .radio-content .radio-title {
    color: var(--text);
}
.radio-option:has(input:checked) {
    border-color: var(--text);
    background: var(--bg-subtle);
}
.radio-content { flex: 1; }
.radio-title {
    font-weight: 500;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 2px;
}
.radio-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* === UTM hint (жёлтая подсказка под полем) === */

.utm-hint {
    margin-top: 4px;
    padding: 4px 8px;
    background: #fef9c3;
    border: 1px solid #fde68a;
    border-radius: 4px;
    font-size: 11px;
    color: #713f12;
    line-height: 1.5;
}
.utm-hint b { font-weight: 600; }

/* === Tables === */

.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
}

th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

td {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text);
    border-top: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:first-child td { border-top: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-subtle); }

/* === Badges === */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.01em;
    white-space: nowrap;
    line-height: 1.5;
}
.badge-active {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid #bbf7d0;
}
.badge-inactive {
    background: var(--bg-subtle);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.badge-role {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid #bfdbfe;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.5;
}
.tag-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

/* === Toolbar === */

.toolbar {
    display: flex;
    gap: 8px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.toolbar .search-box {
    flex: 1;
    min-width: 200px;
    display: flex;
    gap: 6px;
}
.toolbar .search-box .form-input { margin: 0; flex: 1; }

.tag-filters {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.tag-filter {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    background: var(--bg-card);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tag-filter:hover { border-color: var(--border-strong); color: var(--text); }
.tag-filter.active {
    background: var(--bg-subtle);
    border-color: var(--text);
    color: var(--text);
}

/* === Pagination === */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 8px;
}
.pagination .page-info {
    color: var(--text-muted);
    font-size: 12px;
    padding: 0 8px;
}

/* === Detail page === */

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .detail-grid { grid-template-columns: 1fr; }
}

.detail-item dt {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 3px;
}
.detail-item dd {
    font-size: 13px;
    margin-bottom: 12px;
    word-break: break-all;
    color: var(--text);
}
.detail-item dd a { color: var(--accent); }

/* === QR Section === */

.qr-section {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
}
@media (max-width: 768px) { .qr-section { grid-template-columns: 1fr; } }

.qr-preview {
    text-align: center;
    padding: 16px;
    background: var(--bg-subtle);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.qr-preview img {
    max-width: 220px;
    width: 100%;
    background: white;
    border-radius: 4px;
    padding: 8px;
}

.url-preview {
    margin: 6px 0;
    padding: 8px 10px;
    background: var(--bg-subtle);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 11.5px;
    word-break: break-all;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    line-height: 1.5;
}

/* === Details (collapsible) === */

details {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    background: var(--bg-card);
}
details summary {
    padding: 8px 12px;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
    user-select: none;
    list-style: none;
}
details summary::-webkit-details-marker { display: none; }
details summary::before {
    content: "▸";
    color: var(--text-muted);
    margin-right: 6px;
    display: inline-block;
    transition: transform var(--transition);
}
details[open] summary::before { transform: rotate(90deg); }

details[open] summary { border-bottom: 1px solid var(--border); }

details > div,
details > form {
    padding: 12px;
}

/* === Login === */

.login-card {
    max-width: 380px;
    margin: 80px auto;
}
.login-card .card-header {
    border: none;
    justify-content: center;
    flex-direction: column;
    padding: 24px 20px 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
}
.login-card .brand-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    background: var(--text);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}
.login-card .brand-icon svg { width: 22px; height: 22px; }

.error-msg {
    background: var(--danger-soft);
    color: var(--danger);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 12px;
    border: 1px solid #fecaca;
}

.success-msg {
    background: var(--success-soft);
    color: var(--success);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 12px;
    border: 1px solid #bbf7d0;
}

/* === 404 === */

.page-404 {
    text-align: center;
    padding: 100px 20px;
}
.page-404 h1 {
    font-size: 72px;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1;
    letter-spacing: -0.04em;
}
.page-404 p {
    color: var(--text-secondary);
    margin-top: 12px;
    font-size: 15px;
}

/* === Footer === */

.footer {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-muted);
    font-size: 11px;
}

/* === Chart === */

.chart-container {
    position: relative;
    padding: 4px 0;
}

/* === Code slug === */

code.slug {
    font-family: var(--font-mono);
    background: var(--bg-subtle);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    color: var(--text);
    border: 1px solid var(--border);
}

/* === Color swatch / palette === */

.color-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: middle;
    border: 1px solid rgba(0,0,0,0.08);
}

.color-palette {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.color-palette label {
    position: relative;
    cursor: pointer;
}
.color-palette input[type="radio"] {
    position: absolute;
    opacity: 0;
}
.color-palette .swatch {
    display: block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all var(--transition);
}
.color-palette input[type="radio"]:checked + .swatch {
    border-color: var(--text);
    transform: scale(1.1);
}

/* === GitHub-style tag input === */

.tag-input {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 8px;
    background: var(--bg-card);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 36px;
    align-items: center;
    transition: all var(--transition);
}
.tag-input:focus-within {
    border-color: var(--text);
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.08);
}
.tag-input .tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}
.tag-input .tag-chip .remove {
    cursor: pointer;
    opacity: 0.5;
    font-size: 14px;
    padding: 0 2px;
}
.tag-input .tag-chip .remove:hover { opacity: 1; }
.tag-input input[type="text"] {
    flex: 1;
    min-width: 100px;
    border: none;
    outline: none;
    font-size: 13px;
    padding: 2px 4px;
    background: transparent;
}

.tag-suggestions {
    position: absolute;
    z-index: 50;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 4px;
    min-width: 200px;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.tag-suggestions .item {
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tag-suggestions .item:hover,
.tag-suggestions .item.active { background: var(--bg-subtle); }
.tag-suggestions .item.create {
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    font-style: italic;
}

/* === Tooltip (built-in HTML title is used, but this styles hint icon) === */

.info-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    cursor: help;
    border: 1px solid var(--border);
}

/* === History timeline === */

.history-list {
    list-style: none;
}
.history-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.history-item:last-child { border-bottom: none; }
.history-item .time {
    color: var(--text-muted);
    font-size: 11px;
    min-width: 110px;
    padding-top: 1px;
}
.history-item .desc {
    flex: 1;
    color: var(--text);
}
.history-item .desc code {
    font-family: var(--font-mono);
    background: var(--bg-subtle);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 11.5px;
    border: 1px solid var(--border);
}
.history-item .user {
    color: var(--text-muted);
    font-size: 12px;
}

/* === Responsive === */

@media (max-width: 640px) {
    .container { padding: 20px 16px; }
    .navbar { padding: 0 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: start; }
    .toolbar { flex-direction: column; align-items: stretch; }
}

/* === Utility === */

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}
.muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }

/* === Connection list (custom) === */
.conn-list {
    display: grid;
    gap: 10px;
}
.conn-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition);
}
.conn-row:hover { border-color: var(--border-strong); }
.conn-row .meta {
    color: var(--text-muted);
    font-size: 12px;
    font-family: var(--font-mono);
}
.conn-row .name {
    font-weight: 500;
    font-size: 14px;
}
.conn-row .actions { display: flex; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; }
.dot.ok { background: var(--success); }
.dot.err { background: var(--danger); }

/* === Modal === */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 200;
}
.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%; max-width: 520px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    border: 1px solid var(--border);
}
.modal h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.modal-row {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.modal-row label { color: var(--text-muted); font-size: 12px; }
.modal-row input {
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-subtle);
    color: var(--text);
}
.modal-row .copy {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: var(--radius);
    cursor: pointer;
}
.modal-row .copy:hover { background: var(--bg-hover); color: var(--text); }
.modal-row .copy.copied { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.modal-link {
    margin-top: 16px;
    padding: 10px;
    background: var(--bg-subtle);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 11px;
    word-break: break-all;
    color: var(--text-secondary);
}
.modal-footer {
    margin-top: 20px;
    display: flex; justify-content: space-between; align-items: center;
}
.modal-close {
    background: transparent;
    color: var(--text-muted);
    border: 0;
    cursor: pointer;
    font-size: 13px;
}
.modal-close:hover { color: var(--text); }
.modal-stats {
    color: var(--text-muted);
    font-size: 12px;
}
.modal-error {
    padding: 16px;
    background: var(--danger-soft);
    color: var(--danger);
    border-radius: var(--radius);
}

.btn.copy-ok {
    background: var(--success-soft);
    color: var(--success);
    border-color: var(--success);
}

.dot.off { background: var(--text-muted); }

/* === Modal meta info row === */
.modal-meta {
    display: flex; flex-wrap: wrap; gap: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 12px;
}
.modal-meta div { display: flex; align-items: center; gap: 4px; }
.modal-ips {
    margin-top: 6px;
    padding: 6px 0;
    font-size: 11px;
    color: var(--text-muted);
}
.modal-ips code { background: var(--bg-subtle); padding: 2px 4px; border-radius: 3px; font-size: 11px; }

/* === Mobile responsive === */
@media (max-width: 700px) {
    .container { padding: 16px 12px; }
    .navbar { padding: 0 12px; flex-wrap: wrap; height: auto; min-height: 52px; }
    .navbar-brand { margin-right: 0; }
    .navbar-links { width: 100%; order: 3; overflow-x: auto; padding: 4px 0; }
    .navbar-links a { font-size: 13px; padding: 6px 10px; }
    .navbar-user { font-size: 12px; }

    .page-header { flex-direction: column; align-items: stretch; }
    .page-header form { width: 100%; flex-wrap: wrap; }
    .page-header form > div { flex: 1 1 140px; }

    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 20px; }

    .conn-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .conn-row .actions { flex-wrap: wrap; justify-content: flex-end; }
    .conn-row .meta { display: block; font-size: 11px; margin-top: 4px; }

    .modal { padding: 16px; }
    .modal-row { grid-template-columns: 1fr; gap: 4px; }
    .modal-row label { font-size: 11px; }
    .modal-row .copy { width: 100%; padding: 8px; }
    .modal-meta { font-size: 11px; gap: 10px; }

    /* Login card */
    .login-card { margin: 32px auto; }

    /* Staff page form */
    .card form[action='/staff'] {
        display: flex !important;
        flex-direction: column;
        gap: 10px !important;
    }
    .card form[action='/staff'] > * { width: 100%; }

    /* Staff table — горизонтальный скролл */
    .card table { font-size: 12px; display: block; overflow-x: auto; white-space: nowrap; }
}

/* === Card body typography (после reset нужны явные отступы) === */
.card-body p { margin-bottom: 10px; }
.card-body p:last-child { margin-bottom: 0; }
.card-body ul,
.card-body ol {
    padding-left: 22px;
    margin: 6px 0 12px;
}
.card-body ul:last-child,
.card-body ol:last-child { margin-bottom: 0; }
.card-body li { margin-bottom: 4px; }
.card-body li:last-child { margin-bottom: 0; }
.card-body code {
    background: var(--bg-subtle);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}

/* === Flash messages === */
.flash {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid;
}
.flash-ok { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.flash-err { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
