/* PrefixBroker UI — small, dependency-free stylesheet.
   Honest framing is visually reinforced: the disclaimer banner and "indicator"
   tags are always visible and high-contrast. */

:root {
  --bg: #f6f7f9;
  --fg: #1d2330;
  --muted: #6b7280;
  --card: #ffffff;
  --border: #dfe3e8;
  --primary: #1f6feb;
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #b42318;
  --warn-bg: #fff8e6;
  --ok-bg: #e9f6ec;
  --bad-bg: #fbeaea;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* Honest-framing banner — always visible (spec 1). */
.honest-banner {
  background: #11243f; color: #eef3fb; padding: 10px 18px;
  font-size: 13px; border-bottom: 3px solid var(--primary);
}
.honest-banner strong { color: #ffd479; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px; background: var(--card); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; text-decoration: none; color: var(--fg); }
/* Tenant badge on the brand: which tenant's data is on screen. Distinct enough
   to read at a glance, quiet enough not to compete with the product name. */
.brand-tenant {
  display: inline-block; margin-left: 10px; padding: 2px 8px;
  border: 1px solid var(--primary); border-radius: 10px;
  color: var(--primary); font-size: 12px; font-weight: 600;
  vertical-align: 2px; white-space: nowrap;
}
.nav { display: flex; gap: 14px; align-items: center; margin-left: auto; }
.nav a { color: var(--primary); text-decoration: none; }
.nav .who { color: var(--muted); font-size: 13px; }

.content { max-width: 1040px; margin: 22px auto; padding: 0 18px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }

h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 18px; margin-bottom: 16px;
  /* A table wider than the card scrolls INSIDE it instead of bleeding past
     the edge (HGPX-21: items overshooting their panels). */
  overflow-x: auto;
}
.card.narrow { max-width: 420px; margin: 40px auto; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
label { display: block; font-size: 13px; color: var(--fg); }
label.inline { display: flex; gap: 8px; align-items: center; }
/* The `label { display: block }` above otherwise overrides the browser's
   built-in `[hidden] { display: none }`, which kept the type-toggled fields on
   the add-resource form (e.g. the ASN input on a prefix) visible. Make the
   hidden attribute always win. */
[hidden] { display: none !important; }
input, select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 7px; font: inherit; margin-top: 4px; background: #fff;
}
label.inline input[type=checkbox] { width: auto; margin: 0; }

.btn {
  display: inline-block; padding: 8px 14px; border-radius: 7px;
  border: 1px solid var(--border); background: #fff; color: var(--fg);
  cursor: pointer; text-decoration: none; font: inherit;
}
.btn:hover { background: #f0f3f7; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.warn { background: var(--warn-bg); border-color: #e7c66b; color: var(--warn); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.is-running { cursor: progress; }
/* Run-button loading spinner (freshness/spinners Unit 1). Pure CSS, no deps. */
.btn-spinner {
  display: inline-block; width: 12px; height: 12px; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: pb-spin .6s linear infinite;
}
@keyframes pb-spin { to { transform: rotate(360deg); } }
/* Data-freshness (freshness Unit 2): a stale source reads amber. */
.stale { color: var(--warn); }
ul.freshness { margin: 4px 0 0; padding-left: 18px; }
ul.freshness li { margin: 1px 0; }

/* Collapsible long tables (cleanup checklist): hide overflow rows behind a
   "Show N more" toggle. Rows are only hidden once JS adds the class. */
.row-collapsed { display: none; }
.collapse-toggle-row td { text-align: center; padding: 6px; background: #fafbfc; }
.collapse-toggle {
  border: 0; background: none; color: var(--primary); cursor: pointer;
  font: inherit; padding: 2px 6px; border-radius: 6px;
}
.collapse-toggle:hover { background: #eef2f7; text-decoration: underline; }
.collapse-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Card section collapsed into a native <details> disclosure (cleanup history).
   Matches the usermenu/signoff-help idiom: hidden default marker + a caret. */
.history-disclosure > summary {
  cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: .5rem;
}
.history-disclosure > summary::-webkit-details-marker { display: none; }
.history-disclosure > summary h2 { margin: 0; }
.history-disclosure > summary .disclosure-count { font-size: 14px; }
.history-disclosure > summary .caret {
  margin-left: auto; font-size: 10px; color: var(--muted); display: inline-block;
}
.history-disclosure[open] > summary .caret { transform: rotate(180deg); }
.history-disclosure-body { margin-top: .75rem; }

/* Deep-check per-IP address list: a compact ~20-line scroll window (a /16 can be
   thousands of addresses). agent.js adds an Expand/Collapse toggle when it
   overflows; JS-off users still get the scrollable window. ~20 lines matches
   the data-collapse-after="20" used by every long table on the page. */
.ip-window-wrap { margin: 6px 0 2px; }
.ip-window {
  max-height: 30em; overflow-y: auto;
  display: flex; flex-wrap: wrap; gap: 2px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: #fafbfc;
}
.ip-window.expanded { max-height: none; }
.ip-window .ip { white-space: nowrap; color: var(--muted); }
.ip-window-wrap .collapse-toggle { margin-top: 4px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.nowrap { white-space: nowrap; }

/* Indicator framing. */
.ind-tag {
  display: inline-block; font-size: 10px; text-transform: uppercase;
  letter-spacing: .04em; background: #eef2ff; color: #3538cd;
  border: 1px solid #c7d2fe; border-radius: 6px; padding: 1px 6px; vertical-align: middle;
}
.indicator-note {
  background: #eef2ff; border: 1px solid #c7d2fe; color: #283593;
  padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px;
}
.notice {
  background: var(--warn-bg); border: 1px solid #e7c66b; color: var(--warn);
  padding: 8px 12px; border-radius: 8px; font-size: 13px;
}

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th { color: var(--muted); font-weight: 600; font-size: 12px; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  border: 1px solid transparent;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: #b7e0c0; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: #e7c66b; }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: #e9b3ae; }
.pill.na { background: #eef0f3; color: var(--muted); }
.pill.big { font-size: 14px; padding: 4px 12px; }

.state { font-weight: 600; }
.state-cancelled { color: var(--bad); }
.state-completed { color: var(--ok); }
.state-cleanup_verified, .state-rir_ticket_submitted { color: var(--primary); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.kv dt { color: var(--muted); }

.reasons { list-style: none; padding: 0; margin: 0; }
.reasons li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.reasons .sev {
  display: inline-block; font-size: 11px; text-transform: uppercase;
  border-radius: 5px; padding: 1px 6px; margin-right: 6px;
}
.sev-block .sev { background: var(--bad-bg); color: var(--bad); }
.sev-review .sev { background: var(--warn-bg); color: var(--warn); }
.sev-info .sev { background: var(--ok-bg); color: var(--ok); }

.cleanup-present_to_remove td { background: #fff6f5; }
.cleanup-clean td { background: #fafffb; }

.signoff { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.state-buttons { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form { display: flex; gap: 8px; align-items: center; }

pre.diff, pre { background: #0d1117; color: #c9d1d9; padding: 10px; border-radius: 8px;
  overflow: auto; font-size: 12px; }

.flash { padding: 10px 14px; border-radius: 8px; background: var(--ok-bg);
  color: var(--ok); margin-bottom: 14px; }
.flash.error { background: var(--bad-bg); color: var(--bad); }

/* Toast. */
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #11243f; color: #fff; padding: 10px 16px; border-radius: 8px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: var(--ok); }
.toast.error { background: var(--bad); }

/* Danger zone (destructive actions) */
.card.danger { border: 1px solid #e0b4b4; background: #fcf4f4; }
.card.danger h2 { color: #a12622; }
.btn.danger { background: #c0392b; color: #fff; border-color: #a12622; }
.btn.danger:hover { background: #a12622; }

/* needs_review (covering aggregate / foreign) pill */
.pill.review { background: #fff3cd; color: #8a6d3b; border: 1px solid #e6c200; }

/* ---- About > Code graph (layered architecture diagram) ---- */
.code-graph { width: 100%; margin: 0.5rem 0; }
.code-graph-svg {
  width: 100%; height: auto;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 6px;
}
.cg-lane { font: 600 12px/1.2 system-ui, sans-serif; pointer-events: none; }
.cg-box { cursor: pointer; transition: opacity 0.12s; }
.cg-name { font: 11px/1.2 ui-monospace, "SFMono-Regular", Menlo, monospace; fill: #1e293b; pointer-events: none; }
.cg-edge { transition: stroke-opacity 0.12s, stroke 0.12s; }

/* ---- API keys page ---- */
.new-key { margin-top: 1rem; padding: 0.75rem 1rem; background: #ecfdf5; border: 1px solid #6ee7b7; border-radius: 6px; }
.key-value { display: block; padding: 0.5rem 0.7rem; margin: 0.3rem 0; background: #0f172a; color: #e2e8f0; border-radius: 4px; font: 13px/1.4 ui-monospace, Menlo, monospace; word-break: break-all; user-select: all; }

/* ---- Ownership sign-off explainer (resource detail) ---- */
.signoff-help { margin: 0.5rem 0 0.75rem; }
.signoff-help summary { cursor: pointer; color: var(--primary); font-size: 0.9rem; }
.signoff-help-body { margin-top: 0.5rem; padding: 0.75rem 1rem; background: var(--warn-bg); border: 1px solid #e7c66b; border-radius: 8px; font-size: 0.9rem; }
.signoff-help-body p { margin: 0 0 0.6rem; }
.signoff-help-body ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.signoff-list { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.signoff-list li { padding: 0.35rem 0; border-bottom: 1px solid #e7d9a8; }
.signoff-list li:last-child { border-bottom: none; }

/* ---- User menu dropdown (nav) ---- */
.nav .usermenu { position: relative; }
.nav .usermenu > summary {
  list-style: none; cursor: pointer; color: var(--primary);
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 7px;
  background: #fff; user-select: none; white-space: nowrap;
}
.nav .usermenu > summary::-webkit-details-marker { display: none; }
.nav .usermenu > summary:hover { background: #f0f3f7; }
.nav .usermenu .caret { font-size: 10px; color: var(--muted); }
.nav .usermenu[open] > summary { background: #f0f3f7; }
.usermenu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 100;
  display: flex; flex-direction: column; min-width: 180px; padding: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(17, 36, 63, .14);
}
.usermenu-panel a {
  padding: 8px 10px; border-radius: 6px; color: var(--fg); text-decoration: none;
  font-size: 14px;
}
.usermenu-panel a:hover { background: #f0f3f7; color: var(--primary); }
/* Logout is a POST form (CSRF-protected) styled to match the panel links. */
.usermenu-panel .logout-form { margin: 4px 0 0; border-top: 1px solid var(--border); padding-top: 4px; }
.usermenu-panel .logout-form .linklike {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 8px 10px; border: 0; border-radius: 6px; background: none;
  font: inherit; font-size: 14px; color: var(--bad);
}
.usermenu-panel .logout-form .linklike:hover { background: #f0f3f7; }
.usermenu-meta {
  padding: 4px 10px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
  color: var(--muted); font-size: 12px; text-transform: capitalize;
}

/* Global-admin "acting as tenant X" banner (sits under the header). */
.ga-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: #fef3c7; color: #78350f; border-bottom: 1px solid #f59e0b;
  padding: 8px 20px; font-size: 14px;
}

/* ===================== Dashboard traffic-light overview ==================== */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  flex: 0 0 auto; vertical-align: middle; }
.dot-green { background: #1a7f37; }
.dot-amber { background: #d99e00; }
.dot-red   { background: #b42318; }
.dot-grey  { background: #9ba3af; }

.summary-banner { border-radius: 10px; padding: 14px 18px; margin: 0 0 16px;
  border: 1px solid var(--border); background: var(--card); }
.summary-banner.tone-green { background: #eef8f0; border-color: #bfe3c8; }
.summary-banner.tone-amber { background: #fff7e6; border-color: #ecd49a; }
.summary-banner.tone-red   { background: #fcf0ee; border-color: #e7b6ae; }
.summary-banner.tone-grey  { background: #f4f5f7; }
.summary-headline { font-size: 17px; font-weight: 600; margin: 0; color: var(--fg); }
.summary-counts { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; }
.count { display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  font-weight: 600; color: var(--muted); }

.attention-card { border-left: 4px solid var(--warn); }
.attention-card h2 { margin-top: 0; }
.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li { display: flex; align-items: baseline; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--border); }
.attention-list li:last-child { border-bottom: 0; }
.all-clear { border-left: 4px solid var(--ok); }
.all-clear p { margin: 0; font-weight: 600; color: var(--ok); }

.overview-head { display: flex; justify-content: space-between; align-items: baseline; }

.res-card { border: 1px solid var(--border); border-left: 4px solid var(--muted);
  border-radius: 8px; padding: 12px 14px; margin: 10px 0; background: var(--card); }
.res-card.rag-green { border-left-color: #1a7f37; }
.res-card.rag-amber { border-left-color: #d99e00; }
.res-card.rag-red   { border-left-color: #b42318; }
.res-card.rag-grey  { border-left-color: #9ba3af; }
.res-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.res-name { font-weight: 600; font-size: 15px; }
.res-type { font-size: 12px; }
.res-headline { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 11px; }
.badge-green { background: #e9f6ec; color: #1a7f37; }
.badge-amber { background: #fdf3da; color: #9a6700; }
.badge-red   { background: #fbeae8; color: #b42318; }
.badge-grey  { background: #eef0f3; color: #6b7280; }
.open-btn { margin-left: auto; }
/* Per-resource tags in the card head (seller ASN / call-to-action). */
.tag { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 11px;
  border: 1px solid transparent; white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; }
.tag-asn { background: #eef4fd; color: var(--primary); border-color: #cfe0fb; }
.tag-danger { background: var(--bad-bg); color: var(--bad); border-color: #e9b3ae; }
.tag-danger::before { content: "⚑ "; }
.tag-danger:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.res-summary { margin: 8px 0 10px; color: var(--fg); font-size: 13.5px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  font-size: 12px; padding: 3px 10px; border-radius: 14px;
  border: 1px solid var(--border); background: #fafbfc; color: var(--fg); }
.chip:hover { border-color: var(--primary); }
.chip-k { color: var(--muted); }
.chip-v { font-weight: 600; }
.chip-green { background: #f1f9f3; border-color: #cce8d3; }
.chip-amber { background: #fff8e8; border-color: #ecd9a6; }
.chip-red   { background: #fdf1ef; border-color: #eec3bc; }
.chip-grey  { background: #f4f5f7; }
.add-summary { cursor: pointer; font-weight: 600; }

/* "Up one level" breadcrumb (base.html). Sits above the page heading on every
   sub-page; the global-admin "Exit to platform console" banner stays separate
   above it, so the two levels never look like one control. */
.breadcrumb { margin: 0 0 14px; }
.breadcrumb .btn { font-weight: 500; }

/* Report summary box (HGPX-15) — the one-glance table at the top of the prefix
   page. Rows are colour-coded by the same pill palette the sections use. */
.report-summary-head { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; }
.report-summary-head h2 { margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.report-summary-title { flex: 1 1 320px; min-width: 0; }
.verdict-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.report-summary-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.report-summary-actions .btn.is-on { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 7px 0 0 7px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 7px 7px 0; }
.btn.big { font-size: 16px; padding: 10px 18px; font-weight: 600; }
.summary-table td { vertical-align: middle; }
.summary-table td:last-child, .summary-table td:first-child { white-space: nowrap; }
.summary-table .pill { white-space: nowrap; }
.summary-table tr.summary-bad td:first-child { border-left: 4px solid var(--bad); }
.summary-table tr.summary-warn td:first-child { border-left: 4px solid var(--warn); }
.summary-table tr.summary-ok td:first-child { border-left: 4px solid var(--ok); }
.summary-table tr.summary-na td:first-child { border-left: 4px solid #c9ced6; }
.nowrap { white-space: nowrap; }
.progress { height: 8px; background: #e6e9ee; border-radius: 4px; overflow: hidden;
  margin: 6px 0 2px; max-width: 520px; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 4px;
  transition: width .6s ease; }

/* Dashboard (HGPX-16): a responsive grid of module cards + customize mode. */
.dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.dash-card { margin: 0; min-width: 0; }
.dash-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.dash-card-head h2 { margin: 0 0 8px; }
.dash-grid.editing .dash-card { outline: 2px dashed #c9ced6; outline-offset: 2px; }
.dash-tools { white-space: nowrap; }
.dash-big { font-size: 28px; font-weight: 600; margin: 0 0 6px; }
.dash-list { list-style: none; padding: 0; margin: 0; }
.dash-list li { padding: 4px 0; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.dash-list li:last-child { border-bottom: 0; }
table.data.compact td, table.data.compact th { padding: 4px 8px; font-size: 13px; }
.view-chip { display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; }
.view-chip .inline-form { display: inline-flex; }
.view-chip .linklike { border: 0; background: none; padding: 0 4px; cursor: pointer; color: var(--muted); font: inherit; }
.view-chip .linklike:hover { color: var(--bad); }

/* Admin sub-navigation (HGPX-21 item 3): one bar on every /admin + /platform page. */
.admin-nav { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center;
  margin: 0 0 16px; padding: 8px 12px; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; font-size: 13px; }
.admin-nav-group { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.admin-nav-label { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px;
  letter-spacing: .04em; margin-right: 4px; }
.admin-nav a { padding: 3px 8px; border-radius: 6px; text-decoration: none; }
.admin-nav a.active { background: var(--primary); color: #fff; }
.admin-nav a:not(.active):hover { background: #eef0f3; }
.feeds-group[hidden] { display: none; }

/* Narrow screens (HGPX-21 4c): the header wraps instead of overflowing, form
   rows stack, and the dense tables drop a size. */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 8px 14px; }
  .nav { margin-left: 0; flex-wrap: wrap; gap: 8px 12px; }
  .content { padding-left: 12px; padding-right: 12px; }
  .row { flex-direction: column; align-items: stretch; }
  .row > label, .row > .btn, .row > button { width: 100%; }
  .report-summary-head, .dash-head { flex-direction: column; }
  .report-summary-actions { align-items: stretch; }
  table.data { font-size: 13px; }
  .summary-table td:last-child { white-space: normal; }
  .admin-nav { gap: 6px 12px; }
}

/* Leases page (HGPX-35): one expandable row per lease. */
.lease-row { border-top: 1px solid var(--border); }
.lease-row:first-of-type { border-top: 0; }
.lease-summary { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center;
  padding: 8px 4px; cursor: pointer; list-style: none; }
.lease-summary::-webkit-details-marker { display: none; }
.lease-summary .caret { margin-left: auto; color: var(--muted); }
.lease-row[open] .lease-summary .caret { transform: rotate(180deg); }
.lease-row.lease-attention .lease-summary { background: #fffaf0; }
.lease-ids { min-width: 160px; }
.lease-parties { flex: 1 1 260px; }
.lease-body { padding: 4px 4px 12px 28px; }
tr.row-attention td { background: #fff8f0; }

/* Compare page (HGPX-17): highlight the rows where the blocks differ. */
table.compare th:first-child { text-align: left; white-space: nowrap; }
table.compare tr.row-differs td { background: var(--warn-bg, #fff7e6); }
table.compare tr.group-row th { text-transform: uppercase; letter-spacing: .04em; padding-top: 10px; }
#pick-toolbar { padding: 6px 0; }
#import-text.drop-target { outline: 2px dashed var(--accent, #2563eb); }

/* System log diff modal */
dialog.diff-modal { border: 1px solid var(--border); border-radius: 12px; padding: 0;
  width: min(1100px, 94vw); max-height: 88vh; background: var(--card); color: inherit; }
dialog.diff-modal::backdrop { background: rgba(0, 0, 0, .45); }
.diff-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border); }
.diff-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 14px 18px;
  overflow: auto; max-height: calc(88vh - 70px); }
.diff-cols h3 { margin: 0 0 6px; font-size: 13px; }
.diff-cols pre.diff { margin: 0; max-height: 70vh; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 800px) { .diff-cols { grid-template-columns: 1fr; } }
.inline-fieldset { border: 1px dashed var(--border); border-radius: 8px; padding: 6px 10px; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.inline-fieldset legend { padding: 0 4px; }
label.inline.nowrap { white-space: nowrap; }
/* Leases: the block you searched for, and the actual blocker text (team lead 2026-09-16) */
tr.row-match td { background: #fff3cd; }
tr.row-match td:first-child { box-shadow: inset 4px 0 0 var(--warn, #d97706); }
.blockers { color: var(--bad); font-size: 12px; margin-top: 3px; max-width: 520px; }
.lease-title { flex: 1; min-width: 260px; }
.count.count-red { color: var(--bad); }
/* Portfolio legend + client-side filter */
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 8px; color: var(--muted); }
.legend .dot { vertical-align: middle; }
.overview-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
/* Portfolio banner counts double as filters */
.summary-counts button.count, .summary-counts a.count { cursor: pointer; border: 1px solid transparent; background: rgba(255,255,255,.6); border-radius: 999px; padding: 4px 10px; font: inherit; text-decoration: none; }
.summary-counts button.count:hover, .summary-counts button.count.is-active,
.summary-counts a.count:hover, .summary-counts a.count.is-active { border-color: currentColor; }
.count.count-red { color: var(--bad); }

.saved-views { display: flex; flex-wrap: wrap; gap: 6px 4px; align-items: center; }

/* Filter card (Leases; the same shapes fit any list page): search first,
   advanced filters in a quiet panel, saved views + report actions as bars. */
.filter-toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filter-toolbar .grow { flex: 1 1 320px; min-width: 240px; }
.filter-toolbar input[type=search] { width: 100%; }
.adv-panel { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.adv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 14px; }
.adv-foot { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.adv-foot .spacer { flex: 1; }
.views-bar { display: flex; gap: 10px 24px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.views-bar .save-view { margin-left: auto; }
.views-bar .save-view input[type=text] { margin-top: 0; padding: 4px 9px; }
.list-actions { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); align-items: center; gap: 8px; }
.list-actions .list-email-input { margin-top: 0; padding: 4px 9px; }
.list-actions .sep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }
label.inline.small { font-size: 12px; color: var(--muted); }
@media (max-width: 760px) {
  .filter-toolbar { flex-direction: column; align-items: stretch; }
  .views-bar .save-view { margin-left: 0; }
}
.adv-group + .adv-group { margin-top: 14px; }
.adv-title { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.adv-grid label { font-size: 12px; color: var(--muted); }
.adv-grid input, .adv-grid select { font-size: 13px; padding: 6px 9px; color: var(--fg); }
.adv-foot .checks { display: flex; gap: 6px 16px; flex-wrap: wrap; }
.adv-foot label.inline { font-size: 13px; }
.adv-foot .sort-pick { gap: 6px; }
.adv-foot .sort-pick select { width: auto; margin-top: 0; padding: 5px 9px; font-size: 13px; }
/* Compact variant: a short row of labelled controls above a table. Labels sit
   above their control, every control and the button share one height. */
.filter-toolbar.compact { margin-bottom: 10px; }
.filter-toolbar.compact > label { flex: 0 0 auto; min-width: 180px; font-size: 12px; color: var(--muted); }
.filter-toolbar.compact > label.wide { flex: 1 1 260px; }
.filter-toolbar.compact select, .filter-toolbar.compact input { display: block; width: 100%; color: var(--fg); }

/* Resource page head: the prefix and its sets on one line. */
.resource-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.resource-head h1 { margin: 0; }
.resource-sets { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.resource-meta { margin-top: 4px; }

/* Sticky section nav: the compact report summary that follows you. */
html { scroll-behavior: smooth; }
section.card[id], h3[id] { scroll-margin-top: 64px; }
.section-nav { position: sticky; top: 8px; z-index: 30; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px; margin: -6px 0 16px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.section-nav.stuck { box-shadow: 0 6px 18px rgba(20, 30, 50, .12); }
.section-nav-home { display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; padding: 3px 8px 3px 4px; text-decoration: none; color: var(--fg); font-weight: 600; }
.section-nav-home code { font-size: 13px; }
.section-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); color: var(--fg); font-size: 12px; text-decoration: none; white-space: nowrap; }
.section-chip:hover { border-color: var(--primary); }
.section-chip.is-active { border-color: var(--primary); background: #eaf2ff; }
.section-chip.is-bad { border-color: #e9b3ae; }
.section-chip.is-warn { border-color: #e7c66b; }

/* Settings card: sets and visibility side by side. */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 28px; }
.settings-col { display: flex; flex-direction: column; padding: 4px 0; }
.settings-col + .settings-col { border-left: 1px solid var(--border); padding-left: 28px; }
.settings-col h3 { margin: 0 0 4px; font-size: 15px; }
.settings-col .hint { margin-top: 6px; }
.settings-foot { margin-top: auto; padding-top: 12px; display: flex; justify-content: flex-end; }
.vis-editor { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
@media (max-width: 760px) {
  .settings-col + .settings-col { border-left: 0; border-top: 1px solid var(--border); padding-left: 0; padding-top: 16px; margin-top: 16px; }
}
@media (max-width: 760px) {
  .section-nav { position: static; }
  .report-summary-actions { justify-content: flex-start; }
}
