.login-brand { text-align:center; margin-bottom:24px; }
.login-brand[hidden] { display:none; }
/* QUANTELM artwork is inline and host-selected by the server. No external fonts. */
.quantelm-wordmark { color:#dce4e8; }
.quantelm-wordmark > svg { display:block; width:100%; height:auto; overflow:visible; }
.login-logo.quantelm-wordmark { display:block; width:min(100%,320px); margin:0 auto; line-height:0; }
.masthead .xr-brand.quantelm-wordmark { display:flex; align-items:center; width:190px; min-height:44px; padding:0; line-height:0; color:var(--text,#dce4e8); }
.quantelm-wordmark:focus-visible { outline:2px solid #68c7bb; outline-offset:5px; }
html[data-theme="light"] .quantelm-wordmark .quantelm-accent { fill:#21796e; }
.auth-page:has(.login-brand .quantelm-wordmark) {
  --auth-bg:#101315; --auth-surface:#191e22; --auth-line:#414c54;
  --auth-text:#e4eaed; --auth-muted:#a8b3bb; --auth-accent:#d5dfe4;
  display:grid; align-content:center; padding:44px 20px; accent-color:#68c7bb;
}
.auth-page:has(.quantelm-wordmark) .login-panel {
  width:min(440px,100%); margin:0 auto; padding:34px;
  border-color:#364047; box-shadow:0 18px 64px #0004;
}
.auth-page:has(.quantelm-wordmark) .login-brand { margin-bottom:28px; padding:2px 0 26px; border-bottom:1px solid #364047; }
.auth-page:has(.quantelm-wordmark) .login-brand p { margin:20px 0 0; font-size:10px; letter-spacing:.17em; text-transform:uppercase; color:var(--auth-muted); }
.auth-page:has(.quantelm-wordmark) .auth-field input { min-height:48px; background:#101619; }
.auth-page:has(.quantelm-wordmark) .auth-primary { min-height:46px; }
.auth-page:has(.quantelm-wordmark) .login-panel > p a { color:var(--auth-accent); }
@media (max-width:480px) {
  .auth-page:has(.login-brand .quantelm-wordmark) { padding:24px 16px; }
  .auth-page:has(.quantelm-wordmark) .login-panel { padding:28px 24px 20px; }
  .masthead .xr-brand.quantelm-wordmark { width:168px; }
}
.login-logo { display:inline-block; font-size:28px; font-weight:650; letter-spacing:.18em; line-height:1.5; color:#e6e9e9; }
.login-logo span { display:block; text-align:center; font-size:12px; letter-spacing:.3em; color:#62b7ab; }
.login-brand p { font-size:14px; color:#a5afb5; margin:14px 0 0; }
.login-logo.itovex-wordmark { display:block; width:min(100%,330px); margin:0 auto; line-height:0; }
.itovex-wordmark > svg { display:block; width:100%; height:auto; }
.login-brand:has(.itovex-wordmark) { margin-bottom:30px; padding-top:5px; }
.login-brand:has(.itovex-wordmark) p { margin:18px 0 0; color:#b3b6b0; font-size:11px; letter-spacing:.13em; }
.masthead .xr-brand.itovex-wordmark { display:block; width:151px; padding:0; line-height:0; }
.masthead .itovex-wordmark svg text { text-anchor:start; transform:translateX(-180px); }
.itovex-wordmark:focus-visible { outline:2px solid #a5b5c7; outline-offset:5px; }
/* BEGIN ITOVEX HEADER TRIAL — remove this block to reverse. */
body .masthead:has(.itovex-wordmark),
body:has(#charts-view:not([hidden])) .masthead:has(.itovex-wordmark) {
  grid-template-columns: 108px minmax(0, 1fr) auto;
  min-height: 60px;
  padding: 8px 16px;
  gap: 8px 20px;
  background: #10141a;
  border-bottom: 1px solid #35404d;
}
.masthead:has(.itovex-wordmark) .identity { min-width: 0; }
.masthead:has(.itovex-wordmark) .xr-brand { width: 96px; }
.masthead:has(.itovex-wordmark) .xr-brand svg { width: 151px; max-width: none; }
.masthead:has(.itovex-wordmark) > #portal-navigation {
  justify-self: stretch; justify-content: flex-start;
  padding: 0; gap: 2px;
}
.masthead:has(.itovex-wordmark) .portal-nav-button {
  min-height: 36px; padding: 8px 11px;
  border: 1px solid transparent; border-radius: 2px;
  color: #a5b1c2; background: transparent;
  font-size: 12px; font-weight: 500;
}
.masthead:has(.itovex-wordmark) .portal-nav-button:hover { color: #f0f3f7; background: #1c242e; }
.masthead:has(.itovex-wordmark) .portal-nav-button[aria-current="page"] {
  color: #f0f3f7; background: #232d39; border-color: #435063;
}
.masthead:has(.itovex-wordmark) .masthead-account { gap: 6px 16px; }
.masthead:has(.itovex-wordmark) .auth-nav { gap: 10px; color: #a5b1c2; font-size: 11px; }
.masthead:has(.itovex-wordmark) .auth-nav a { color: #d2d9e3; }
.masthead:has(.itovex-wordmark) #sign-out { color: #c7d0dc; border-color: #435063; border-radius: 2px; }
.masthead:has(.itovex-wordmark) :focus-visible { outline: 2px solid #c5d0df; outline-offset: 2px; }
@media (max-width: 1600px) {
  body .masthead:has(.itovex-wordmark),
  body:has(#charts-view:not([hidden])) .masthead:has(.itovex-wordmark) {
    grid-template-columns: 96px minmax(0, 1fr); gap: 8px 16px;
  }
  .masthead:has(.itovex-wordmark) > #portal-navigation {
    grid-column: 1 / -1; grid-row: 2; flex-wrap: nowrap;
    overflow-x: auto; scrollbar-width: thin; padding-top: 6px;
    border-top: 1px solid #29323e;
  }
  .masthead:has(.itovex-wordmark) .portal-nav-button { flex-shrink: 0; min-height: 44px; }
  .masthead:has(.itovex-wordmark) .masthead-account { grid-column: 2; grid-row: 1; }
}
/* END ITOVEX HEADER TRIAL */
/* ITOVEX-only access surface; SKYNET and terminal data colors stay intact. */
.auth-page:has(.login-brand .itovex-wordmark) {
  --auth-bg: #050608;
  --auth-surface: #0b0e12;
  --auth-line: #454e5b;
  --auth-text: #ecf0f5;
  --auth-muted: #a0a9b7;
  --auth-accent: #d2d9e3;
  --auth-danger: #ed9a9a;
  accent-color: var(--auth-accent);
  display: grid;
  align-content: center;
  padding: 56px 20px;
}
.auth-page:has(.itovex-wordmark) .login-panel {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: 38px 38px 22px;
  border-color: #292f38;
  border-top: 2px solid #a5b1c2;
  border-bottom: 1px solid #697381;
  box-shadow: 0 24px 100px #00000080;
}
.auth-page:has(.itovex-wordmark) .login-brand {
  padding-top: 4px;
  padding-bottom: 30px;
  margin-bottom: 30px;
  border-bottom: 1px solid #292f38;
}
.auth-page:has(.itovex-wordmark) .login-brand p {
  color: var(--auth-muted);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.auth-page:has(.itovex-wordmark) .auth-field { margin: 22px 0; gap: 10px; }
.auth-page:has(.itovex-wordmark) .auth-field label {
  color: #c7ced8;
  font: 11px/1.5 var(--auth-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.auth-page:has(.itovex-wordmark) .auth-field input {
  min-height: 48px;
  background: #07090c;
  border-radius: 0;
}
.auth-page:has(.itovex-wordmark) .auth-field input:focus { border-color: var(--auth-accent); }
.auth-page:has(.itovex-wordmark) .auth-field [aria-invalid="true"] { border-color: var(--auth-danger); }
.auth-page:has(.itovex-wordmark) .check-row { font-size: 12px; }
.auth-page:has(.itovex-wordmark) #login-form > .auth-muted {
  font-size: 12px;
  line-height: 1.8;
  padding-top: 16px;
  margin: 14px 0 24px;
  border-top: 1px solid #292f38;
}
.auth-page:has(.itovex-wordmark) .auth-primary {
  min-height: 48px;
  border-radius: 0;
  background: #d2d9e3;
  color: #080b0f;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.auth-page:has(.itovex-wordmark) .auth-primary:hover:not(:disabled) {
  background: #f0f3f7;
  border-color: #f0f3f7;
  filter: none;
}
@media (max-width: 480px) {
  .auth-page:has(.login-brand .itovex-wordmark) { padding: 28px 18px; }
  .auth-page:has(.itovex-wordmark) .login-panel { padding: 28px 24px 16px; }
}
:root {
  color-scheme: dark;
  --auth-bg: #141719;
  --auth-surface: #1a1e21;
  --auth-line: #343b40;
  --auth-text: #e6e9e9;
  --auth-muted: #a5afb5;
  --auth-accent: #62b7ab;
  --auth-danger: #d88585;
  --auth-sans: 'Segoe UI', Arial, sans-serif;
  --auth-mono: Consolas, 'Cascadia Mono', 'Courier New', monospace;
}
[hidden] { display: none !important; }
.auth-page { box-sizing: border-box; margin: 0; min-width: 320px; min-height: 100svh; background: var(--auth-bg); color: var(--auth-text); font: 14px/1.5 var(--auth-sans); }
.auth-page *, .auth-nav * { box-sizing: border-box; }
.login-panel { width: min(420px, calc(100% - 40px)); margin: clamp(48px, 12vh, 130px) auto; padding: 28px; border: 1px solid var(--auth-line); background: var(--auth-surface); }
.auth-page h1 { margin: 0 0 10px; font-size: 24px; font-weight: 600; letter-spacing: -.4px; }
.auth-eyebrow { margin: 0 0 20px; color: var(--auth-muted); font: 11px/1.5 var(--auth-mono); }
.auth-muted { color: var(--auth-muted); }
.auth-field { display: grid; gap: 6px; margin: 18px 0; min-width: 0; }
.auth-field label { font-size: 12px; font-weight: 600; }
.auth-field input, .auth-field select { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--auth-line); border-radius: 2px; padding: 9px 11px; background: var(--auth-bg); color: var(--auth-text); font: 14px var(--auth-sans); }
.auth-field [aria-invalid="true"] { border-color: var(--auth-danger); }
.auth-page button, .auth-nav button { min-height: 44px; border: 1px solid var(--auth-line); border-radius: 2px; padding: 8px 14px; background: transparent; color: var(--auth-text); font: 13px var(--auth-sans); cursor: pointer; touch-action: manipulation; }
.auth-page .auth-primary { background: var(--auth-accent); color: var(--auth-bg); border-color: var(--auth-accent); font-weight: 600; }
.login-panel .auth-primary { width: 100%; }
#register-link:not([hidden]) { display: flex; justify-content: center; align-items: center; padding: 10px 14px; text-decoration: none; border: 1px solid; }
#register-link[hidden] { display: none; }
#registration-resend { width: 100%; margin-top: 12px; }
.auth-page button:hover:not(:disabled), .auth-nav button:hover:not(:disabled) { filter: brightness(1.15); }
.auth-page button:disabled, .auth-nav button:disabled, .auth-field input:disabled, .auth-field select:disabled { opacity: .6; cursor: default; }
.auth-page :focus-visible, .auth-nav :focus-visible { outline: 2px solid var(--auth-accent); outline-offset: 3px; }
.auth-status { min-height: 21px; margin: 12px 0 0; color: var(--auth-danger); overflow-wrap: anywhere; }
.auth-status[data-tone="success"] { color: var(--auth-accent); }
.auth-nav { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 14px; padding: 8px 26px; font: 12px/1.5 var(--auth-sans); color: var(--auth-muted); }
.auth-nav a { color: var(--auth-accent); min-height: 44px; display: inline-flex; align-items: center; }
#auth-user { font-family: var(--auth-mono); overflow-wrap: anywhere; max-width: 100%; }
.session-feedback { padding: 0 26px; font: 13px/1.5 var(--auth-sans); }
.session-feedback .auth-status:empty { display: none; }
.boss-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 22px 26px; border-bottom: 1px solid var(--auth-line); }
.boss-header .auth-eyebrow, .boss-header h1 { margin: 0; }
.boss-header .auth-nav { padding: 0; }
.boss-header .admin-nav { flex-basis: 100%; justify-content: flex-start; gap: 8px 20px; }
.admin-nav a[aria-current="page"] { color: var(--auth-text); font-weight: 600; text-decoration-thickness: 2px; }
.boss-content { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 320px); gap: 28px; max-width: 1240px; margin: 26px auto; padding: 0 26px; }
.boss-content h2 { margin: 0; font-size: 16px; font-weight: 600; }
.users-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.users-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.auth-link-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 14px; border: 1px solid var(--auth-accent); border-radius: 2px; text-decoration: none; }
.users-section, .add-user-section { min-width: 0; }
.users-section { grid-column: 1 / -1; }
.add-user-section { padding: 20px; border: 1px solid var(--auth-line); background: var(--auth-surface); align-self: start; }
.account-counts { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 10px; margin: 18px 0; }
.account-counts article { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--auth-line); background: var(--auth-surface); }
.account-counts span { color: var(--auth-muted); font-size: 12px; }
.account-counts strong { font: 600 24px/1.2 var(--auth-mono); }
.users-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; }
.check-row { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; color: var(--auth-muted); }
.check-row input { width: 18px; height: 18px; margin: 0; }
.admin-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.edit-user-panel { grid-column: 1 / -1; padding: 20px; border: 1px solid var(--auth-line); background: var(--auth-surface); }
.edit-user-panel .users-heading { align-items: flex-start; }
.auth-edit { margin-right: 8px; }
.auth-ip-warning { display: block; margin-top: 4px; color: #f5c66c; font-size: 11px; font-weight: 600; white-space: nowrap; }
.auth-ip-history { margin-top: 5px; min-width: 160px; max-width: 360px; font-size: 11px; }
.auth-ip-history summary { cursor: pointer; }
.auth-ip-history p { white-space: normal; opacity: .75; }
.auth-ip-history div { padding: 6px 0; border-top: 1px solid var(--auth-line); }
.auth-ip-history span, .auth-ip-history strong { display: block; white-space: nowrap; }
.auth-client-warning { display: block; margin-top: 4px; color: var(--auth-danger); font-size: 11px; font-weight: 600; white-space: nowrap; }
/* Reason text is a sentence, not an address; it must wrap. */
.auth-ip-history strong.auth-client-reason { white-space: normal; }
.users-scroll { min-width: 0; max-width: 100%; overflow-x: auto; }
#users-table { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 12px; text-align: left; }
#users-table th, #users-table td { padding: 10px 12px; border-bottom: 1px solid var(--auth-line); overflow-wrap: anywhere; }
#users-table th { font-weight: 600; color: var(--auth-muted); overflow-wrap: normal; }
#users-table .users-sort { display: flex; align-items: center; gap: 5px; width: 100%; min-height: 44px; padding: 4px 0; border: 0; color: inherit; font: inherit; text-align: left; line-height: 1.4; overflow-wrap: normal; }
#users-table .users-sort:hover:not(:disabled), #users-table .users-sort:focus-visible { color: var(--auth-text); }
#users-table .users-sort:focus-visible { outline-offset: 2px; }
#users-table .users-sort-indicator { flex: 0 0 .7em; font-size: 11px; opacity: .45; }
#users-table .users-sort-indicator::before { content: '↕'; }
#users-table th[aria-sort="ascending"] .users-sort-indicator::before { content: '↑'; }
#users-table th[aria-sort="descending"] .users-sort-indicator::before { content: '↓'; }
#users-table th[aria-sort="ascending"] .users-sort, #users-table th[aria-sort="descending"] .users-sort { color: var(--auth-text); }
#users-table th[aria-sort="ascending"] .users-sort-indicator, #users-table th[aria-sort="descending"] .users-sort-indicator { opacity: 1; }
#users-table td:first-child, #users-table td:nth-child(4) { font-family: var(--auth-mono); }
.auth-page .auth-remove { color: var(--auth-danger); }
.users-status { grid-column: 1 / -1; margin-top: 0; }
.boss-content .methodology { grid-column: 1 / -1; min-width: 0; padding: 22px 0 0; border-top: 1px solid var(--auth-line); color: var(--auth-muted); }
.boss-content .methodology summary { min-height: 44px; padding: 8px 0; cursor: pointer; color: var(--auth-text); font-weight: 600; }
.boss-content .method-summary { display: block; margin: 4px 0 0 18px; color: var(--auth-muted); font: 12px/1.6 var(--auth-mono); overflow-wrap: anywhere; }
.boss-content .method-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 22px 32px; padding: 18px 0; }
.boss-content .method-grid section { min-width: 0; }
.boss-content .method-grid h2 { margin: 0 0 8px; color: var(--auth-text); font-size: 14px; }
.boss-content .method-grid p { margin: 0 0 10px; font-size: 13px; line-height: 1.7; }
.boss-content .health-text { white-space: pre-line; overflow-wrap: anywhere; }
.boss-content .chart-credit { margin: 14px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.boss-content .chart-credit a { color: var(--auth-accent); }
.boss-content .footer-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; padding: 14px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.activity-section { grid-column: 1 / -1; min-width: 0; padding-top: 22px; border-top: 1px solid var(--auth-line); }
.activity-section a { color: var(--auth-accent); }
.activity-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 16px 0; }
.activity-filters .auth-field { flex: 1 1 180px; margin: 0; }
.activity-scroll { min-width: 0; max-width: 100%; overflow-x: auto; }
#activity-table { width: 100%; min-width: 1280px; table-layout: fixed; border-collapse: collapse; text-align: left; font-size: 12px; }
#activity-table th, #activity-table td { padding: 10px 12px; border-bottom: 1px solid var(--auth-line); overflow-wrap: anywhere; vertical-align: top; white-space: pre-wrap; }
#activity-table th { font-weight: 600; color: var(--auth-muted); }
#activity-table th:nth-child(7), #activity-table th:nth-child(8) { width: 240px; }
#activity-table td:first-child, #activity-table td:nth-child(5) { font-family: var(--auth-mono); }
.activity-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.activity-pagination .auth-status { margin: 0; }
.activity-pagination .auth-status[data-tone="neutral"] { color: var(--auth-muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 760px) { .boss-content { grid-template-columns: minmax(0, 1fr); gap: 20px; } .auth-nav { justify-content: flex-start; } .account-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .admin-form-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .login-panel { padding: 22px; margin-top: 40px; } .boss-header, .boss-content, .session-feedback, .auth-nav { padding-left: 16px; padding-right: 16px; } #users-table th, #users-table td { padding: 8px 6px; } .account-counts { grid-template-columns: minmax(0, 1fr); } .users-actions, .users-actions > * { width: 100%; } }

/* ---------- IP inventory (admin, read-only mirror of phpIPAM) ---------- */
#inventory-table { width: 100%; border-collapse: collapse; }
#inventory-table th, #inventory-table td { padding: 9px 10px; border-bottom: 1px solid var(--auth-line); text-align: left; vertical-align: top; }
#inventory-table th { position: sticky; top: 0; z-index: 1; background: var(--auth-surface); white-space: nowrap; }
#inventory-table td code { font: 13px var(--auth-mono); }
#inventory-table tbody tr:hover { background: var(--auth-surface); }
.inventory-sort { padding: 0; color: inherit; background: none; border: 0; font: inherit; cursor: pointer; }
.inventory-sort::after { content: ' \2195'; color: var(--auth-muted); }
[aria-sort="ascending"] .inventory-sort::after { content: ' \2191'; color: inherit; }
[aria-sort="descending"] .inventory-sort::after { content: ' \2193'; color: inherit; }
.inventory-state { display: inline-block; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--auth-line); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.inventory-state.is-reserved { color: #9be3c9; border-color: #2f6a58; background: #122b25; }
.inventory-state.is-used { color: #f0d291; border-color: #a8863f; background: #2a2418; }
.inventory-state.is-available { color: #cfd8dc; }
.inventory-tag { margin-left: 8px; padding: 1px 6px; border-radius: 4px; background: #2b353b; color: var(--auth-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
#inventory-status[data-tone="neutral"] { color: var(--auth-muted); }
.inventory-search { flex: 1 1 260px; }
.users-filters .auth-field { display: grid; gap: 4px; min-width: 0; }
.users-filters .auth-field > span { color: var(--auth-muted); font-size: 12px; }
.users-filters .auth-field :is(input, select) { min-height: 38px; min-width: 0; }
@media (max-width: 760px) { .users-filters .auth-field { flex: 1 1 100%; } #inventory-table th { position: static; } }

/* /boss/naming - the naming map table. */
.naming-section { padding: 18px 20px; border-bottom: 1px solid var(--auth-line); }
.naming-section h2 { margin: 0 0 6px; font-size: 15px; }
.naming-note { margin: 0 0 12px; max-width: 70ch; color: var(--auth-muted, #93a1a8); font-size: 12px; line-height: 1.6; }
.naming-table { border-collapse: collapse; margin: 0 0 4px; min-width: min(420px, 100%); }
.naming-table caption { text-align: left; }
.naming-table th, .naming-table td { padding: 7px 18px 7px 0; border-bottom: 1px solid var(--auth-line); text-align: left; font: 13px var(--auth-mono, Consolas, monospace); }
.naming-table thead th { border-bottom-width: 2px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--auth-muted, #93a1a8); }
.naming-table tbody th { font-weight: 400; color: var(--auth-muted, #93a1a8); }
.naming-list { margin: 0; padding-left: 18px; max-width: 70ch; font-size: 12px; line-height: 1.8; }
.naming-list code { font: 12px var(--auth-mono, Consolas, monospace); }

/* /boss/analytics ---------------------------------------------------------
   .boss-content is a two-column grid (content + a 250-320px sidebar). Anything
   that is not explicitly spanned lands in that narrow sidebar - which is exactly
   what squeezed this page into the right-hand gutter. Span both columns first,
   then lay the cards out inside. */
#analytics-status, #analytics-body { grid-column: 1 / -1; min-width: 0; }
#analytics-status { margin: 0 0 16px; font: 12px/1.6 var(--auth-mono); color: var(--auth-muted); }
.analytics-tiles { grid-column: 1 / -1; display: grid; gap: 10px; margin: 0 0 20px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.analytics-tiles article { display: grid; gap: 3px; padding: 14px; border: 1px solid var(--auth-line);
  border-radius: 4px; background: var(--auth-surface); min-width: 0; }
.analytics-tiles span { color: var(--auth-muted); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.analytics-tiles strong { font: 600 26px/1.15 var(--auth-mono); font-variant-numeric: tabular-nums; }
.analytics-tiles small { color: var(--auth-muted); font-size: 11px; overflow-wrap: anywhere; }
#analytics-body { display: grid; gap: 16px; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
#analytics-body .naming-section { margin: 0; padding: 16px 18px; border: 1px solid var(--auth-line);
  border-bottom: 1px solid var(--auth-line); border-radius: 4px; background: var(--auth-surface); min-width: 0; }
#analytics-body .analytics-wide { grid-column: 1 / -1; }
#analytics-body .naming-note { margin: 0 0 12px; font-size: 11.5px; line-height: 1.65; }
#analytics-body .naming-table { width: 100%; min-width: 0; }
/* Numbers read down a column, so right-align them and stop digit jitter. */
#analytics-body .naming-table th:not(:first-child), #analytics-body .naming-table td:not(:first-child) {
  text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
#analytics-body .naming-table th:first-child, #analytics-body .naming-table td:first-child { padding-right: 14px; }
#analytics-body .naming-table tbody tr:hover { background: #ffffff0a; }
#analytics-body .naming-table tbody td { color: var(--auth-text); }
/* A long list must not push every other card off the screen. */
.analytics-table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
#analytics-body .naming-table th { white-space: nowrap; }
.analytics-scroll { max-height: 330px; overflow: auto; overscroll-behavior: contain;
  /* Reserve the scrollbar gutter, otherwise it sits on top of the right-aligned
     numbers in the last column. */
  scrollbar-gutter: stable; padding-right: 6px; }
.analytics-empty { margin: 0; color: var(--auth-muted); font-size: 12px; }
@media (max-width: 760px) {
  .analytics-tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  #analytics-body .naming-section { padding: 14px; }
}

/* /boss/research - reuses the /boss/analytics card layout. Same two-column trap:
   span both columns first, then lay the cards out inside. */
#research-status, #research-body { grid-column: 1 / -1; min-width: 0; }
#research-status { margin: 0 0 16px; font: 12px/1.6 var(--auth-mono); color: var(--auth-muted); }
#research-body { display: grid; gap: 16px; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
#research-body .naming-section { margin: 0; padding: 16px 18px; border: 1px solid var(--auth-line);
  border-radius: 4px; background: var(--auth-surface); min-width: 0; }
#research-body .analytics-wide, #research-body .analytics-tiles { grid-column: 1 / -1; }
#research-body .naming-note { margin: 0 0 12px; font-size: 11.5px; line-height: 1.65; }
#research-body .naming-table { width: 100%; min-width: 0; }
#research-body .naming-table th:not(:first-child), #research-body .naming-table td:not(:first-child) {
  text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
#research-body .naming-table th:first-child, #research-body .naming-table td:first-child { padding-right: 14px; }
#research-body .naming-table tbody td { color: var(--auth-text); }
#research-body .naming-table th { white-space: nowrap; }
.research-badge { display: inline-block; margin: 0 0 10px; padding: 3px 9px; border: 1px solid var(--auth-line);
  border-radius: 999px; font: 11px/1.4 var(--auth-mono); letter-spacing: .04em; }
.research-insufficient { color: var(--auth-muted); }
.research-emerging { color: #d2a06b; border-color: #d2a06b66; }
.research-usable { color: var(--auth-accent); border-color: var(--auth-accent); }
.research-warn { color: #d2a06b; }
.research-progress { height: 8px; margin: 4px 0 8px; border: 1px solid var(--auth-line); border-radius: 999px;
  overflow: hidden; background: #ffffff08; }
.research-progress span { display: block; height: 100%; background: var(--auth-accent); }

/* /boss/backtest - same two-column trap as the other admin pages: span both columns first,
   then lay the cards out inside. Reuses the analytics tiles/table idioms and research progress. */
#bt-status, #bt-body { grid-column: 1 / -1; min-width: 0; }
#bt-status { margin: 0 0 16px; font: 12px/1.6 var(--auth-mono); color: var(--auth-muted); }
#bt-body, #bt-result { display: grid; gap: 16px; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
#bt-result { grid-column: 1 / -1; min-width: 0; }
#bt-result:empty { display: none; }
#bt-body .naming-section { margin: 0; padding: 16px 18px; border: 1px solid var(--auth-line); border-radius: 4px;
  background: var(--auth-surface); min-width: 0; }
#bt-body .analytics-wide, #bt-body .analytics-tiles { grid-column: 1 / -1; }
#bt-body .naming-note { margin: 0 0 12px; font-size: 11.5px; line-height: 1.65; }
#bt-body .naming-table { width: 100%; min-width: 0; }
#bt-body .naming-table th:not(:first-child), #bt-body .naming-table td:not(:first-child) {
  text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; }
#bt-body .naming-table th:first-child, #bt-body .naming-table td:first-child { padding-right: 14px; }
#bt-body .naming-table tbody td { color: var(--auth-text); }
#bt-body .naming-table th { white-space: nowrap; }
.bt-form fieldset { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
  gap: 10px 14px; margin: 0 0 14px; padding: 12px 14px 14px; border: 1px solid var(--auth-line); border-radius: 4px; min-width: 0; }
.bt-form legend { padding: 0 6px; color: var(--auth-muted); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.bt-form label { display: grid; gap: 5px; color: var(--auth-muted); font-size: 12px; min-width: 0; }
.bt-form input, .bt-form select { width: 100%; min-width: 0; min-height: 40px; box-sizing: border-box;
  border: 1px solid var(--auth-line); border-radius: 2px; padding: 7px 10px; background: var(--auth-bg);
  color: var(--auth-text); font: 14px var(--auth-sans); }
.bt-form input:focus, .bt-form select:focus { border-color: var(--auth-accent); outline: none; }
.bt-form input[type="checkbox"] { width: auto; min-height: 0; }
.bt-form input:disabled { opacity: .5; }
.bt-form .bt-inline { display: inline-flex; gap: 8px; align-items: center; color: var(--auth-text); font-size: 12px;
  letter-spacing: 0; text-transform: none; }
.bt-form #bt-sweep-count { grid-column: 1 / -1; margin: 0; }
.bt-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
#bt-run { border-color: var(--auth-accent); color: var(--auth-accent); }
.bt-error { color: var(--auth-danger); font-size: 12px; }
.bt-up { color: #3fb984; }
.bt-down { color: var(--auth-danger); }
.bt-chart { display: block; width: 100%; height: auto; margin-top: 12px; }
.bt-line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.bt-line.bt-up { stroke: #3fb984; }
.bt-line.bt-down { stroke: #e5534b; }
.bt-zero { stroke: var(--auth-line); stroke-dasharray: 4 4; }
.bt-dd { fill: rgba(229, 83, 75, .35); stroke: none; }
.bt-axis { fill: var(--auth-muted); font: 11px var(--auth-mono); }
#bt-body .bt-heat td { text-align: center; min-width: 44px; font-size: 11px; }
#bt-body .bt-heat th { font-size: 11px; }
.bt-trades td, .bt-trades th { font-size: 12px; white-space: nowrap; }
.bt-link { display: inline-block; margin: 0 0 10px; color: var(--auth-accent); font-size: 12px; }
#bt-body .bt-open { min-height: 32px; padding: 4px 10px; }
#bt-progress-fill { display: block; width: 0; height: 100%; background: var(--auth-accent); transition: width .3s; }
/* Optimiser controls. .bt-form label is display:grid, which would override the UA [hidden] rule,
   so method-specific fields need an explicit hide. */
.bt-form [hidden] { display: none; }
.bt-space { grid-column: 1 / -1; display: grid; gap: 8px; margin: 4px 0 0; }
.bt-space-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 0;
  border-top: 1px solid var(--auth-line); }
.bt-space-name { min-width: 190px; }
.bt-form .bt-range { display: inline-flex; align-items: center; gap: 6px; }
.bt-form .bt-range input { width: 96px; }
.bt-form .bt-chip { display: inline-flex; align-items: center; gap: 5px; }
#bt-opt-count { grid-column: 1 / -1; margin: 0; }
.bt-line.bt-mid { stroke: #d2a06b; }
.bt-line.bt-low { stroke: var(--auth-muted); }
.bt-split { stroke: var(--auth-accent); stroke-dasharray: 6 5; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.bt-top td, .bt-top th { font-size: 12px; white-space: nowrap; }
/* Backtest page, part 2: tabs, edge studies, random-entry histogram. */
.bt-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.bt-tabs [role="tab"] { min-height: 40px; padding: 8px 16px; border: 1px solid var(--auth-line); border-radius: 4px;
  background: transparent; color: var(--auth-muted); font: inherit; font-size: 13px; cursor: pointer; }
.bt-tabs [role="tab"][aria-selected="true"] { border-color: var(--auth-accent); color: var(--auth-accent); }
#bt-body .naming-section[hidden] { display: none; }
#st-run { border-color: var(--auth-accent); color: var(--auth-accent); }
.bt-mid { color: #d2a06b; }
.bt-low { color: var(--auth-muted); }
.bt-bar { fill: rgba(147, 161, 168, .5); }
.bt-form .bt-wide-note, .bt-form .bt-wf-toggle { grid-column: 1 / -1; margin: 0; }
#bt-body .naming-table th:not(:first-child), #bt-body .naming-table td:not(:first-child) { padding-left: 16px; }
.analytics-tiles strong.bt-verdict { font-size: 18px; line-height: 1.3; }
