/* JCO Dashboards shell: design tokens + chrome (sidebar, topbar, menus, palette, toasts,
   login, 404). Tabs style themselves from the tokens in :root only. Light is the default;
   dark is selected with data-theme="dark" (the toggle) or the OS setting when nothing is
   saved. Every color below exists in both themes. */

@font-face { font-family: "Space Grotesk"; src: url("/fonts/space-grotesk.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/fonts/dm-sans.woff2") format("woff2"); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/plex-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #FFFFFF;
  --paper-raised: #F6F7F9;
  --card: #FFFFFF;
  --card-2: #F6F7FA;
  --surface-controls: #F7F8FA;
  --surface-kpi: #EEF1F6;
  --surface-cards: #FFFFFF;
  --ink: #0E1117;
  --ink-soft: rgba(14, 17, 23, 0.70);
  --ink-faint: rgba(14, 17, 23, 0.60);
  --rule: rgba(14, 17, 23, 0.09);
  --rule-strong: rgba(14, 17, 23, 0.16);
  --gridline: #ECEEF2;
  --baseline: #D3D7DF;
  --accent: #2F63E0;
  --accent-2: #1D4FC7;
  --accent-hover: #1D4FC7;
  --accent-soft: rgba(47, 99, 224, 0.08);
  --accent-ring: rgba(47, 99, 224, 0.22);
  --on-accent: #FFFFFF;
  --pos: #15803D;
  --pos-soft: rgba(21, 128, 61, 0.10);
  --warn: #B45309;
  --warn-soft: rgba(180, 83, 9, 0.12);
  --neg: #B42318;
  --neg-soft: rgba(180, 35, 24, 0.10);
  --series-1: #2F63E0; --series-1-soft: rgba(47, 99, 224, 0.12);
  --series-2: #EB6834; --series-2-soft: rgba(235, 104, 52, 0.12);
  --series-3: #1BAF7A; --series-3-soft: rgba(27, 175, 122, 0.12);
  --series-4: #EDA100; --series-4-soft: rgba(237, 161, 0, 0.14);
  --series-5: #1C5CAB; --series-5-soft: rgba(28, 92, 171, 0.12);
  --series-6: #E34948; --series-6-soft: rgba(227, 73, 72, 0.12);
  --shadow-card: 0 1px 2px rgba(14, 17, 23, 0.04), 0 6px 20px rgba(14, 17, 23, 0.05);
  --shadow-lift: 0 2px 6px rgba(14, 17, 23, 0.06), 0 16px 40px rgba(14, 17, 23, 0.12);
  --radius: 10px;
  --radius-sm: 8px;
  --radius-card: 14px;
  --radius-pill: 999px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font-display: "Space Grotesk", "DM Sans", system-ui, -apple-system, sans-serif;
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --cur-arrow: url("/img/cursor.svg") 5 3, auto;
  --cur-hand: url("/img/cursor-hand.svg") 10 2, pointer;
  --cur-col: url("/img/cursor-col-resize.svg") 12 12, col-resize;
  --sidebar-w: 272px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 56px;
  --sidebar-bg: #FFFFFF;
  --scrim: rgba(14, 17, 23, 0.40);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0A0B0F;
  --paper-raised: #10121A;
  --card: #10121A;
  --card-2: #171A24;
  --surface-controls: #0D0F15;
  --surface-kpi: #151A26;
  --surface-cards: #10121A;
  --ink: #F2F2F5;
  --ink-soft: rgba(242, 242, 245, 0.74);
  --ink-faint: rgba(242, 242, 245, 0.52);
  --rule: rgba(255, 255, 255, 0.08);
  --rule-strong: rgba(255, 255, 255, 0.15);
  --gridline: #1E222D;
  --baseline: #2E3443;
  --accent: #6C9BFF;
  --accent-2: #4D7FE8;
  --accent-hover: #8FB3FF;
  --accent-soft: rgba(108, 155, 255, 0.12);
  --accent-ring: rgba(108, 155, 255, 0.28);
  --on-accent: #06101F;
  --pos: #5BDA8B;
  --pos-soft: rgba(91, 218, 139, 0.12);
  --warn: #E8B44D;
  --warn-soft: rgba(232, 180, 77, 0.14);
  --neg: #F07070;
  --neg-soft: rgba(240, 112, 112, 0.14);
  --series-1: #5B8DEF; --series-1-soft: rgba(91, 141, 239, 0.16);
  --series-2: #D95926; --series-2-soft: rgba(217, 89, 38, 0.16);
  --series-3: #199E70; --series-3-soft: rgba(25, 158, 112, 0.16);
  --series-4: #C98500; --series-4-soft: rgba(201, 133, 0, 0.18);
  --series-5: #2C62B8; --series-5-soft: rgba(44, 98, 184, 0.18);
  --series-6: #E66767; --series-6-soft: rgba(230, 103, 103, 0.16);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 4px 12px rgba(0, 0, 0, 0.4), 0 20px 48px rgba(0, 0, 0, 0.5);
  --sidebar-bg: #0D0F15;
  --scrim: rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0A0B0F;
    --paper-raised: #10121A;
    --card: #10121A;
    --card-2: #171A24;
  --surface-controls: #0D0F15;
  --surface-kpi: #151A26;
  --surface-cards: #10121A;
    --ink: #F2F2F5;
    --ink-soft: rgba(242, 242, 245, 0.74);
    --ink-faint: rgba(242, 242, 245, 0.52);
    --rule: rgba(255, 255, 255, 0.08);
    --rule-strong: rgba(255, 255, 255, 0.15);
    --gridline: #1E222D;
    --baseline: #2E3443;
    --accent: #6C9BFF;
    --accent-2: #4D7FE8;
    --accent-hover: #8FB3FF;
    --accent-soft: rgba(108, 155, 255, 0.12);
    --accent-ring: rgba(108, 155, 255, 0.28);
    --on-accent: #06101F;
    --pos: #5BDA8B;
    --pos-soft: rgba(91, 218, 139, 0.12);
    --warn: #E8B44D;
    --warn-soft: rgba(232, 180, 77, 0.14);
    --neg: #F07070;
    --neg-soft: rgba(240, 112, 112, 0.14);
    --series-1: #5B8DEF; --series-1-soft: rgba(91, 141, 239, 0.16);
    --series-2: #D95926; --series-2-soft: rgba(217, 89, 38, 0.16);
    --series-3: #199E70; --series-3-soft: rgba(25, 158, 112, 0.16);
    --series-4: #C98500; --series-4-soft: rgba(201, 133, 0, 0.18);
    --series-5: #2C62B8; --series-5-soft: rgba(44, 98, 184, 0.18);
    --series-6: #E66767; --series-6-soft: rgba(230, 103, 103, 0.16);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lift: 0 4px 12px rgba(0, 0, 0, 0.4), 0 20px 48px rgba(0, 0, 0, 0.5);
    --sidebar-bg: #0D0F15;
    --scrim: rgba(0, 0, 0, 0.55);
  }
}

/* ==========================================================================
   Base
   ========================================================================== */

* { box-sizing: border-box; }
/* `hidden` wins over any component display rule: it is how role visibility is enforced */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
svg { display: block; }
button { font-family: inherit; }
code, kbd, .mono { font-family: var(--font-mono); }

/* the pointer is the same drawn arrow and hand everywhere in the product (and in the sign-in page's demo) */
html { cursor: var(--cur-arrow); }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]), textarea { cursor: text; }
a, button, select, summary, label[for], [role="button"] { cursor: var(--cur-hand); }
button:disabled, [aria-disabled="true"] { cursor: var(--cur-arrow); }
.tk-chart > div { cursor: var(--cur-arrow) !important; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
::selection { background: var(--accent-soft); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   App shell: sidebar + main column
   ========================================================================== */

.app-shell { display: flex; align-items: flex-start; min-height: 100vh; }
.app-shell.no-anim, .app-shell.no-anim * { transition: none !important; }

.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 12px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--rule);
  z-index: 40;
  transition: width 240ms var(--ease), flex-basis 240ms var(--ease), transform 240ms var(--ease);
}
.app-shell.sidebar-collapsed .sidebar { flex-basis: var(--sidebar-w-collapsed); width: var(--sidebar-w-collapsed); }
html:not(.jd-nav-ready) .sidebar-nav { visibility: hidden; }

.sidebar-top { display: flex; align-items: center; padding: 4px 6px 10px; min-height: 44px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); }
.brand-tile { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-word { font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: -0.03em; white-space: nowrap; }
.brand-by { font-weight: 500; color: var(--ink-faint); letter-spacing: -0.01em; margin-left: 6px; }
.brand-org { font-size: 11.5px; font-weight: 500; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.brand-inline .brand-word { font-size: 18px; }

.sidebar-nav {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent;
  padding: 2px 0 8px;
}
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }

/* category header (collapsible, one open at a time) */
.nav-cat {
  display: flex; align-items: center; gap: 7px; width: 100%;
  margin-top: 14px; padding: 6px 8px; border: 0; border-radius: var(--radius-sm);
  background: transparent; font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
  text-align: left; color: var(--ink); white-space: nowrap; overflow: hidden; cursor: var(--cur-hand); user-select: none;
  transition: background 130ms ease, color 130ms ease;
}
.nav-cat:first-of-type { margin-top: 0; }
.nav-cat:hover { background: var(--card-2); }
.nav-cat:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-cat-caret { width: 14px; height: 14px; flex: 0 0 auto; color: var(--ink-faint); transition: transform 200ms var(--ease); }
.nav-cat[aria-expanded="false"] .nav-cat-caret { transform: rotate(-90deg); }
.nav-cat-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-cat-count {
  display: none; margin-left: auto; padding: 1px 7px; border-radius: var(--radius-pill);
  background: var(--card-2); border: 1px solid var(--rule); font-size: 10.5px; font-weight: 600; color: var(--ink-faint);
}
.nav-cat[aria-expanded="false"] .nav-cat-count { display: inline-block; }

.nav-cat-group { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 200ms var(--ease); }
.nav-cat-group.collapsed { grid-template-rows: 0fr; overflow: hidden; }
.nav-cat-inner { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow: hidden; }
.nav-sub { margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--rule); transition: margin 240ms var(--ease), padding 240ms var(--ease); }
.nav-sub + .nav-sub { margin-top: 8px; }
.nav-sub-label { padding: 6px 6px 3px 0; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-group-inner { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 8px; border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--ink-soft); font-size: 13.5px; font-weight: 500; text-align: left; cursor: var(--cur-hand);
  transition: background 130ms ease, color 130ms ease, padding 240ms var(--ease), gap 240ms var(--ease);
}
.nav-item:hover { background: var(--card-2); color: var(--ink); }
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--accent);
  animation: nav-indicator-in 200ms var(--ease);
}
.nav-sub .nav-item.active::before { left: -11px; }
@keyframes nav-indicator-in { from { height: 4px; opacity: 0; } to { height: 18px; opacity: 1; } }
.nav-icon { flex: 0 0 auto; display: inline-flex; width: 20px; height: 20px; color: var(--ink-faint); transition: color 130ms ease; }
.nav-icon svg { width: 18px; height: 18px; }
.nav-item:hover .nav-icon, .nav-item.active .nav-icon { color: currentColor; }
.nav-tile {
  display: none; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  background: var(--card-2); color: var(--ink-soft); border: 1px solid var(--rule);
}
.nav-item.active .nav-tile { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; transition: opacity 160ms ease; }
.nav-beta {
  flex: 0 0 auto; margin-left: auto; padding: 2px 6px; border-radius: var(--radius-pill);
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; line-height: 1.4;
  color: var(--series-5); background: var(--series-5-soft);
}

.sidebar-bottom { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--rule); position: relative; z-index: 2; background: var(--sidebar-bg); }
.sidebar-toggle {
  display: inline-flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  color: var(--ink-faint); cursor: var(--cur-hand); font-size: 12.5px; font-weight: 500;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.sidebar-toggle:hover { background: var(--card-2); color: var(--ink); }
.sidebar-toggle svg { width: 16px; height: 16px; flex: 0 0 auto; }
.sidebar-toggle .ico-expand { display: none; }

/* collapsed rail */
.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .nav-beta,
.app-shell.sidebar-collapsed .nav-icon,
.app-shell.sidebar-collapsed .nav-sub-label,
.app-shell.sidebar-collapsed .nav-cat-label,
.app-shell.sidebar-collapsed .nav-cat-count,
.app-shell.sidebar-collapsed .sidebar-toggle-label { display: none; }
.app-shell.sidebar-collapsed .nav-tile { display: inline-flex; }
.app-shell.sidebar-collapsed .sidebar-top { justify-content: center; padding-left: 0; padding-right: 0; }
.app-shell.sidebar-collapsed .nav-item { padding: 5px 5px; gap: 0; justify-content: center; }
.app-shell.sidebar-collapsed .nav-item.active::before { display: none; }
.app-shell.sidebar-collapsed .nav-sub { margin-left: 0; padding-left: 0; border-left-color: transparent; }
.app-shell.sidebar-collapsed .nav-cat { justify-content: center; padding: 6px 4px; margin-top: 8px; border: 1px solid transparent; }
.app-shell.sidebar-collapsed .nav-cat[aria-expanded="true"] { background: var(--card-2); border-color: var(--rule); }
.app-shell.sidebar-collapsed .nav-cat-caret { display: block; }
.app-shell.sidebar-collapsed .sidebar-toggle { justify-content: center; gap: 0; }
.app-shell.sidebar-collapsed .sidebar-toggle .ico-collapse { display: none; }
.app-shell.sidebar-collapsed .sidebar-toggle .ico-expand { display: inline; }
/* rail tooltip: the label becomes a fixed-position tip placed by shell.js */
.app-shell.sidebar-collapsed .nav-item:hover .nav-label,
.app-shell.sidebar-collapsed .nav-item:focus-visible .nav-label {
  display: block; position: fixed; left: var(--tip-x, 80px); top: var(--tip-y, 50%); transform: translateY(-50%);
  padding: 6px 10px; background: var(--card); color: var(--ink); border: 1px solid var(--rule);
  border-radius: 8px; box-shadow: var(--shadow-lift); font-size: 12.5px; font-weight: 500; pointer-events: none; z-index: 60;
}

.sidebar-scrim { display: none; position: fixed; inset: 0; background: var(--scrim); z-index: 35; opacity: 0; transition: opacity 200ms ease; }

/* ---------- Main column ---------- */

.main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: var(--topbar-h); padding: 0 clamp(14px, 2.5vw, 28px);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: saturate(160%) blur(8px); -webkit-backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--rule);
  container: jd-topbar / inline-size;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink-soft);
  border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500; cursor: var(--cur-hand);
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 120ms ease;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { color: var(--ink); background: var(--card-2); border-color: var(--rule-strong); }
.icon-btn:active { transform: scale(0.97); }
.icon-btn.icon-only { padding: 0; width: 32px; justify-content: center; }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-toggle-mobile { display: none; }

kbd {
  font-family: var(--font-sans); font-size: 10.5px; font-weight: 600; line-height: 1; padding: 3px 5px;
  border-radius: 5px; color: var(--ink-faint); background: var(--card-2); border: 1px solid var(--rule);
}
.pal-open { color: var(--ink-faint); gap: 8px; }
.pal-open-kbd { display: inline-flex; gap: 2px; }
@container jd-topbar (max-width: 900px) { .profile-name { display: none; } }
@container jd-topbar (max-width: 720px) { .pal-open-kbd, .pal-open-label { display: none; } .pal-open { width: 32px; padding: 0; justify-content: center; } }
@container jd-topbar (max-width: 560px) { .rdx-btn-label { display: none; } }
@container jd-topbar (max-width: 470px) { .rdx { display: none; } }
@container jd-topbar (max-width: 520px) {
  .di-btn #di-age, .di-btn .di-caret { display: none; }
  .di-btn { width: 32px; padding: 0; justify-content: center; }
  #share-btn { display: none !important; }
}

/* Data chip + popover */
.di { position: relative; }
.di-btn { gap: 7px; }
.di-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); flex: 0 0 auto; }
.di-dot.old { background: var(--warn); }
.di-dot.bad { background: var(--neg); }
.di-caret { width: 12px !important; height: 12px !important; opacity: 0.6; }
.di-pop {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 320px; max-width: 460px;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-lift); padding: 13px 14px; z-index: 80; animation: jd-pop-in 150ms var(--ease);
}
@keyframes jd-pop-in { from { opacity: 0; transform: translateY(-5px) scale(0.98); } to { opacity: 1; transform: none; } }
.di-title { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 8px; }
.di-srcs { display: flex; flex-wrap: wrap; gap: 4px; }
.di-src { display: inline-block; font-family: var(--font-mono); font-size: 11.5px; background: var(--card-2); border: 1px solid var(--rule); border-radius: 5px; padding: 2px 8px; color: var(--ink-soft); }
.di-note { font-size: 12px; color: var(--ink-faint); margin-top: 8px; line-height: 1.45; }
.di-refresh { display: flex; align-items: center; gap: 7px; margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--ink-soft); }
.di-refresh strong { font-weight: 600; color: var(--ink); }

/* Export dropdown (report-export.js shows and owns it) */
.rdx { position: relative; }
.rdx-btn { gap: 7px; }
.rdx-btn[aria-expanded="true"] { color: var(--ink); background: var(--card-2); border-color: var(--rule-strong); }
.rdx-caret { width: 12px !important; height: 12px !important; opacity: 0.6; transition: transform 160ms ease; }
.rdx-btn[aria-expanded="true"] .rdx-caret { transform: rotate(180deg); }
.rdx-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: 268px; padding: 6px;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-lift);
  transform-origin: top right; animation: jd-pop-in 150ms var(--ease);
}
.rdx-item { align-items: flex-start; }
.rdx-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rdx-item-name { font-weight: 600; color: var(--ink); }
.rdx-item-sub { font-size: 11.5px; font-weight: 400; color: var(--ink-faint); line-height: 1.35; }

/* profile menu */
.profile { position: relative; }
.profile-trigger {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 9px 0 4px;
  border: 1px solid var(--rule); background: var(--card); border-radius: var(--radius-pill); cursor: var(--cur-hand); color: var(--ink-soft);
  transition: background 150ms ease, border-color 150ms ease;
}
.profile-trigger:hover { background: var(--card-2); border-color: var(--rule-strong); }
.profile-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
}
.avatar-lg { width: 36px; height: 36px; font-size: 14px; }
.profile-name { font-size: 13px; font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-caret { width: 14px; height: 14px; color: var(--ink-faint); transition: transform 160ms ease; }
.profile-trigger[aria-expanded="true"] .profile-caret { transform: rotate(180deg); }
.profile-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 276px; padding: 6px; z-index: 50;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-lift);
  opacity: 0; transform: translateY(-6px) scale(0.98); transform-origin: top right; pointer-events: none;
  transition: opacity 150ms var(--ease), transform 150ms var(--ease);
}
.profile.open .profile-menu { opacity: 1; transform: none; pointer-events: auto; }
.profile-menu-head { display: flex; align-items: center; gap: 11px; padding: 8px 8px 10px; }
.profile-id { min-width: 0; }
.profile-id-name { font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-id-email { font-size: 12px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-sep { height: 1px; background: var(--rule); margin: 4px 4px 6px; }
.menu-label { padding: 4px 10px 2px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink-soft); font-size: 13.5px; font-weight: 500; text-align: left; cursor: var(--cur-hand);
  transition: background 120ms ease, color 120ms ease;
}
.menu-item:hover { background: var(--card-2); color: var(--ink); }
.menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.menu-item-icon { display: inline-flex; width: 17px; height: 17px; color: var(--ink-faint); flex: 0 0 auto; }
.menu-item-icon svg { width: 17px; height: 17px; }
.menu-item:hover .menu-item-icon { color: var(--ink); }
.menu-item.current { color: var(--accent); background: var(--accent-soft); }
.menu-item.current .menu-item-icon { color: var(--accent); }
.menu-item-danger:hover { background: var(--neg-soft); color: var(--neg); }
.menu-item-danger:hover .menu-item-icon { color: var(--neg); }

/* ---------- Content ---------- */

#tab-root { width: 100%; max-width: 1720px; margin: 0 auto; padding: 0 clamp(14px, 2.5vw, 28px) 64px; position: relative; flex: 1 1 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: tab-in 200ms var(--ease); }
@keyframes tab-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page { padding-top: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 16px; }
.page-head h1 { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.page-sub { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-faint); max-width: 70ch; }
.access-empty { max-width: 440px; margin: 100px auto; text-align: center; color: var(--ink-faint); }
.access-empty h2 { font-size: 18px; color: var(--ink); margin: 0 0 8px; }
.access-empty p { margin: 0; line-height: 1.5; }
.jd-loading { color: var(--ink-faint); font-size: 13.5px; padding: 40px 0; text-align: center; }

/* boot progress bar under the topbar */
.boot-bar { position: sticky; top: var(--topbar-h); z-index: 25; height: 3px; background: var(--card-2); }
body.impersonating .boot-bar { top: calc(var(--topbar-h) + var(--imp-h)); }
.boot-fill { height: 100%; width: 0%; background: var(--accent); transition: width 180ms linear; }
.boot-pct { position: absolute; right: clamp(14px, 2.5vw, 28px); top: 6px; font-size: 11px; font-weight: 600; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* skip link */
.skip-link { position: fixed; top: -60px; left: 12px; z-index: 300; background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: var(--radius-sm); transition: top 140ms var(--ease); }
.skip-link:focus { top: 12px; outline: 2px solid var(--ink); outline-offset: 2px; }

/* impersonation banner (fixed identity color in both themes) */
.imp-banner { display: none; }
body.impersonating { --imp-h: 42px; }
body.impersonating .imp-banner {
  display: flex; align-items: center; gap: 10px; position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--imp-h); padding: 0 clamp(12px, 3vw, 24px); background: #B45309; color: #fff; font-size: 13px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}
.imp-banner svg { width: 16px; height: 16px; }
.imp-banner-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.imp-banner-text strong { font-weight: 700; }
.imp-banner-actor { opacity: 0.85; }
.imp-banner-exit {
  margin-left: auto; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: #fff; cursor: var(--cur-hand);
  background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.55); border-radius: var(--radius-sm); padding: 5px 12px; transition: background 150ms ease;
}
.imp-banner-exit:hover { background: rgba(255, 255, 255, 0.3); }
body.impersonating .app-shell { padding-top: var(--imp-h); }
body.impersonating .sidebar { top: var(--imp-h); height: calc(100vh - var(--imp-h)); }
body.impersonating .topbar { top: var(--imp-h); }

/* ---------- Responsive: sidebar becomes a drawer ---------- */

@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%); box-shadow: var(--shadow-lift); }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .app-shell.sidebar-collapsed .sidebar { flex-basis: var(--sidebar-w); width: var(--sidebar-w); }
  .app-shell.sidebar-collapsed .brand-text, .app-shell.sidebar-collapsed .nav-label, .app-shell.sidebar-collapsed .nav-icon,
  .app-shell.sidebar-collapsed .nav-sub-label, .app-shell.sidebar-collapsed .nav-cat-label { display: block; }
  .app-shell.sidebar-collapsed .nav-icon { display: inline-flex; }
  .app-shell.sidebar-collapsed .nav-tile { display: none; }
  .app-shell.sidebar-collapsed .nav-item { justify-content: flex-start; padding: 8px; gap: 10px; }
  .app-shell.sidebar-collapsed .nav-item:hover .nav-label { position: static; transform: none; padding: 0; background: none; border: 0; box-shadow: none; }
  .sidebar-toggle { display: none !important; }
  .sidebar-scrim { display: block; pointer-events: none; }
  .app-shell.nav-open .sidebar-scrim { opacity: 1; pointer-events: auto; }
  .nav-toggle-mobile { display: inline-flex; }
  #tab-root { padding-left: 14px; padding-right: 14px; }
}

/* ==========================================================================
   Shared primitives (jdUI): buttons, inputs, toasts, modal, error state
   ========================================================================== */

.jd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: var(--cur-hand); white-space: nowrap;
  border-radius: var(--radius-sm); border: 1px solid var(--rule); background: var(--card); color: var(--ink);
  transition: background 150ms ease, border-color 150ms ease, transform 120ms ease, color 150ms ease;
}
.jd-btn svg { width: 15px; height: 15px; }
.jd-btn:hover { background: var(--card-2); border-color: var(--rule-strong); }
.jd-btn:active { transform: scale(0.98); }
.jd-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.jd-btn:disabled { opacity: 0.55; cursor: var(--cur-arrow); }
.jd-btn-primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.jd-btn-primary:hover { background: var(--accent-hover); border-color: transparent; }
.jd-btn-danger { background: var(--neg); color: #fff; border-color: transparent; }
.jd-btn-danger:hover { background: var(--neg); filter: brightness(1.08); }
.jd-btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.jd-btn-ghost:hover { background: var(--card-2); border-color: transparent; color: var(--ink); }
.jd-btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

.jd-input, .jd-select {
  height: 34px; padding: 0 11px; font: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--card); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); outline: none; width: 100%;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.jd-input:focus, .jd-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.jd-input::placeholder { color: var(--ink-faint); }
.jd-field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin: 12px 0 0; }
.jd-field-label .jd-input, .jd-field-label .jd-select { margin-top: 6px; }

.jd-toasts { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.jd-toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: min(440px, calc(100vw - 36px));
  padding: 11px 12px 11px 13px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-lift); font-size: 13px; color: var(--ink); animation: jd-toast-in 200ms var(--ease);
}
.jd-toast.leaving { animation: jd-toast-out 180ms ease forwards; }
@keyframes jd-toast-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes jd-toast-out { to { opacity: 0; transform: translateY(6px); } }
.jd-toast-ico { flex: 0 0 auto; display: inline-flex; }
.jd-toast-ico svg { width: 16px; height: 16px; }
.jd-toast-success .jd-toast-ico { color: var(--pos); }
.jd-toast-error .jd-toast-ico { color: var(--neg); }
.jd-toast-info .jd-toast-ico { color: var(--accent); }
.jd-toast-msg { flex: 1 1 auto; line-height: 1.4; }
.jd-toast-action { flex: 0 0 auto; font: inherit; font-size: 12.5px; font-weight: 700; cursor: var(--cur-hand); background: transparent; border: 0; color: var(--accent); padding: 2px 4px; }
.jd-toast-x { flex: 0 0 auto; background: transparent; border: 0; cursor: var(--cur-hand); padding: 2px; color: var(--ink-faint); display: inline-flex; }
.jd-toast-x:hover { color: var(--ink); }
.jd-toast-x svg { width: 14px; height: 14px; }

.jd-modal-back { position: fixed; inset: 0; z-index: 210; background: var(--scrim); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: jd-fade-in 140ms ease; }
@keyframes jd-fade-in { from { opacity: 0; } to { opacity: 1; } }
.jd-modal { width: min(440px, 100%); background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-card); box-shadow: var(--shadow-lift); padding: 20px 20px 16px; animation: jd-modal-in 200ms var(--ease); }
@keyframes jd-modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.jd-modal-wide { width: min(620px, 100%); }
.jd-modal-title { font-size: 17px; font-weight: 600; margin: 0 0 8px; }
.jd-modal-body { font-size: 13.5px; color: var(--ink-soft); margin: 0 0 16px; line-height: 1.5; }
.jd-modal-body p { margin: 0; }
.jd-modal-body p + p { margin-top: 8px; }
.jd-modal-warn { margin: 0 0 16px; padding: 11px 12px; background: var(--warn-soft); border-radius: var(--radius-sm); font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.jd-modal-warn p { margin: 0; }
.jd-modal-warn p + p { margin-top: 8px; }
.jd-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.jd-err { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 40px 20px; color: var(--ink-soft); }
.jd-err-ico { color: var(--warn); }
.jd-err-ico svg { width: 30px; height: 30px; }
.jd-err-title { font-size: 15px; font-weight: 600; color: var(--ink); margin-top: 4px; }
.jd-err-msg { font-size: 13px; color: var(--ink-faint); max-width: 460px; line-height: 1.5; }
.jd-err-btn { margin-top: 12px; }

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

.pal-back { position: fixed; inset: 0; z-index: 190; background: var(--scrim); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 20px 20px; animation: jd-fade-in 130ms ease; }
.pal { width: min(620px, 100%); background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-card); box-shadow: var(--shadow-lift); overflow: hidden; animation: jd-modal-in 180ms var(--ease); }
.pal-head { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-bottom: 1px solid var(--rule); }
.pal-ico { width: 17px; height: 17px; color: var(--ink-faint); flex: 0 0 auto; }
.pal-input { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; outline: none; font-family: inherit; font-size: 15px; color: var(--ink); }
.pal-input::placeholder { color: var(--ink-faint); }
.pal-list { max-height: min(420px, 50vh); overflow-y: auto; padding: 6px; }
.pal-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 9px 11px; border: 0; border-radius: var(--radius-sm); background: transparent; cursor: var(--cur-hand); text-align: left; }
.pal-row.sel { background: var(--accent-soft); }
.pal-row-label { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.pal-row.sel .pal-row-label { font-weight: 600; }
.pal-row-hint { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-faint); flex: 0 0 auto; }
.pal-empty { padding: 22px 12px; text-align: center; color: var(--ink-faint); font-size: 13px; }
.pal-foot { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--rule); background: var(--card-2); font-size: 11.5px; color: var(--ink-faint); }
.pal-foot span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Status pills, generic (used by setup and docs) ---------- */
.jd-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 600; background: var(--card-2); color: var(--ink-soft); border: 1px solid var(--rule); }
.jd-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.jd-pill-pos { color: var(--pos); background: var(--pos-soft); border-color: transparent; }
.jd-pill-warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.jd-pill-neg { color: var(--neg); background: var(--neg-soft); border-color: transparent; }
.jd-pill-accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

/* ---------- Platform page chrome ---------- */
.platform-body { background: var(--paper); }
.pf-top { display: flex; align-items: center; gap: 16px; height: var(--topbar-h); padding: 0 clamp(16px, 3vw, 32px); border-bottom: 1px solid var(--rule); }
.pf-title { font-weight: 600; color: var(--ink-faint); }
.pf-nav { margin-left: auto; display: flex; gap: 8px; }
.pf-root { max-width: 1100px; margin: 0 auto; padding: 28px clamp(16px, 3vw, 32px) 64px; }

/* ---------- 404 ---------- */
.nf { max-width: 520px; margin: 14vh auto 0; padding: 0 20px; text-align: center; }
.nf-brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 36px; }
.nf-brand svg { width: 28px; height: 28px; }
.nf-by { font-weight: 500; color: var(--ink-faint); margin-left: -3px; }
.nf h1 { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 10px; }
.nf p { color: var(--ink-faint); font-size: 14.5px; line-height: 1.55; margin: 0 0 24px; }

/* touch: every control at least 40 px tall */
@media (pointer: coarse) {
  .icon-btn, .menu-item, .nav-item, .nav-cat, .jd-btn { min-height: 40px; }
  .icon-btn { min-width: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar * { transition: none !important; }
}

/* ---------- sidebar width: drag the edge, double-click to reset, arrows when focused ---------- */
.sidebar-grip { position: absolute; top: 0; bottom: 0; right: -5px; width: 10px; z-index: 6; cursor: var(--cur-col); background: transparent; touch-action: none; }
.sidebar-grip::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; border-radius: 2px; background: var(--rule); transition: background .15s; }
.sidebar-grip:hover::after { background: var(--rule-strong); }
.sidebar-grip:focus-visible::after, .sidebar-resizing .sidebar-grip::after { background: var(--accent); }
.sidebar-grip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.sidebar-resizing, .sidebar-resizing * { cursor: var(--cur-col) !important; user-select: none; }
.sidebar-resizing .sidebar, .sidebar-resizing .sidebar * { transition: none !important; }
.app-shell.snap-hint .sidebar-nav, .app-shell.snap-hint .sidebar-bottom { opacity: .5; }
@media (max-width: 900px) { .sidebar-grip { display: none; } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* a hover that drives another component shows the linked pointer (color from the org theme) */
html.cur-link, html.cur-link * { cursor: var(--cur-link, var(--cur-arrow)) !important; }
