/* ============================================================================
   UNEXT Console  ·  console.css (Round 36, contract section 8)
   The shell (sidebar, product switcher, top bar), the console pages
   (overview, releases, admins, audit), the command palette, and the restyle
   of the existing card/table/badge look to design/admin-redesign.
   Every class here starts with cx- (people.css is free to use its own).
   ========================================================================== */

:root {
  --cx-line: #26313b;
  --cx-line2: #323f4b;
  --cx-panel: #171e25;
  --cx-panel2: #1d252d;
  --cx-hover: #222c35;
  --cx-bg2: #0c1014;
  --cx-side: #13191f;
  --cx-acc2: #7cc6ff;
  --cx-accS: rgba(47, 166, 255, 0.14);
  --cx-utc: #a68bff;
  --cx-utcS: rgba(166, 139, 255, 0.15);
  --cx-goodS: rgba(60, 193, 115, 0.14);
  --cx-warnS: rgba(240, 177, 62, 0.15);
  --cx-badS: rgba(240, 87, 75, 0.15);
  --cx-mono: 'IBM Plex Mono', Consolas, monospace;
  --cx-sw: 264px;
}

/* ---- Shell ------------------------------------------------------------------- */

.cx-shell { display: grid; grid-template-columns: var(--cx-sw) minmax(0, 1fr); height: 100vh; }
body:has(.cx-shell) { overflow: hidden; }

.cx-side {
  background: var(--cx-side);
  border-right: 1px solid var(--cx-line);
  display: flex; flex-direction: column; min-height: 0;
}
.cx-brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 14px; }
.cx-logo {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #2fa6ff, #1663d6);
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  box-shadow: 0 6px 18px rgba(47, 166, 255, 0.35);
}
.cx-brand-tx { min-width: 0; }
.cx-brand-tx b { display: block; font-size: 15px; letter-spacing: 0.06em; line-height: 1.3; }
.cx-brand-tx small { color: var(--text-faint); font-size: 11.5px; }
.cx-brand .badge-mock { margin-left: auto; }

.cx-switch {
  margin: 2px 14px 12px; padding: 4px; gap: 4px;
  background: var(--cx-bg2); border: 1px solid var(--cx-line); border-radius: 12px;
  display: grid; grid-template-columns: 1.25fr 1fr;
}
.cx-sw-btn {
  border: 0; background: none; border-radius: 9px; padding: 8px 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  color: var(--text-dim); font-weight: 600; font-size: 13px;
}
.cx-sw-btn:hover { color: var(--text); }
.cx-sw-btn.on { background: var(--cx-panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--cx-line2); }
.cx-main-tag {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em;
  background: var(--cx-accS); color: var(--cx-acc2); padding: 1px 5px; border-radius: 5px;
}
.cx-pdot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.cx-pdot-unext { background: var(--accent); }
.cx-pdot-utcnext { background: var(--cx-utc); }

.cx-ksearch {
  margin: 0 14px 10px; display: flex; align-items: center; gap: 9px; padding: 8px 11px;
  border: 1px solid var(--cx-line); border-radius: 9px; background: var(--cx-panel);
  color: var(--text-faint); cursor: pointer; font-size: 13px; text-align: left;
}
.cx-ksearch:hover { border-color: var(--cx-line2); color: var(--text-dim); }
.cx-ksearch-tx { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-kbd {
  font: 600 11px var(--cx-mono); border: 1px solid var(--cx-line2); border-bottom-width: 2px;
  border-radius: 5px; padding: 0 5px; color: var(--text-dim); white-space: nowrap;
}
.cx-ic16 svg, .cx-ic16 { width: 16px; height: 16px; display: inline-flex; flex: none; }
.cx-ic15 svg, .cx-ic15 { width: 15px; height: 15px; display: inline-flex; flex: none; }
.cx-ic18 svg, .cx-ic18 { width: 18px; height: 18px; display: inline-flex; flex: none; color: var(--text-dim); }

.cx-nav { flex: 1; overflow: auto; padding: 4px 10px 12px; }
.cx-nav-inner { display: flex; flex-direction: column; }
.cx-ng { margin-top: 12px; order: 0; transition: opacity var(--t); }
.cx-ng-unext { order: 1; }
.cx-ng-utcnext { order: 2; }
.cx-ng:last-child { order: 3; }
body[data-product='utcnext'] .cx-ng-utcnext { order: 1; }
body[data-product='utcnext'] .cx-ng-unext { order: 2; opacity: 0.62; }
body[data-product='unext'] .cx-ng-utcnext { opacity: 0.62; }
.cx-ng:hover { opacity: 1; }
.cx-ng-h {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--text-faint); text-transform: uppercase;
}
.cx-ng-h .cx-pdot { width: 7px; height: 7px; }
.cx-ng-h em { font-style: normal; margin-left: auto; font-size: 10px; letter-spacing: 0.02em; font-weight: 600; text-transform: none; }
.cx-nl {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
  color: var(--text-dim); font-weight: 500; position: relative; text-decoration: none;
}
.cx-nl:hover { background: var(--cx-hover); color: var(--text); }
.cx-nl.on { background: var(--cx-accS); color: var(--text); }
.cx-nl.on::before {
  content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 3px; background: var(--accent);
}
.cx-ng-utcnext .cx-nl.on { background: var(--cx-utcS); }
.cx-ng-utcnext .cx-nl.on::before { background: var(--cx-utc); }
.cx-nl-ic, .cx-nl-ic svg { width: 18px; height: 18px; display: inline-flex; flex: none; }
.cx-nl-tx { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-ct {
  margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text-faint);
  background: var(--cx-panel2); border-radius: 6px; padding: 0 6px;
}
.cx-ct-w { background: var(--cx-warnS); color: var(--warn); }

.cx-me { border-top: 1px solid var(--cx-line); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.cx-who { min-width: 0; flex: 1; }
.cx-who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-who small { display: block; color: var(--text-faint); font-size: 11.5px; line-height: 1.4; }

.cx-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.cx-top {
  height: 60px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 26px;
  border-bottom: 1px solid var(--cx-line); background: rgba(16, 20, 24, 0.78); backdrop-filter: blur(8px);
}
.cx-top-tx { min-width: 0; }
.cx-crumb { color: var(--text-faint); font-size: 12.5px; line-height: 1.3; }
.cx-crumb b { color: var(--text); font-weight: 600; }
.cx-title { font-size: 17px; font-weight: 600; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-sp { flex: 1; }
.cx-env {
  display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-dim);
  border: 1px solid var(--cx-line); border-radius: 20px; padding: 4px 11px; white-space: nowrap;
}
.cx-env i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--cx-goodS); }
.cx-env-mock i { background: var(--warn); box-shadow: 0 0 0 3px var(--cx-warnS); }
.cx-ibtn {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--cx-line);
  background: var(--cx-panel); display: grid; place-items: center; color: var(--text-dim); cursor: pointer; flex: none;
}
.cx-ibtn:hover { color: var(--text); border-color: var(--cx-line2); }
.cx-ibtn svg { width: 18px; height: 18px; }
.cx-menu-btn { display: none; }
.cx-nav-scrim { display: none; }
.cx-scroll { flex: 1; overflow: auto; }
.cx-content { padding: 24px 26px 48px; max-width: 1372px; margin: 0 auto; width: 100%; }

/* ---- Base restyle inside the console ------------------------------------------ */

.cx-shell .card { border-color: var(--cx-line); border-radius: 10px; box-shadow: none; background: var(--cx-panel); }
.cx-shell .card + .card { margin-top: 16px; }
.cx-shell .card-head { border-bottom-color: var(--cx-line); padding: 14px 16px; }
.cx-shell .card-title { font-size: 14px; }
.cx-shell .table th {
  background: var(--cx-panel); text-transform: none; letter-spacing: 0.03em; color: var(--text-faint);
  padding: 10px 12px; border-bottom-color: var(--cx-line);
}
.cx-shell .table td { padding: 10px 12px; border-bottom-color: var(--cx-line); }
.cx-shell .table tbody tr:hover td { background: var(--cx-hover); }
.cx-shell .stat-tile { border-color: var(--cx-line); box-shadow: none; background: var(--cx-panel); }
.cx-shell .btn-primary { background: var(--accent); border-color: var(--accent); color: #04121f; }
.cx-shell .btn-primary:hover { background: #4cb3ff; }
.cx-page-utc .card-head { border-top: 2px solid rgba(166, 139, 255, 0.35); }

.ux-mono, .cx-mono { font-family: var(--cx-mono); letter-spacing: 0.02em; }
.ux-code-cell { font-weight: 600; letter-spacing: 0.04em; white-space: nowrap; }
.ux-serial { color: var(--text-dim); }
.ux-st-warn { color: var(--warn); background: var(--cx-warnS); border-color: rgba(240, 177, 62, 0.4); }
.ux-type-trial { color: var(--warn); background: var(--cx-warnS); border-color: rgba(240, 177, 62, 0.3); }
.ux-type-paid { color: var(--cx-acc2); background: var(--cx-accS); border-color: rgba(47, 166, 255, 0.3); }
.ux-type-free { color: var(--good); background: var(--cx-goodS); border-color: rgba(60, 193, 115, 0.3); }
td.ux-dl-warn { color: var(--warn); }
td.ux-dl-bad { color: var(--bad); }
.cx-kpi-d.ux-dl-warn { color: var(--warn); }

/* ---- Building blocks ------------------------------------------------------------ */

.cx-grid { display: grid; gap: 16px; }
.cx-grid > * { min-width: 0; }
.cx-grid > .card + .card { margin-top: 0; }
.cx-g-kpi { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.cx-g-kpi.cx-kpi-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cx-g-kpi.cx-kpi-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cx-g-2 { grid-template-columns: 1.65fr 1fr; }
.cx-g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cx-g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cx-mt { margin-top: 16px; }
.cx-mt-s { margin-top: 10px; }
.cx-mb { margin-bottom: 16px; }
.cx-mb:empty { display: none; }
.cx-row { display: flex; align-items: center; gap: 12px; }
.cx-row-gap { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.cx-mt-s.cx-row-gap { justify-content: flex-start; }
.cx-between { justify-content: space-between; }
.cx-end { justify-content: flex-end; }
.cx-hr { height: 1px; background: var(--cx-line); margin: 14px 0; }
.cx-empty, .cx-dim { color: var(--text-faint); font-size: 12.5px; }
.cx-small { font-size: 12.5px; }
.cx-strong { font-weight: 600; }
.cx-pad-y { padding: 18px 0; }
.cx-up, .cx-good { color: var(--good); }
.cx-wn { color: var(--warn); }
.cx-bad { color: var(--bad); }
.cx-link-dim { color: var(--text-faint); font-size: 12.5px; }
.cx-link-dim:hover { color: var(--text); }

.cx-card { display: flex; flex-direction: column; }
.cx-card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; flex-wrap: wrap; }
.cx-card-h h3 { font-size: 14px; font-weight: 600; margin: 0; }
.cx-sub { color: var(--text-faint); font-size: 12px; }
.cx-card-b { padding: 14px 16px 16px; flex: 1; }
.cx-card > .table-scroll { margin-top: 10px; }
.cx-count-badge { background: var(--cx-warnS); color: var(--warn); border-color: rgba(240, 177, 62, 0.3); }

.cx-kpi { padding: 14px 15px; position: relative; overflow: hidden; }
.cx-kpi-lb { display: flex; align-items: center; gap: 7px; color: var(--text-dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; }
.cx-pt { font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em; padding: 1px 6px; border-radius: 5px; flex: none; }
.cx-pt-u { background: var(--cx-accS); color: var(--cx-acc2); }
.cx-pt-t { background: var(--cx-utcS); color: var(--cx-utc); }
.cx-kpi-vr { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 6px; }
.cx-kpi-v { font-size: 27px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.cx-kpi-plain .cx-kpi-v { margin-top: 6px; }
.cx-kpi-d { font-size: 12px; color: var(--text-faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-spark { flex: none; width: 74px; height: 28px; margin-bottom: 4px; }

.cx-seg {
  display: inline-flex; background: var(--cx-bg2); border: 1px solid var(--cx-line); border-radius: 8px; padding: 3px;
  max-width: 100%; overflow-x: auto;
}
.cx-seg button {
  border: 0; background: none; padding: 4px 11px; border-radius: 6px; font-size: 12.5px;
  color: var(--text-dim); cursor: pointer; white-space: nowrap;
}
.cx-seg button:hover { color: var(--text); }
.cx-seg button.on { background: var(--cx-panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--cx-line2); }

.cx-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--cx-line); }
.cx-inp {
  display: flex; align-items: center; gap: 8px; background: var(--cx-bg2); border: 1px solid var(--cx-line);
  border-radius: 8px; padding: 7px 11px; color: var(--text-faint); min-width: 260px;
}
.cx-inp:focus-within { border-color: var(--accent); }
.cx-inp input { background: none; border: 0; outline: 0; flex: 1; min-width: 0; color: var(--text); }
.cx-toolbar .role-select { padding-top: 5px; padding-bottom: 5px; }

.cx-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-dim); flex-wrap: wrap; margin-bottom: 8px; }
.cx-legend i, .cx-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.cx-legend-col { flex-direction: column; gap: 8px; margin: 0; }
.cx-chart-box { display: flex; flex-direction: column; flex: 1; }
.cx-chart-d, .cx-chart-m { width: 100%; height: auto; display: block; }
.cx-chart-m { display: none; }
.cx-cstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: auto; padding-top: 14px; }
.cx-cstats div { background: var(--cx-bg2); border: 1px solid var(--cx-line); border-radius: 8px; padding: 9px 11px; min-width: 0; }
.cx-cstats b { display: block; font-size: 17px; font-weight: 600; }
.cx-cstats small { color: var(--text-faint); font-size: 11.5px; white-space: nowrap; }

.cx-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cx-big > span:first-child { font-size: 30px; font-weight: 600; }
.cx-stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; margin: 14px 0 12px; background: var(--cx-line); }
.cx-kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; margin: 0; }
.cx-kv dt { color: var(--text-faint); }
.cx-kv dd { margin: 0; min-width: 0; }
.cx-donut { width: 140px; height: 140px; flex: none; }
.cx-donut-row { align-items: center; gap: 18px; flex-wrap: wrap; }
.cx-bars { width: 100%; height: auto; display: block; }

.cx-alert { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--cx-line); align-items: flex-start; }
.cx-alert:last-child { border-bottom: 0; }
.cx-alert-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.cx-alert-ico svg { width: 16px; height: 16px; }
.cx-ico-w { background: var(--cx-warnS); color: var(--warn); }
.cx-ico-b { background: var(--cx-badS); color: var(--bad); }
.cx-ico-i { background: var(--cx-accS); color: var(--accent); }
.cx-ico-p { background: var(--cx-utcS); color: var(--cx-utc); }
.cx-alert-tx { flex: 1; min-width: 0; }
.cx-alert-tx b { font-weight: 600; }
.cx-alert-tx small { display: block; color: var(--text-faint); font-size: 12px; }
.cx-alert-acts { display: flex; gap: 6px; flex: none; }
.cx-alerts-card .cx-card-b { padding-top: 6px; }

.cx-feed { padding-top: 0; }
.cx-fi { display: flex; gap: 11px; padding: 9px 0; align-items: flex-start; border-radius: 8px; }
.cx-fi-link { cursor: pointer; }
.cx-fi-link:hover .cx-fi-tx { color: var(--text); }
.cx-fi-tx { flex: 1; min-width: 0; font-size: 13px; color: #cfd8e0; overflow-wrap: anywhere; }
.cx-fi-tm { color: var(--text-faint); font-size: 11.5px; white-space: nowrap; }
.cx-pb { font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; letter-spacing: 0.04em; margin-right: 6px; vertical-align: 1px; }
.cx-pb-u { background: var(--cx-accS); color: var(--cx-acc2); }
.cx-pb-t { background: var(--cx-utcS); color: var(--cx-utc); }
.cx-pb-a { background: var(--cx-badS); color: #ff8a80; }

.cx-chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px; white-space: nowrap; border: 1px solid transparent; vertical-align: 1px;
}
.cx-chip-ok { background: var(--cx-goodS); color: var(--good); }
.cx-chip-bad { background: var(--cx-badS); color: var(--bad); }
.cx-chip-warn { background: var(--cx-warnS); color: var(--warn); border-color: rgba(240, 177, 62, 0.3); }
.cx-chip-paid { background: var(--cx-accS); color: var(--cx-acc2); border-color: rgba(47, 166, 255, 0.3); }
.cx-chip-utc { background: var(--cx-utcS); color: var(--cx-utc); border-color: rgba(166, 139, 255, 0.3); }
.cx-chip-admin { background: var(--cx-badS); color: #ff8a80; border-color: rgba(240, 87, 75, 0.3); }
.cx-chip-off { background: #232b33; color: var(--text-faint); border-color: var(--cx-line2); }

.cx-ver { margin-bottom: 12px; font-size: 13px; }
.cx-ver-bar { height: 7px; border-radius: 4px; background: var(--cx-line); margin-top: 5px; overflow: hidden; }
.cx-ver-bar i { display: block; height: 100%; border-radius: 4px; }

.cx-meter { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cx-meter-bar { width: 54px; height: 6px; border-radius: 4px; background: var(--cx-line); overflow: hidden; flex: none; }
.cx-meter-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.cx-meter.over .cx-meter-bar i { background: var(--bad); }
.cx-meter.over span:last-child { color: var(--bad); font-weight: 600; }
.cx-meter.full span:last-child { color: var(--warn); }

.cx-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cx-person-tx { min-width: 0; }
.cx-person b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-person small { display: block; color: var(--text-faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-row-static { cursor: default; }
.cx-role-sel.cx-role-unext { border-color: rgba(47, 166, 255, 0.35); }
.cx-role-sel.cx-role-utcnext { border-color: rgba(166, 139, 255, 0.35); }
.cx-matrix td, .cx-matrix th { text-align: center; }
.cx-matrix td:first-child, .cx-matrix th:first-child { text-align: left; }
.cx-yes { color: var(--good); font-weight: 700; }
.cx-no { color: var(--text-faint); }
.cx-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.cx-add-form .field-input, .cx-add-form .role-select { width: 100%; color-scheme: dark; }
.cx-add-form .cx-end { margin-top: 14px; }

/* releases */
.cx-rel { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.cx-rel-main { flex: 1; min-width: 240px; }
.cx-rel-json { flex: 1.2; min-width: 280px; }
.cx-rel-ver { font-size: 34px; font-weight: 600; line-height: 1.25; }
.cx-rel-notes { margin-top: 12px; color: #cfd8e0; }
.cx-rel-stats { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 16px; }
.cx-rel-num { font-size: 20px; font-weight: 600; }
.cx-rel-sig { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.cx-rel-hash { font-size: 13px; }
.cx-sec-t { font-size: 12px; font-weight: 700; color: var(--text-faint); letter-spacing: 0.06em; margin: 4px 0 10px; text-transform: uppercase; }
.cx-code {
  font: 12.5px/1.6 var(--cx-mono); background: var(--cx-bg2); border: 1px solid var(--cx-line);
  border-radius: 8px; padding: 12px 14px; overflow: auto; color: #c9d4de; white-space: pre;
}
.cx-code-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.cx-k { color: var(--cx-acc2); }
.cx-s { color: #9fe0b0; }
.cx-n { color: #ffcf86; }
.cx-how { color: #cfd8e0; font-size: 13px; }
.cx-cmd { display: flex; align-items: center; gap: 8px; margin-top: 12px; white-space: normal; overflow-wrap: anywhere; padding: 6px 6px 6px 12px; }
.cx-cmd span:first-child { flex: 1; }
.cx-step { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.cx-step-n {
  min-width: 24px; height: 22px; border-radius: 20px; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 600;
  background: var(--cx-accS); color: var(--cx-acc2); border: 1px solid rgba(47, 166, 255, 0.3);
}

/* audit timeline */
.cx-tl { position: relative; padding-left: 20px; }
.cx-tl::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--cx-line); }
.cx-tl-e { position: relative; padding: 0 0 14px; }
.cx-tl-e::before {
  content: ''; position: absolute; left: -19px; top: 6px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--cx-panel); border: 2px solid var(--accent);
}
.cx-tl-t::before { border-color: var(--cx-utc); }
.cx-tl-a::before { border-color: #ff8a80; }
.cx-tl-line b { font-weight: 600; }
.cx-tl-detail { color: var(--text-dim); font-size: 12.5px; overflow-wrap: anywhere; }
.cx-tl-e small { color: var(--text-faint); display: block; font-size: 11.5px; }

/* ---- Command palette -------------------------------------------------------- */

.cx-pal-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(5, 8, 11, 0.6); backdrop-filter: blur(2px); }
.cx-pal {
  position: absolute; left: 50%; top: 12vh; transform: translateX(-50%); width: 640px; max-width: calc(100% - 32px);
  background: #161d24; border: 1px solid var(--cx-line2); border-radius: 14px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
  overflow: hidden; display: flex; flex-direction: column; max-height: 76vh;
}
.cx-pal-in { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--cx-line); }
.cx-pal-in input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 16px; color: var(--text); }
.cx-pal-scope { display: flex; gap: 6px; padding: 10px 18px; border-bottom: 1px solid var(--cx-line); flex-wrap: wrap; }
.cx-pal-chip {
  font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 20px; cursor: pointer;
  background: #232b33; color: var(--text-dim); border: 1px solid var(--cx-line2);
}
.cx-pal-chip.on { background: var(--cx-accS); color: var(--cx-acc2); border-color: rgba(47, 166, 255, 0.4); }
.cx-pal-l { overflow: auto; padding: 6px 8px 10px; flex: 1; min-height: 80px; }
.cx-pal-g { font-size: 11px; font-weight: 700; color: var(--text-faint); letter-spacing: 0.07em; padding: 10px 10px 4px; }
.cx-pal-wait { font-weight: 500; letter-spacing: 0; }
.cx-pal-none { color: var(--text-faint); padding: 22px 10px; text-align: center; font-size: 13px; }
.cx-pal-i { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.cx-pal-i.on { background: var(--cx-accS); box-shadow: inset 0 0 0 1px rgba(47, 166, 255, 0.35); }
.cx-pal-tx { flex: 1; min-width: 0; }
.cx-pal-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-pal-title .cx-chip { margin-left: 6px; }
.cx-pal-i small { color: var(--text-faint); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-pal-i mark { background: none; color: var(--cx-acc2); font-weight: 600; }
.cx-pal-go { color: var(--text-faint); font-size: 11.5px; white-space: nowrap; }
.cx-pal-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--cx-panel2); display: grid; place-items: center; color: var(--text-dim); flex: none; }
.cx-pal-ic svg { width: 16px; height: 16px; }
.cx-pal-f { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--cx-line); color: var(--text-faint); font-size: 12px; align-items: center; flex-wrap: wrap; }
.cx-pal-f .cx-kbd { margin-right: 3px; }

/* ---- Read-only roles: viewers see no write buttons ----------------------------- */

body.cx-ro-unext .cx-write,
body.cx-ro-unext .ux-drawer .cx-write { display: none !important; }
body.cx-ro-utcnext .cx-page-utc .btn-del { display: none !important; }
body.cx-ro-utcnext .cx-page-utc .role-select,
body.cx-ro-utcnext .cx-page-utc .switch { pointer-events: none; opacity: 0.55; }
/* users.js also sets `disabled` on these for viewers, so the keyboard can't reach them. */

/* ---- Responsive -------------------------------------------------------------- */

@media (max-width: 1180px) {
  .cx-g-kpi, .cx-g-kpi.cx-kpi-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cx-g-2 { grid-template-columns: minmax(0, 1fr); }
  .cx-g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  body:has(.cx-shell) { overflow: auto; }
  .cx-shell { display: block; height: auto; }
  .cx-side {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--cx-sw); max-width: 86vw; z-index: 40;
    transform: translateX(-100%); transition: transform 0.2s ease;
  }
  body.cx-nav-open .cx-side { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5); }
  body.cx-nav-open .cx-nav-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(5, 8, 11, 0.55); }
  .cx-main { min-height: 100vh; }
  .cx-top { padding: 0 16px; gap: 10px; position: sticky; top: 0; z-index: 20; }
  .cx-menu-btn { display: grid; }
  .cx-crumb, .cx-env { display: none; }
  .cx-scroll { overflow: visible; }
  .cx-content { padding: 16px 16px 40px; }
  .cx-g-kpi, .cx-g-kpi.cx-kpi-4, .cx-g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cx-g-3, .cx-two { grid-template-columns: minmax(0, 1fr); }
  .cx-kpi-v { font-size: 23px; }
  .cx-spark { display: none; }
  .cx-inp { min-width: 0; flex: 1 1 100%; }
  .cx-toolbar > .cx-sp { display: none; }
  .cx-chart-d { display: none; }
  .cx-chart-m { display: block; }
  .cx-cstats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cx-alert { flex-wrap: wrap; }
  .cx-alert-acts { width: 100%; padding-left: 42px; flex-wrap: wrap; }
  .cx-rel-main, .cx-rel-json { min-width: 0; flex-basis: 100%; }
  .cx-pal { top: 5vh; max-height: 88vh; }
  .cx-pal-hint { display: none; }
  .cx-card-h { flex-wrap: wrap; }
}

/* ---- Admins page fit ------------------------------------------------------------ */

.cx-two .field + .field { margin-top: 0; }
.cx-shell .cx-role-sel { width: auto; min-width: 0; padding: 5px 26px 5px 9px; font-size: 12.5px; }
.cx-add-form .cx-role-sel { width: 100%; padding: 9px 26px 9px 11px; font-size: 13.5px; }
.cx-matrix th, .cx-matrix td { padding: 8px 6px; white-space: normal; }
.cx-matrix th:not(:first-child) { width: 64px; }
.cx-staff-table td:nth-child(4) { min-width: 110px; }
.cx-matrix { min-width: 0; }
