/*
 * Citadel application kit for the Gate portal (gate.citadelframe.com), November 2026.
 * Implements CITADEL-DESIGN-SYSTEM.md sections 3 and 7 with the shared tokens in kit/tokens.css (no forked values):
 * 52 px navy top bar with the product switcher and the provider/client indicator, a 3 px Gate accent rule, a 248/60 px
 * sidebar with expandable groups, breadcrumbs, page header, toolbar with filter menu and removable chips, tables with
 * sticky sortable headers and row menus, record layout, forms, dialogs, drawers and the designed states.
 * The look matches the suite hub (dashboard.citadelframe.com, css/app.css) so the products read as one family.
 * kit.js builds every element with createElement/textContent; no inline style strings.
 * Order: base, shell, page frame, controls, menus and popovers, sections, lists, records, forms, dialogs, feedback,
 * states, sign-in, responsive.
 */

/* ============================================================ base */
*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: light; }
body.cx { margin: 0; min-height: 100vh; font: 400 var(--t-14)/1.5 var(--f-sans); color: var(--c-text); background: var(--c-bg); }
.cx h1, .cx h2, .cx h3, .cx h4 { margin: 0; color: var(--c-ink); line-height: 1.3; }
.cx h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.012em; }
.cx h2 { font-size: var(--t-16); font-weight: 600; }
.cx h3 { font-size: var(--t-14); font-weight: 600; }
.cx p { margin: 0; }
.cx a { color: var(--c-accent); text-decoration: none; }
.cx a:hover { color: var(--c-accent-hover); text-decoration: underline; }
:where(.cx) button, :where(.cx) input, :where(.cx) select, :where(.cx) textarea { font: inherit; color: inherit; }
.cx :focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.cx table { border-collapse: collapse; }
.cx hr { border: 0; border-top: 1px solid var(--c-line); margin: var(--s-2) 0; }
.cx code, .cx-mono { font-family: var(--f-mono); font-size: var(--t-13); }
.cx-muted { color: var(--c-text-2); }
.cx-faint { color: var(--c-text-3); }
.cx-num { font-variant-numeric: tabular-nums; }
.cx-nowrap { white-space: nowrap; }
.cx-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.cx-skip { position: absolute; left: var(--s-2); top: -60px; z-index: 200; padding: var(--s-2) var(--s-3); background: var(--c-surface); color: var(--c-accent); border-radius: var(--r-md); box-shadow: var(--e-2); }
.cx-skip:focus { top: var(--s-2); }
/* the hidden attribute always wins over component display rules (search box, SSO panel, filter chips, tab panes) */
[hidden] { display: none !important; }

/* Lucide icons: 24-unit grid, stroke 1.75, round caps and joins, currentColor */
.cx-icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.cx-icon.is-20 { width: 20px; height: 20px; }
.cx-icon.is-14 { width: 14px; height: 14px; }

/* ============================================================ shell: top bar (52 px, navy-950, 3 px Gate accent rule) */
.cx-top { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: var(--s-2); height: 52px; padding: 0 var(--s-3) 3px var(--s-2); background: var(--c-navy-950); background-image: var(--g-topbar); color: var(--c-on-dark); box-shadow: inset 0 1px 0 rgba(127,176,255,.22), inset 0 -3px 0 var(--c-gate); }
.cx-top a { color: var(--c-on-dark); }
.cx-top a:hover { text-decoration: none; }
.cx-top-btn { position: relative; display: inline-flex; align-items: center; gap: var(--s-2); height: 36px; min-width: 36px; padding: 0 var(--s-2); border: 0; border-radius: var(--r-md); background: none; color: var(--c-on-dark); font-size: var(--t-13); white-space: nowrap; cursor: pointer; }
.cx-top-btn:hover, .cx-top-btn[aria-expanded="true"] { background: var(--c-navy-800); }
.cx-top-btn .cx-icon { color: var(--c-on-dark-2); }
.cx-top-btn.is-icon { justify-content: center; padding: 0; }
.cx-top-btn:disabled { cursor: default; }
.cx-top-btn:disabled:hover { background: none; }
.cx-menu-toggle { display: none; }
.cx-top .cx-brand { gap: var(--s-2); padding: 0 var(--s-2); font-size: var(--t-16); font-weight: 600; letter-spacing: .01em; }
.cx-brand .cx-mark { width: 22px; height: 22px; color: var(--c-accent-on-dark); }
.cx-brand-product { display: inline-flex; align-items: center; gap: 6px; height: 24px; margin-left: 2px; padding-left: var(--s-2); border-left: 1px solid var(--c-navy-700); color: var(--c-on-dark); font-weight: 500; font-size: var(--t-14); }
.cx-brand-product::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c-gate); }
.cx-org { max-width: 320px; }
.cx-org-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cx-org-kind { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--c-navy-700); color: var(--c-on-dark); font-size: var(--t-12); font-weight: 600; }
.cx-org.is-client .cx-org-kind { background: var(--c-accent-on-dark); color: var(--c-navy-950); }
.cx-top-spacer { flex: 1; }
.cx-top-search { position: relative; display: flex; align-items: center; flex: 0 1 380px; min-width: 180px; }
.cx-top-search .cx-icon { position: absolute; left: 10px; color: var(--c-on-dark-2); pointer-events: none; }
.cx-top-search input { width: 100%; height: 34px; padding: 0 36px 0 32px; border: 1px solid var(--c-navy-700); border-radius: var(--r-md); background: var(--c-navy-900); color: var(--c-on-dark); }
.cx-top-search input::placeholder { color: var(--c-on-dark-2); }
.cx-top-search input:focus { outline: none; border-color: var(--c-accent-on-dark); box-shadow: 0 0 0 2px rgba(127,176,255,.35); }
.cx-top-search kbd { position: absolute; right: 8px; min-width: 20px; padding: 0 5px; border: 1px solid var(--c-navy-700); border-radius: var(--r-sm); color: var(--c-on-dark-2); font: 500 var(--t-12)/18px var(--f-sans); text-align: center; }
.cx-badge { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #d92d20; color: #fff; font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; }
.cx-avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--c-navy-700); color: var(--c-on-dark); font-size: var(--t-12); font-weight: 600; flex: none; }
.cx-usermenu-head .cx-avatar { background: var(--c-accent-soft); color: var(--c-accent); }
.cx-user-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================ shell: frame and left menu (CITADEL-DESIGN-SYSTEM.md §8)
   Microsoft 365 admin center model with Citadel branding: light full-height menu (#f3f4f6), 20 px icons, 40 px rows,
   groups that expand with a chevron to show sub-items, "≡" toggle at the top that collapses to a 60 px icon rail.
   Current item: white, 3 px accent bar on the left, semibold. */
:root { --cx-side-bg: var(--c-sidebar, #f4f6fa); --cx-side-hover: #e8ecf5; }
.cx-frame { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 52px); background: linear-gradient(to right, var(--cx-side-bg) 247px, var(--c-line) 247px, var(--c-line) 248px, transparent 248px); }
.cx-side { position: sticky; top: 52px; height: calc(100vh - 52px); display: flex; flex-direction: column; border-right: 1px solid var(--c-line); background: var(--cx-side-bg); color: var(--c-text); z-index: 40; }
.cx-side-top { padding: var(--s-1) var(--s-2) 0; }
.cx-side-scroll { flex: 1; overflow-y: auto; padding: var(--s-1) 0 var(--s-4); scrollbar-color: var(--c-line-2) transparent; }
.cx-collapse { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 40px; border: 0; border-radius: var(--r-md); background: none; color: var(--c-text); cursor: pointer; }
.cx-collapse .cx-icon { width: 20px; height: 20px; }
.cx-collapse:hover { background: var(--cx-side-hover); }
.cx .cx-nav-item, .cx-nav-head { position: relative; display: flex; align-items: center; gap: var(--s-3); width: calc(100% - 16px); min-height: 40px; margin: 0 var(--s-2); padding: 0 var(--s-3) 0 12px; border: 0; border-radius: var(--r-md); background: none; color: var(--c-text); font: 400 var(--t-14)/1.3 var(--f-sans); text-align: left; cursor: pointer; }
.cx-nav-item .cx-icon, .cx-nav-head .cx-icon { width: 20px; height: 20px; color: var(--c-text-2); }
.cx .cx-nav-item:hover, .cx-nav-head:hover { background: var(--cx-side-hover); color: var(--c-ink); text-decoration: none; }
.cx .cx-nav-item.is-sub { min-height: 36px; padding-left: 44px; }
.cx .cx-nav-item.is-current { background: var(--c-surface); color: var(--c-ink); font-weight: 600; box-shadow: var(--e-1); }
.cx-nav-item.is-current::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--c-accent); }
.cx-nav-item.is-current .cx-icon { color: var(--c-accent); }
.cx-nav-head.has-current { font-weight: 600; color: var(--c-ink); }
.cx-nav-head .cx-chev { width: 16px; height: 16px; margin-left: auto; transition: transform .15s ease; }
.cx-nav-head[aria-expanded="true"] .cx-chev { transform: rotate(180deg); }
.cx-nav-dot { width: 7px; height: 7px; border-radius: 50%; background: #d92d20; flex: none; }
.cx-nav-items[hidden] { display: none; }
.cx-nav-items { padding-bottom: var(--s-1); }
.cx-nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-nav-count { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: #d92d20; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.cx-nav-single, .cx-nav-group { margin: 0; }
.cx-side-backdrop { display: none; }

/* collapsed icon rail (desktop and tablet): top-level icons only; a group icon expands the menu and opens the group */
@media (min-width: 768px) {
  .cx-app.is-collapsed .cx-frame { grid-template-columns: 60px minmax(0, 1fr); background: linear-gradient(to right, var(--cx-side-bg) 59px, var(--c-line) 59px, var(--c-line) 60px, transparent 60px); }
  .cx-app.is-collapsed .cx-side-top { padding: var(--s-1) 8px 0; }
  .cx-app.is-collapsed .cx-nav-item, .cx-app.is-collapsed .cx-nav-head { justify-content: center; width: 44px; margin: 0 8px; padding: 0; }
  .cx-app.is-collapsed .cx-nav-label, .cx-app.is-collapsed .cx-nav-head .cx-chev, .cx-app.is-collapsed .cx-nav-items { display: none; }
  .cx-app.is-collapsed .cx-nav-count { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; line-height: 16px; }
  .cx-app.is-collapsed .cx-nav-dot { position: absolute; top: 9px; right: 9px; }
  .cx-app.is-collapsed .cx-nav-head.has-current { background: var(--c-surface); box-shadow: var(--e-1); }
  .cx-app.is-collapsed .cx-nav-head.has-current .cx-icon { color: var(--c-accent); }
  .cx-app.is-collapsed .cx-nav-head.has-current::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--c-accent); }
}

/* ============================================================ page frame */
.cx-content { min-width: 0; padding: 0 var(--s-6) var(--s-12); }
.cx-context { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin: 0 calc(-1 * var(--s-6)) var(--s-1); padding: var(--s-2) var(--s-6); border-bottom: 1px solid var(--c-line); background: var(--c-surface); color: var(--c-text-2); font-size: var(--t-13); }
.cx-context .cx-icon { color: var(--c-text-3); }
.cx-context strong { color: var(--c-ink); font-weight: 600; }
.cx-context-kind { display: inline-flex; align-items: center; height: 22px; padding: 0 var(--s-2); border-radius: 11px; background: var(--c-muted-bg); color: var(--c-text); font-size: var(--t-12); font-weight: 600; white-space: nowrap; }
.cx-context.is-client { border-bottom-color: #b9cdf3; background: var(--c-accent-soft); }
.cx-context.is-client .cx-context-kind { background: var(--c-accent); color: #fff; }
.cx-context .cx-grow { flex: 1 1 260px; min-width: 0; }
.cx-context .cx-btn { height: 28px; font-size: var(--t-13); }
.cx-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1); margin: var(--s-3) 0 var(--s-2); padding: 0; list-style: none; color: var(--c-text-3); font-size: var(--t-13); }
.cx-crumbs li { display: inline-flex; align-items: center; gap: var(--s-1); min-width: 0; }
.cx-crumbs li + li::before { content: "/"; color: var(--c-line-2); margin-right: var(--s-1); }
.cx-crumbs a { color: var(--c-text-2); }
.cx-crumbs [aria-current] { color: var(--c-text); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-banners:not(:empty) { display: grid; gap: var(--s-2); margin-bottom: var(--s-4); }
.cx-banners > .cx-banner-stop { order: -1; }  /* an active emergency stop always comes first */
.cx-page { min-width: 0; }
.cx-pagehead { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s-3) var(--s-4); margin-bottom: var(--s-4); padding: var(--s-4) var(--s-5); border: 1px solid var(--c-band-line, #e6ebf4); border-radius: var(--r-lg); background: linear-gradient(180deg, #f9fbff, var(--c-band, #f6f8fc)); }
.cx-pagehead-text { flex: 1 1 320px; min-width: 0; }
.cx-pagehead h1 { overflow-wrap: anywhere; }
.cx-pagehead-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s-2); margin-top: 2px; color: var(--c-text-2); }
.cx-pagehead-meta > span:not(.cx-chip):not(.cx-status) + span:not(.cx-chip):not(.cx-status)::before { content: "·"; margin-right: var(--s-2); color: var(--c-text-3); }
.cx-pagehead-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s-2); }
.cx-stack { display: grid; gap: var(--s-4); min-width: 0; }
.cx-cols { display: grid; gap: var(--s-4); grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.cx-cols-main { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; }
.cx-cols > *, .cx-cols-main > * { min-width: 0; }
.cx-mt { margin-top: var(--s-4); }
.cx-mt-sm { margin-top: var(--s-2); }
.cx-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.cx-row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); }
.cx-grow { flex: 1; min-width: 0; }

/* ============================================================ controls */
.cx-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); height: var(--ctl-h); padding: 0 var(--s-3); border: 1px solid var(--c-line-2); border-radius: var(--r-md); background: var(--c-surface); color: var(--c-text); font: 500 var(--t-14)/1 var(--f-sans); white-space: nowrap; cursor: pointer; text-decoration: none; }
.cx a.cx-btn { color: var(--c-text); }
.cx .cx-btn:hover { background: var(--c-surface-2); border-color: #b8bec8; color: var(--c-ink); text-decoration: none; }
.cx .cx-btn-primary, .cx a.cx-btn-primary { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.cx .cx-btn-primary:hover { background: var(--c-accent-hover); border-color: var(--c-accent-hover); color: #fff; }
.cx .cx-btn-danger, .cx a.cx-btn-danger { background: var(--c-surface); border-color: #e6a39d; color: var(--c-bad); }
.cx .cx-btn-danger:hover { background: var(--c-bad-bg); border-color: var(--c-bad); color: var(--c-bad); }
.cx .cx-btn-ghost { border-color: transparent; background: transparent; }
.cx .cx-btn-ghost:hover { background: var(--c-muted-bg); border-color: transparent; }
.cx-btn-sm { height: 28px; padding: 0 var(--s-2); font-size: var(--t-13); }
.cx-btn:disabled, .cx-btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.cx-btn-link { padding: 0; border: 0; background: none; color: var(--c-accent); font: inherit; cursor: pointer; }
.cx-btn-link:hover { text-decoration: underline; }
.cx-iconbtn { display: inline-grid; place-items: center; width: var(--ctl-h); height: var(--ctl-h); padding: 0; border: 1px solid transparent; border-radius: var(--r-md); background: none; color: var(--c-text-2); cursor: pointer; flex: none; }
.cx-iconbtn:hover, .cx-iconbtn[aria-expanded="true"] { background: var(--c-muted-bg); color: var(--c-ink); }
.cx-iconbtn:disabled { opacity: .4; cursor: not-allowed; }
.cx-iconbtn.is-bordered { border-color: var(--c-line-2); background: var(--c-surface); }

/* status: small label chip, semantic colour plus text (never colour alone) */
.cx-chip, .cx-status { display: inline-flex; align-items: center; gap: 6px; height: 22px; max-width: 100%; padding: 0 var(--s-2); border-radius: 11px; background: var(--c-muted-bg); color: var(--c-muted); font-size: var(--t-12); font-weight: 600; line-height: 1; white-space: nowrap; vertical-align: middle; }
.cx-chip::before, .cx-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.cx-chip > span, .cx-status > span { overflow: hidden; text-overflow: ellipsis; }
.cx-chip.is-ok, .cx-status.is-ok { background: var(--c-ok-bg); color: var(--c-ok); }
.cx-chip.is-warn, .cx-status.is-warn { background: var(--c-warn-bg); color: var(--c-warn); }
.cx-chip.is-crit, .cx-status.is-crit { background: var(--c-bad-bg); color: var(--c-bad); }
.cx-chip.is-info, .cx-status.is-info, .cx-chip.is-pending, .cx-status.is-pending { background: var(--c-info-bg); color: var(--c-info); }
.cx-chip.is-unknown, .cx-status.is-unknown, .cx-chip.is-off, .cx-status.is-off { background: var(--c-muted-bg); color: var(--c-muted); }
.cx-chip.is-plain::before { content: none; }
.cx-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border: 1px solid var(--c-line-2); border-radius: var(--r-sm); color: var(--c-text-2); font-size: var(--t-12); font-weight: 500; white-space: nowrap; }
/* ticket priority uses the same chip */
.cx-sev { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 var(--s-2); border-radius: 11px; font-size: var(--t-12); font-weight: 600; white-space: nowrap; background: var(--c-muted-bg); color: var(--c-muted); }
.cx-sev::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cx-sev.is-crit { background: var(--c-bad-bg); color: var(--c-bad); }
.cx-sev.is-high { background: var(--c-warn-bg); color: var(--c-warn); }
.cx-sev.is-med { background: var(--c-info-bg); color: var(--c-info); }

/* ============================================================ menus and popovers (kit.js; keyboard: arrows, Escape returns focus) */
.cx-menu { position: absolute; z-index: 300; min-width: 200px; max-width: min(340px, calc(100vw - 16px)); padding: var(--s-1) 0; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-md); box-shadow: var(--e-3); color: var(--c-text); }
.cx-menu button, .cx-menu a { display: flex; align-items: center; gap: var(--s-2); width: 100%; min-height: 34px; padding: var(--s-1) var(--s-3); border: 0; background: none; color: var(--c-text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; white-space: nowrap; }
.cx .cx-menu button:hover, .cx .cx-menu button:focus-visible, .cx .cx-menu a:hover, .cx .cx-menu a:focus-visible { background: var(--c-surface-2); color: var(--c-ink); text-decoration: none; box-shadow: none; }
.cx-menu .cx-icon { color: var(--c-text-3); }
.cx-menu .is-danger, .cx-menu .is-danger .cx-icon { color: var(--c-bad); }
.cx-menu .is-on { font-weight: 600; }
.cx-menu .cx-menu-check { margin-left: auto; color: var(--c-accent); }
.cx-menu .cx-menu-count { margin-left: auto; color: var(--c-text-3); font-size: var(--t-13); font-variant-numeric: tabular-nums; }
.cx-menu .is-on .cx-menu-count { color: var(--c-accent); }
.cx-menu-label { padding: var(--s-2) var(--s-3) var(--s-1); color: var(--c-text-3); font-size: var(--t-12); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.cx-menu hr { margin: var(--s-1) 0; }
.cx-pop { position: absolute; z-index: 300; max-height: min(70vh, 560px); overflow: auto; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-md); box-shadow: var(--e-3); color: var(--c-text); }
.cx-pop-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--c-line); color: var(--c-ink); font-weight: 600; }
.cx-pop-group { padding: var(--s-2) var(--s-3) var(--s-1); color: var(--c-text-3); font-size: var(--t-12); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.cx .cx-pop-item { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: var(--s-3); width: 100%; min-height: 44px; padding: var(--s-2) var(--s-3); border: 0; background: none; color: var(--c-text); text-align: left; cursor: pointer; }
.cx .cx-pop-item:hover, .cx .cx-pop-item.is-active, .cx .cx-pop-item:focus-visible { background: var(--c-surface-2); text-decoration: none; box-shadow: none; }
.cx-pop-item .cx-icon { color: var(--c-text-3); }
.cx-pop-item strong { display: block; overflow: hidden; color: var(--c-ink); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.cx-pop-item small { display: block; overflow: hidden; color: var(--c-text-3); font-size: var(--t-13); text-overflow: ellipsis; white-space: nowrap; }
.cx-pop-item.is-crit .cx-icon, .cx-pop-item.is-danger strong, .cx-pop-item.is-danger .cx-icon { color: var(--c-bad); }
.cx-pop-item.is-warn .cx-icon { color: var(--c-warn); }
.cx-pop-item.is-info .cx-icon { color: var(--c-info); }
.cx-pop-item.is-ok .cx-icon { color: var(--c-ok); }
.cx-pop-item.is-current strong { font-weight: 600; }
.cx .cx-pop-item[aria-disabled="true"] { cursor: default; }
.cx .cx-pop-item[aria-disabled="true"]:hover { background: none; }
.cx-pop-meta { color: var(--c-text-3); font-size: var(--t-13); white-space: nowrap; }
.cx-pop-empty { padding: var(--s-4) var(--s-3); color: var(--c-text-2); }
.cx-pop-foot { padding: var(--s-2) var(--s-3); border-top: 1px solid var(--c-line); color: var(--c-text-3); font-size: var(--t-13); }
.cx .cx-pop-link { display: block; color: var(--c-accent); }
.cx-pop-sep { margin: var(--s-1) 0; border: 0; border-top: 1px solid var(--c-line); }
.cx-usermenu-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); border-bottom: 1px solid var(--c-line); }
.cx-usermenu-head > div { min-width: 0; }
.cx-usermenu-head strong, .cx-usermenu-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-usermenu-head strong { color: var(--c-ink); }
.cx-usermenu-head small { color: var(--c-text-2); font-size: var(--t-13); }
.cx-product-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c-line-2); justify-self: center; }
.cx-product-dot.is-gate { background: var(--c-gate); }
.cx-product-dot.is-frame { background: var(--c-frame); }
.cx-product-dot.is-lite { background: var(--c-lite); }
.cx-product-dot.is-pen { background: var(--c-pen); }
.cx-product-dot.is-hub { background: var(--c-navy-700); }
.cx-keys { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px var(--s-3); margin: 0; padding: var(--s-1) var(--s-3) var(--s-3); }
.cx-keys dt { min-width: 30px; padding: 0 6px; border: 1px solid var(--c-line-2); border-radius: var(--r-sm); background: var(--c-surface-2); color: var(--c-text-2); font-size: var(--t-12); line-height: 20px; text-align: center; }
.cx-keys dd { margin: 0; color: var(--c-text-2); }
.cx-tooltip { position: fixed; z-index: 400; padding: 4px 8px; border-radius: var(--r-sm); background: var(--c-navy-950); color: var(--c-on-dark); font-size: var(--t-12); pointer-events: none; white-space: nowrap; }

/* ============================================================ sections (panels) */
.cx-panel { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); box-shadow: var(--e-1); min-width: 0; }
.cx-panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-3); min-height: 48px; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--c-line); }
.cx-panel-head h2 { flex: 1 1 auto; min-width: 0; font-size: var(--t-16); }
.cx-panel-sub { color: var(--c-text-3); font-size: var(--t-13); }
.cx-panel-head .cx-panel-link { font-size: var(--t-13); white-space: nowrap; }
.cx-panel-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.cx-panel-body { padding: var(--s-4); min-width: 0; }
.cx-panel-body > * + * { margin-top: var(--s-3); }
.cx-panel-body.is-flush { padding: 0; }
.cx-panel-body.is-flush > * + * { margin-top: 0; }
.cx-panel-foot, .cx-panel-note { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--c-line); color: var(--c-text-2); font-size: var(--t-13); }
.cx-panel.is-danger { border-color: #f1c4bf; }
.cx-panel.is-danger .cx-panel-head { border-bottom-color: #f1c4bf; }
.cx-panel.is-danger .cx-panel-head h2 { color: var(--c-bad); }
.cx-section-title { margin: var(--s-4) 0 var(--s-2); color: var(--c-ink); font-size: var(--t-14); font-weight: 600; }
.cx-section-title:first-child { margin-top: 0; }
.cx-page > .cx-panel, .cx-page > .cx-gridwrap, .cx-page > .cx-cols, .cx-page > .cx-cols-main, .cx-page > .cx-stack, .cx-page > .cx-alert { margin-bottom: var(--s-4); }

/* label / value rows */
.cx-props { display: grid; grid-template-columns: minmax(130px, 36%) minmax(0, 1fr); margin: 0; }
.cx-props > dt, .cx-props > dd { margin: 0; padding: 9px 0; border-top: 1px solid var(--c-line); }
.cx-props > dt:first-of-type, .cx-props > dt:first-of-type + dd { border-top: 0; }
.cx-props > dt { padding-right: var(--s-3); color: var(--c-text-2); font-size: var(--t-13); font-weight: 500; }
.cx-props > dd { color: var(--c-text); overflow-wrap: anywhere; }
.cx-panel-body.is-flush > .cx-props > dt, .cx-panel-body.is-flush > .cx-props > dd { padding-left: var(--s-4); padding-right: var(--s-4); }

/* activity list */
.cx-feed { margin: 0; padding: 0; list-style: none; }
.cx-feed > li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: var(--s-3); align-items: start; padding: 10px var(--s-4); border-top: 1px solid var(--c-line); }
.cx-feed > li:first-child { border-top: 0; }
.cx-feed > li > .cx-icon { width: 28px; height: 28px; padding: 6px; border-radius: 50%; background: var(--c-muted-bg); color: var(--c-text-2); }
.cx-feed > li > .cx-icon.cx-feed-crit { background: var(--c-bad-bg); color: var(--c-bad); }
.cx-feed > li > .cx-icon.cx-feed-warn { background: var(--c-warn-bg); color: var(--c-warn); }
.cx-feed > li > .cx-icon.cx-feed-ok { background: var(--c-ok-bg); color: var(--c-ok); }
.cx-feed > li > .cx-icon.cx-feed-info { background: var(--c-info-bg); color: var(--c-info); }
.cx .cx-feed-title { display: block; color: var(--c-ink); font-weight: 500; overflow-wrap: anywhere; }
.cx a.cx-feed-title:hover { color: var(--c-accent); }
.cx-feed-meta { color: var(--c-text-3); font-size: var(--t-13); overflow-wrap: anywhere; }
.cx-feed-time { color: var(--c-text-3); font-size: var(--t-13); white-space: nowrap; }

/* work queue rows on overviews: what needs doing, each linking into a filtered list */
/* task panels (§8 home): short lists with actions at the foot */
.cx-task { display: flex; flex-direction: column; }
.cx-task > .cx-panel-body { flex: 1; }
.cx-task-icon { box-sizing: content-box; width: 16px; height: 16px; padding: 6px; border-radius: var(--r-md); background: var(--c-accent-soft); color: var(--c-accent); }
.cx-tasklist { margin: 0; padding: 0; list-style: none; }
.cx-tasklist > li { display: flex; align-items: center; gap: var(--s-3); min-height: 52px; padding: var(--s-2) var(--s-4); border-top: 1px solid var(--c-line); }
.cx-tasklist > li:first-child { border-top: 0; }
.cx-task-main { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.cx-task-title { overflow: hidden; color: var(--c-ink); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.cx a.cx-task-title { color: var(--c-accent); }
.cx-task-sub { overflow: hidden; color: var(--c-text-3); font-size: var(--t-13); text-overflow: ellipsis; white-space: nowrap; }
.cx-task-end { flex: none; color: var(--c-text-2); font-size: var(--t-13); font-variant-numeric: tabular-nums; }
.cx-tasklist > li > .cx-chip, .cx-tasklist > li > .cx-status, .cx-tasklist > li > .cx-sev { flex: none; }
.cx-task-empty { padding: var(--s-4); color: var(--c-text-2); }
.cx-task-note { padding: var(--s-2) var(--s-4) var(--s-3); color: var(--c-text-3); font-size: var(--t-13); }
.cx-task-actions { gap: var(--s-2); }
.cx-queue { margin: 0; padding: 0; list-style: none; }
.cx-queue > li { border-top: 1px solid var(--c-line); }
.cx-queue > li:first-child { border-top: 0; }
.cx .cx-queue a, .cx-queue .cx-queue-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto 16px; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-4); color: var(--c-text); }
.cx .cx-queue a:hover { background: var(--c-surface-2); text-decoration: none; }
.cx-queue .cx-queue-row { grid-template-columns: 20px minmax(0, 1fr) auto; }
.cx-queue-title { display: block; color: var(--c-ink); font-weight: 500; }
.cx-queue-text { display: block; color: var(--c-text-2); font-size: var(--t-13); }
.cx-queue-count { color: var(--c-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.cx-queue .cx-icon { color: var(--c-text-3); }
.cx-queue .is-crit .cx-queue-icon { color: var(--c-bad); }
.cx-queue .is-warn .cx-queue-icon { color: var(--c-warn); }
.cx-queue .is-ok .cx-queue-icon { color: var(--c-ok); }
.cx-queue .is-info .cx-queue-icon { color: var(--c-info); }

/* ============================================================ lists: toolbar, filter chips, table, footer */
.cx-gridwrap { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); box-shadow: var(--e-1); min-width: 0; }
.cx-gridwrap.is-embedded { border: 0; border-radius: 0; box-shadow: none; }
.cx-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--c-line); }
.cx-toolbar-sep { width: 1px; height: 22px; background: var(--c-line); }
.cx-toolbar-right { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; }
.cx-toolbar-search { position: relative; display: flex; align-items: center; flex: 0 1 280px; min-width: 200px; }
/* command bar (§8): flat icon+text commands, accent icons; the page's primary command keeps its filled style */
.cx-cmds { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-width: 0; }
.cx-cmdbar { flex-wrap: nowrap; align-items: flex-start; padding: var(--s-2) var(--s-3); }
.cx-cmdbar > .cx-cmds { flex: 1 1 auto; }
.cx-cmdbar > .cx-toolbar-right { flex: none; }
.cx-gridwrap:not(.has-selection) .cx-cmdbar .cx-bulk { display: none; }
.cx .cx-cmds .cx-btn:not(.cx-btn-primary) { border-color: transparent; background: transparent; padding: 0 var(--s-2); }
.cx .cx-cmds .cx-btn:not(.cx-btn-primary):hover { background: var(--c-muted-bg); border-color: transparent; }
.cx-cmds .cx-btn:not(.cx-btn-primary):not(.cx-btn-danger) .cx-icon { color: var(--c-accent); }
.cx-cmds .cx-toolbar-sep { margin: 0 var(--s-1); }
.cx-cmds .cx-selinfo { margin-left: var(--s-2); }
.cx-toolbar-right .cx-filter-btn { border-color: transparent; background: transparent; }
.cx .cx-toolbar-right .cx-filter-btn:hover { background: var(--c-muted-bg); border-color: transparent; }
.cx-toolbar-right .cx-filter-btn .cx-icon { color: var(--c-accent); }
.cx-toolbar-search .cx-icon { position: absolute; left: 10px; color: var(--c-text-3); pointer-events: none; }
.cx-toolbar-search input { width: 100%; height: var(--ctl-h); padding: 0 var(--s-3) 0 32px; border: 1px solid var(--c-line-2); border-radius: var(--r-md); background: var(--c-surface); color: var(--c-text); }
.cx-toolbar-search input:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
.cx-filter-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--c-accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; }
.cx-selinfo { display: none; align-items: center; gap: var(--s-2); color: var(--c-ink); font-weight: 500; }
.cx-gridwrap.has-selection .cx-selinfo { display: inline-flex; }
.cx-selinfo button { padding: 0; border: 0; background: none; color: var(--c-accent); cursor: pointer; }
.cx-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--c-line); background: var(--c-surface-2); font-size: var(--t-13); }
.cx-filters-label { color: var(--c-text-3); }
.cx-fchip { display: inline-flex; align-items: center; gap: 2px; height: 26px; padding: 0 2px 0 var(--s-2); border: 1px solid #b9cdf3; border-radius: 13px; background: var(--c-accent-soft); color: var(--c-ink); }
.cx-fchip b { font-weight: 600; }
.cx-fchip button { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--c-text-2); cursor: pointer; }
.cx-fchip button:hover { background: #cfdcf6; color: var(--c-ink); }
.cx-fchip .cx-icon { width: 14px; height: 14px; vertical-align: 0; }
.cx-tablescroll { position: relative; min-width: 0; }
.cx-tablescroll.is-scroll, .cx-panel-body .cx-tablescroll, .cx-drawer-body .cx-tablescroll, .cx-modal-body .cx-tablescroll { overflow-x: auto; }
.cx-tablescroll.is-scroll .cx-table th, .cx-panel-body .cx-table th, .cx-drawer-body .cx-table th, .cx-modal-body .cx-table th { position: static; }
.cx-table { width: 100%; background: var(--c-surface); }
.cx-table th, .cx-table td { height: var(--row-h); padding: 6px var(--s-3); border-bottom: 1px solid var(--c-line); text-align: left; vertical-align: middle; }
.cx-table th { position: sticky; top: 52px; z-index: 5; height: 38px; background: var(--c-surface-2); color: var(--c-text-2); font-size: var(--t-13); font-weight: 600; white-space: nowrap; }
.cx-table th:first-child, .cx-table td:first-child { padding-left: var(--s-4); }
.cx-table th:last-child, .cx-table td:last-child { padding-right: var(--s-4); }
.cx-table tbody tr:last-child td { border-bottom: 0; }
.cx-table tbody tr:hover td { background: #fafbfc; }
.cx-table tr.is-link { cursor: pointer; }
.cx-table tr.is-selected td { background: var(--c-accent-soft); }
.cx-table tr.is-open td { background: var(--c-accent-soft); }
.cx-table tr.is-open td:first-child { box-shadow: inset 3px 0 0 var(--c-accent); }
.cx-table th .cx-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.cx-table th .cx-sort:hover { color: var(--c-ink); }
.cx-table th .cx-sort .cx-icon { width: 14px; height: 14px; color: var(--c-text-3); }
.cx-table th[aria-sort] { color: var(--c-ink); }
.cx-table th[aria-sort] .cx-sort .cx-icon { color: var(--c-accent); }
.cx-table .cx-right, .cx-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.cx-table th.cx-right .cx-sort { flex-direction: row-reverse; }
.cx-table .cx-check { width: 40px; }
.cx-table .cx-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--c-accent); vertical-align: middle; }
.cx-table td.cx-wrap { white-space: normal; min-width: 200px; max-width: 460px; overflow-wrap: anywhere; }
.cx-table .cx-col-actions { width: 52px; text-align: right; }
.cx-table .cx-rowmenu { width: 30px; height: 30px; }
.cx-table .cx-empty-row td { height: auto; padding: 0; }
.cx-table.is-busy tbody { opacity: .55; }
.cx-cell-main { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.cx-cell-main > div { min-width: 0; }
.cx-cell-stack { display: grid; min-width: 0; }
.cx-cell-stack > strong { overflow: hidden; color: var(--c-ink); font-weight: 500; text-overflow: ellipsis; }
.cx-table td:first-child .cx-cell-stack > strong, .cx-table td:first-child .cx-cell-stack > a, .cx-table .cx-cell-main .cx-cell-stack > strong, .cx-table .cx-cell-main .cx-cell-stack > a { white-space: nowrap; }
.cx-table .cx-cell-main { min-width: 170px; }
.cx-table .cx-cell-stack { min-width: 150px; }
.cx-table td.cx-wrap .cx-cell-stack > strong, .cx-table td.cx-wrap .cx-cell-stack > a { white-space: normal; }
.cx-cell-stack > .cx-chip, .cx-cell-stack > .cx-sev, .cx-cell-stack > .cx-status { justify-self: start; }
.cx-cell-sub { display: block; overflow: hidden; color: var(--c-text-3); font-size: var(--t-13); text-overflow: ellipsis; white-space: nowrap; }
.cx .cx-cell-link { color: var(--c-ink); font-weight: 500; }
.cx-table td:not(.cx-wrap) .cx-cell-link, .cx-table td:not(.cx-wrap) > .cx-mono { white-space: nowrap; }
.cx-ostype { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-md); background: var(--c-muted-bg); color: var(--c-text-2); flex: none; }
.cx-pager { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); padding: var(--s-2) var(--s-4); border-top: 1px solid var(--c-line); color: var(--c-text-2); font-size: var(--t-13); }
.cx-pager .cx-grow { flex: 1; }
.cx-pager select { height: 28px; padding: 0 22px 0 6px; border: 1px solid var(--c-line-2); border-radius: var(--r-sm); background: var(--c-surface); }
.cx-pager-nav { display: inline-flex; gap: var(--s-1); }
.cx-pager-nav .cx-btn { height: 28px; padding: 0 var(--s-2); font-size: var(--t-13); }

/* plain charts (only where a trend matters) and usage bars drawn in SVG */
.cx-chart { width: 100%; }
.cx-chart svg { display: block; width: 100%; height: auto; }
.cx-chart text { fill: var(--c-text-3); font-size: 11px; font-family: var(--f-sans); }
.cx-gridline { stroke: var(--c-line); stroke-width: 1; }
.cx-chart-legend { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); margin-top: var(--s-2); color: var(--c-text-2); font-size: var(--t-13); }
.cx-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cx-chart-legend svg { width: 10px; height: 10px; }
.cx-hbars { display: grid; gap: var(--s-3); margin: 0; padding: 0; list-style: none; }
.cx-hbars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--s-3); }
.cx-hbars li > span:first-child { overflow: hidden; color: var(--c-text); text-overflow: ellipsis; white-space: nowrap; }
.cx-hbar-val { color: var(--c-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.cx-hbars svg { grid-column: 1 / -1; width: 100%; height: 6px; }
.cx-meter { display: inline-flex; align-items: center; gap: var(--s-2); min-width: 120px; }
.cx-meter svg { width: 90px; height: 6px; flex: none; }
.cx-meter-text { min-width: 40px; color: var(--c-text); font-size: var(--t-13); font-variant-numeric: tabular-nums; }
.cx-track { fill: var(--c-muted-bg); }
.cx-fill { fill: var(--c-accent); }
.cx-fill.is-ok { fill: var(--c-ok); }
.cx-fill.is-warn { fill: #c98a00; }
.cx-fill.is-crit { fill: var(--c-bad); }
.cx-fill.is-muted { fill: #9aa3af; }
.cx-fill.is-info { fill: var(--c-accent); }

/* ============================================================ records */
.cx-record-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s-3) var(--s-4); margin-bottom: var(--s-3); }
.cx-record-id, .cx-devhead { display: flex; align-items: center; gap: var(--s-3); flex: 1 1 320px; min-width: 0; }
.cx-record-icon, .cx-devhead-icon, .cx-drawer-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-lg); background: var(--c-accent-soft); color: var(--c-accent); flex: none; }
.cx-record-icon .cx-icon, .cx-devhead-icon .cx-icon, .cx-drawer-icon .cx-icon { width: 22px; height: 22px; }
.cx-record-type { color: var(--c-text-3); font-size: var(--t-13); }
.cx-record-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); min-width: 0; }
.cx-record-title h1 { overflow-wrap: anywhere; }
.cx-record-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s-2); margin-top: 2px; color: var(--c-text-2); font-size: var(--t-13); }
.cx-record-meta > span:not(.cx-chip):not(.cx-status) + span:not(.cx-chip):not(.cx-status)::before { content: "·"; margin-right: var(--s-2); color: var(--c-text-3); }
.cx-record-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.cx-facts { display: flex; flex-wrap: wrap; margin: 0 0 var(--s-4); padding: var(--s-3) 0; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); }
.cx-facts > div { min-width: 140px; padding: 0 var(--s-4); border-left: 1px solid var(--c-line); }
.cx-facts > div:first-child { border-left: 0; }
.cx-facts dt { color: var(--c-text-3); font-size: var(--t-12); font-weight: 500; }
.cx-facts dd { margin: 2px 0 0; color: var(--c-ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-panel-body > .cx-facts { margin: 0; border: 0; padding: 0; }
.cx-panel-body > .cx-facts > div:first-child { padding-left: 0; }
.cx-tabs { display: flex; gap: var(--s-1); margin: 0 0 var(--s-4); border-bottom: 1px solid var(--c-line); overflow-x: auto; scrollbar-width: thin; }
.cx .cx-tab { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 var(--s-3); border: 0; border-bottom: 2px solid transparent; background: none; color: var(--c-text-2); font-weight: 500; white-space: nowrap; cursor: pointer; }
.cx .cx-tab:hover { color: var(--c-ink); text-decoration: none; border-bottom-color: var(--c-line-2); }
.cx .cx-tab.is-active { color: var(--c-ink); border-bottom-color: var(--c-accent); font-weight: 600; }
.cx-tab-count { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--c-muted-bg); color: var(--c-text-2); font-size: var(--t-12); line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.cx-tab.is-active .cx-tab-count { background: var(--c-accent-soft); color: var(--c-accent); }
.cx-secret { display: block; margin: 0; padding: var(--s-2) var(--s-3); border: 1px dashed var(--c-line-2); border-radius: var(--r-sm); background: var(--c-surface-2); color: var(--c-ink); font: 600 var(--t-13)/1.5 var(--f-mono); overflow-wrap: anywhere; user-select: all; }
.cx-pre { margin: 0; padding: var(--s-3); max-height: 420px; overflow: auto; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface-2); font: var(--t-13)/1.5 var(--f-mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ============================================================ forms */
.cx-field { display: grid; gap: 6px; min-width: 0; }
.cx-field > label, .cx-field > .cx-label { color: var(--c-ink); font-size: var(--t-13); font-weight: 500; }
.cx-input, .cx-select, .cx-textarea { width: 100%; min-height: var(--ctl-h); padding: 6px 10px; border: 1px solid var(--c-line-2); border-radius: var(--r-md); background: var(--c-surface); color: var(--c-text); }
.cx-textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.cx-select { padding-right: 28px; }
.cx-input:focus, .cx-select:focus, .cx-textarea:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
.cx-input[readonly] { background: var(--c-surface-2); color: var(--c-text-2); }
.cx-input[aria-invalid="true"], .cx-select[aria-invalid="true"], .cx-textarea[aria-invalid="true"] { border-color: var(--c-bad); }
.cx-input.cx-code-input { max-width: 180px; font: 600 var(--t-18)/1 var(--f-mono); letter-spacing: .2em; }
.cx-field-help { color: var(--c-text-2); font-size: var(--t-13); }
.cx-form-error { color: var(--c-bad); font-size: var(--t-13); font-weight: 500; }
.cx-form-error:empty { display: none; }
.cx-form-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.cx-check-row { display: flex; align-items: flex-start; gap: var(--s-2); color: var(--c-text); cursor: pointer; }
.cx-check-row input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--c-accent); flex: none; }
.cx-form-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s-2); margin: var(--s-4) calc(-1 * var(--s-4)) calc(-1 * var(--s-4)); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--c-line); background: var(--c-surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.cx-details summary { color: var(--c-text-2); font-size: var(--t-13); cursor: pointer; }
.cx-details[open] summary { margin-bottom: var(--s-2); }

/* ============================================================ dialogs and drawers (focus moves in, is trapped, and returns) */
.cx-modal-backdrop { position: fixed; inset: 0; z-index: 250; display: grid; place-items: start center; padding: 8vh var(--s-4) var(--s-4); overflow-y: auto; background: rgba(10, 20, 38, .45); }
.cx-modal { width: min(520px, 100%); background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); box-shadow: var(--e-3); }
.cx-modal.is-wide { width: min(760px, 100%); }
.cx-modal-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-4) 0 var(--s-5); }
.cx-modal-head h2 { flex: 1; min-width: 0; font-size: var(--t-18); }
.cx-modal-desc { padding: var(--s-1) var(--s-5) 0; color: var(--c-text-2); }
.cx-modal-body { padding: var(--s-4) var(--s-5); }
.cx-modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--c-line); background: var(--c-surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.cx-modal-form { display: grid; gap: var(--s-4); }
.cx-modal-form .cx-alert { margin: 0; }
.cx-modal-list { margin: 0; padding-left: var(--s-5); color: var(--c-text-2); }
.cx-drawer-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(10, 20, 38, .32); }
.cx-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 210; display: flex; flex-direction: column; width: min(560px, 100vw); background: var(--c-surface); border-left: 1px solid var(--c-line); box-shadow: var(--e-3); }
.cx-drawer-head { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-4) var(--s-4) var(--s-3) var(--s-5); border-bottom: 1px solid var(--c-line); }
.cx-drawer-icon { width: 40px; height: 40px; }
.cx-drawer-title { flex: 1; min-width: 0; }
.cx-drawer-full { flex: none; margin-top: 2px; }
.cx-drawer-full .cx-icon { color: var(--c-accent); }
.cx-drawer-title h2 { font-size: var(--t-18); overflow-wrap: anywhere; }
.cx-drawer-title p { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s-2); margin-top: 4px; color: var(--c-text-2); font-size: var(--t-13); }
.cx-drawer-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); padding: var(--s-3) var(--s-5); border-bottom: 1px solid var(--c-line); background: var(--c-surface-2); }
.cx-drawer > .cx-tabs { margin: 0; padding: 0 var(--s-4); flex: none; }
.cx-drawer-body { flex: 1; overflow-y: auto; padding: var(--s-4) var(--s-5) var(--s-6); }
.cx-drawer-body > * + * { margin-top: var(--s-3); }
.cx-drawer-body > .cx-section-title { margin-top: var(--s-5); }
.cx-drawer-body > .cx-section-title:first-child { margin-top: 0; }
.cx-drawer-para { color: var(--c-text-2); }
.cx-prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.cx-drawer-foot-link { padding-top: var(--s-3); border-top: 1px solid var(--c-line); }

/* ============================================================ feedback */
.cx-alert { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3) var(--s-4); border: 1px solid var(--c-line); border-left-width: 4px; border-radius: var(--r-md); background: var(--c-surface); color: var(--c-ink); }
.cx-alert > .cx-icon { margin-top: 2px; }
.cx-alert > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cx-alert strong { font-weight: 600; }
.cx-alert.is-ok { border-color: #b7dfc5; border-left-color: var(--c-ok); background: var(--c-ok-bg); }
.cx-alert.is-ok > .cx-icon { color: var(--c-ok); }
.cx-alert.is-warn { border-color: #ecd28f; border-left-color: #c98a00; background: var(--c-warn-bg); }
.cx-alert.is-warn > .cx-icon { color: var(--c-warn); }
.cx-alert.is-crit { border-color: #f1c4bf; border-left-color: var(--c-bad); background: var(--c-bad-bg); }
.cx-alert.is-crit > .cx-icon { color: var(--c-bad); }
.cx-alert.is-info { border-color: #b9cdf3; border-left-color: var(--c-accent); background: var(--c-info-bg); }
.cx-alert.is-info > .cx-icon { color: var(--c-info); }
.cx-alert .cx-alert-close { width: 26px; height: 26px; margin: -3px -8px -3px 0; }
.cx-toasts { position: fixed; right: var(--s-4); bottom: var(--s-4); z-index: 350; display: grid; gap: var(--s-2); width: min(420px, calc(100vw - 32px)); }
.cx-toast { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3) var(--s-2) var(--s-3) var(--s-4); border: 1px solid var(--c-line); border-left: 4px solid var(--c-accent); border-radius: var(--r-md); background: var(--c-surface); box-shadow: var(--e-3); color: var(--c-ink); }
.cx-toast > .cx-icon { margin-top: 2px; color: var(--c-info); }
.cx-toast > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cx-toast .cx-iconbtn { width: 26px; height: 26px; }
.cx-toast.is-ok { border-left-color: var(--c-ok); }
.cx-toast.is-ok > .cx-icon { color: var(--c-ok); }
.cx-toast.is-warn { border-left-color: #c98a00; }
.cx-toast.is-warn > .cx-icon { color: var(--c-warn); }
.cx-toast.is-crit { border-left-color: var(--c-bad); }
.cx-toast.is-crit > .cx-icon { color: var(--c-bad); }

/* ============================================================ states: loading, empty, error, unavailable, no permission */
.cx-empty { display: grid; justify-items: start; gap: var(--s-2); padding: var(--s-6) var(--s-4); color: var(--c-text-2); }
.cx-empty > .cx-icon { width: 36px; height: 36px; padding: 9px; border-radius: 50%; background: var(--c-muted-bg); color: var(--c-text-2); }
.cx-empty > strong { color: var(--c-ink); font-weight: 600; }
.cx-empty > span { max-width: 600px; }
.cx-empty > .cx-btn, .cx-empty > a.cx-btn { margin-top: var(--s-1); }
.cx-empty.is-error > .cx-icon { background: var(--c-bad-bg); color: var(--c-bad); }
.cx-empty.is-unavailable > .cx-icon, .cx-empty.is-denied > .cx-icon { background: var(--c-warn-bg); color: var(--c-warn); }
.cx-page > .cx-empty { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); }
.cx-loading { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-4) 0; color: var(--c-text-2); }
.cx-loading::before { content: ""; width: 14px; height: 14px; border: 2px solid var(--c-line-2); border-top-color: var(--c-accent); border-radius: 50%; animation: cx-spin .8s linear infinite; flex: none; }
.cx-panel-body > .cx-loading { padding: 0; }
@keyframes cx-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cx-loading::before, .cx-nav-head .cx-chev, .cx-side { animation: none; transition: none; } }

/* ============================================================ sign-in screens */
body.cx-auth-body { background: var(--c-bg); }
.cx-auth { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.cx-auth-bar { display: flex; align-items: center; height: 52px; padding: 0 var(--s-4) 3px; background: var(--c-navy-950); background-image: var(--g-topbar); color: var(--c-on-dark); box-shadow: inset 0 1px 0 rgba(127,176,255,.22), inset 0 -3px 0 var(--c-gate); }
.cx .cx-brand { display: inline-flex; align-items: center; gap: var(--s-2); }
.cx-auth-bar .cx-brand { color: var(--c-on-dark); font-size: var(--t-16); font-weight: 600; }
.cx-auth-main { flex: 1; display: grid; place-items: start center; padding: var(--s-12) var(--s-4) var(--s-8); }
.cx-auth-card { width: 100%; max-width: 420px; padding: var(--s-6); background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); box-shadow: var(--e-2); }
.cx-auth-card.is-wide { max-width: 560px; }
.cx-auth-card h1 { font-size: var(--t-20); }
.cx-auth-card .cx-auth-lead { margin: var(--s-1) 0 var(--s-5); color: var(--c-text-2); }
.cx-auth-card .cx-auth-kicker { margin-bottom: 2px; color: var(--c-text-3); font-size: var(--t-12); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.cx-auth-card .cx-auth-error { margin: 0 0 var(--s-4); }
.cx-auth-sso { display: grid; gap: var(--s-2); }
.cx .cx-auth-submit { width: 100%; height: 40px; }
.cx-auth-card .cx-auth-divider { margin: var(--s-5) 0 var(--s-3); padding-top: var(--s-4); border-top: 1px solid var(--c-line); color: var(--c-text-2); }
.cx-auth-form { display: grid; gap: var(--s-4); }
.cx-auth-card > .cx-btn:not(.cx-auth-submit), .cx-auth-actions { margin-top: var(--s-4); }
.cx-auth-card .cx-auth-footnote { margin-top: var(--s-5); color: var(--c-text-3); font-size: var(--t-13); }
.cx-auth-legal { padding: var(--s-4); color: var(--c-text-3); font-size: var(--t-13); text-align: center; }
.cx-auth-legal a { color: var(--c-text-2); }
/* step 2 of sign-in: six digit boxes over one real input (design system §9; same look as the dashboard's .otp) */
.cx-otp { position: relative; display: block; width: 100%; max-width: 336px; }
.cx-otp-boxes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s-2); }
.cx-otp-box { display: grid; place-items: center; min-width: 0; height: 52px; border: 1px solid var(--c-line-2); border-radius: var(--r-md); background: var(--c-surface); color: var(--c-ink); font: 600 var(--t-20)/1 var(--f-mono); transition: border-color var(--t-fast, 160ms), box-shadow var(--t-fast, 160ms); }
.cx-otp-box.is-filled { border-color: var(--c-text-3); }
.cx-otp-box.is-active { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
.cx .cx-otp-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; background: transparent; color: transparent; caret-color: transparent; font-size: 16px; letter-spacing: 40px; outline: none; box-shadow: none; }
.cx .cx-otp-input:focus-visible { box-shadow: none; }
.cx-otp-input::selection { background: transparent; }
.cx-auth-alt { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2) var(--s-4); margin-top: var(--s-4); font-size: var(--t-13); }
@media (max-width: 400px) { .cx-otp-box { height: 46px; } .cx-otp-boxes { gap: 6px; } }
@media (prefers-reduced-motion: reduce) { .cx-otp-box { transition: none; } }
.cx-mfa-qr { display: grid; justify-items: start; gap: var(--s-2); margin: var(--s-4) 0; }
.cx-mfa-qr-code canvas { display: block; max-width: 200px; height: auto; border: 1px solid var(--c-line); border-radius: var(--r-sm); }
.cx-backup-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0 0 var(--s-4); padding: var(--s-3); border: 1px dashed var(--c-line-2); border-radius: var(--r-md); background: var(--c-surface-2); list-style: none; font: 600 var(--t-14)/1.6 var(--f-mono); }
.cx-busy { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; }
.cx-busy-inner { display: grid; justify-items: center; gap: var(--s-3); }
.cx-busy .cx-brand { color: var(--c-ink); font-size: var(--t-16); font-weight: 600; }
.cx-busy .cx-mark, .cx-auth-bar .cx-mark { width: 24px; height: 24px; }
.cx-busy .cx-mark { color: var(--c-accent); }
.cx-auth-bar .cx-mark { color: var(--c-accent-on-dark); }

/* ============================================================ premium layer (design system §9) */
.cx-table td, .cx-table th, .cx-task-end, .cx-nav-count, .cx-badge { font-variant-numeric: tabular-nums; }
.cx-panel { border-color: #e3e7ef; }
.cx-tasklist > li, .cx-table tr.is-link, .cx-queue a { transition: background-color var(--t-fast, 160ms), box-shadow var(--t-fast, 160ms); }
.cx-table tr.is-link:hover td { background: var(--c-row-hover, #f6f9ff); }
@media (prefers-reduced-motion: reduce) { .cx-tasklist > li, .cx-table tr.is-link, .cx-queue a { transition: none; } }

/* ============================================================ responsive */
@media (max-width: 1100px) {
  .cx-cols-main { grid-template-columns: minmax(0, 1fr); }
  .cx-tablescroll { overflow-x: auto; }
  .cx-table th { position: static; }
  .cx-top-search { flex-basis: 260px; }
}
@media (max-width: 900px) {
  .cx-cols { grid-template-columns: minmax(0, 1fr); }
  .cx-user-name, .cx-top .cx-hide-tablet { display: none; }
  .cx-org { max-width: 220px; }
}
@media (max-width: 767px) {
  .cx-frame, .cx-app.is-collapsed .cx-frame { grid-template-columns: minmax(0, 1fr); background: none; }
  .cx-top { gap: var(--s-1); padding: 0 var(--s-1) 3px; }
  .cx-menu-toggle { display: inline-flex; width: 44px; height: 44px; justify-content: center; padding: 0; }
  .cx-top .cx-brand-word, .cx-top .cx-hide-phone { display: none; }
  .cx-brand-product { border-left: 0; padding-left: 0; }
  .cx-org { max-width: 150px; margin-left: var(--s-1); }
  .cx-org .cx-org-kind { display: none; }
  .cx-record-actions { width: 100%; }
  .cx-top-search { display: none; }
  .cx-top-search.is-open { display: flex; position: absolute; left: var(--s-2); right: var(--s-2); top: 8px; z-index: 5; }
  .cx-top-btn.is-icon { width: 44px; height: 44px; }
  .cx-side { position: fixed; top: 52px; left: 0; bottom: 0; width: 280px; height: auto; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--e-3); z-index: 90; visibility: hidden; }
  .cx-app.is-mobile-open .cx-side { transform: none; visibility: visible; }
  .cx-app.is-mobile-open .cx-side-backdrop { display: block; position: fixed; inset: 52px 0 0 0; z-index: 85; background: rgba(10, 20, 38, .45); }
  .cx-side-top { display: none; }
  .cx-side-scroll { padding-top: var(--s-2); }
  .cx .cx-nav-item, .cx-nav-head, .cx .cx-nav-item.is-sub { min-height: 44px; }
  .cx-content { padding: 0 var(--s-3) var(--s-8); }
  .cx-context { margin: 0 calc(-1 * var(--s-3)) var(--s-1); padding: var(--s-2) var(--s-3); }
  .cx-pagehead { flex-direction: column; gap: var(--s-3); }
  .cx-pagehead-text { flex-basis: auto; }
  .cx-pagehead-actions { justify-content: flex-start; }
  .cx-btn { height: var(--ctl-h-touch); }
  .cx-btn-sm { height: 36px; }
  .cx-iconbtn { width: var(--ctl-h-touch); height: var(--ctl-h-touch); }
  .cx-table .cx-rowmenu { width: 44px; height: 44px; }
  .cx-input, .cx-select, .cx-textarea, .cx-toolbar-search input { min-height: var(--ctl-h-touch); font-size: var(--t-16); }
  .cx-toolbar-search { flex: 1 1 auto; min-width: 0; }
  .cx-toolbar { padding: var(--s-2); }
  .cx-cmdbar .cx-toolbar-right { flex: 1 1 100%; order: -1; margin-left: 0; }
  .cx-cmdbar { flex-wrap: wrap; }
  .cx-toolbar-right { margin-left: auto; }
  .cx-gridwrap:not(.has-selection) .cx-toolbar .cx-bulk { display: none; }
  .cx-props { grid-template-columns: minmax(0, 1fr); }
  .cx-props > dt { padding-bottom: 0; }
  .cx-props > dd { border-top: 0; padding-top: 2px; }
  .cx-facts > div { flex: 1 1 45%; padding: var(--s-2) var(--s-3); border-left: 0; }
  .cx-menu button, .cx-menu a { min-height: 44px; }
  .cx-pager-nav .cx-btn { height: 36px; }
  .cx-modal-backdrop { padding: var(--s-3); }
  .cx-modal-head { padding: var(--s-3) var(--s-3) 0 var(--s-4); }
  .cx-modal-desc, .cx-modal-body { padding-left: var(--s-4); padding-right: var(--s-4); }
  .cx-modal-foot { padding: var(--s-3) var(--s-4); }
  .cx-drawer-head { padding-left: var(--s-4); }
  .cx-drawer-head { flex-wrap: wrap; }
  .cx-drawer-head > .cx-iconbtn { order: 2; }
  .cx-drawer-head > .cx-drawer-title { flex-basis: calc(100% - 112px); }  /* name keeps the first line; "Open full page" wraps below it */
  .cx-drawer-full { order: 3; margin-left: 52px; }
  .cx-drawer-actions, .cx-drawer-body { padding-left: var(--s-4); padding-right: var(--s-4); }
  .cx-auth-main { padding: var(--s-6) var(--s-3); }
  .cx-auth-card { padding: var(--s-5) var(--s-4); }
  .cx-crumbs [aria-current] { max-width: 220px; }
}
@media print {
  .cx-top, .cx-side, .cx-context, .cx-crumbs, .cx-pagehead-actions, .cx-toasts { display: none; }
  .cx-frame { display: block; }
  .cx-content { padding: 0; }
}

/* ============================================================ summary line (replaces KPI tiles) */
.cx-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-5); margin: 0 0 var(--s-3); color: var(--c-text-2); }
.cx-summary-item b { color: var(--c-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.cx a.cx-summary-item { color: var(--c-text-2); }
.cx a.cx-summary-item:hover { color: var(--c-accent); }
.cx-summary-item.is-crit b { color: var(--c-bad); }
.cx-summary-item.is-warn b { color: var(--c-warn); }
.cx-summary-item.is-ok b { color: var(--c-ok); }
.cx-panel-body > .cx-summary:last-child, .cx-drawer-body > .cx-summary:last-child { margin-bottom: 0; }
.cx-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c-text-3); vertical-align: 1px; }
.cx-dot.is-ok { background: var(--c-ok); }
.cx-dot.is-warn { background: #c98a00; }
.cx-dot.is-crit { background: var(--c-bad); }

/* ============================================================ 12-column layout used by a few pages (layout only, no tiles) */
.cx-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s-4); align-items: start; }
.cx-grid > * { min-width: 0; }
.cx-w-3 { grid-column: span 3; } .cx-w-4 { grid-column: span 4; } .cx-w-5 { grid-column: span 5; } .cx-w-6 { grid-column: span 6; }
.cx-w-7 { grid-column: span 7; } .cx-w-8 { grid-column: span 8; } .cx-w-12 { grid-column: 1 / -1; }
@media (max-width: 1100px) { .cx-w-3, .cx-w-4 { grid-column: span 6; } .cx-w-5, .cx-w-6, .cx-w-7, .cx-w-8 { grid-column: 1 / -1; } }
@media (max-width: 767px) { .cx-grid > [class*="cx-w-"] { grid-column: 1 / -1; } }
/* command bar below 900 px: search, filter and columns on their own first line, commands below */
@media (max-width: 900px) {
  .cx-cmdbar { flex-wrap: wrap; }
  .cx-cmdbar .cx-toolbar-right { flex: 1 1 100%; order: -1; margin-left: 0; }
  .cx-cmdbar .cx-toolbar-search { flex: 1 1 auto; min-width: 0; }
}
/* task panels share a row's height; below 900 px each takes the full width so its rows stay readable */
.cx-grid > .cx-task { align-self: stretch; }
@media (max-width: 900px) { .cx-grid > .cx-task { grid-column: 1 / -1; } }

/* the row "⋯" menu stays in view when a wide table scrolls inside its region */
.cx-table td.cx-col-actions, .cx-table th.cx-col-actions { position: sticky; right: 0; z-index: 4; background: var(--c-surface); }
.cx-table th.cx-col-actions { z-index: 6; background: var(--c-surface-2); }
.cx-tablescroll.is-scroll .cx-col-actions { box-shadow: inset 1px 0 0 var(--c-line); }
@media (max-width: 1100px) { .cx-tablescroll .cx-col-actions { box-shadow: inset 1px 0 0 var(--c-line); } }
.cx-tablescroll.is-scroll .cx-table th.cx-col-actions, .cx-panel-body .cx-table th.cx-col-actions, .cx-drawer-body .cx-table th.cx-col-actions { position: sticky; top: auto; }
@media (max-width: 1100px) { .cx-tablescroll .cx-table th.cx-col-actions { top: auto; } }
@media (max-width: 1100px) { .cx-grid:has(> .cx-w-8) > .cx-w-4 { grid-column: 1 / -1; } }
@media (max-width: 767px) { .cx-pagehead { padding: var(--s-3); } }
