/* ============================================================
   Radix-Design System Dashboard - layout shell + components
   Radix UI geometry (12-step scales, soft radii, inset borders,
   the 1px-ring shadow) on Skypoint amber + Inter.
   All values derive from tokens.css. Never hardcode colors/sizes.
   ============================================================ */
@import url("./tokens.css");

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-base);
  font-size: var(--fs-2);
  line-height: var(--lh-2);
  letter-spacing: var(--ls-2);
  color: var(--fg-high);
  background: var(--color-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }

/* ---- App shell: header on top, sidebar + content below ---- */
.app-shell {
  display: grid;
  grid-template-rows: auto 56px 1fr;   /* banner row collapses to 0 when empty */
  grid-template-columns: 256px 1fr;
  grid-template-areas:
    "banner banner"
    "header header"
    "sidebar content";
  height: 100vh;
}

/* Announcement banner (thin strip above the header; dismissible) */
.app-banner { grid-area: banner; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-5); background: var(--accent-3); color: var(--accent-11); font-size: var(--fs-1); }
.app-banner .ab-icon { width: 16px; height: 16px; flex: 0 0 auto; }
.app-banner a { color: var(--accent-11); font-weight: var(--weight-medium); text-decoration: underline; }
.app-banner .ab-spacer { flex: 1; }
.app-banner .ab-close { display: inline-flex; border: 0; background: transparent; color: var(--accent-11); cursor: pointer; padding: 2px; border-radius: var(--radius-2); }
.app-banner .ab-close:hover { background: var(--accent-4); }
.app-banner[hidden] { display: none; }

/* ---- Header (full width, end to end) ---- */
.app-header {
  grid-area: header;
  background: var(--color-panel-solid);
  border-bottom: var(--stroke-thin) solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--space-5);
  color: var(--fg-high);
}
.app-header .brand { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-3); font-weight: var(--weight-bold); letter-spacing: -0.01em; }
.app-header .header-right { display: flex; align-items: center; gap: var(--space-3); }
.app-header .icon-btn {
  width: 32px; height: 32px; border-radius: var(--radius-3);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--fg-low); background: transparent; border: 0; cursor: pointer;
}
.app-header .icon-btn:hover { background: var(--gray-3); }
.app-header .header-user { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-2); color: var(--fg-low); }
.app-header .divider-v { width: 1px; height: 24px; background: var(--border-subtle); }

/* ---- Sidebar (Navigation) - Radix inset rounded pills ---- */
.app-sidebar {
  grid-area: sidebar;
  background: var(--color-page);
  border-right: var(--stroke-thin) solid var(--border-subtle);
  display: flex; flex-direction: column;
  padding: var(--space-3) var(--space-3);
  gap: 2px; overflow-y: auto;
}
.sidebar-toggle {
  width: 32px; height: 32px; border-radius: var(--radius-3);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--fg-low); background: transparent; border: 0; cursor: pointer;
  margin-bottom: var(--space-2);
}
.sidebar-toggle:hover { background: var(--gray-3); }
.nav-section {
  font-size: var(--fs-1); font-weight: var(--weight-medium);
  letter-spacing: .04em; text-transform: uppercase; color: var(--fg-subtle);
  padding: var(--space-3) var(--space-2) var(--space-1);
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 36px; padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-3);
  color: var(--fg-low); background: transparent;
  text-decoration: none; cursor: pointer;
  font-size: var(--fs-2); font-weight: var(--weight-medium);
}
.nav-item .nav-icon { width: 18px; height: 18px; color: var(--fg-subtle); flex: 0 0 auto; }
.nav-item .nav-label { flex: 1; }
.nav-item .nav-chevron { width: 16px; height: 16px; color: var(--fg-subtle); }
.nav-item:hover { background: var(--gray-3); color: var(--fg-high); }
.nav-item:hover .nav-icon { color: var(--fg-low); }
.nav-item[aria-current="page"],
.nav-item.is-active {
  background: var(--accent-9); color: var(--accent-contrast);   /* solid brand amber pill */
}
.nav-item[aria-current="page"] .nav-icon,
.nav-item.is-active .nav-icon { color: var(--accent-contrast); }
.nav-item[aria-current="page"]:hover,
.nav-item.is-active:hover { background: var(--accent-10); color: var(--accent-contrast); }

/* ---- Content area ---- */
.app-content { grid-area: content; background: var(--color-page); display: flex; flex-direction: column; overflow-y: auto; }
.content-body { flex: 1; padding: var(--space-5) var(--space-6) var(--space-6); text-align: left; }

/* Breadcrumbs (always present) */
.breadcrumbs { display: flex; align-items: center; gap: var(--space-1); padding: var(--space-4) var(--space-6); border-bottom: var(--stroke-thin) solid var(--border-subtle); font-size: var(--fs-2); }
.breadcrumbs a { color: var(--fg-low); text-decoration: none; padding: 2px 6px; border-radius: var(--radius-2); }
.breadcrumbs a:hover { background: var(--gray-3); color: var(--fg-high); }
.breadcrumbs .sep { color: var(--fg-subtle); display: inline-flex; }
.breadcrumbs .current { color: var(--fg-high); font-weight: var(--weight-medium); padding: 2px 6px; }

/* Page header */
.page-header { margin-bottom: var(--space-5); }
.page-header h1 { font-size: var(--fs-7); line-height: var(--lh-7); letter-spacing: var(--ls-7); font-weight: var(--weight-bold); }
.page-header p { margin-top: var(--space-2); color: var(--fg-low); font-size: var(--fs-3); line-height: var(--lh-3); }

/* Footer */
.app-footer { padding: var(--space-4) var(--space-6); border-top: var(--stroke-thin) solid var(--border-subtle); color: var(--fg-low); font-size: var(--fs-1); }
.app-footer a { color: var(--accent-11); text-decoration: none; }

/* ============================================================
   BUTTON - Radix variants (solid / soft / surface / outline / ghost)
   Accent solid uses DARK text because amber-9 is high-luminance.
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 32px; padding: 0 var(--space-3);
  border-radius: var(--radius-3);
  font-family: var(--font-base); font-size: var(--fs-2); line-height: var(--lh-2);
  font-weight: var(--weight-medium);
  border: 0; cursor: pointer; white-space: nowrap;
  transition: background-color .12s ease-out, box-shadow .12s ease-out;
}
.btn .btn-icon { width: 16px; height: 16px; flex: 0 0 auto; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--color-page), 0 0 0 4px var(--focus-ring); }
.btn:disabled { background: var(--gray-3); color: var(--fg-disabled); box-shadow: none; cursor: not-allowed; }

/* solid - the primary CTA */
.btn-solid { background: var(--accent-9); color: var(--accent-contrast); }
.btn-solid:hover { background: var(--accent-10); }
/* soft - secondary, tinted */
.btn-soft { background: var(--accent-3); color: var(--accent-11); }
.btn-soft:hover { background: var(--accent-4); }
/* surface - neutral panel button with inset hairline */
.btn-surface { background: var(--color-surface); color: var(--fg-high); box-shadow: inset 0 0 0 1px var(--border-ui); }
.btn-surface:hover { background: var(--gray-2); box-shadow: inset 0 0 0 1px var(--border-strong); }
/* outline - accent hairline */
.btn-outline { background: transparent; color: var(--accent-11); box-shadow: inset 0 0 0 1px var(--accent-8); }
.btn-outline:hover { background: var(--accent-2); }
/* ghost - chromeless */
.btn-ghost { background: transparent; color: var(--fg-low); }
.btn-ghost:hover { background: var(--gray-3); color: var(--fg-high); }

/* destructive modifier (compose with a variant) */
.btn-solid.is-danger { background: var(--red-9); color: #fff; }
.btn-solid.is-danger:hover { background: var(--red-10); }
.btn-soft.is-danger { background: var(--red-3); color: var(--red-11); }
.btn-soft.is-danger:hover { background: var(--red-4); }

/* sizes */
.btn.is-sm { height: 26px; padding: 0 var(--space-2); font-size: var(--fs-1); }
.btn.is-lg { height: 40px; padding: 0 var(--space-4); font-size: var(--fs-3); border-radius: var(--radius-4); }
.btn.is-icon { width: 32px; padding: 0; }

/* ============================================================
   CARD
   ============================================================ */
.card {
  background: var(--color-panel-solid);
  border: var(--stroke-thin) solid var(--border-subtle);
  border-radius: var(--radius-4);
  padding: var(--space-5);
  display: flex; flex-direction: column;
}
.card.is-raised { border-color: transparent; box-shadow: var(--shadow-3); }
.card.is-ghost { background: transparent; border-color: transparent; padding: 0; }

/* Avatar */
.avatar {
  width: 32px; height: 32px; border-radius: var(--radius-full);
  background: var(--gray-9); color: #fff;   /* neutral fallback; assign a .c1-.c8 per person */
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: var(--weight-medium); font-size: var(--fs-1);
  flex: 0 0 auto;
}
.avatar.is-neutral { background: var(--gray-4); color: var(--fg-low); }
/* Per-person color palette (chart hues; amber excluded so it stays brand-only).
   Assign deterministically from the person's initials, white text. */
.avatar.c1 { background: var(--chart-1); color: #fff; }
.avatar.c2 { background: var(--chart-2); color: #fff; }
.avatar.c3 { background: var(--chart-3); color: #fff; }
.avatar.c4 { background: var(--chart-4); color: #fff; }
.avatar.c5 { background: var(--chart-5); color: #fff; }
.avatar.c6 { background: var(--chart-6); color: #fff; }
.avatar.c7 { background: var(--chart-7); color: #fff; }
.avatar.c8 { background: var(--chart-8); color: #fff; }

/* Badge - soft by default (Radix) */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  height: 20px; padding: 0 var(--space-2); border-radius: var(--radius-2);
  background: var(--accent-3); color: var(--accent-11);
  font-size: var(--fs-1); font-weight: var(--weight-medium); line-height: 1;
}
.badge.is-solid { background: var(--accent-9); color: var(--accent-contrast); }
.badge.is-surface { background: transparent; box-shadow: inset 0 0 0 1px var(--accent-7); color: var(--accent-11); }
.badge.is-pill { border-radius: var(--radius-full); }
.badge.is-success { background: var(--success-bg); color: var(--success-text); }
.badge.is-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge.is-danger  { background: var(--danger-bg);  color: var(--danger-text); }
.badge.is-info    { background: var(--info-bg);    color: var(--info-text); }
.badge.is-neutral { background: var(--gray-3);     color: var(--fg-low); }

/* Empty state - the ONLY block allowed to center its contents */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3); padding: var(--space-7) var(--space-6); }
.empty-state .empty-art { width: 88px; height: 88px; border-radius: var(--radius-5); background: var(--accent-3); color: var(--accent-11); display: inline-flex; align-items: center; justify-content: center; position: relative; }
.empty-state h2 { font-size: var(--fs-5); line-height: var(--lh-5); font-weight: var(--weight-bold); }
.empty-state p { color: var(--fg-low); max-width: 420px; font-size: var(--fs-3); }
.empty-state .empty-hint { color: var(--fg-subtle); font-size: var(--fs-1); }

/* ============================================================
   FORM & INPUT - Radix surface fields (inset 1px shadow border)
   ============================================================ */
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field-label { font-size: var(--fs-2); font-weight: var(--weight-medium); color: var(--fg-high); }
.field-label .req { color: var(--danger-text); margin-left: 2px; }
.field-hint { font-size: var(--fs-1); color: var(--fg-low); }
.field-hint.is-error { color: var(--danger-text); }

.input, .select, .textarea {
  width: 100%; min-height: 32px;
  font-family: var(--font-base); font-size: var(--fs-2); line-height: var(--lh-2);
  color: var(--fg-high);
  background: var(--color-surface);
  border: 0; border-radius: var(--radius-2);
  box-shadow: inset 0 0 0 1px var(--border-ui);
  padding: 0 var(--space-2);
}
.textarea { min-height: 72px; padding: var(--space-2); resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--fg-subtle); }
.input:focus, .select:focus, .textarea:focus { outline: none; box-shadow: inset 0 0 0 1px var(--accent-8), 0 0 0 2px var(--accent-a8, transparent); }
.input:focus, .select:focus, .textarea:focus { box-shadow: inset 0 0 0 1px var(--accent-8); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--gray-2); color: var(--fg-disabled); box-shadow: inset 0 0 0 1px var(--border-subtle); }
.select { appearance: none; padding-right: var(--space-5); }

/* Spin button */
.spin-button { display: inline-flex; align-items: stretch; box-shadow: inset 0 0 0 1px var(--border-ui); border-radius: var(--radius-2); background: var(--color-surface); }
.spin-button .input { box-shadow: none; border-radius: var(--radius-2) 0 0 var(--radius-2); }
.spin-button .steppers { display: flex; flex-direction: column; }
.spin-button .steppers button { flex: 1; width: 24px; border: 0; background: transparent; color: var(--fg-low); cursor: pointer; }
.spin-button .steppers button:hover { background: var(--gray-3); }

/* Checkbox & Radio */
.checkbox, .radio { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; font-size: var(--fs-2); color: var(--fg-high); }
.checkbox input, .radio input { appearance: none; margin: 0; width: 18px; height: 18px; box-shadow: inset 0 0 0 1px var(--border-ui); background: var(--color-surface); cursor: pointer; display: inline-grid; place-content: center; }
.checkbox input { border-radius: 5px; }   /* fixed: a checkbox stays a checkbox even if the radius scale is bumped */
.radio input { border-radius: var(--radius-full); }
.checkbox input:checked, .radio input:checked { background: var(--accent-9); box-shadow: none; }
.checkbox input:checked::after { content: ""; width: 11px; height: 11px; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); background: var(--accent-contrast); }
.radio input:checked::after { content: ""; width: 7px; height: 7px; border-radius: var(--radius-full); background: var(--accent-contrast); }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.switch input { appearance: none; margin: 0; width: 40px; height: 22px; border-radius: var(--radius-full); background: var(--gray-7); position: relative; cursor: pointer; transition: background .12s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: var(--radius-full); background: #fff; box-shadow: var(--shadow-2); transition: transform .12s; }
.switch input:checked { background: var(--accent-9); }
.switch input:checked::after { transform: translateX(18px); }

/* Slider */
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: var(--radius-full); background: var(--gray-5); outline: none; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: var(--radius-full); background: #fff; box-shadow: var(--shadow-2), inset 0 0 0 1px var(--gray-7); cursor: pointer; }
.slider::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: var(--radius-full); background: #fff; box-shadow: var(--shadow-2), inset 0 0 0 1px var(--gray-7); cursor: pointer; }

/* ============================================================
   DATA & FEEDBACK
   ============================================================ */

/* Tabs */
.tabs { display: flex; gap: var(--space-1); border-bottom: var(--stroke-thin) solid var(--border-subtle); }
.tab { position: relative; padding: var(--space-2) var(--space-3); background: transparent; border: 0; cursor: pointer; font-size: var(--fs-2); font-weight: var(--weight-medium); color: var(--fg-low); }
.tab:hover { color: var(--fg-high); }
.tab.is-active { color: var(--fg-high); }
.tab.is-active::after { content: ""; position: absolute; left: var(--space-3); right: var(--space-3); bottom: -1px; height: 2px; border-radius: var(--radius-full); background: var(--accent-9); }

/* Tag (closable chip) */
.tag { display: inline-flex; align-items: center; gap: var(--space-1); height: 24px; padding: 0 var(--space-2); border-radius: var(--radius-2); background: var(--gray-3); color: var(--fg-low); font-size: var(--fs-1); }
.tag .tag-dismiss { cursor: pointer; color: var(--fg-subtle); display: inline-flex; }

/* Toast */
.toast { display: flex; gap: var(--space-3); padding: var(--space-3); background: var(--color-panel-solid); border-radius: var(--radius-4); box-shadow: var(--shadow-4); max-width: 360px; }
.toast .toast-title { font-size: var(--fs-2); font-weight: var(--weight-medium); }
.toast .toast-body { font-size: var(--fs-1); color: var(--fg-low); }

/* Callout (Radix Callout = soft tinted info/status banner) */
.callout { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-radius: var(--radius-4); background: var(--gray-3); color: var(--fg-high); font-size: var(--fs-2); }
.callout .co-icon { width: 18px; height: 18px; flex: 0 0 auto; color: var(--fg-low); margin-top: 1px; }
.callout.is-info    { background: var(--info-bg);    color: var(--info-text); }
.callout.is-info .co-icon    { color: var(--info-solid); }
.callout.is-success { background: var(--success-bg); color: var(--success-text); }
.callout.is-success .co-icon { color: var(--success-solid); }
.callout.is-warning { background: var(--warning-bg); color: var(--warning-text); }
.callout.is-warning .co-icon { color: var(--warning-solid); }
.callout.is-danger  { background: var(--danger-bg);  color: var(--danger-text); }
.callout.is-danger .co-icon  { color: var(--danger-solid); }

/* Progress */
.progress { width: 100%; height: 6px; border-radius: var(--radius-full); background: var(--gray-4); overflow: hidden; }
.progress > .progress-fill { height: 100%; background: var(--accent-9); border-radius: var(--radius-full); }

/* Spinner */
.spinner { display: inline-flex; align-items: center; gap: var(--space-2); }
.spinner .spin { width: 20px; height: 20px; border-radius: var(--radius-full); border: 2px solid var(--gray-5); border-top-color: var(--accent-9); animation: rx-spin .8s linear infinite; }
@keyframes rx-spin { to { transform: rotate(360deg); } }

/* Skeleton */
.skeleton { background: var(--gray-3); border-radius: var(--radius-2); position: relative; overflow: hidden; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent); animation: rx-shimmer 1.4s infinite; }
@keyframes rx-shimmer { to { transform: translateX(100%); } }

/* Tooltip - Radix solid inverted */
.tooltip { background: var(--color-inverted); color: var(--fg-on-inverted); border-radius: var(--radius-2); padding: var(--space-1) var(--space-2); box-shadow: var(--shadow-3); font-size: var(--fs-1); max-width: 240px; }

/* Persona */
.persona { display: inline-flex; align-items: center; gap: var(--space-2); }
.persona .persona-text { display: flex; flex-direction: column; }
.persona .persona-name { font-size: var(--fs-3); font-weight: var(--weight-medium); color: var(--fg-high); }
.persona .persona-sub { font-size: var(--fs-1); color: var(--fg-low); }

/* ============================================================
   CONTAINERS & OVERLAYS
   ============================================================ */
.overlay { position: fixed; inset: 0; background: var(--color-overlay); display: flex; align-items: center; justify-content: center; z-index: 1000; }

.dialog { width: min(540px, 92vw); background: var(--color-panel-solid); border-radius: var(--radius-5); box-shadow: var(--shadow-5); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.dialog-title { font-size: var(--fs-5); line-height: var(--lh-5); font-weight: var(--weight-bold); }
.dialog-body { font-size: var(--fs-2); color: var(--fg-low); }
.dialog-footer { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

.modal { width: min(820px, 94vw); max-height: 90vh; overflow: auto; background: var(--color-panel-solid); border-radius: var(--radius-5); box-shadow: var(--shadow-5); }

.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 90vw); background: var(--color-panel-solid); box-shadow: var(--shadow-5); padding: var(--space-5); overflow-y: auto; z-index: 1000; }
.drawer.is-left { right: auto; left: 0; }

.popover { background: var(--color-panel-solid); border-radius: var(--radius-4); box-shadow: var(--shadow-4); padding: var(--space-3); }

.accordion-item { border-bottom: var(--stroke-thin) solid var(--border-subtle); }
.accordion-header { display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: var(--space-3) var(--space-2); background: transparent; border: 0; cursor: pointer; font-size: var(--fs-2); font-weight: var(--weight-medium); color: var(--fg-high); text-align: left; }
.accordion-header .acc-chevron { transition: transform .12s; color: var(--fg-subtle); }
.accordion-header[aria-expanded="true"] .acc-chevron { transform: rotate(90deg); }
.accordion-panel { padding: 0 var(--space-2) var(--space-3) calc(var(--space-2) + 18px); font-size: var(--fs-2); color: var(--fg-low); }

/* Separator */
.divider { border: 0; border-top: var(--stroke-thin) solid var(--border-subtle); margin: var(--space-3) 0; }
.divider.is-vertical { border-top: 0; border-left: var(--stroke-thin) solid var(--border-subtle); height: auto; align-self: stretch; margin: 0 var(--space-3); }

/* Link */
.link { color: var(--accent-11); text-decoration: none; font-size: var(--fs-2); }
.link:hover { text-decoration: underline; }

/* Tree */
.tree { display: flex; flex-direction: column; }
.tree-item { display: flex; align-items: center; gap: var(--space-1); min-height: 32px; padding: 0 var(--space-2); border-radius: var(--radius-3); color: var(--fg-low); cursor: pointer; font-size: var(--fs-2); }
.tree-item:hover { background: var(--gray-3); color: var(--fg-high); }
.tree-item .tree-chevron { width: 16px; height: 16px; color: var(--fg-subtle); }
.tree-item.is-selected { background: var(--accent-3); color: var(--accent-11); }
.tree-children { padding-left: var(--space-5); }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: var(--space-1); min-height: 36px; padding: var(--space-1); border-radius: var(--radius-3); background: var(--color-panel-solid); box-shadow: inset 0 0 0 1px var(--border-subtle); }
.toolbar .toolbar-spacer { flex: 1; }

/* Info button */
.info-btn { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: var(--radius-2); color: var(--fg-subtle); cursor: pointer; }
.info-btn:hover { background: var(--gray-3); color: var(--fg-low); }

/* Dropdown menu (Select / Dropdown Menu surface) */
.dropdown { display: inline-flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-width: 180px; height: 32px; padding: 0 var(--space-2) 0 var(--space-3); background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--border-ui); border-radius: var(--radius-2); color: var(--fg-high); font-size: var(--fs-2); cursor: pointer; }
.dropdown:hover { background: var(--gray-2); }
.dropdown:focus-within, .dropdown.is-focus { box-shadow: inset 0 0 0 1px var(--accent-8); outline: none; }
.dropdown .dropdown-chevron { width: 16px; height: 16px; color: var(--fg-subtle); transition: transform .12s; }
.dropdown[aria-expanded="true"] .dropdown-chevron { transform: rotate(180deg); }
.dropdown-menu { background: var(--color-panel-solid); border-radius: var(--radius-3); box-shadow: var(--shadow-4); padding: var(--space-1); display: flex; flex-direction: column; gap: 1px; min-width: 200px; }
.list-item { display: flex; align-items: center; gap: var(--space-2); min-height: 32px; padding: var(--space-1) var(--space-2); border-radius: var(--radius-2); color: var(--fg-high); font-size: var(--fs-2); cursor: pointer; }
.list-item:hover { background: var(--accent-9); color: var(--accent-contrast); }
.list-item:hover .list-check { color: var(--accent-contrast); }
.list-item.is-selected .list-check { color: var(--accent-11); }
.list-item.is-disabled { color: var(--fg-disabled); pointer-events: none; }
.list-item.is-header { font-size: var(--fs-1); font-weight: var(--weight-medium); color: var(--fg-subtle); pointer-events: none; text-transform: uppercase; letter-spacing: .04em; }
.list-item .list-check { width: 16px; height: 16px; }

/* ============================================================
   TABLE - Radix data table
   Header text gray-11 (--fg-low), body gray-12, gray-6 separators,
   gray-2 row hover, 40px header / 48px body rows (the §4 literal).
   Pair with .table-toolbar above and .pagination below.
   ============================================================ */
.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--radius-4); border: var(--stroke-thin) solid var(--border-subtle); background: var(--color-panel-solid); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-2); }
.table thead th { position: sticky; top: 0; z-index: 1; background: var(--gray-2); text-align: left; font-weight: var(--weight-medium); color: var(--fg-low); padding: 0 var(--space-4); height: 40px; border-bottom: var(--stroke-thin) solid var(--border-subtle); white-space: nowrap; }
.table thead th.is-numeric { text-align: right; }
.table tbody td { height: 48px; padding: 0 var(--space-4); color: var(--table-fg); font-weight: var(--weight-regular); border-bottom: var(--stroke-thin) solid var(--border-subtle); vertical-align: middle; }
.table tbody td.is-numeric { text-align: right; font-variant-numeric: tabular-nums; color: var(--table-fg); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--row-accent); }
.table tbody tr.is-selected td { background: var(--row-accent); }
.table tbody tr[data-href] { cursor: pointer; }   /* clickable rows (wire with the row-click snippet) */
.table .cell-strong { font-weight: var(--weight-regular); color: var(--table-fg); }
.table .cell-sub { color: var(--fg-subtle); }
.table .cell-sub { color: var(--fg-low); font-size: var(--fs-1); }
.table .cell-person { display: flex; align-items: center; gap: var(--space-3); }
.table-toolbar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.table-toolbar .toolbar-spacer { flex: 1; }
.pagination { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-4); font-size: var(--fs-2); color: var(--fg-low); }
.pagination .page-spacer { flex: 1; }
.pagination .page-info { color: var(--fg-low); }
.pagination .page-controls { display: flex; align-items: center; gap: var(--space-1); }

/* Search field (leading icon inside a surface input) */
.search { position: relative; display: inline-flex; align-items: center; }
.search .search-icon { position: absolute; left: var(--space-2); width: 16px; height: 16px; color: var(--fg-subtle); pointer-events: none; }
.search .input { padding-left: var(--space-6); }

/* ============================================================
   RADIX EXTRAS
   ============================================================ */

/* Segmented Control - track with a sliding active panel */
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: var(--gray-3); border-radius: var(--radius-3); }
.segmented-item { display: inline-flex; align-items: center; gap: var(--space-1); height: 28px; padding: 0 var(--space-3); border: 0; background: transparent; color: var(--fg-low); font-family: var(--font-base); font-size: var(--fs-2); font-weight: var(--weight-medium); border-radius: var(--radius-2); cursor: pointer; }
.segmented-item:hover { color: var(--fg-high); }
.segmented-item.is-active { background: var(--color-panel-solid); color: var(--fg-high); box-shadow: var(--shadow-2); }

/* Toggle Group - pressed/unpressed buttons (single or multi) */
.toggle-group { display: inline-flex; gap: var(--space-1); }
.toggle { display: inline-flex; align-items: center; gap: var(--space-1); height: 32px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-2); background: transparent; box-shadow: inset 0 0 0 1px var(--border-ui); color: var(--fg-low); font-family: var(--font-base); font-size: var(--fs-2); font-weight: var(--weight-medium); cursor: pointer; }
.toggle:hover { background: var(--gray-2); color: var(--fg-high); }
.toggle.is-on { background: var(--accent-3); color: var(--accent-11); box-shadow: inset 0 0 0 1px var(--accent-7); }

/* Data List - key/value pairs */
.data-list { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-3) var(--space-5); align-items: baseline; }
.data-list .dl-label { color: var(--fg-low); font-size: var(--fs-2); }
.data-list .dl-value { color: var(--fg-high); font-size: var(--fs-2); }

/* Radio Cards - selectable card group */
.radio-cards { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.radio-card { display: block; padding: var(--space-4); border-radius: var(--radius-4); background: var(--color-panel-solid); box-shadow: inset 0 0 0 1px var(--border-ui); cursor: pointer; }
.radio-card:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.radio-card.is-selected { box-shadow: inset 0 0 0 2px var(--accent-9); }
.radio-card .rc-title { font-size: var(--fs-2); font-weight: var(--weight-medium); color: var(--fg-high); }
.radio-card .rc-sub { font-size: var(--fs-1); color: var(--fg-low); margin-top: 2px; }

/* Alert Dialog - destructive confirm (narrower than Dialog) */
.alert-dialog { width: min(460px, 92vw); background: var(--color-panel-solid); border-radius: var(--radius-5); box-shadow: var(--shadow-5); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.alert-dialog .ad-title { font-size: var(--fs-5); line-height: var(--lh-5); font-weight: var(--weight-bold); }
.alert-dialog .ad-body { font-size: var(--fs-2); color: var(--fg-low); }
.alert-dialog .ad-footer { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

/* Hover Card - rich preview surface */
.hover-card { background: var(--color-panel-solid); border-radius: var(--radius-4); box-shadow: var(--shadow-4); padding: var(--space-4); max-width: 320px; }

/* Context Menu - reuses the dropdown menu surface */
.context-menu { background: var(--color-panel-solid); border-radius: var(--radius-3); box-shadow: var(--shadow-4); padding: var(--space-1); display: flex; flex-direction: column; gap: 1px; min-width: 180px; }

/* Inset - bleed content to the card edge (cancels card padding) */
.inset { margin-left: calc(-1 * var(--space-5)); margin-right: calc(-1 * var(--space-5)); }
.inset.is-top { margin-top: calc(-1 * var(--space-5)); }
.inset.is-bottom { margin-bottom: calc(-1 * var(--space-5)); }
.inset > img { display: block; width: 100%; }

/* Scroll Area - thin custom scrollbars */
.scroll-area { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--gray-7) transparent; }
.scroll-area::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll-area::-webkit-scrollbar-track { background: transparent; }
.scroll-area::-webkit-scrollbar-thumb { background: var(--gray-7); border-radius: var(--radius-full); border: 3px solid var(--color-panel-solid); }
.scroll-area::-webkit-scrollbar-thumb:hover { background: var(--gray-8); }

/* Tab Nav - links styled as tabs (navigation, not in-page panels) */
.tab-nav { display: flex; gap: var(--space-1); border-bottom: var(--stroke-thin) solid var(--border-subtle); }
.tab-nav-item { position: relative; padding: var(--space-2) var(--space-3); color: var(--fg-low); text-decoration: none; font-size: var(--fs-2); font-weight: var(--weight-medium); }
.tab-nav-item:hover { color: var(--fg-high); }
.tab-nav-item.is-active { color: var(--fg-high); }
.tab-nav-item.is-active::after { content: ""; position: absolute; left: var(--space-3); right: var(--space-3); bottom: -1px; height: 2px; border-radius: var(--radius-full); background: var(--accent-9); }

/* Inline typography: Code, Kbd, Blockquote */
.code { font-family: var(--font-mono); font-size: 0.9em; padding: 0.1em var(--space-1); background: var(--gray-3); color: var(--fg-high); border-radius: var(--radius-1); }
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 var(--space-1); font-family: var(--font-mono); font-size: var(--fs-1); color: var(--fg-low); background: var(--gray-2); box-shadow: inset 0 0 0 1px var(--border-subtle), 0 1px 0 var(--border-ui); border-radius: var(--radius-2); }
.blockquote { border-left: var(--stroke-thick) solid var(--gray-6); padding-left: var(--space-4); color: var(--fg-low); font-size: var(--fs-3); line-height: var(--lh-3); }

/* Aspect Ratio - set --ratio (e.g. 56.25% for 16:9) on the element */
.aspect { position: relative; width: 100%; overflow: hidden; border-radius: var(--radius-3); }
.aspect::before { content: ""; display: block; padding-top: var(--ratio, 56.25%); }
.aspect > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   HEADER EXTRAS (presence, org switcher, notif count, apps, theme)
   ============================================================ */
.presence { display: inline-flex; align-items: center; gap: var(--space-2); height: 28px; padding: 0 var(--space-3); border-radius: var(--radius-full); box-shadow: inset 0 0 0 1px var(--border-subtle); font-size: var(--fs-1); color: var(--fg-low); }
.presence .dot { width: 7px; height: 7px; border-radius: var(--radius-full); background: var(--green-9); }
.icon-btn { position: relative; }
.icon-btn .ic-badge { position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--radius-full); background: var(--red-9); color: #fff; font-size: 10px; font-weight: var(--weight-bold); display: inline-flex; align-items: center; justify-content: center; }
/* App launcher popover grid */
.app-launcher { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-1); width: 264px; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); padding: var(--space-3) var(--space-2); border-radius: var(--radius-3); text-decoration: none; color: var(--fg-high); font-size: var(--fs-1); }
.app-tile:hover { background: var(--gray-3); }
.app-tile .at-ic { width: 36px; height: 36px; border-radius: var(--radius-3); display: inline-flex; align-items: center; justify-content: center; background: var(--accent-3); color: var(--accent-11); }

/* ============================================================
   LAYOUT HELPERS (archetype grids - see references/layout.md)
   ============================================================ */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.split-2 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-4); align-items: start; }
.split-even { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); align-items: start; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: var(--space-4); }
.stack-5 { display: flex; flex-direction: column; gap: var(--space-5); }
@media (max-width: 1024px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } .split-2, .split-even { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .kpi-row { grid-template-columns: 1fr; } .card-grid { grid-template-columns: 1fr; } }

/* KPI stat card (extends .card) */
.stat-card { gap: var(--space-2); }
.stat-card .sc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); }
.stat-card .sc-label { font-size: var(--fs-2); color: var(--fg-low); }
.stat-card .sc-icon { width: 32px; height: 32px; border-radius: var(--radius-3); display: inline-flex; align-items: center; justify-content: center; background: var(--gray-3); color: var(--fg-low); flex: 0 0 auto; }
.stat-card .sc-value { font-size: var(--fs-8); line-height: 1; letter-spacing: var(--ls-8); font-weight: var(--weight-bold); color: var(--fg-high); }
.stat-card .sc-delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-1); }
.stat-card .sc-delta.is-up { color: var(--success-text); }
.stat-card .sc-delta.is-down { color: var(--danger-text); }
.stat-card .sc-spark { margin-top: var(--space-1); height: 40px; }
.stat-card .sc-spark svg { width: 100%; height: 100%; display: block; }

/* Card with a titled header (panel) */
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.panel-title { font-size: var(--fs-4); font-weight: var(--weight-bold); color: var(--fg-high); }
.panel-sub { font-size: var(--fs-1); color: var(--fg-low); margin-top: 2px; }

/* ============================================================
   TABLE ENHANCEMENTS (select, sortable, status) - see layout.md
   ============================================================ */
.table .col-check { width: 44px; text-align: center; }
.table th.is-sortable { cursor: pointer; user-select: none; }
.table th.is-sortable:hover { color: var(--fg-high); }
.table th .th-sort { display: inline-flex; vertical-align: middle; margin-left: 4px; color: var(--fg-subtle); }
.badge.is-void { text-decoration: line-through; }

/* ============================================================
   THREE-PANE (list + detail) - see layout.md
   Use inside <main.app-content> with a flush content-body.
   ============================================================ */
.content-body.is-flush { padding: 0; }
.three-pane { display: grid; grid-template-columns: 232px minmax(320px, 380px) 1fr; height: 100%; }
.pane-rail { border-right: var(--stroke-thin) solid var(--border-subtle); padding: var(--space-4); display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.pane-list { border-right: var(--stroke-thin) solid var(--border-subtle); overflow-y: auto; }
.pane-detail { overflow-y: auto; padding: var(--space-6); }
.pane-list-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4); border-bottom: var(--stroke-thin) solid var(--border-subtle); position: sticky; top: 0; background: var(--color-panel-solid); font-size: var(--fs-1); font-weight: var(--weight-medium); letter-spacing: .04em; text-transform: uppercase; color: var(--fg-subtle); }
.pane-folder { display: flex; align-items: center; gap: var(--space-3); min-height: 34px; padding: 0 var(--space-3); border-radius: var(--radius-3); color: var(--fg-low); text-decoration: none; font-size: var(--fs-2); font-weight: var(--weight-medium); }
.pane-folder:hover { background: var(--gray-3); color: var(--fg-high); }
.pane-folder.is-active { background: var(--accent-3); color: var(--accent-11); }
.pane-folder .pf-ic { width: 18px; height: 18px; color: var(--fg-subtle); flex: 0 0 auto; }
.pane-folder.is-active .pf-ic { color: var(--accent-11); }
.pane-folder .pf-count { margin-left: auto; font-size: var(--fs-1); color: var(--fg-subtle); }
.pane-folder.is-active .pf-count { color: var(--accent-11); }
.mail-item { display: block; padding: var(--space-3) var(--space-4); border-bottom: var(--stroke-thin) solid var(--border-subtle); border-left: 2px solid transparent; cursor: pointer; text-decoration: none; color: inherit; }
.mail-item:hover { background: var(--gray-2); }
.mail-item.is-active { background: var(--accent-2); border-left-color: var(--accent-9); }
.mail-item.is-unread .mail-name { font-weight: var(--weight-bold); }
.mail-item.is-unread { border-left-color: var(--accent-9); }
.mail-from { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.mail-name { font-size: var(--fs-2); font-weight: var(--weight-medium); color: var(--fg-high); }
.mail-time { font-size: var(--fs-1); color: var(--fg-subtle); flex: 0 0 auto; }
.mail-subj { font-size: var(--fs-2); color: var(--fg-high); margin-top: 2px; }
.mail-snippet { font-size: var(--fs-1); color: var(--fg-low); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1024px) { .three-pane { grid-template-columns: minmax(300px, 360px) 1fr; } .three-pane .pane-rail { display: none; } }

/* ============================================================
   APP SHELL EXTENSIONS (v2) - opt-in patterns proven in the field
   Dark app bar, click-to-open profile menu, SPA view switching,
   page tab bar, colored metric cards, parameter sliders, collapsibles.
   All token-driven; the single dark-bar literal is documented below.
   ============================================================ */

/* ---- Dark app bar: add .is-dark to .app-header for a persistent dark
   frame across BOTH themes. Controls flip to light-on-dark. The #242424
   is the one allowed shell literal (a fixed chrome color, theme-independent). */
.app-header.is-dark { background: #242424; color: #fff; border-bottom-color: rgba(255,255,255,.10); }
.app-header.is-dark .brand { color: #fff; }
.app-header.is-dark .header-user,
.app-header.is-dark .icon-btn,
.app-header.is-dark .presence { color: rgba(255,255,255,.72); }
.app-header.is-dark .icon-btn:hover { background: rgba(255,255,255,.12); }
.app-header.is-dark .presence { box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.app-header.is-dark .divider-v { background: rgba(255,255,255,.16); }
.app-header.is-dark .search .search-icon { color: rgba(255,255,255,.55); }
.app-header.is-dark .input { background: rgba(255,255,255,.08); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.app-header.is-dark .input::placeholder { color: rgba(255,255,255,.55); }
.app-header.is-dark .input:focus { box-shadow: inset 0 0 0 1px var(--accent-8); }
.app-header.is-dark .dropdown { background: rgba(255,255,255,.08); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.app-header.is-dark .dropdown:hover { background: rgba(255,255,255,.12); }
.app-header.is-dark .dropdown .dropdown-chevron { color: rgba(255,255,255,.6); }
.app-header.is-dark .avatar.is-neutral { background: rgba(255,255,255,.16); color: #fff; }

/* ---- Profile trigger + menu (header account dropdown; opens on click).
   Put a .profile-btn (avatar + name + chevron) next to a .profile-menu popover. */
.profile-btn { display: inline-flex; align-items: center; gap: var(--space-2); height: 36px; padding: 0 var(--space-2); border: 0; background: transparent; color: var(--fg-high); font-family: var(--font-base); font-size: var(--fs-2); font-weight: var(--weight-medium); border-radius: var(--radius-3); cursor: pointer; }
.profile-btn:hover { background: var(--gray-3); }
.app-header.is-dark .profile-btn { color: #fff; }
.app-header.is-dark .profile-btn:hover { background: rgba(255,255,255,.12); }
.profile-btn .avatar { background: var(--accent-9); color: var(--accent-contrast); }   /* brand account avatar */
.profile-btn .pb-chevron { color: var(--fg-subtle); display: inline-flex; transition: transform .12s; }
.app-header.is-dark .profile-btn .pb-name { color: #fff; }
.app-header.is-dark .profile-btn .pb-chevron { color: rgba(255,255,255,.6); }
.profile-btn[aria-expanded="true"] .pb-chevron { transform: rotate(180deg); }
.profile-menu { width: 320px; padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
.profile-menu[hidden] { display: none; }                                     /* beats the flex display */
.profile-menu .pm-head { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-2); }
.profile-menu .pm-head .avatar { background: var(--accent-9); color: var(--accent-contrast); }
.profile-menu .pm-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile-menu .pm-name { font-size: var(--fs-3); font-weight: var(--weight-bold); color: var(--fg-high); }
.profile-menu .pm-email { font-size: var(--fs-1); color: var(--fg-low); overflow: hidden; text-overflow: ellipsis; }
.profile-menu .pm-viewprofile { margin-top: 2px; font-size: var(--fs-2); font-weight: var(--weight-medium); color: var(--accent-11); text-decoration: none; }
.profile-menu .pm-viewprofile:hover { text-decoration: underline; }
.profile-menu .divider { margin: var(--space-2) 0; width: 100%; }
.profile-menu .pm-field { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-1) var(--space-2); }
.profile-menu .pm-field label { font-size: var(--fs-2); font-weight: var(--weight-medium); color: var(--fg-high); }
.profile-menu .dropdown { width: 100%; min-width: 0; background: var(--color-surface); color: var(--fg-high); box-shadow: inset 0 0 0 1px var(--border-ui); }
.profile-menu .dropdown:hover { background: var(--gray-2); }
.profile-menu .dropdown .dropdown-chevron { color: var(--fg-subtle); }
.profile-menu .pm-item { display: flex; align-items: center; justify-content: space-between; min-height: 36px; padding: 0 var(--space-2); border-radius: var(--radius-2); color: var(--fg-high); text-decoration: none; font-size: var(--fs-2); }
.profile-menu .pm-item svg { color: var(--fg-subtle); }
.profile-menu .pm-item:hover { background: var(--gray-3); }
.profile-menu .pm-version { text-align: center; font-size: var(--fs-1); color: var(--fg-subtle); padding-top: var(--space-1); }

/* ---- SPA view switching: wrap each page in <div class="view" id="..">, toggle [hidden].
   Sidebar .nav-item[data-view] targets a view id; only the active view renders. */
.app-content > .view { display: flex; flex-direction: column; flex: 1; }
.view[hidden] { display: none; }

/* ---- Page tab bar (in-page nav; distinct from sidebar). Active = amber pill. */
.seg-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--space-2); background: var(--gray-3); padding: 4px; border-radius: var(--radius-4); }
.seg-tab { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: 44px; border: 0; background: transparent; color: var(--fg-low); font-family: var(--font-base); font-size: var(--fs-3); font-weight: var(--weight-medium); border-radius: var(--radius-3); cursor: pointer; transition: background .12s, color .12s; }
.seg-tab svg { width: 18px; height: 18px; }
.seg-tab:hover { color: var(--fg-high); }
.seg-tab.is-active { background: var(--accent-9); color: var(--accent-contrast); box-shadow: var(--shadow-2); }
.tab-panel[hidden] { display: none; }
/* brand variant of the segmented control (amber active instead of white panel) */
.segmented.is-brand .segmented-item.is-active { background: var(--accent-9); color: var(--accent-contrast); }
.segmented.is-brand .segmented-item.is-active svg { color: var(--accent-contrast); }

/* ---- Colored metric cards (status-tinted KPI tiles; extends .card).
   Amber stays brand-only, so metric hues use blue/green/purple/red. */
.metric-card { gap: var(--space-1); }
.metric-card .mc-top { display: flex; align-items: center; justify-content: space-between; }
.metric-card .mc-label { font-size: var(--fs-2); font-weight: var(--weight-medium); color: var(--fg-low); }
.metric-card .mc-ic { width: 32px; height: 32px; border-radius: var(--radius-3); display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--mcs) 14%, transparent); color: var(--mcs); }
.metric-card .mc-value { font-size: var(--fs-8); line-height: 1.05; letter-spacing: var(--ls-8); font-weight: var(--weight-bold); color: var(--mc); margin-top: var(--space-2); }
.metric-card .mc-sub { font-size: var(--fs-1); color: var(--fg-low); margin-top: 2px; }
.metric-card.is-blue   { --mc: var(--blue-11);  --mcs: var(--blue-9); }
.metric-card.is-green  { --mc: var(--green-11); --mcs: var(--green-9); }
.metric-card.is-purple { --mc: var(--chart-4);  --mcs: var(--chart-4); }
.metric-card.is-red    { --mc: var(--red-11);   --mcs: var(--red-9); }

/* ---- Filter bar (inline control strip inside a flush .card) */
.filter-bar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-3) var(--space-4); }
.filter-bar .fb-ic { color: var(--fg-subtle); display: inline-flex; }
.filter-bar .fb-label { font-size: var(--fs-2); color: var(--fg-low); }
.filter-bar .spacer { flex: 1; }

/* ---- Summary strip (compact key/value quad on a gray surface) */
.summary-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--space-4); background: var(--gray-2); border-radius: var(--radius-4); padding: var(--space-4); }
.summary-strip .ss-label { font-size: var(--fs-1); color: var(--fg-low); }
.summary-strip .ss-value { font-size: var(--fs-3); font-weight: var(--weight-medium); color: var(--fg-high); margin-top: 2px; }

/* ---- Parameter slider (labeled range with an icon tile + live value badge).
   Set --pc on .param for the icon hue; the JS paints the track fill. */
.param { padding: var(--space-3) 0; border-top: var(--stroke-thin) solid var(--border-subtle); }
.param-head { display: flex; align-items: flex-start; gap: var(--space-3); }
.param-ic { width: 30px; height: 30px; border-radius: var(--radius-2); display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--pc, var(--accent-9)) 14%, transparent); color: var(--pc, var(--accent-11)); flex: 0 0 auto; }
.param-meta { flex: 1; min-width: 0; }
.param-title { font-size: var(--fs-2); font-weight: var(--weight-medium); color: var(--fg-high); }
.param-desc { font-size: var(--fs-1); color: var(--fg-low); margin-top: 1px; }
.param-val { flex: 0 0 auto; min-width: 44px; text-align: center; height: 24px; line-height: 24px; padding: 0 var(--space-2); border-radius: var(--radius-2); background: var(--gray-3); color: var(--fg-high); font-size: var(--fs-1); font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; }
.param .slider { margin-top: var(--space-3); }
.param-range { display: flex; justify-content: space-between; font-size: var(--fs-1); color: var(--fg-subtle); margin-top: 4px; }

/* ---- Collapsible (native <details class="collapse">) */
details.collapse > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-3); box-shadow: inset 0 0 0 1px var(--border-ui); border-radius: var(--radius-3); font-size: var(--fs-2); font-weight: var(--weight-medium); color: var(--fg-high); }
details.collapse > summary::-webkit-details-marker { display: none; }
details.collapse > summary .sm-chev { margin-left: auto; color: var(--fg-subtle); transition: transform .12s; }
details.collapse[open] > summary .sm-chev { transform: rotate(180deg); }
details.collapse .collapse-body { padding: var(--space-3); font-size: var(--fs-2); color: var(--fg-low); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .skeleton::after { display: none; }
}
