/* MagnoNetwork admin UI — layout and components modelled on the reference tracker captures (dense, desktop-first). */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/assets/fonts/manrope-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/assets/fonts/manrope-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
    --bn-navy: #14213d;
    --bn-text: #334155;
    --bn-text-2: #475569;
    --bn-muted: #64748b;
    --bn-muted-2: #64748b;
    --bn-blue: #1769aa;
    --bn-blue-dark: #104f83;
    --bn-blue-soft: #eff6ff;
    --bn-lime: #ff4f00;
    --bn-lime-2: #2563a6;
    --bn-lime-hover: #e84a00;
    --bn-lime-pale: #fff0e8;
    --bn-lime-text: #64748b;
    --bn-red: #b42318;
    --bn-green: #15803d;
    --bn-green-edge: #15803d;
    --bn-row-selected: #fff0e8;
    --bn-card: #ffffff;
    --bn-border: #e2e8f0;
    --bn-border-strong: #cbd5e1;
    --bn-cancel: #e8eef4;
    --bn-chip: #e8eef4;
    --bn-badge-green: #15803d;
    --bn-amber: #92400e;
    --bn-ink: #14213d;
    --bn-heading: #14213d;
    --bn-muted-3: #64748b;
    --bn-surface: #f8fafc;
    --bn-surface-2: #ffffff;
    --bn-surface-3: #f1f5f9;
    --bn-surface-4: #f8fafc;
    --bn-table-head: #eef2f7;
    --bn-border-soft: #e2e8f0;
    --bn-border-off: #cbd5e1;
    --bn-card-hover: #f1f5f9;
    --bn-chip-hover: #d8e2ec;
    --bn-field-muted: #f8fafc;
    --bn-grip: #cbd5e1;
    --bn-toggle-track: #cbd5e1;
    --bn-toggle-knob: #fff;
    --bn-badge-dark-bg: var(--bn-text);
    --bn-badge-dark-text: #fff;
    --bn-blue-fill: #2563a6;
    --bn-blue-fill-hover: #194f87;
    --bn-red-pale: #fef3f2;
    --bn-red-border: #f4c7c3;
    --bn-code-bg: #1f2430;
    --bn-code-text: #e5e7eb;
    --bn-ok-bg: #f0fdf4;
    --bn-ok-text: #15803d;
    --bn-warn-bg: #fffbeb;
    --bn-warn-text: #92400e;
    --bn-err-bg: #fef3f2;
    --bn-err-text: #b42318;
    --bn-info-bg: #eff6ff;
    --bn-info-text: #1769aa;
    --bn-shadow: rgba(15, 23, 42, 0.25);
    --bn-shadow-soft: rgba(15, 23, 42, 0.12);
    --bn-shadow-dot: rgba(15, 23, 42, 0.2);
    --bn-scrim: rgba(20, 33, 61, 0.82);
    --bn-scrim-soft: rgba(20, 33, 61, 0.6);
    --bn-focus-ring: rgba(37, 99, 166, 0.25);
    --bn-select-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 5l4-4 4 4' fill='none' stroke='%23445062' stroke-width='1.5'/%3E%3C/svg%3E");
    /* Client identity (ADR-0035): roles, not colours. Legacy names above keep their meaning
       (--bn-lime = the primary action, --bn-blue-fill = the secondary action, --bn-blue = links). */
    --bn-brand: #ff4f00;
    --bn-primary: #ff4f00;
    --bn-primary-hover: #e84a00;
    --bn-primary-ink: #ffffff; /* owner's choice over the spec's dark ink (ADR-0035 §2) */
    --bn-secondary: #2563a6;
    --bn-secondary-hover: #194f87;
    --bn-neutral: #e8eef4;
    --bn-neutral-hover: #d8e2ec;
    --bn-danger: #b42318;
    --bn-danger-hover: #912018;
    --bn-focus: #2563a6;
    --bn-header-bg: #14213d;
    --bn-header-hover: #233454;
    --bn-header-active: #2d4165;
    --bn-header-muted: #cbd5e1;
    --bn-selected: #fff0e8;
    --bn-disabled-bg: #e2e8f0;
    --bn-disabled-text: #64748b;
    --bn-motion: 140ms ease;
    --bn-radius-card: 12px;
    color-scheme: light;
    --bn-font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bn-radius: 6px;
}

/* ---------- Dark theme — variable overrides only; <html data-theme="dark"> is set server-side ---------- */
html[data-theme="dark"] {
    --bn-navy: #14213d;
    --bn-text: #e2e8f0;
    --bn-text-2: #cbd5e1;
    --bn-muted: #94a3b8;
    --bn-muted-2: #94a3b8;
    --bn-blue: #7cb8eb;
    --bn-blue-dark: #a5cdf2;
    --bn-blue-soft: #1e3a5f;
    --bn-lime-hover: #e84a00;
    --bn-lime-pale: #3b2a22;
    --bn-lime-text: #94a3b8;
    --bn-red: #f87171;
    --bn-green: #4ade80;
    --bn-green-edge: #4ade80;
    --bn-row-selected: #3b2a22;
    --bn-card: #1e293b;
    --bn-border: #334155;
    --bn-border-strong: #475569;
    --bn-cancel: #334155;
    --bn-chip: #334155;
    --bn-ink: #e2e8f0;
    --bn-heading: #e2e8f0;
    --bn-muted-3: #94a3b8;
    --bn-surface: #0f172a;
    --bn-surface-2: #1e293b;
    --bn-surface-3: #273449;
    --bn-surface-4: #0f172a;
    --bn-table-head: #233146;
    --bn-border-soft: #2b3a52;
    --bn-border-off: #475569;
    --bn-card-hover: #273449;
    --bn-chip-hover: #475569;
    --bn-field-muted: #172033;
    --bn-grip: #64748b;
    --bn-toggle-track: #475569;
    --bn-toggle-knob: #e2e8f0;
    --bn-badge-dark-bg: #475569;
    --bn-badge-dark-text: #e2e8f0;
    --bn-blue-fill: #2563a6;
    --bn-blue-fill-hover: #194f87;
    --bn-red-pale: #3f1d1b;
    --bn-red-border: #7f2a24;
    --bn-code-bg: #0b1220;
    --bn-code-text: #d7dee8;
    --bn-ok-bg: #14532d;
    --bn-ok-text: #86efac;
    --bn-warn-bg: #45350e;
    --bn-warn-text: #fcd34d;
    --bn-err-bg: #3f1d1b;
    --bn-err-text: #fca5a5;
    --bn-shadow: rgba(0,0,0,0.6);
    --bn-shadow-soft: rgba(0,0,0,0.45);
    --bn-shadow-dot: rgba(0,0,0,0.5);
    --bn-scrim: rgba(2, 5, 10, 0.86);
    --bn-scrim-soft: rgba(2, 5, 10, 0.7);
    --bn-focus-ring: rgba(124, 184, 235, 0.35);
    --bn-select-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 5l4-4 4 4' fill='none' stroke='%23b3bcc9' stroke-width='1.5'/%3E%3C/svg%3E");
    --bn-badge-green: #4ade80;
    --bn-amber: #fcd34d;
    --bn-neutral: #334155;
    --bn-neutral-hover: #475569;
    --bn-selected: #3b2a22;
    --bn-disabled-bg: #334155;
    --bn-disabled-text: #94a3b8;
    --bn-focus: #7cb8eb;
    --bn-info-bg: #1e3a5f;
    --bn-info-text: #a5cdf2;
    color-scheme: dark;
}

html { font-size: 13px; }
/* The portal has no Bootstrap reboot: the hidden attribute must still win over display rules (dialogs). */
[hidden] { display: none !important; }
body.bn-body {
    margin: 0;
    font-family: var(--bn-font);
    font-size: 13px;
    color: var(--bn-text);
    background: var(--bn-surface);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--bn-blue); text-decoration: none; }
a:hover { color: var(--bn-blue-dark); text-decoration: underline; text-underline-offset: 3px; }
code { font-size: 12px; color: var(--bn-text-2); }

/* ---------- Top strip + section tabs ---------- */
.bn-topbar {
    height: 26px;
    background: var(--bn-header-bg);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 12px;
}
.bn-topbar-brand { display: flex; align-items: center; gap: 6px; color: #fff; font-weight: 600; white-space: nowrap; }
.bn-topbar-brand:hover { color: #fff; text-decoration: none; }
/* The brand mark (ADR-0035): a rounded square in the brand colour with the brand letter, CSS only. */
.bn-logo { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; background: var(--bn-brand); color: #fff; font-weight: 800; line-height: 1; border-radius: 25%; }
.bn-topbar-brand .bn-logo { width: 20px; height: 20px; font-size: 12px; }
.bn-topbar-crumb { color: var(--bn-header-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 auto; }
.bn-topbar-crumb span::before { content: '|'; margin: 0 8px; color: #7f91ab; }
.bn-topbar-nav { margin-left: auto; display: flex; gap: 18px; white-space: nowrap; flex: 0 0 auto; align-items: center; }
.bn-topbar-nav a, .bn-topbar-nav button { color: #fff; background: none; border: 0; padding: 0 6px; line-height: 20px; border-radius: 4px; font: inherit; cursor: pointer; transition: background-color var(--bn-motion); }
.bn-topbar-nav a:hover, .bn-topbar-nav button:hover { background: var(--bn-header-hover); color: #fff; text-decoration: none; }
.bn-topbar-nav .active { background: var(--bn-header-active); color: #fff; padding: 0 6px; line-height: 20px; border-radius: 4px; }
.bn-topbar-nav .disabled { color: #7f91ab; cursor: not-allowed; }

.bn-tabs {
    display: flex;
    align-items: stretch;
    height: 44px;
    border-bottom: 1px solid var(--bn-border);
    padding: 0 8px;
    background: var(--bn-surface-2);
}
.bn-tab {
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 14px;
    color: var(--bn-text);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.bn-tab:hover { color: var(--bn-blue); text-decoration: none; }
.bn-tab.active { color: var(--bn-ink); font-weight: 600; border-bottom-color: var(--bn-primary); }
.bn-tab.disabled { color: var(--bn-muted); cursor: not-allowed; }
.bn-tab.disabled small { font-size: 10px; margin-left: 4px; color: var(--bn-muted); }
.bn-tabs-right { margin-left: auto; display: flex; align-items: center; gap: 14px; padding-right: 8px; font-size: 12px; color: var(--bn-text-2); }
.bn-tabs-right .bn-user-chip { background: var(--bn-neutral); border-radius: 12px; padding: 2px 10px; color: var(--bn-text); }

.bn-content { padding: 12px 12px 60px; }
.bn-content.bn-content-flush { padding: 0; }

/* ---------- Buttons ---------- */
.bn-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 14px;
    border-radius: var(--bn-radius);
    border: 1px solid transparent;
    font: 600 13px var(--bn-font);
    color: var(--bn-ink);
    background: var(--bn-surface-2);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
    transition: background-color var(--bn-motion), color var(--bn-motion), border-color var(--bn-motion), transform var(--bn-motion);
}
.bn-btn:hover { text-decoration: none; }
/* Action hierarchy (ADR-0035): primary orange with dark ink (AA), secondary blue solid or outlined,
   neutral grey for cancel/back/utility, red for destructive actions only. Class names are the inherited ones. */
.bn-btn-lime { background: var(--bn-primary); color: var(--bn-primary-ink); }
.bn-btn-lime:hover { background: var(--bn-primary-hover); color: var(--bn-primary-ink); }
.bn-btn-lime:active { background: var(--bn-primary-hover); transform: translateY(1px); }
.bn-btn-blue { background: var(--bn-secondary); color: #fff; }
.bn-btn-blue:hover { background: var(--bn-secondary-hover); color: #fff; }
.bn-btn-pale, .bn-btn-outline-blue { background: transparent; border-color: var(--bn-secondary); color: var(--bn-secondary); }
.bn-btn-pale:hover, .bn-btn-outline-blue:hover { background: var(--bn-blue-soft); border-color: var(--bn-secondary-hover); color: var(--bn-secondary-hover); text-decoration: none; }
.bn-btn-outline { background: var(--bn-surface-2); border-color: var(--bn-border-strong); color: var(--bn-text-2); }
.bn-btn-outline:hover { background: var(--bn-neutral); color: var(--bn-ink); }
.bn-btn-gray { background: var(--bn-neutral); color: var(--bn-ink); }
.bn-btn-gray:hover { background: var(--bn-neutral-hover); color: var(--bn-ink); }
.bn-btn-red { background: var(--bn-danger); color: #fff; }
.bn-btn-red:hover { background: var(--bn-danger-hover); color: #fff; }
.bn-btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.bn-btn-xs { height: 22px; padding: 0 8px; font-size: 11px; }
.bn-btn:disabled, .bn-btn.disabled { cursor: not-allowed; background: var(--bn-disabled-bg); color: var(--bn-disabled-text); border-color: transparent; opacity: 1; transform: none; }
.bn-btn .bn-i { font-size: 13px; opacity: 0.85; }
.bn-link-btn { background: none; border: 0; padding: 0; color: var(--bn-blue); font: inherit; cursor: pointer; }
.bn-link-btn:hover { color: var(--bn-blue-dark); text-decoration: underline; text-underline-offset: 3px; }
.bn-icon-btn { background: none; border: 0; padding: 2px 4px; color: var(--bn-muted-2); cursor: pointer; font-size: 14px; line-height: 1; }
.bn-icon-btn:hover { color: var(--bn-text); }
.bn-icon-btn.danger:hover { color: var(--bn-red); }

/* ---------- Inputs ---------- */
.bn-input, .bn-select, .bn-textarea {
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--bn-border-strong);
    border-radius: var(--bn-radius);
    font: 500 13px var(--bn-font);
    color: var(--bn-text);
    background: var(--bn-surface-2);
    outline: none;
    min-width: 0;
}
.bn-input::placeholder, .bn-textarea::placeholder { color: var(--bn-muted); }
.bn-textarea { height: auto; padding: 6px 10px; line-height: 1.45; width: 100%; resize: vertical; }
.bn-input:focus, .bn-select:focus, .bn-textarea:focus { border-color: var(--bn-focus); box-shadow: 0 0 0 2px var(--bn-focus-ring); }
.bn-input.is-invalid, .bn-select.is-invalid, .bn-textarea.is-invalid { border-color: var(--bn-red); }
.bn-select { appearance: none; padding-right: 26px; background-image: var(--bn-select-caret); background-repeat: no-repeat; background-position: right 10px center; }
.bn-search { position: relative; }
.bn-search .bn-input { padding-right: 28px; }
.bn-search::after { content: ''; position: absolute; right: 9px; top: 8px; width: 11px; height: 11px; border: 1.5px solid var(--bn-muted); border-radius: 50%; box-shadow: 3px 3px 0 -1.5px var(--bn-muted); }
.bn-input-sm, .bn-select-sm { height: 26px; font-size: 12px; }
.bn-input-num { width: 80px; text-align: right; }
.bn-invalid { color: var(--bn-red); font-size: 12px; margin-top: 3px; }
.bn-plain-list { margin: 0 0 6px; padding-left: 16px; }
.bn-hint { color: var(--bn-muted); font-size: 12px; margin-top: 3px; }

/* ---------- Toolbar + filters ---------- */
.bn-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.bn-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bn-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; align-items: center; }
.bn-filters .bn-select, .bn-filters .bn-input { min-width: 130px; }

/* ---------- Tables ---------- */
.bn-table-wrap { border: 1px solid var(--bn-border); border-radius: 4px; overflow: auto; background: var(--bn-surface-2); }
/* List tables (selectable rows) become a bounded scroll region so the horizontal scrollbar stays on
   screen instead of sitting at the bottom of a very tall table; the sticky header keeps columns labelled. */
.bn-table-wrap:has(table[data-selectable]) { max-height: calc(100vh - 210px); }
.bn-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bn-table th {
    text-align: left;
    font-weight: 600;
    color: var(--bn-ink);
    padding: 8px 8px;
    border-bottom: 1px solid var(--bn-border);
    white-space: nowrap;
    background: var(--bn-table-head);
    position: sticky;
    top: 0;
    z-index: 2;
}
.bn-table th.num, .bn-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.bn-table td { padding: 0 8px; height: 31px; border-bottom: 1px solid var(--bn-border-soft); color: var(--bn-text); white-space: nowrap; vertical-align: middle; }
.bn-table td.wrap { white-space: normal; }
.bn-table tbody tr { border-left: 3px solid transparent; }
.bn-table tbody tr:hover { background: var(--bn-surface-3); }
.bn-table tbody tr.selected { background: var(--bn-row-selected); border-left-color: var(--bn-primary); }
.bn-table tbody tr.row-good { border-left-color: var(--bn-green-edge); }
.bn-table tbody tr.row-off td { color: var(--bn-muted); }
.bn-table td.id, .bn-table th.id { width: 40px; color: var(--bn-text-2); }
.bn-table td.check, .bn-table th.check { width: 28px; padding-right: 0; }
.bn-table .bn-name { color: var(--bn-text); font-weight: 500; }
.bn-table .bn-name:hover { color: var(--bn-blue); }
.bn-table td .muted { color: var(--bn-muted); }
.bn-table td.actions { text-align: right; }
.bn-table .empty { text-align: center; color: var(--bn-muted); padding: 28px 0; white-space: normal; }
.bn-profit { color: var(--bn-green); }

.bn-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-top: 1px solid var(--bn-border);
    margin-top: 10px;
    color: var(--bn-text-2);
    font-size: 12px;
    position: sticky;
    bottom: 0;
    background: var(--bn-surface);
}
.bn-pager { display: inline-flex; align-items: center; gap: 6px; }
.bn-pager a, .bn-pager span.pg { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; border: 1px solid var(--bn-border-strong); border-radius: 4px; color: var(--bn-text-2); padding: 0 8px; }
.bn-pager a:hover { text-decoration: none; border-color: var(--bn-blue); color: var(--bn-blue); }
.bn-pager .disabled { opacity: 0.4; pointer-events: none; }
.bn-footer .bn-totals { margin-left: auto; color: var(--bn-muted); }

/* ---------- Badges, chips, toggles ---------- */
.bn-badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; line-height: 1.3; background: var(--bn-chip); color: var(--bn-text-2); vertical-align: middle; }
/* Status badges carry meaning with their label; colours are semantic (ADR-0035 §8), never the brand. */
.bn-badge-green { background: var(--bn-ok-bg); color: var(--bn-ok-text); }
.bn-badge-lime { background: var(--bn-info-bg); color: var(--bn-info-text); }
.bn-badge-red { background: var(--bn-err-bg); color: var(--bn-err-text); }
.bn-badge-blue { background: var(--bn-info-bg); color: var(--bn-info-text); }
.bn-badge-amber { background: var(--bn-warn-bg); color: var(--bn-warn-text); }
.bn-badge-dark { background: var(--bn-badge-dark-bg); color: var(--bn-badge-dark-text); }
.bn-badge-outline { background: var(--bn-surface-2); border: 1px solid var(--bn-border-strong); }
.bn-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 4px; background: var(--bn-chip); color: var(--bn-text); font-size: 12px; border: 0; cursor: pointer; font-family: var(--bn-font); }
.bn-chip:hover { background: var(--bn-chip-hover); }
.bn-chip.active { background: var(--bn-blue-fill); color: #fff; }
.bn-chip-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

.bn-toggle { position: relative; display: inline-block; width: 36px; height: 20px; vertical-align: middle; flex: 0 0 auto; }
.bn-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.bn-toggle .bn-toggle-track { position: absolute; inset: 0; background: var(--bn-toggle-track); border-radius: 20px; transition: background 0.15s; }
.bn-toggle .bn-toggle-track::after { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: var(--bn-toggle-knob); border-radius: 50%; box-shadow: 0 1px 2px var(--bn-shadow-dot); transition: transform 0.15s; }
.bn-toggle input:checked + .bn-toggle-track { background: var(--bn-secondary); }
.bn-toggle input:checked + .bn-toggle-track::after { transform: translateX(16px); }
.bn-toggle input:disabled + .bn-toggle-track { opacity: 0.5; }
.bn-check { width: 15px; height: 15px; accent-color: var(--bn-secondary); cursor: pointer; }

/* ---------- Modal-style pages (create / edit) ---------- */
.bn-backdrop { position: fixed; inset: 70px 0 0 0; background: var(--bn-scrim); overflow: auto; z-index: 20; padding: 30px 16px; }
.bn-modal { background: var(--bn-surface-2); border: 1px solid var(--bn-border); border-radius: 14px; box-shadow: 0 20px 60px var(--bn-shadow); width: 100%; max-width: 640px; margin: 0 auto; padding: 22px 28px 20px; }
.bn-modal-lg { max-width: 960px; }
.bn-modal-xl { max-width: 1240px; }
.bn-modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.bn-modal-title { font-size: 20px; font-weight: 700; color: var(--bn-heading); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn-modal-head .bn-btn { margin-left: auto; }
.bn-modal-footer { display: flex; justify-content: center; gap: 14px; margin-top: 22px; }

/* ---------- Form rows (label left, field right) ---------- */
.bn-form-row { display: grid; grid-template-columns: 150px 1fr; align-items: start; gap: 10px 14px; margin-bottom: 12px; }
.bn-form-row > label, .bn-form-row > .bn-label { padding-top: 7px; text-align: right; color: var(--bn-ink); font-weight: 500; }
.bn-form-row .bn-field { min-width: 0; }
.bn-form-row .bn-field .bn-input, .bn-form-row .bn-field .bn-select { width: 100%; }
.bn-form-row .bn-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bn-form-row .bn-inline .bn-input, .bn-form-row .bn-inline .bn-select { width: auto; }
.bn-form-narrow .bn-form-row { grid-template-columns: 130px 1fr; }
.bn-form-section { margin: 18px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--bn-muted); }
.bn-help { display: inline-block; width: 13px; height: 13px; border: 1px solid var(--bn-muted); border-radius: 50%; color: var(--bn-muted); font-size: 9px; text-align: center; line-height: 11px; margin-left: 4px; cursor: help; }
.bn-links { display: flex; gap: 12px; margin-top: 6px; font-size: 12px; }
.bn-links .sep { color: var(--bn-border-strong); }
.bn-segment { display: inline-flex; gap: 4px; }
.bn-segment label { border: 1px solid var(--bn-border-strong); border-radius: var(--bn-radius); padding: 0 10px; height: 30px; display: inline-flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--bn-text-2); }
.bn-segment input { display: none; }
.bn-segment label:has(input:checked) { background: var(--bn-blue-fill); border-color: var(--bn-blue-fill); color: #fff; }
.bn-collapsible summary { cursor: pointer; font-weight: 600; color: var(--bn-ink); list-style: none; padding: 6px 0; display: flex; align-items: center; gap: 6px; }
.bn-collapsible summary::-webkit-details-marker { display: none; }
.bn-collapsible summary::after { content: '⌄'; color: var(--bn-text-2); font-size: 14px; }
.bn-collapsible[open] summary::after { content: '⌃'; }
.bn-token-panel { background: var(--bn-card); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.bn-token-panel .bn-chip { margin: 0 4px 4px 0; background: var(--bn-surface-2); border: 1px solid var(--bn-border-strong); }
.bn-token-panel .bn-chip:hover { border-color: var(--bn-blue); color: var(--bn-blue); }

/* ---------- Full-page editor (campaign) ---------- */
.bn-editor-head { display: flex; align-items: center; gap: 12px; padding: 10px 0 14px; border-bottom: 1px solid var(--bn-border); margin-bottom: 18px; }
.bn-editor-title { font-size: 20px; font-weight: 700; color: var(--bn-heading); margin: 0; }
.bn-editor-title small { font-size: 14px; color: var(--bn-muted-3); font-weight: 500; margin-left: 10px; }
.bn-editor-actions { margin-left: auto; display: flex; gap: 8px; }
.bn-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; }
@media (max-width: 1100px) { .bn-editor-grid { grid-template-columns: 1fr; } }
.bn-card { background: var(--bn-card); border: 1px solid var(--bn-border); border-radius: var(--bn-radius-card); padding: 12px 14px; margin-bottom: 12px; }
.bn-card-head { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; color: var(--bn-blue); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.bn-card-head.red { color: var(--bn-red); }
.bn-card-head .cols { margin-left: auto; display: flex; gap: 22px; color: var(--bn-text); text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; }
.bn-list-row { display: flex; align-items: center; gap: 8px; background: var(--bn-surface-2); border-radius: 6px; padding: 5px 8px 5px 0; margin-bottom: 4px; border-left: 3px solid var(--bn-green-edge); }
.bn-list-row.off { border-left-color: var(--bn-border-off); }
.bn-list-row .num { width: 22px; text-align: center; color: var(--bn-muted); font-size: 12px; }
.bn-list-row .grow { flex: 1; min-width: 0; }
.bn-list-row .bn-select, .bn-list-row .bn-input { height: 26px; font-size: 12px; }
.bn-list-row .w { width: 70px; text-align: right; }
.bn-list-row .payout { width: 82px; }
.bn-list-row .name { font-weight: 600; }
.bn-list-row .meta { color: var(--bn-muted); font-size: 12px; }
.bn-subhead { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--bn-text); margin: 10px 0 6px; }
.bn-path { background: var(--bn-surface-2); border-radius: 8px; padding: 6px 8px 10px; margin-bottom: 10px; border: 1px solid var(--bn-border); }
.bn-path-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 6px; border-left: 3px solid var(--bn-green-edge); }
.bn-path-head .bn-input { height: 28px; font-weight: 600; }
.bn-path-body { padding: 4px 4px 0 10px; }
.bn-path-body .bn-list-row { background: var(--bn-card); }
.bn-adders { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.bn-rule { background: var(--bn-card); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.bn-rule-head { display: flex; align-items: center; gap: 8px; background: var(--bn-surface-2); border-radius: 6px; padding: 6px 8px; border-left: 3px solid var(--bn-green-edge); margin-bottom: 8px; }
.bn-rule-head .bn-input { height: 28px; font-weight: 600; }
.bn-cond-row { display: grid; grid-template-columns: 170px 130px 1fr auto; gap: 6px; align-items: start; background: var(--bn-surface-2); border-radius: 6px; padding: 5px 8px 5px 0; margin-bottom: 4px; border-left: 3px solid var(--bn-green-edge); }
.bn-cond-row .bn-select, .bn-cond-row .bn-input, .bn-cond-row .bn-textarea { height: 26px; font-size: 12px; }
.bn-cond-row .bn-textarea { height: auto; min-height: 26px; padding: 3px 8px; }
.bn-cond-row .hint { grid-column: 1 / -1; font-size: 11px; color: var(--bn-muted); padding-left: 10px; }
.bn-mini-icons { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.bn-status-strip { border-radius: 8px; padding: 8px 12px; font-size: 12px; margin-bottom: 12px; }
.bn-status-strip.ok { background: var(--bn-ok-bg); color: var(--bn-ok-text); }
.bn-status-strip.err { background: var(--bn-err-bg); color: var(--bn-err-text); }
.bn-status-strip.warn { background: var(--bn-warn-bg); color: var(--bn-warn-text); }
.bn-status-strip ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Settings ---------- */
.bn-settings { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 70px); }
.bn-settings-nav { border-right: 1px solid var(--bn-border); padding: 18px 0; }
.bn-settings-nav a, .bn-settings-nav span { display: block; padding: 8px 26px; color: var(--bn-text); font-weight: 500; }
.bn-settings-nav a:hover { color: var(--bn-blue); text-decoration: none; }
.bn-settings-nav a.active { color: var(--bn-ink); background: var(--bn-selected); box-shadow: inset 4px 0 0 var(--bn-primary); }
.bn-settings-nav span { color: var(--bn-muted); }
.bn-settings-nav span small { font-size: 10px; }
.bn-settings-content { padding: 18px 40px; max-width: 980px; }
.bn-settings-title { font-size: 20px; font-weight: 700; color: var(--bn-ink); margin: 0 0 18px; }
.bn-bordered-table { border: 1px solid var(--bn-border); border-radius: 4px; }
.bn-bordered-table .bn-table th { font-weight: 600; color: var(--bn-text); }

/* ---------- Misc ---------- */
.bn-flash { border-radius: 6px; padding: 8px 12px; font-size: 13px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.bn-flash.success { background: var(--bn-ok-bg); color: var(--bn-ok-text); }
.bn-flash.error { background: var(--bn-err-bg); color: var(--bn-err-text); }
.bn-flash.warning { background: var(--bn-warn-bg); color: var(--bn-warn-text); }
.bn-flash.info { background: var(--bn-info-bg); color: var(--bn-info-text); }
.bn-flash .close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; }
.bn-empty { color: var(--bn-muted); padding: 24px; text-align: center; }
.bn-kv { font-size: 13px; }
.bn-kv th { font-weight: 500; color: var(--bn-muted); padding: 4px 12px 4px 0; text-align: left; }
.bn-kv td { padding: 4px 0; }
.mt-code { background: var(--bn-code-bg); color: var(--bn-code-text); font-size: 12px; padding: 10px 12px; border-radius: 6px; white-space: pre-wrap; word-break: break-all; margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.mt-copied { color: var(--bn-green) !important; }
.bn-tags .bn-badge { margin-right: 3px; }
.mt-tag-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.mt-tag-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--bn-chip); border-radius: 12px; padding: 1px 8px; font-size: 12px; }
.mt-tag-chip button { border: 0; background: transparent; padding: 0; line-height: 1; color: var(--bn-muted-2); cursor: pointer; }
.mt-token-table.mt-hide-empty .mt-token-empty { display: none; }
.mt-token-empty input { background: var(--bn-field-muted); }
.bn-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) { .bn-two-col { grid-template-columns: 1fr; } }

/* ---------- Auth ---------- */
body.bn-auth { background: var(--bn-header-bg); display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; font-family: var(--bn-font); }
.bn-auth-box { width: 100%; max-width: 380px; background: var(--bn-surface-2); border: 1px solid var(--bn-border); border-radius: 14px; padding: 28px 30px 20px; box-shadow: 0 20px 60px var(--bn-shadow); }
.bn-auth-brand { font-size: 22px; font-weight: 700; color: var(--bn-ink); text-align: center; margin-bottom: 4px; }
.bn-auth-brand span { color: var(--bn-brand); }
.bn-auth-title { text-align: center; color: var(--bn-muted); font-size: 13px; margin-bottom: 18px; }
.bn-auth-box label { display: block; font-weight: 600; color: var(--bn-ink); margin: 10px 0 4px; }
.bn-auth-box .bn-input { width: 100%; height: 34px; }
.bn-auth-box .bn-btn { width: 100%; height: 34px; justify-content: center; margin-top: 16px; }
.bn-auth-links { text-align: center; font-size: 12px; margin: 12px 0 0; }
.bn-auth-links a { color: var(--bn-blue); }
.bn-auth-footer { text-align: center; color: var(--bn-muted); font-size: 11px; margin: 14px 0 0; }

/* ---------- additions: groups grid, inline forms, flashes as toasts, settings width ---------- */
.bn-groups-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .bn-groups-grid { grid-template-columns: 1fr; } }
.bn-inline-form { display: flex; gap: 6px; align-items: center; }
.bn-inline-form .bn-input { flex: 1; min-width: 0; }
.bn-flashes { position: fixed; top: 80px; right: 16px; z-index: 60; width: 380px; max-width: calc(100% - 32px); }
.bn-flashes .bn-flash { box-shadow: 0 6px 24px var(--bn-shadow-soft); }
.bn-content > .bn-settings { margin: -12px -12px 0; }
.bn-settings-content.bn-settings-wide { max-width: none; }
.bn-table-audit td { white-space: normal; height: auto; padding: 5px 8px; font-size: 12px; }
.bn-table-audit td.wrap { max-width: 260px; word-break: break-word; }
.bn-table tbody tr.row-off td .bn-name { color: var(--bn-muted); }

/* ---------- additions: modal form details ---------- */
.bn-checkline { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-weight: 500; color: var(--bn-text); }
.bn-token-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--bn-text-2); font-size: 12px; }
.bn-token-head .bn-search { margin-left: auto; }
.bn-token-head .bn-input { width: 150px; }
.bn-token-list { display: flex; flex-wrap: wrap; gap: 6px; }
.bn-token-list:not(.expanded) .bn-chip:nth-child(n+10) { display: none; }
.bn-token-panel .bn-link-btn { margin-top: 6px; font-size: 12px; }
.bn-token-panel .bn-hint { margin-top: 6px; }
.bn-copy-row { display: flex; gap: 6px; margin-bottom: 6px; }
.bn-copy-row .bn-input { flex: 1; font-size: 12px; color: var(--bn-text-2); }
.bn-param-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.bn-param span { display: block; font-size: 11px; color: var(--bn-muted); margin-bottom: 2px; }
.bn-param .bn-input { width: 100%; }
.bn-table-compact td { height: 28px; padding: 2px 6px; }
.bn-table-compact .bn-input, .bn-table-compact .bn-select { width: 100%; height: 26px; }
.bn-row-label { color: var(--bn-ink); font-weight: 500; white-space: nowrap; }
.bn-form-wide .bn-form-row { grid-template-columns: 220px minmax(0, 420px); }
.bn-modal .bn-collapsible { margin: 6px 0 4px; }
.bn-modal .bn-collapsible > summary { margin-left: 164px; }
.bn-modal .bn-collapsible[open] > summary { margin-bottom: 10px; }
.bn-modal-lg .bn-collapsible > summary { margin-left: 164px; }
.bn-modal .dropdown-menu { font-size: 13px; }
.bn-modal .font-monospace { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ---------- additions: campaign editor ---------- */
.bn-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.bn-editor-head .bn-version { display: inline-flex; gap: 6px; }
.bn-subtabs { display: flex; gap: 14px; margin-left: 24px; }
.bn-subtabs a { color: var(--bn-text-2); font-weight: 600; padding: 4px 0; border-bottom: 2px solid transparent; }
.bn-subtabs a.active { color: var(--bn-blue); border-bottom-color: var(--bn-blue); }
.bn-subtabs a:hover { text-decoration: none; color: var(--bn-blue); }
.bn-editor-main .bn-form-row { grid-template-columns: 150px minmax(0, 460px); }
.bn-editor-main .bn-form-section:first-child { margin-top: 0; }
.bn-editor-main .bn-textarea { max-width: 624px; }
.bn-collapsible-plain summary { font-size: 15px; margin: 14px 0 6px; }
.bn-side-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.bn-side-head .bn-card-head { margin: 0; }
.bn-rotation { margin-left: auto; color: var(--bn-text-2); font-size: 12px; }
.bn-card-caret { color: var(--bn-blue); font-size: 14px; line-height: 1; }
.bn-card-head.red .bn-card-caret { color: var(--bn-red); }
.bn-grip { color: var(--bn-grip); font-size: 11px; letter-spacing: -2px; padding: 0 2px 0 6px; cursor: grab; user-select: none; }
.bn-path-head.off, .bn-rule-head.off { border-left-color: var(--bn-border-off); }
.bn-path.collapsed .bn-path-body, .bn-rule.collapsed .bn-rule-body { display: none; }
.bn-path.collapsed [data-collapse], .bn-rule.collapsed [data-collapse] { transform: rotate(-90deg); }
.bn-list-row .num { flex: 0 0 22px; }
.bn-list-row .dest-type { width: 110px; flex: 0 0 auto; }
.bn-list-row .bn-toggle, .bn-path-head .bn-toggle, .bn-rule-head .bn-toggle { margin-left: 4px; }
.bn-path-head .grow { min-width: 0; }
.bn-subhead-note { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--bn-muted); margin-left: 6px; }
.bn-rule-body > [data-editor="paths"] { margin-top: 8px; }
.bn-rule-body > [data-editor="paths"] > .bn-card { background: var(--bn-surface-2); border: 1px solid var(--bn-border); padding: 8px 10px; }
.bn-rule-body > [data-editor="paths"] > .bn-btn { margin-bottom: 8px; }
.bn-rule-notes { margin-top: 8px; width: 100%; height: 26px; font-size: 12px; }
.bn-cond-row > div { display: flex; flex-direction: column; gap: 4px; }
.bn-cond-row .bn-select, .bn-cond-row .bn-input { width: 100%; }
.bn-editor-single { max-width: 1100px; }
.bn-status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.bn-status-action { margin-left: auto; }
.bn-status-strip ul.warn { color: var(--bn-warn-text); }
.bn-status-strip.ok ul { margin-top: 4px; }
.bn-url { font-size: 12px; color: var(--bn-blue); }

/* ---------- additions: clicklog ---------- */
.bn-kv th { white-space: nowrap; vertical-align: top; }
.bn-kv td { word-break: break-word; }
.bn-hops { padding-left: 18px; font-size: 12px; color: var(--bn-text-2); }
.bn-hops li { margin-bottom: 2px; }

/* ---------- additions: reports ---------- */
.bn-chips { gap: 6px; margin-bottom: 6px; }
.bn-chip-btn { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 6px; background: var(--bn-card); color: var(--bn-text); font-weight: 600; font-size: 12px; border: 0; cursor: pointer; font-family: var(--bn-font); }
.bn-chip-btn:hover { background: var(--bn-card-hover); text-decoration: none; color: var(--bn-blue); }
.bn-chip-btn.active { background: var(--bn-blue-fill); color: #fff; }
.bn-report .bn-table th.sorted a { color: var(--bn-blue); }
.bn-report .bn-table th a { color: var(--bn-muted); }
.bn-report .bn-table th a:hover { color: var(--bn-blue); text-decoration: none; }
.bn-report-label { white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.bn-drill { border: 0; background: none; color: var(--bn-blue); cursor: pointer; font-size: 12px; width: 18px; padding: 0; margin-right: 2px; transition: transform 0.15s; }
.bn-drill.open { transform: rotate(90deg); }
.bn-report-row.depth-1 td { background: var(--bn-surface-3); }
.bn-report-row.depth-2 td { background: var(--bn-surface-4); }
.bn-report-row td.pos { color: var(--bn-green); }
.bn-report-row td.neg, .bn-totals-row td.neg { color: var(--bn-red); }
.bn-totals-row td { font-weight: 600; background: var(--bn-surface-2); border-top: 2px solid var(--bn-border); position: sticky; bottom: 0; }
.bn-totals-row td.pos { color: var(--bn-green); }
.bn-table td.num.pos { color: var(--bn-green); }
.bn-table td.num.neg { color: var(--bn-red); }
.bn-dialog { position: fixed; inset: 0; background: var(--bn-scrim-soft); z-index: 70; display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; overflow: auto; }
.bn-dialog-box { background: var(--bn-surface-2); border: 1px solid var(--bn-border); border-radius: 14px; padding: 20px 24px; width: 100%; max-width: 720px; box-shadow: 0 20px 60px var(--bn-shadow); }
.bn-column-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 20px; }
.bn-column-group .bn-checkline { display: flex; margin-bottom: 4px; }
.bn-column-group .bn-form-section { margin-top: 6px; }
/* Column picker: one ordered list, because the row order is the column order. */
.bn-dialog-columns { max-width: 560px; }
.bn-column-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bn-column-toolbar .bn-search { flex: 1; }
.bn-column-toolbar .bn-search .bn-input { width: 100%; }
.bn-column-toolbar [data-column-count] { white-space: nowrap; }
.bn-column-help { margin-bottom: 8px; }
.bn-column-list { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow-y: auto; border: 1px solid var(--bn-border); border-radius: var(--bn-radius); }
.bn-column-row { display: flex; align-items: center; gap: 8px; padding: 3px 8px; border-bottom: 1px solid var(--bn-border); }
.bn-column-row:last-child { border-bottom: 0; }
.bn-column-row:hover { background: var(--bn-surface-3); }
.bn-column-row.just-moved { background: var(--bn-blue-soft); }
.bn-column-move { display: flex; gap: 2px; }
.bn-column-move .bn-icon-btn { width: 20px; height: 20px; line-height: 1; }
.bn-column-label { display: flex; align-items: center; gap: 8px; flex: 1; cursor: pointer; min-width: 0; }
.bn-column-caption { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn-column-group-tag { font-size: 11px; color: var(--bn-muted); white-space: nowrap; }
.bn-column-row.is-pinned .bn-column-label { cursor: default; }
.bn-column-row.is-pinned .bn-check { opacity: 0.55; }
.bn-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
@media (max-width: 1000px) { .bn-cards { grid-template-columns: 1fr; } .bn-column-groups { grid-template-columns: 1fr 1fr; } }
.bn-card-stat { background: var(--bn-card); border: 1px solid var(--bn-border); border-radius: var(--bn-radius-card); padding: 12px 14px; }
.bn-card-stat h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--bn-muted); margin: 0 0 8px; }
.bn-card-stat table { width: 100%; font-size: 13px; }
.bn-card-stat th { text-align: left; font-weight: 500; color: var(--bn-text-2); padding: 2px 0; }
.bn-card-stat td { text-align: right; font-variant-numeric: tabular-nums; padding: 2px 0; }
.bn-clicklog .bn-table td { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn-clicklog .bn-table td.ua { max-width: 200px; }

/* Wide list tables keep their natural width so .bn-table-wrap shows a horizontal scrollbar. */
.bn-table[data-selectable] td { white-space: nowrap; }
/* Click-to-sort column headers (app.js) */
.bn-table th.sortable { cursor: pointer; user-select: none; }
.bn-table th.sortable:hover { color: var(--bn-text); }
.bn-table th.sorted { color: var(--bn-text); }
.bn-table th .sort-arrow { font-size: 10px; color: var(--bn-primary); }
/* Day-over-day comparison (ADR-0020) */
.bn-change { font-size: 11px; font-weight: 500; margin-left: 5px; white-space: nowrap; }
.bn-change.chg-up { color: var(--bn-green); }
.bn-change.chg-down { color: var(--bn-red); }
.bn-compare { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; }
.bn-compare-label { color: var(--bn-muted); font-size: 12px; margin-right: 2px; }

/* Settings → Columns (Phase 6) */
.bn-table-columns td.actions { white-space: nowrap; text-align: right; }
.bn-table-columns tr.bn-row-disabled td { color: var(--bn-muted); }
.bn-table-columns td.wrap { max-width: 280px; white-space: normal; word-break: break-word; }
.bn-formula-status { font-size: 12px; margin-top: 4px; color: var(--bn-muted); min-height: 16px; }
.bn-formula-status.ok { color: var(--bn-ok-text); }
.bn-formula-status.err { color: var(--bn-red); }
.bn-formula-tools { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-top: 8px; }
.bn-formula-tools .bn-select { width: auto; max-width: 260px; }
.bn-formula-tools .bn-chip { font-family: var(--bn-mono, Menlo, Consolas, monospace); }

/* Monitor (Phase 7) */
.bn-meter { display: inline-block; width: 120px; height: 8px; border-radius: 4px; background: var(--bn-chip); vertical-align: middle; overflow: hidden; margin-right: 4px; }
.bn-meter > span { display: block; height: 100%; background: var(--bn-badge-green); }
.bn-meter.warn > span { background: var(--bn-amber); }
.bn-meter.high > span, .bn-meter.critical > span { background: var(--bn-red); }
.bn-kv td.pos { color: var(--bn-ok-text); }
.bn-kv td.neg, .bn-kv span.neg { color: var(--bn-red); }

/* Lander mass edit: the selected landers, each URL previewed on the domain being typed */
.bn-mass-list { max-height: 50vh; }
.bn-table td.bn-url { white-space: normal; overflow-wrap: anywhere; padding-top: 6px; padding-bottom: 6px; }
.bn-origin-old { text-decoration: line-through; color: var(--bn-muted); }
.bn-origin-new { color: var(--bn-green); font-weight: 600; margin-left: 6px; }


/* Partner portal (ADR-0025): a light single-column layout on the same tokens, usable on a phone */
body.bn-portal { background: var(--bn-surface-4); min-height: 100vh; display: flex; flex-direction: column; }
.bn-portal-bar { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 4px 16px; background: var(--bn-header-bg); color: #fff; }
.bn-portal-brand .bn-logo { width: 26px; height: 26px; font-size: 15px; }
.bn-portal-bar [data-theme-toggle] { background: none; border: 0; color: #fff; font: inherit; font-size: 15px; line-height: 1; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.bn-portal-bar [data-theme-toggle]:hover { background: var(--bn-header-hover); }
.bn-portal-brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; text-decoration: none; margin-right: auto; }
.bn-portal-user { font-size: 13px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.bn-portal-bar form { margin: 0; }
.bn-portal-bar .bn-btn-outline { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); }
.bn-portal-main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 20px 16px; box-sizing: border-box; }
.bn-portal-card { background: var(--bn-surface-2); border: 1px solid var(--bn-border); border-radius: var(--bn-radius-card); padding: 20px; box-shadow: 0 1px 3px var(--bn-shadow-soft); }
.bn-portal-card h1 { font-size: 20px; margin: 0 0 10px; color: var(--bn-ink); }
.bn-portal-footer { text-align: center; color: var(--bn-muted); font-size: 11px; padding: 12px; }

/* Portal forms: registration, terms (ADR-0028) */
.bn-portal-narrow { max-width: 640px; margin: 0 auto; }
.bn-portal-link { color: #fff; text-decoration: none; font-size: 13px; }
.bn-portal-form label { display: block; font-weight: 600; color: var(--bn-ink); margin: 12px 0 4px; }
.bn-portal-form .bn-input, .bn-portal-form .bn-textarea { width: 100%; box-sizing: border-box; }
.bn-portal-form .bn-btn { margin-top: 16px; }
.bn-portal-form label.bn-check-row { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.bn-portal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .bn-portal-grid { grid-template-columns: 1fr; } }
.bn-portal-checks { border: 0; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; }
.bn-portal-checks legend { font-weight: 600; color: var(--bn-ink); margin-bottom: 6px; padding: 0; font-size: inherit; }
.bn-portal-checks.is-invalid legend { color: var(--bn-red); }
.bn-portal-form .bn-check-label, .bn-portal-checks .bn-check-label { display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; }
.bn-portal-form .bn-terms-check { margin-top: 16px; }
.bn-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.bn-legal h2 { font-size: 18px; margin: 18px 0 8px; } .bn-legal h3 { font-size: 15px; margin: 16px 0 6px; }
.bn-legal p, .bn-legal li { line-height: 1.55; }

/* Affiliates (docs/network/06 §6.1) */
.bn-tab-badge { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px; background: var(--bn-red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
.bn-count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--bn-navy); color: #fff; font-size: 11px; line-height: 18px; }
.bn-facts { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; margin: 0 0 12px; font-size: 13px; }
.bn-facts dt { color: var(--bn-text-2); font-weight: 600; }
.bn-facts dd { margin: 0; color: var(--bn-text); }
.bn-pre { white-space: pre-wrap; }
.bn-check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; }
.bn-check-grid.is-invalid .bn-checkline { color: var(--bn-red); }

/* Two-factor login (ADR-0028 §8) */
.bn-recovery-codes { display: grid; grid-template-columns: repeat(2, max-content); gap: 6px 24px; padding: 0; margin: 0 0 12px; list-style: none; }
.bn-recovery-codes code, .bn-secret { font-size: 15px; letter-spacing: 1px; }
.bn-steps { margin: 0 0 12px; padding-left: 20px; line-height: 1.6; }

/* Portal offers (docs/network/06 §6.5) */
.bn-portal-nav { display: flex; gap: 14px; margin-right: auto; margin-left: 18px; }
.bn-portal-nav a { color: #fff; text-decoration: none; font-size: 13px; padding: 5px 9px; border-radius: 6px; transition: background-color var(--bn-motion); }
.bn-portal-nav a:hover { background: var(--bn-header-hover); text-decoration: none; }
.bn-portal-nav a.active { background: var(--bn-header-active); font-weight: 600; }
.bn-offer-list { list-style: none; padding: 0; margin: 0; }
.bn-offer-list li { padding: 10px 0; border-bottom: 1px solid var(--bn-border); }
.bn-offer-list li:last-child { border-bottom: 0; }
.bn-offer-name { font-weight: 600; margin-right: 8px; }
.bn-portal-h2 { font-size: 16px; margin: 16px 0 8px; color: var(--bn-ink); }
.bn-portal-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.bn-portal-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 12px 0; }
.bn-portal-cards .bn-card-stat table { width: 100%; }
.bn-break { word-break: break-all; max-width: 380px; }
.bn-break code { white-space: normal; }
.bn-portal-details { margin: 14px 0; }
.bn-portal-details > summary { display: inline-block; list-style: none; cursor: pointer; }
.bn-portal-details > summary::-webkit-details-marker { display: none; }
.bn-portal-details[open] > summary { margin-bottom: 8px; }
.bn-portal-details .bn-portal-narrow { margin: 0; }
tr.is-editing td { background: var(--bn-surface-3); }
.bn-portal-main:has(.bn-portal-wide) { max-width: 1280px; }
.bn-catalogue { font-size: 12px; }
.bn-catalogue td { white-space: nowrap; vertical-align: middle; }
.bn-catalogue td.bn-cell-clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.bn-catalogue .bn-badge { font-size: 10px; margin-left: 4px; }
.bn-link-cell { white-space: nowrap; }
.bn-link-input { width: 160px; font-size: 11px; color: var(--bn-text-2); }
.bn-dash-hot { margin-bottom: 16px; }
.bn-dash-strip { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x mandatory; }
.bn-dash-tile { flex: 0 0 260px; scroll-snap-align: start; background: var(--bn-surface-2); border: 1px solid var(--bn-border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.bn-dash-tile-head { background: var(--bn-header-bg); color: #fff; border-radius: 6px; padding: 4px 8px; font-size: 12px; font-weight: 700; text-align: center; }
.bn-dash-tile h3 { font-size: 14px; margin: 0; min-height: 36px; }
.bn-dash-tile h3 a { color: var(--bn-ink); text-decoration: none; }
.bn-dash-tile-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; }
.bn-dash-tile-actions .bn-link-input { width: 100%; }
.bn-dash-cards { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.bn-dash-current { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.bn-dash-change { font-weight: 700; font-size: 12px; }
.bn-dash-change.up { color: var(--bn-ok-text); }
.bn-dash-change.down { color: var(--bn-err-text); }
.bn-dash-big { font-size: 26px; font-weight: 700; color: var(--bn-ink); margin: 2px 0 4px; font-variant-numeric: tabular-nums; }
.bn-sparkline { display: block; width: 100%; height: 44px; margin-bottom: 6px; }
.bn-sparkline-line { stroke: var(--bn-secondary); stroke-width: 1.5; }
.bn-sparkline-area { fill: var(--bn-blue-soft); opacity: .7; }
.bn-dash-earnings { margin: 4px 0 16px; }
.bn-dash-best { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .bn-dash-best { grid-template-columns: 1fr; } }
.bn-dash-best ol { margin: 0; padding-left: 22px; }
.bn-dash-best li { padding: 3px 0; }

/* ---------- Client identity (ADR-0035): focus, motion, header focus ---------- */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 3px solid var(--bn-focus); outline-offset: 2px; }
.bn-topbar :focus-visible, .bn-portal-bar :focus-visible { outline-color: #fff; }
.bn-input:focus-visible, .bn-select:focus-visible, .bn-textarea:focus-visible { outline-offset: 0; }
@media (prefers-reduced-motion: reduce) {
    .bn-btn, .bn-topbar-nav a, .bn-topbar-nav button, .bn-portal-nav a, .bn-drill, .bn-toggle .bn-toggle-track { transition: none; }
}

/* ---------- Staff dashboard (no side menu) and the denser admin type ---------- */
.bn-dash-page { padding: 6px 12px 40px; max-width: 1440px; }
.bn-dash-page .bn-dash-cards { margin-bottom: 18px; }
body.bn-body:not(.bn-portal) { font-size: 12px; }
body.bn-body:not(.bn-portal) .bn-table { font-size: 12px; }
body.bn-body:not(.bn-portal) .bn-table th { padding: 6px 6px; }
body.bn-body:not(.bn-portal) .bn-table td { padding: 0 6px; height: 28px; }
body.bn-body:not(.bn-portal) .bn-btn { font-size: 12px; height: 28px; padding: 0 12px; }
body.bn-body:not(.bn-portal) .bn-btn-sm { height: 24px; padding: 0 9px; font-size: 11px; }
body.bn-body:not(.bn-portal) .bn-input, body.bn-body:not(.bn-portal) .bn-select, body.bn-body:not(.bn-portal) .bn-textarea { font-size: 12px; height: 28px; }
body.bn-body:not(.bn-portal) .bn-textarea { height: auto; }
body.bn-body:not(.bn-portal) .bn-tab { font-size: 13px; }
body.bn-body:not(.bn-portal) .bn-card-stat table, body.bn-body:not(.bn-portal) .bn-kv { font-size: 12px; }
