/* MagnoTracker 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: #011e3b;
    --bn-text: #252d3e;
    --bn-text-2: #445062;
    --bn-muted: #949faf;
    --bn-muted-2: #7f8d9c;
    --bn-blue: #008fe1;
    --bn-blue-dark: #007ac2;
    --bn-blue-soft: #d7efff;
    --bn-lime: #c9f98e;
    --bn-lime-2: #cbfb8f;
    --bn-lime-hover: #bdf277;
    --bn-lime-pale: #e3fbc5;
    --bn-lime-text: #728c80;
    --bn-red: #fe4d4f;
    --bn-green: #0b9852;
    --bn-green-edge: #6fcf97;
    --bn-row-selected: #f4faf4;
    --bn-card: #f8f8f8;
    --bn-border: #e6e9ee;
    --bn-border-strong: #d0d5dd;
    --bn-cancel: #edf2f9;
    --bn-chip: #e3e4e6;
    --bn-badge-green: #16af88;
    --bn-amber: #dba575;
    --bn-ink: #011e3b;
    --bn-heading: #16343b;
    --bn-muted-3: #878787;
    --bn-surface: #fff;
    --bn-surface-2: #fff;
    --bn-surface-3: #fafbfc;
    --bn-surface-4: #f4f6f8;
    --bn-table-head: #fff;
    --bn-border-soft: #eef1f4;
    --bn-border-off: #cfd4dc;
    --bn-card-hover: #eef1f4;
    --bn-chip-hover: #d5d7db;
    --bn-field-muted: #fafafa;
    --bn-grip: #c5cbd3;
    --bn-toggle-track: #e4e7ec;
    --bn-toggle-knob: #fff;
    --bn-badge-dark-bg: var(--bn-text);
    --bn-badge-dark-text: #fff;
    --bn-blue-fill: var(--bn-blue);
    --bn-blue-fill-hover: var(--bn-blue-dark);
    --bn-red-pale: #ffe1e1;
    --bn-red-border: #ffd0d0;
    --bn-code-bg: #1f2430;
    --bn-code-text: #e5e7eb;
    --bn-ok-bg: #eefbe7;
    --bn-ok-text: #2b6b2f;
    --bn-warn-bg: #fff7e0;
    --bn-warn-text: #7a5a00;
    --bn-err-bg: #ffecec;
    --bn-err-text: #a33;
    --bn-info-bg: var(--bn-blue-soft);
    --bn-info-text: var(--bn-blue-dark);
    --bn-shadow: rgba(0,0,0,0.35);
    --bn-shadow-soft: rgba(0,0,0,0.18);
    --bn-shadow-dot: rgba(0,0,0,0.25);
    --bn-scrim: rgba(1, 30, 59, 0.82);
    --bn-scrim-soft: rgba(1, 30, 59, 0.6);
    --bn-focus-ring: rgba(0, 143, 225, 0.15);
    --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");
    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: #0a1017;
    --bn-text: #e4e8ee;
    --bn-text-2: #b3bcc9;
    --bn-muted: #8792a3;
    --bn-muted-2: #9aa5b4;
    --bn-blue: #3aa9ee;
    --bn-blue-dark: #63bdf2;
    --bn-blue-soft: #16304a;
    --bn-lime-hover: #d6fca7;
    --bn-lime-pale: #d7f3b6;
    --bn-lime-text: #5f7a63;
    --bn-red: #ff6b6d;
    --bn-green: #3fbf7f;
    --bn-green-edge: #5ec98c;
    --bn-row-selected: #16241c;
    --bn-card: #181f28;
    --bn-border: #2c3644;
    --bn-border-strong: #3a4656;
    --bn-cancel: #2b3542;
    --bn-chip: #2b3442;
    --bn-ink: #e8edf4;
    --bn-heading: #e4e8ee;
    --bn-muted-3: #8b93a0;
    --bn-surface: #12161d;
    --bn-surface-2: #1e2731;
    --bn-surface-3: #272f3c;
    --bn-surface-4: #303a49;
    --bn-table-head: #222b36;
    --bn-border-soft: #252e3a;
    --bn-border-off: #3a4656;
    --bn-card-hover: #232c38;
    --bn-chip-hover: #36414f;
    --bn-field-muted: #171d25;
    --bn-grip: #5a6675;
    --bn-toggle-track: #333d4b;
    --bn-toggle-knob: #dfe5ec;
    --bn-badge-dark-bg: #3a4656;
    --bn-badge-dark-text: #e4e8ee;
    --bn-blue-fill: #2b8fcc;
    --bn-blue-fill-hover: #1f7fb8;
    --bn-red-pale: #3a1f21;
    --bn-red-border: #5b2b2d;
    --bn-code-bg: #0d1117;
    --bn-code-text: #d7dee8;
    --bn-ok-bg: #16301f;
    --bn-ok-text: #7fd6a3;
    --bn-warn-bg: #3a3018;
    --bn-warn-text: #f0c979;
    --bn-err-bg: #3a1f21;
    --bn-err-text: #ff9b9d;
    --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(58, 169, 238, 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");
    color-scheme: dark;
}

html { font-size: 13px; }
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; }
code { font-size: 12px; color: var(--bn-text-2); }

/* ---------- Top strip + section tabs ---------- */
.bn-topbar {
    height: 26px;
    background: var(--bn-navy);
    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; }
.bn-topbar-brand .bn-logo { width: 12px; height: 12px; display: inline-block; background: linear-gradient(135deg, #ffd54f, #00b8d9 60%, #c9f98e); border-radius: 2px; }
.bn-topbar-crumb { color: #cfd8e3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bn-topbar-crumb span::before { content: '|'; margin: 0 8px; color: #6b7c92; }
.bn-topbar-nav { margin-left: auto; display: flex; gap: 18px; white-space: nowrap; }
.bn-topbar-nav a, .bn-topbar-nav button { color: #fff; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.bn-topbar-nav a:hover, .bn-topbar-nav button:hover { color: var(--bn-lime); text-decoration: none; }
.bn-topbar-nav .active { color: var(--bn-lime); }
.bn-topbar-nav .disabled { color: #6b7c92; 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);
}
.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-blue); border-bottom-color: var(--bn-blue); }
.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-card); 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;
}
.bn-btn:hover { text-decoration: none; filter: brightness(0.97); }
.bn-btn-lime { background: var(--bn-lime); color: var(--bn-navy); }
.bn-btn-lime:hover { background: var(--bn-lime-hover); }
.bn-btn-blue { background: var(--bn-blue-fill); color: #fff; }
.bn-btn-blue:hover { background: var(--bn-blue-fill-hover); color: #fff; }
.bn-btn-pale { background: var(--bn-lime-pale); color: var(--bn-navy); }
.bn-btn-outline { background: var(--bn-surface-2); border-color: var(--bn-border-strong); color: var(--bn-muted-2); }
.bn-btn-outline:hover { color: var(--bn-text); }
.bn-btn-gray { background: var(--bn-cancel); color: var(--bn-text); }
.bn-btn-red { background: var(--bn-surface-2); border-color: var(--bn-red-border); color: var(--bn-red); }
.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; opacity: 0.55; filter: none; }
.bn-btn-pale:disabled, .bn-btn-pale.disabled { opacity: 1; color: var(--bn-lime-text); }
.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 { text-decoration: underline; }
.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-2);
    background: var(--bn-surface-2);
    outline: none;
    min-width: 0;
}
.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-blue); 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-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); }
.bn-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bn-table th {
    text-align: left;
    font-weight: 500;
    color: var(--bn-muted);
    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-green-edge); }
.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; }
.bn-badge-green { background: var(--bn-badge-green); color: #fff; }
.bn-badge-lime { background: var(--bn-lime-pale); color: var(--bn-navy); }
.bn-badge-red { background: var(--bn-red-pale); color: var(--bn-red); }
.bn-badge-blue { background: var(--bn-blue-soft); color: var(--bn-blue-dark); }
.bn-badge-amber { background: var(--bn-amber); color: #fff; }
.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-lime-2); }
.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-blue); 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-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-radius: 10px; 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-blue); }
.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-navy); 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-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-blue); }
.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-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-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; }
.bn-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 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-radius: 10px; 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; }
.bn-clicklog .bn-table td.ua { max-width: 200px; }

/* 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); }
