/* CaseZero workspace — the simple, default experience.
   Design system + layout. Every rule is scoped under #czx and uses zx- class names so the
   advanced workspace's global stylesheets can never leak in. */

html[data-ux="simple"] body #appShell { display: none !important; }
html[data-ux="advanced"] body #czx { display: none !important; }

#czx {
  --zx-bg: #f4f6f9;
  --zx-surface: #ffffff;
  --zx-sunken: #eef1f5;
  --zx-line: #e1e6ed;
  --zx-line-strong: #c9d1dc;
  --zx-ink: #0f1a2b;
  --zx-ink-2: #36435a;
  --zx-ink-3: #596579;
  --zx-ink-4: #7d8798;
  --zx-brand: #0a6b87;
  --zx-brand-hover: #085872;
  --zx-brand-soft: #e6f4f8;
  --zx-brand-line: #b3dbe6;
  --zx-ok: #14703a;
  --zx-ok-soft: #e8f6ee;
  --zx-ok-line: #b6e0c5;
  --zx-warn: #8f5500;
  --zx-warn-soft: #fff5de;
  --zx-warn-line: #f0d598;
  --zx-bad: #b42318;
  --zx-bad-soft: #fdeceb;
  --zx-bad-line: #f3c2bd;
  --zx-info: #1f4fb8;
  --zx-info-soft: #eaf0fd;
  --zx-info-line: #bccdf2;
  --zx-r: 12px;
  --zx-r-sm: 8px;
  --zx-r-lg: 16px;
  --zx-shadow: 0 1px 2px rgba(15, 26, 43, .06), 0 1px 1px rgba(15, 26, 43, .03);
  --zx-shadow-lg: 0 16px 48px rgba(15, 26, 43, .22);
  --zx-side: 250px;
  --zx-focus: 0 0 0 3px rgba(10, 107, 135, .35);

  position: relative;
  display: grid;
  grid-template-columns: var(--zx-side) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--zx-bg);
  color: var(--zx-ink);
  font: 400 14px/1.5 "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
  text-align: left;
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  &[hidden], &.zx-hidden { display: none !important; }
  *, *::before, *::after { box-sizing: border-box; }

  /* ---------- isolation: drop every global element style the advanced workspace defines ---------- */
  :is(label, span, div, p, ul, ol, li, dl, dt, dd, h1, h2, h3, h4, a, b, strong, em, small, code, pre, kbd, form, fieldset, legend, details, summary, section, article, aside, header, footer, main, nav, table, thead, tbody, tr, th, td, button, input, select, textarea, img, i, time) { all: revert; box-sizing: border-box; }
  h1, h2, h3, h4, p, ul, ol, dl, dd, figure, pre, blockquote { margin: 0; padding: 0; }
  ul, ol { list-style: none; }
  h1, h2, h3, h4 { font-family: inherit; color: var(--zx-ink); letter-spacing: -.01em; text-transform: none; }
  a { color: var(--zx-brand); text-decoration: none; background: none; border: 0; }
  a:hover { text-decoration: underline; }
  button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; text-transform: none; margin: 0; }
  button { appearance: none; -webkit-appearance: none; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
  img, svg { display: block; max-width: 100%; }
  .zx-ic { width: 18px; height: 18px; flex: none; }
  :is(button, a, input, select, textarea, summary, [tabindex]):focus-visible { outline: none !important; box-shadow: var(--zx-focus) !important; }
  [hidden] { display: none !important; }
  /* Advanced-workspace press/busy effects must never disable or restyle controls in this workspace. */
  .cz-btn-busy, .cz-pressing, .cz-click-pulse, .is-loading-control { pointer-events: auto !important; opacity: 1 !important; transform: none !important; animation: none !important; }
  .cz-btn-busy::before { content: none !important; }

  /* ---------- helpers ---------- */
  .zx-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .zx-stack { display: flex; flex-direction: column; gap: var(--g, 16px); min-width: 0; }
  .zx-row { display: flex; align-items: center; gap: var(--g, 12px); min-width: 0; }
  .zx-wrap { flex-wrap: wrap; }
  .zx-between { justify-content: space-between; }
  .zx-end { justify-content: flex-end; }
  .zx-top-align { align-items: flex-start; }
  .zx-grow { flex: 1 1 0; min-width: 0; }
  .zx-noshrink { flex: 0 0 auto; }
  .zx-muted { color: var(--zx-ink-3); }
  .zx-faint { color: var(--zx-ink-4); }
  .zx-small { font-size: 12.5px; }
  .zx-xs { font-size: 12px; }
  .zx-strong { font-weight: 650; color: var(--zx-ink); }
  .zx-mono { font-family: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px; }
  .zx-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .zx-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .zx-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .zx-break { overflow-wrap: anywhere; }
  .zx-mt { margin-top: 12px; }
  .zx-mt-lg { margin-top: 24px; }

  /* ---------- sidebar ---------- */
  .zx-side { position: sticky; top: 0; align-self: start; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 14px; padding: 16px 12px 12px; background: var(--zx-surface); border-right: 1px solid var(--zx-line); overflow-y: auto; z-index: 30; }
  .zx-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; color: var(--zx-ink); font-weight: 750; font-size: 17px; letter-spacing: -.02em; }
  .zx-brand:hover { text-decoration: none; }
  .zx-brand img { width: 30px; height: 30px; object-fit: contain; }
  .zx-brand b { color: var(--zx-brand); font-weight: 750; }
  .zx-ws { padding: 0 4px; }
  .zx-ws-btn { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--zx-line); border-radius: 10px; background: var(--zx-sunken); color: var(--zx-ink); font-size: 13.5px; font-weight: 640; line-height: 1.3; text-align: left; cursor: pointer; }
  .zx-ws-btn:hover { border-color: var(--zx-ink-4); }
  .zx-ws-btn svg { width: 16px; height: 16px; flex: none; color: var(--zx-ink-3); }
  .zx-ws-name { flex: 1 1 auto; min-width: 0; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .zx-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
  .zx-nav-link { display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 8px 12px; border-radius: 10px; color: var(--zx-ink-2); font-weight: 560; cursor: pointer; }
  .zx-nav-link:hover { background: var(--zx-sunken); text-decoration: none; color: var(--zx-ink); }
  .zx-nav-link.is-active { background: var(--zx-brand-soft); color: var(--zx-brand); font-weight: 650; }
  .zx-nav-link svg { width: 19px; height: 19px; flex: none; }
  .zx-nav-badge { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--zx-warn); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 1.5; text-align: center; }
  .zx-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--zx-line); }
  .zx-side-link { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 12px; border-radius: 9px; color: var(--zx-ink-3); font-size: 13px; font-weight: 520; cursor: pointer; width: 100%; }
  .zx-side-link:hover { background: var(--zx-sunken); color: var(--zx-ink); text-decoration: none; }
  .zx-side-link svg { width: 17px; height: 17px; flex: none; }
  .zx-user { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 10px; cursor: pointer; }
  .zx-user:hover { background: var(--zx-sunken); }
  .zx-avatar { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--zx-brand); color: #fff; font-weight: 700; font-size: 13px; text-transform: uppercase; }
  .zx-user-name { font-weight: 620; font-size: 13px; line-height: 1.25; }
  .zx-user-sub { font-size: 12px; color: var(--zx-ink-4); line-height: 1.25; }

  /* ---------- top bar / content ---------- */
  .zx-main { min-width: 0; display: flex; flex-direction: column; }
  .zx-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 10px 32px; background: rgba(244, 246, 249, .92); backdrop-filter: saturate(1.3) blur(10px); }
  .zx-top-title { display: none; font-size: 16px; font-weight: 700; }
  .zx-top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
  .zx-search-btn { display: flex; align-items: center; gap: 10px; width: min(360px, 38vw); min-height: 38px; padding: 6px 12px; border: 1px solid var(--zx-line-strong); border-radius: 10px; background: var(--zx-surface); color: var(--zx-ink-4); font-size: 13.5px; }
  .zx-search-btn:hover { border-color: var(--zx-ink-4); color: var(--zx-ink-3); }
  .zx-search-btn svg { width: 16px; height: 16px; }
  .zx-search-btn .zx-kbd { margin-left: auto; }
  .zx-kbd { padding: 1px 6px; border: 1px solid var(--zx-line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--zx-sunken); color: var(--zx-ink-3); font: 600 11px/1.5 "JetBrains Mono", ui-monospace, Consolas, monospace; }
  .zx-icon-btn.zx-menu-btn { display: none; }
  .zx-content { width: 100%; max-width: 1200px; margin: 0 auto; padding: 8px 32px 64px; flex: 1 1 auto; }
  .zx-navscrim { display: none; }

  /* ---------- page head ---------- */
  .zx-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 0 22px; }
  .zx-page-title { font-size: 26px; line-height: 1.2; font-weight: 720; letter-spacing: -.02em; }
  .zx-page-sub { margin-top: 6px; color: var(--zx-ink-3); font-size: 14.5px; max-width: 70ch; }
  .zx-page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .zx-crumb { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 10px; color: var(--zx-ink-3); font-weight: 560; font-size: 13px; cursor: pointer; }
  .zx-crumb:hover { color: var(--zx-ink); text-decoration: none; }
  .zx-crumb svg { width: 15px; height: 15px; }

  /* ---------- surfaces ---------- */
  .zx-card { background: var(--zx-surface); border: 1px solid var(--zx-line); border-radius: var(--zx-r); box-shadow: var(--zx-shadow); min-width: 0; }
  .zx-pad { padding: 20px; }
  .zx-pad-sm { padding: 14px 16px; }
  .zx-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
  .zx-card-title { font-size: 15px; font-weight: 680; }
  .zx-card-sub { margin-top: 2px; color: var(--zx-ink-3); font-size: 13px; }
  .zx-card-body { padding: 16px 20px 20px; }
  .zx-card-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--zx-line); background: #fafbfc; border-radius: 0 0 var(--zx-r) var(--zx-r); }
  .zx-section { margin-top: 28px; }
  .zx-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
  .zx-section-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
  .zx-count { min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--zx-sunken); color: var(--zx-ink-3); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; }
  .zx-count.is-warn { background: var(--zx-warn-soft); color: var(--zx-warn); }
  .zx-cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
  .zx-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
  .zx-grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* ---------- tiles ---------- */
  .zx-tiles { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .zx-tile { display: block; padding: 16px 18px; background: var(--zx-surface); border: 1px solid var(--zx-line); border-radius: var(--zx-r); box-shadow: var(--zx-shadow); color: inherit; text-align: left; width: 100%; cursor: pointer; }
  .zx-tile:hover { border-color: var(--zx-line-strong); text-decoration: none; }
  .zx-tile-label { color: var(--zx-ink-3); font-size: 12.5px; font-weight: 600; }
  .zx-tile-value { margin-top: 4px; font-size: 28px; line-height: 1.15; font-weight: 740; letter-spacing: -.02em; }
  .zx-tile-hint { margin-top: 2px; color: var(--zx-ink-4); font-size: 12.5px; }
  .zx-tile.is-warn .zx-tile-value { color: var(--zx-warn); }

  /* ---------- lists ---------- */
  .zx-list { background: var(--zx-surface); border: 1px solid var(--zx-line); border-radius: var(--zx-r); box-shadow: var(--zx-shadow); overflow: hidden; }
  .zx-item { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 18px; min-width: 0; width: 100%; text-align: left; color: inherit; }
  .zx-item + .zx-item { border-top: 1px solid var(--zx-line); }
  .zx-item.is-link { cursor: pointer; }
  .zx-item.is-link:hover { background: #f8fafc; text-decoration: none; }
  .zx-item-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--zx-brand-soft); color: var(--zx-brand); }
  .zx-item-icon svg { width: 19px; height: 19px; }
  .zx-item-main { flex: 1 1 220px; min-width: 0; }
  .zx-item-title { font-weight: 620; color: var(--zx-ink); overflow-wrap: anywhere; }
  .zx-item-sub { margin-top: 1px; color: var(--zx-ink-3); font-size: 13px; overflow-wrap: anywhere; }
  .zx-item-end { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 10px; margin-left: auto; }
  .zx-chev { width: 16px; height: 16px; color: var(--zx-ink-4); flex: none; }

  /* ---------- pills / dots ---------- */
  .zx-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--zx-sunken); color: var(--zx-ink-2); font-size: 12px; font-weight: 640; line-height: 20px; white-space: nowrap; }
  .zx-pill.is-ok { background: var(--zx-ok-soft); color: var(--zx-ok); }
  .zx-pill.is-warn { background: var(--zx-warn-soft); color: var(--zx-warn); }
  .zx-pill.is-bad { background: var(--zx-bad-soft); color: var(--zx-bad); }
  .zx-pill.is-info { background: var(--zx-info-soft); color: var(--zx-info); }
  .zx-pill.is-brand { background: var(--zx-brand-soft); color: var(--zx-brand); }
  .zx-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

  /* ---------- buttons ---------- */
  .zx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 7px 16px; border: 1px solid var(--zx-line-strong); border-radius: 10px; background: var(--zx-surface); color: var(--zx-ink); font-weight: 620; font-size: 13.5px; line-height: 1.25; white-space: nowrap; cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s, color .12s; }
  .zx-btn:hover { background: var(--zx-sunken); text-decoration: none; }
  .zx-btn svg { width: 16px; height: 16px; flex: none; }
  .zx-btn.is-primary { background: var(--zx-brand); border-color: var(--zx-brand); color: #fff; }
  .zx-btn.is-primary:hover { background: var(--zx-brand-hover); border-color: var(--zx-brand-hover); }
  .zx-btn.is-danger { background: var(--zx-surface); border-color: var(--zx-bad-line); color: var(--zx-bad); }
  .zx-btn.is-danger:hover { background: var(--zx-bad-soft); }
  .zx-btn.is-ghost { border-color: transparent; background: transparent; color: var(--zx-ink-2); }
  .zx-btn.is-ghost:hover { background: var(--zx-sunken); }
  .zx-btn.is-sm { min-height: 32px; padding: 4px 12px; font-size: 13px; border-radius: 9px; }
  .zx-btn.is-block { width: 100%; }
  .zx-btn[disabled], .zx-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; pointer-events: none; }
  .zx-btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
  .zx-btn.is-loading > * { visibility: hidden; }
  .zx-btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: zx-spin .7s linear infinite; }
  .zx-btn.is-loading:not(.is-primary)::after { border-color: var(--zx-line-strong); border-top-color: var(--zx-brand); }
  .zx-icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; color: var(--zx-ink-3); cursor: pointer; }
  .zx-icon-btn:hover { background: var(--zx-sunken); color: var(--zx-ink); }
  .zx-icon-btn svg { width: 19px; height: 19px; }
  .zx-link { display: inline-flex; align-items: center; gap: 5px; color: var(--zx-brand); font-weight: 620; cursor: pointer; }
  .zx-link svg { width: 14px; height: 14px; }

  /* ---------- forms ---------- */
  .zx-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
  .zx-label { font-size: 13px; font-weight: 640; color: var(--zx-ink-2); }
  .zx-hint { font-size: 12.5px; color: var(--zx-ink-3); }
  .zx-input, .zx-select, .zx-textarea { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--zx-line-strong); border-radius: 10px; background-color: var(--zx-surface); color: var(--zx-ink); font-size: 14px; line-height: 1.4; }
  .zx-input::placeholder, .zx-textarea::placeholder { color: var(--zx-ink-4); }
  .zx-input:hover, .zx-select:hover, .zx-textarea:hover { border-color: var(--zx-ink-4); }
  .zx-input:focus, .zx-select:focus, .zx-textarea:focus { border-color: var(--zx-brand); }
  .zx-textarea { min-height: 96px; resize: vertical; }
  .zx-select { appearance: none; -webkit-appearance: none; padding-right: 34px; text-overflow: ellipsis; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23596579' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; background-size: 16px; cursor: pointer; }
  .zx-select.is-sm { min-height: 34px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
  .zx-form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .zx-form-grid .is-wide { grid-column: 1 / -1; }
  .zx-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
  .zx-check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--zx-brand); flex: none; }
  .zx-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
  .zx-switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
  .zx-switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--zx-line-strong); transition: background .15s; }
  .zx-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
  .zx-switch input:checked + span { background: var(--zx-brand); }
  .zx-switch input:checked + span::after { transform: translateX(18px); }
  .zx-switch input:focus-visible + span { box-shadow: var(--zx-focus); }
  .zx-radio-cards { display: grid; gap: 10px; }
  .zx-radio-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 1px solid var(--zx-line-strong); border-radius: 12px; background: var(--zx-surface); cursor: pointer; }
  .zx-radio-card:hover { border-color: var(--zx-ink-4); }
  .zx-radio-card:has(input:checked) { border-color: var(--zx-brand); background: var(--zx-brand-soft); box-shadow: inset 0 0 0 1px var(--zx-brand); }
  .zx-radio-card input { margin-top: 3px; accent-color: var(--zx-brand); width: 17px; height: 17px; flex: none; }
  .zx-radio-card b { display: block; font-weight: 650; }
  .zx-radio-card span { display: block; color: var(--zx-ink-3); font-size: 13px; margin-top: 1px; }

  /* ---------- tabs / chips ---------- */
  .zx-tabs { display: flex; gap: 4px; margin: 0 0 20px; padding: 0; border-bottom: 1px solid var(--zx-line); overflow-x: auto; scrollbar-width: none; }
  .zx-tab { position: relative; padding: 10px 14px; color: var(--zx-ink-3); font-weight: 620; font-size: 14px; white-space: nowrap; cursor: pointer; border-radius: 8px 8px 0 0; }
  .zx-tab:hover { color: var(--zx-ink); text-decoration: none; background: var(--zx-sunken); }
  .zx-tab.is-active { color: var(--zx-brand); }
  .zx-tab.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--zx-brand); }
  .zx-chips { display: flex; gap: 8px; flex-wrap: wrap; }
  .zx-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 4px 13px; border: 1px solid var(--zx-line-strong); border-radius: 999px; background: var(--zx-surface); color: var(--zx-ink-2); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
  .zx-chip:hover { border-color: var(--zx-ink-4); }
  .zx-chip.is-active { background: var(--zx-ink); border-color: var(--zx-ink); color: #fff; }
  .zx-chip em { font-style: normal; font-weight: 700; opacity: .7; }
  .zx-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
  .zx-search { position: relative; flex: 1 1 260px; max-width: 380px; }
  .zx-search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--zx-ink-4); pointer-events: none; }
  .zx-search .zx-input { padding-left: 36px; }

  /* ---------- feedback ---------- */
  .zx-banner { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border: 1px solid var(--zx-info-line); border-radius: 12px; background: var(--zx-info-soft); color: var(--zx-ink-2); font-size: 13.5px; }
  .zx-banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--zx-info); }
  .zx-banner.is-warn { border-color: var(--zx-warn-line); background: var(--zx-warn-soft); }
  .zx-banner.is-warn svg { color: var(--zx-warn); }
  .zx-banner.is-bad { border-color: var(--zx-bad-line); background: var(--zx-bad-soft); }
  .zx-banner.is-bad svg { color: var(--zx-bad); }
  .zx-banner.is-ok { border-color: var(--zx-ok-line); background: var(--zx-ok-soft); }
  .zx-banner.is-ok svg { color: var(--zx-ok); }
  .zx-update { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 0 32px 4px; padding: 10px 16px; border: 1px solid var(--zx-info-line); border-radius: 12px; background: var(--zx-info-soft); color: var(--zx-ink-2); font-size: 13.5px; }
  .zx-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 44px 24px; text-align: center; background: var(--zx-surface); border: 1px dashed var(--zx-line-strong); border-radius: var(--zx-r); }
  .zx-empty-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 6px; border-radius: 50%; background: var(--zx-brand-soft); color: var(--zx-brand); }
  .zx-empty-icon svg { width: 24px; height: 24px; }
  .zx-empty h3 { font-size: 16px; font-weight: 680; }
  .zx-empty p { max-width: 46ch; color: var(--zx-ink-3); }
  .zx-empty .zx-row { margin-top: 10px; justify-content: center; flex-wrap: wrap; }
  .zx-skel { display: block; border-radius: 8px; background: linear-gradient(90deg, #e8ecf1 25%, #f3f5f8 50%, #e8ecf1 75%); background-size: 200% 100%; animation: zx-shimmer 1.2s ease-in-out infinite; }
  .zx-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--zx-line-strong); border-top-color: var(--zx-brand); animation: zx-spin .7s linear infinite; }
  .zx-progress { height: 8px; border-radius: 999px; background: var(--zx-sunken); overflow: hidden; }
  .zx-progress > i { display: block; height: 100%; border-radius: inherit; background: var(--zx-brand); transition: width .3s; }
  @keyframes zx-spin { to { transform: rotate(360deg); } }
  @keyframes zx-shimmer { to { background-position: -200% 0; } }

  /* ---------- decision card ---------- */
  .zx-decision { position: relative; overflow: hidden; }
  .zx-decision::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--zx-warn); }
  .zx-decision.is-quiet::before { background: var(--zx-info); }
  .zx-decision-body { padding: 18px 22px 18px 24px; display: flex; flex-direction: column; gap: 14px; }
  .zx-decision-title { font-size: 17px; line-height: 1.35; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
  .zx-meta { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; color: var(--zx-ink-3); font-size: 12.5px; }
  .zx-meta > span + span::before { content: "·"; margin-right: 12px; color: var(--zx-ink-4); }
  .zx-ask { padding: 14px 16px; border-radius: 10px; background: var(--zx-sunken); }
  .zx-ask-label { margin-bottom: 4px; color: var(--zx-ink-3); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
  .zx-ask-q { font-weight: 640; }
  .zx-choices { display: flex; flex-direction: column; gap: 8px; }
  .zx-choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--zx-line-strong); border-radius: 10px; background: var(--zx-surface); color: var(--zx-ink); font-weight: 600; text-align: left; cursor: pointer; }
  .zx-choice:hover { border-color: var(--zx-brand); background: var(--zx-brand-soft); }
  .zx-choice.is-primary { border-color: var(--zx-brand); background: var(--zx-brand); color: #fff; }
  .zx-choice.is-primary:hover { background: var(--zx-brand-hover); }
  .zx-choice svg { width: 17px; height: 17px; flex: none; }
  .zx-choice[disabled] { opacity: .6; pointer-events: none; }
  .zx-richtext { overflow-wrap: anywhere; }
  .zx-richtext p + p, .zx-richtext p + ul, .zx-richtext ul + p { margin-top: 8px; }
  .zx-richtext ul { padding-left: 18px; list-style: disc; }
  .zx-richtext ol { padding-left: 20px; list-style: decimal; }
  .zx-richtext li + li { margin-top: 4px; }
  .zx-md-h { margin: 14px 0 6px; font-size: 14px; font-weight: 700; }
  .zx-richtext .zx-code { margin: 8px 0; }
  details > summary { list-style: none; }
  details > summary::-webkit-details-marker { display: none; }
  .zx-richtext code, code:not(.zx-code) { padding: 1px 5px; border-radius: 5px; background: rgba(15, 26, 43, .07); font: 12.5px "JetBrains Mono", ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
  .zx-ph { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--zx-brand-soft); color: var(--zx-brand); font-size: .92em; font-weight: 600; line-height: 1.5; white-space: nowrap; }
  code .zx-ph { padding: 0; background: transparent; }
  details[open] > summary .zx-chev-flip { transform: rotate(180deg); }
  .zx-chev-flip { transition: transform .15s ease; }
  .zx-collapsible { position: relative; max-height: 6.2em; overflow: hidden; }
  .zx-collapsible::after { content: ""; position: absolute; inset: auto 0 0 0; height: 2.2em; background: linear-gradient(transparent, var(--zx-sunken)); pointer-events: none; }
  .zx-collapsible.is-open { max-height: none; }
  .zx-collapsible.is-open::after { display: none; }
  .zx-collapsible.is-plain::after { background: linear-gradient(transparent, var(--zx-surface)); }

  /* ---------- stepper / timeline / kv ---------- */
  .zx-stepper { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: 0; padding: 0; list-style: none; }
  .zx-step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--zx-ink-4); font-size: 12.5px; font-weight: 600; }
  .zx-step::before { content: ""; position: absolute; top: 13px; left: calc(-50% + 16px); right: calc(50% + 16px); height: 2px; background: var(--zx-line-strong); }
  .zx-step:first-child::before { display: none; }
  .zx-step-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--zx-line-strong); background: var(--zx-surface); color: var(--zx-ink-4); font-size: 12px; font-weight: 700; }
  .zx-step-dot svg { width: 14px; height: 14px; }
  .zx-step.is-done { color: var(--zx-ink-2); }
  .zx-step.is-done::before { background: var(--zx-brand); }
  .zx-step.is-done .zx-step-dot { border-color: var(--zx-brand); background: var(--zx-brand); color: #fff; }
  .zx-step.is-current { color: var(--zx-ink); }
  .zx-step.is-current::before { background: var(--zx-brand); }
  .zx-step.is-current .zx-step-dot { border-color: var(--zx-brand); color: var(--zx-brand); box-shadow: 0 0 0 4px var(--zx-brand-soft); }
  .zx-step.is-attention.is-current .zx-step-dot { border-color: var(--zx-warn); color: var(--zx-warn); box-shadow: 0 0 0 4px var(--zx-warn-soft); }
  .zx-timeline { position: relative; display: flex; flex-direction: column; gap: 18px; padding-left: 22px; }
  .zx-timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--zx-line); }
  .zx-tl-item { position: relative; min-width: 0; }
  .zx-tl-item::before { content: ""; position: absolute; left: -22px; top: 5px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--zx-brand); background: var(--zx-surface); }
  .zx-tl-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .zx-tl-who { font-weight: 650; font-size: 13.5px; }
  .zx-tl-when { color: var(--zx-ink-4); font-size: 12px; }
  .zx-tl-text { margin-top: 3px; color: var(--zx-ink-2); font-size: 13.5px; }
  .zx-kv { display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: 10px 14px; font-size: 13.5px; }
  .zx-kv dt { color: var(--zx-ink-3); }
  .zx-kv dd { overflow-wrap: anywhere; font-weight: 520; }
  .zx-code { display: block; padding: 12px 14px; border-radius: 10px; background: #0f1a2b; color: #d7e3f4; font: 12.5px/1.6 "JetBrains Mono", ui-monospace, Consolas, monospace; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 280px; }

  /* ---------- checklist / safety ---------- */
  .zx-checklist { display: flex; flex-direction: column; }
  .zx-check-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; }
  .zx-check-item + .zx-check-item { border-top: 1px solid var(--zx-line); }
  .zx-check-mark { display: grid; place-items: center; width: 24px; height: 24px; flex: none; margin-top: 1px; border-radius: 50%; border: 2px solid var(--zx-line-strong); color: transparent; }
  .zx-check-mark svg { width: 13px; height: 13px; }
  .zx-check-item.is-done .zx-check-mark { border-color: var(--zx-ok); background: var(--zx-ok); color: #fff; }
  .zx-check-item.is-pending .zx-check-mark { border-color: var(--zx-warn-line); background: var(--zx-warn-soft); color: var(--zx-warn); }
  .zx-check-item.is-attention .zx-check-mark { border-color: var(--zx-bad); background: var(--zx-bad-soft); color: var(--zx-bad); }
  .zx-check-item.is-skipped .zx-check-mark { border-color: var(--zx-line-strong); background: var(--zx-sunken); color: var(--zx-ink-3); }
  .zx-check-item.is-done .zx-item-title, .zx-check-item.is-skipped .zx-item-title { color: var(--zx-ink-3); font-weight: 560; }
  .zx-check-note { color: var(--zx-warn); font-weight: 560; }
  .zx-safe { display: flex; flex-direction: column; gap: 12px; }
  .zx-safe li { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--zx-ink-2); }
  .zx-safe svg { width: 17px; height: 17px; flex: none; margin-top: 2px; color: var(--zx-ok); }

  /* ---------- table ---------- */
  .zx-table-wrap { overflow-x: auto; background: var(--zx-surface); border: 1px solid var(--zx-line); border-radius: var(--zx-r); box-shadow: var(--zx-shadow); }
  .zx-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
  .zx-table th { padding: 11px 16px; text-align: left; color: var(--zx-ink-3); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: #fafbfc; border-bottom: 1px solid var(--zx-line); white-space: nowrap; }
  .zx-table td { padding: 13px 16px; border-bottom: 1px solid var(--zx-line); vertical-align: middle; }
  .zx-table tr:last-child td { border-bottom: 0; }
  .zx-table tbody tr.is-link { cursor: pointer; }
  .zx-table tbody tr.is-link:hover td { background: #f8fafc; }

  /* ---------- overlays ---------- */
  .zx-layer { position: fixed; inset: 0; z-index: 10010; pointer-events: none; }
  .zx-layer > * { pointer-events: auto; }
  .zx-scrim { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(15, 26, 43, .5); backdrop-filter: blur(2px); animation: zx-fade .15s ease-out; }
  .zx-scrim.is-drawer { justify-content: flex-end; padding: 0; align-items: stretch; }
  .zx-scrim.is-top { align-items: flex-start; padding-top: 12vh; }
  .zx-dialog { display: flex; flex-direction: column; width: min(560px, 100%); max-height: calc(100dvh - 48px); background: var(--zx-surface); border-radius: var(--zx-r-lg); box-shadow: var(--zx-shadow-lg); animation: zx-pop .16s ease-out; overflow: hidden; }
  .zx-dialog.is-wide { width: min(820px, 100%); }
  .zx-dialog.is-narrow { width: min(440px, 100%); }
  .zx-dialog.is-drawer { width: min(620px, 100%); max-height: none; height: 100%; border-radius: 0; animation: zx-slide .2s ease-out; }
  .zx-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 12px; }
  .zx-dialog-head > div { min-width: 0; }
  .zx-dialog-head > .zx-icon-btn { flex: none; }
  .zx-dialog-title { font-size: 18px; font-weight: 720; letter-spacing: -.015em; }
  .zx-dialog-sub { margin-top: 3px; color: var(--zx-ink-3); font-size: 13.5px; }
  .zx-dialog-body { padding: 8px 24px 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
  .zx-dialog-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 14px 24px; border-top: 1px solid var(--zx-line); background: #fafbfc; }
  .zx-menu { position: fixed; min-width: 220px; max-width: min(360px, calc(100vw - 16px)); max-height: min(60vh, 420px); overflow-y: auto; padding: 6px; background: var(--zx-surface); border: 1px solid var(--zx-line); border-radius: 12px; box-shadow: var(--zx-shadow-lg); animation: zx-pop .12s ease-out; }
  .zx-menu-item span { overflow-wrap: anywhere; }
  .zx-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 8px 10px; border-radius: 8px; color: var(--zx-ink); font-size: 13.5px; font-weight: 540; text-align: left; cursor: pointer; }
  .zx-menu-item:hover { background: var(--zx-sunken); text-decoration: none; }
  .zx-menu-item svg { width: 17px; height: 17px; color: var(--zx-ink-3); flex: none; }
  .zx-menu-sep { height: 1px; margin: 6px 4px; background: var(--zx-line); }
  .zx-menu-label { padding: 6px 10px 2px; color: var(--zx-ink-4); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
  .zx-palette { width: min(640px, 100%); background: var(--zx-surface); border-radius: var(--zx-r-lg); box-shadow: var(--zx-shadow-lg); overflow: hidden; animation: zx-pop .14s ease-out; }
  .zx-palette-input { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--zx-line); }
  .zx-palette-input svg { width: 19px; height: 19px; color: var(--zx-ink-4); flex: none; }
  .zx-palette-input input { flex: 1; min-width: 0; border: 0; outline: 0 !important; box-shadow: none !important; background: transparent; font-size: 16px; }
  .zx-palette-list { max-height: min(420px, 55vh); overflow-y: auto; padding: 8px; }
  .zx-palette-group { padding: 8px 10px 4px; color: var(--zx-ink-4); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
  .zx-palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: 9px; text-align: left; cursor: pointer; }
  .zx-palette-item svg { width: 17px; height: 17px; color: var(--zx-ink-3); flex: none; }
  .zx-palette-item.is-active, .zx-palette-item:hover { background: var(--zx-brand-soft); }
  .zx-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 10011; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
  .zx-toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--zx-ink); color: #fff; box-shadow: var(--zx-shadow-lg); font-size: 13.5px; animation: zx-pop .16s ease-out; pointer-events: auto; }
  .zx-toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
  .zx-toast.is-ok svg { color: #6ee7a0; }
  .zx-toast.is-bad svg { color: #ff9d94; }
  @keyframes zx-fade { from { opacity: 0; } }
  @keyframes zx-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
  @keyframes zx-slide { from { transform: translateX(40px); opacity: 0; } }

  /* ---------- cards used by marketplace / connections ---------- */
  .zx-tile-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; background: var(--zx-surface); border: 1px solid var(--zx-line); border-radius: var(--zx-r); box-shadow: var(--zx-shadow); min-width: 0; }
  .zx-tile-card h3 { font-size: 15px; font-weight: 680; }
  .zx-tile-card p { color: var(--zx-ink-3); font-size: 13.5px; }
  .zx-tile-card > .zx-row:last-child { margin-top: auto; padding-top: 6px; }
  .zx-eyebrow { color: var(--zx-ink-3); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

  /* ---------- contrast preferences ---------- */
  html[data-contrast="high"] &, html[data-contrast="maximum"] & {
    --zx-line: #8a94a6; --zx-line-strong: #4b5568; --zx-ink-3: #2c3648; --zx-ink-4: #3d475a;
    .zx-card, .zx-list, .zx-tile, .zx-table-wrap { border-color: var(--zx-line-strong); box-shadow: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  }
  @media (pointer: coarse) {
    .zx-btn, .zx-input, .zx-select, .zx-chip, .zx-nav-link, .zx-side-link, .zx-menu-item, .zx-palette-item { min-height: 44px; }
    .zx-btn.is-sm { min-height: 40px; }
  }

  /* ---------- responsive ---------- */
  @media (max-width: 1180px) {
    .zx-cols { grid-template-columns: minmax(0, 1fr); }
    .zx-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  @media (max-width: 960px) {
    grid-template-columns: minmax(0, 1fr);
    .zx-side { position: fixed; inset: 0 auto 0 0; width: min(86vw, 300px); transform: translateX(-104%); transition: transform .22s ease; box-shadow: var(--zx-shadow-lg); z-index: 10002; visibility: hidden; }
    &[data-nav-open="true"] .zx-side { transform: none; visibility: visible; }
    &[data-nav-open="true"] .zx-navscrim { position: fixed; inset: 0; display: block; z-index: 10001; background: rgba(15, 26, 43, .45); }
    .zx-icon-btn.zx-menu-btn { display: inline-grid; }
    .zx-top { padding: 8px 14px; min-height: 56px; }
    .zx-update { margin: 0 16px 4px; }
    .zx-top-title { display: block; }
    .zx-search-btn { width: 40px; min-height: 40px; padding: 0; justify-content: center; }
    .zx-search-btn span, .zx-search-btn .zx-kbd { display: none; }
    .zx-content { padding: 4px 16px 72px; }
    .zx-page-title { font-size: 22px; }
    .zx-form-grid, .zx-grid-2 { grid-template-columns: minmax(0, 1fr); }
  }
  @media (max-width: 640px) {
    .zx-btn, .zx-input, .zx-select, .zx-chip, .zx-nav-link, .zx-side-link, .zx-menu-item, .zx-palette-item { min-height: 44px; }
    .zx-btn.is-sm { min-height: 40px; }
    .zx-icon-btn { width: 44px; height: 44px; }
    .zx-tiles { gap: 10px; }
    .zx-tile { padding: 12px 14px; }
    .zx-tile-value { font-size: 24px; }
    .zx-decision-body { padding: 16px 16px 16px 18px; }
    .zx-item { padding: 12px 14px; gap: 10px; }
    .zx-item-end .zx-hide-sm { display: none; }
    .zx-step { font-size: 11px; }
    .zx-scrim { padding: 0; align-items: flex-end; }
    .zx-dialog { width: 100%; max-height: 92dvh; border-radius: var(--zx-r-lg) var(--zx-r-lg) 0 0; }
    .zx-dialog.is-drawer { height: 92dvh; max-height: 92dvh; }
    .zx-scrim.is-top { align-items: flex-start; padding: 0; }
    .zx-palette { border-radius: 0 0 var(--zx-r-lg) var(--zx-r-lg); }
    .zx-dialog-head, .zx-dialog-body, .zx-dialog-foot { padding-left: 18px; padding-right: 18px; }
    .zx-dialog-foot .zx-btn { flex: 1 1 auto; }
    .zx-toasts { right: 12px; left: 12px; bottom: 12px; width: auto; }
    .zx-kv { grid-template-columns: 1fr; gap: 2px 0; }
    .zx-kv dt { margin-top: 8px; font-size: 12px; }
    .zx-table.is-stack thead { display: none; }
    .zx-table.is-stack tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--zx-line); }
    .zx-table.is-stack td { display: block; padding: 2px 0; border: 0; }
  }
}

@media print {
  html[data-ux="simple"] body > *:not(#czx) { display: none !important; }
  #czx { display: block; background: #fff; }
  #czx .zx-side, #czx .zx-top, #czx .zx-toasts, #czx .zx-navscrim, #czx .zx-content { display: none !important; }
  #czx .zx-layer { position: static; }
  #czx .zx-scrim { position: static; padding: 0; background: none; backdrop-filter: none; display: block; }
  #czx .zx-dialog { box-shadow: none; max-height: none; width: 100%; }
  #czx .zx-no-print { display: none !important; }
}
