/* ============================================================
   Component styles. Colors come from tokens.css via rgb(var(--x)).
   Layered: chrome (sidebar/top-strip = bg) → canvas (main = surface) →
   transparent cards (border-only) → lifted elements (surface-2/3).
   ============================================================ */

* { box-sizing: border-box; }

/* No default focus rings anywhere — the user asked for the brief click-time
   outline to be gone. Inputs still get a subtle border-colour change via
   their own :focus rule; buttons highlight their border on :focus-visible. */
*:focus,
*:focus-visible {
  outline: none;
  outline-offset: 0;
}
/* Kill the sticky dotted ring Firefox adds to keyboard-focused buttons. */
button::-moz-focus-inner { border: 0; padding: 0; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: rgb(var(--bg));
  color: rgb(var(--fg));
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-normal);
  letter-spacing: var(--tracking-tight);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01';
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
::selection { background: rgb(var(--accent) / .35); color: rgb(var(--fg)); }

/* Strip browser-default block-level margins. The framework controls
   spacing via container rules (`.card > * + *`, `.stack` gap, etc) and
   explicit per-component overrides; default heading/paragraph margins
   leak through flex/grid layouts (e.g. icon + text rows where the icon
   has no margin but the adjacent <h3> sits 1em lower than expected). */
h1, h2, h3, h4, h5, h6, p, ul, ol, pre {
  margin: 0;
}

.app {
  position: relative;
  height: 100vh;
  overflow: hidden;
  isolation: isolate;
}

.sidebar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--rail-w);
  background: rgb(var(--sidebar));
  border-right: 1px solid rgb(var(--border));
  z-index: 20;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.sidebar:hover,
.sidebar:focus-within {
  width: var(--sidebar-w);
  box-shadow: var(--shadow-lg);
}

.main {
  margin-left: var(--rail-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: rgb(var(--surface));
}

/* ============================================================
   Sidebar internals
   ============================================================ */

.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 10px;               /* matches .sidebar-nav horizontal padding */
  gap: var(--space-3);            /* matches .nav-item gap → brand text aligns with menu labels */
  border-bottom: 1px solid rgb(var(--border));
  font-weight: 600;
  font-size: var(--font-size-lg);
  letter-spacing: -0.015em;
  flex-shrink: 0;
  white-space: nowrap;
}
.sidebar-brand .brand-icon {
  width: 32px;                    /* matches .nav-item > i:first-child column */
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}
.sidebar-brand .dot {
  width: 16px; height: 16px;
  border-radius: 4px;
  background: rgb(var(--accent));
}
.sidebar-brand .brand-logo {
  width: 20px; height: 20px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  display: block;
}
.sidebar-brand .brand-name {
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.sidebar:hover .brand-name,
.sidebar:focus-within .brand-name { opacity: 1; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-4) 10px;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgb(var(--border-strong)); border-radius: 3px; }

/* nav-item: the 30px-tall row with icon + label; width adapts to rail.
   Icon is fixed-left so it stays centred in the 52px rail. */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  height: var(--nav-item-h);
  padding: 0 10px 0 0;
  gap: var(--space-3);
  border-radius: var(--radius);
  color: rgb(var(--fg-muted));
  font-size: var(--font-size-base);
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-item > i:first-child {
  font-size: 16px;
  width: 32px;                       /* icon column = (rail 52 – nav padding 20)/2 approx */
  display: inline-flex;
  justify-content: center;
  flex-shrink: 0;
  color: rgb(var(--fg-subtle));
  transition: color var(--dur-fast) var(--ease);
}
.nav-item > span {
  flex: 1;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar:hover .nav-item > span,
.sidebar:focus-within .nav-item > span { opacity: 1; }

.nav-item:hover { background: rgb(var(--surface-2)); color: rgb(var(--fg)); }
.nav-item:hover > i:first-child { color: rgb(var(--fg)); }

/* Active row: muted bg fill, no accent bar. */
.nav-item[aria-current="page"] {
  background: rgb(var(--surface-2));
  color: rgb(var(--fg));
}
.nav-item[aria-current="page"] > i:first-child { color: rgb(var(--fg)); }

/* Collapsible (parent) */
.collapsible { display: flex; flex-direction: column; }
.collapsible > .nav-item .chevron {
  font-size: 14px;
  color: rgb(var(--fg-subtle));
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
  opacity: 0;
  margin-left: auto;
}
.sidebar:hover .collapsible > .nav-item .chevron,
.sidebar:focus-within .collapsible > .nav-item .chevron { opacity: 1; }
.collapsible[data-state="open"] > .nav-item .chevron { transform: rotate(90deg); }

.submenu {
  display: none;
  flex-direction: column;
  padding-left: 32px;                /* align with parent icon width */
  padding-top: 2px;
  padding-bottom: 2px;
  gap: 1px;
}
.sidebar:hover .collapsible[data-state="open"] > .submenu,
.sidebar:focus-within .collapsible[data-state="open"] > .submenu { display: flex; }

.submenu-item {
  display: flex;
  align-items: center;
  text-decoration: none;
  height: 28px;
  padding: 0 10px;
  font-size: var(--font-size-sm);
  color: rgb(var(--fg-muted));
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  white-space: nowrap;
  opacity: 0;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), opacity var(--dur) var(--ease);
}
.sidebar:hover .submenu-item,
.sidebar:focus-within .submenu-item { opacity: 1; }
.submenu-item:hover { background: rgb(var(--surface-2)); color: rgb(var(--fg)); }
.submenu-item[aria-current="page"] { color: rgb(var(--fg)); font-weight: 500; background: rgb(var(--surface-2)); }

/* ============================================================
   Sidebar foot — profile with dropdown menu
   ============================================================ */

.sidebar-foot {
  border-top: 1px solid rgb(var(--border));
  padding: var(--space-2);
  flex-shrink: 0;
  position: relative;
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius);
  width: 100%;
  height: 40px;              /* fixed — don't let wrapping meta resize the foot */
  background: transparent;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  color: rgb(var(--fg));
  transition: background-color var(--dur-fast) var(--ease);
  overflow: hidden;
}
.profile-trigger:hover { background: rgb(var(--surface-2)); }

.avatar {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: rgb(var(--surface-3));
  color: rgb(var(--fg-muted));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 600;
  flex-shrink: 0;
}
.foot-meta {
  min-width: 0;
  flex: 1;
  line-height: 1.2;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.sidebar:hover .foot-meta,
.sidebar:focus-within .foot-meta { opacity: 1; }
.foot-meta .name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.foot-meta .mail { font-size: var(--font-size-xs); color: rgb(var(--fg-subtle)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-trigger .chevron {
  font-size: 14px;
  color: rgb(var(--fg-subtle));
  opacity: 0;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.sidebar:hover .profile-trigger .chevron,
.sidebar:focus-within .profile-trigger .chevron { opacity: 1; }
.profile-menu[data-state="open"] .profile-trigger .chevron { transform: rotate(180deg); }

.profile-menu { position: relative; }
.profile-popover {
  position: absolute;
  left: var(--space-2);
  bottom: calc(100% + 6px);
  width: calc(var(--sidebar-w) - 24px);
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border-strong));
  border-radius: var(--radius);
  padding: var(--space-2);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 30;
}
.profile-menu[data-state="open"] .profile-popover { display: block; }
.profile-popover .item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  height: 30px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  background: transparent;
  border: 0;
  color: rgb(var(--fg));
  font-size: var(--font-size-sm);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.profile-popover .item:hover { background: rgb(var(--surface-2)); }
.profile-popover .item > i {
  color: rgb(var(--fg-subtle));
  font-size: 14px;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}
.profile-popover .item.destructive { color: rgb(var(--c-danger)); }
.profile-popover .item.destructive:hover { background: rgb(var(--c-danger) / .1); }
.profile-popover .item span { flex: 1; }
.profile-popover .item .check {
  margin-left: auto;
  color: rgb(var(--accent));
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.profile-popover .item[aria-checked="true"] .check { opacity: 1; }
.profile-popover .item[aria-checked="true"] { color: rgb(var(--fg)); }
.profile-popover .sep {
  height: 1px;
  background: rgb(var(--border));
  margin: var(--space-2) 0;
}
.profile-popover .group-label {
  font-size: var(--font-size-xs);
  color: rgb(var(--fg-subtle));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-2) var(--space-3) 2px;
  font-weight: 500;
}

/* ============================================================
   Top strip — title + tabs + actions (single row; wraps at narrow)
   ============================================================ */

/* Unified typography + unified baseline.
   All three text groups share ONE size (13px) + ONE line-height (1.4),
   so centring each in the strip puts their baselines on the same Y —
   no explicit `align-items: baseline` needed (grid baseline-align would
   collapse vertical centring of the whole group, pushing content to the
   top edge). Same-size text + align-items:center = same baseline. */
.top-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "title tabs actions";
  align-items: center;
  column-gap: var(--space-7);
  padding: 0 var(--space-6);
  height: var(--header-h);
  border-bottom: 1px solid rgb(var(--border));
  background: rgb(var(--bg));           /* chrome tone (same as sidebar) */
  flex-shrink: 0;
}
.top-strip .title-block {
  grid-area: title;
  display: flex;
  align-items: baseline;             /* crumb ↔ title share baseline */
  gap: var(--space-3);
  min-width: 0;
}
.top-strip .pill-tabs   { grid-area: tabs; justify-self: end; }
/* On wide screens, collapse the actions column when nothing is in it.
   Otherwise `auto 1fr auto` + column-gap still reserves a gap before
   the (empty) third track, leaving a visible "double margin" between
   the right-aligned tabs and the strip's right padding.
   Scoped to min-width 1025px so the narrow-viewport rule below
   (which wraps tabs to a full-width second row) keeps winning on
   small screens.
   `.strip-actions:empty { display: none }` is universal — without
   it, the empty `.strip-actions` (which still claims
   `grid-area: actions`) gets auto-placed into an implicit second
   row, halving each row's height and pushing the title/tabs into
   the top half of the strip. */
.top-strip .strip-actions:empty { display: none; }
@media (min-width: 1025px) {
  .top-strip:has(.strip-actions:empty) {
    grid-template-columns: auto 1fr;
    grid-template-areas: "title tabs";
  }
}
.top-strip .strip-actions {
  grid-area: actions;
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.top-strip .crumb,
.top-strip .title,
.top-strip .pill-tabs .tab {
  font-size: var(--font-size-base);  /* 13px — single size across the strip */
  line-height: 1.4;                  /* consistent line-box for aligned baselines */
  letter-spacing: var(--tracking-tight);
  font-family: inherit;
}

.top-strip .crumb {
  color: rgb(var(--fg-muted));
  font-weight: 400;
  white-space: nowrap;
}
.top-strip .crumb i {
  font-size: 13px;
  line-height: 1;
  vertical-align: -2px;              /* nudge chevron onto the text baseline */
  color: rgb(var(--fg-subtle));
  margin: 0 2px;
}
.top-strip .title {
  font-weight: 600;
  color: rgb(var(--fg));
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pill tabs. Padding is symmetric so text baseline sits predictably,
   matching the title/crumb baseline on the same line-box. */
.pill-tabs {
  display: inline-flex;
  padding: 2px;
  background: rgb(var(--surface-2));
  border-radius: var(--radius);
  gap: 2px;
}
/* Pages without tabs (single JSX, no `tabs:` in menu) leave the
   container in place but empty — the border + 2px padding would
   render as a tiny visible bar on the strip. Hide when empty. */
.pill-tabs:empty { display: none; }
.pill-tabs .tab {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-4);
  background: transparent;
  border: 0;
  font-weight: 400;
  color: rgb(var(--fg-muted));
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;        /* <a> default underline */
}
.pill-tabs .tab:hover { color: rgb(var(--fg)); }
.pill-tabs .tab.active,
.pill-tabs .tab[aria-selected="true"] {
  background: rgb(var(--surface-3));
  color: rgb(var(--fg));
  box-shadow: var(--shadow-sm);
  font-weight: 500;
}
/* Wrap: when the viewport is narrow, tabs drop to a full-width second row. */
@media (max-width: 1024px) {
  .top-strip {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "title actions"
      "tabs  tabs";
    height: auto;
    padding: var(--space-3) var(--space-6);
    row-gap: var(--space-3);
  }
  .top-strip .pill-tabs {
    justify-self: stretch;
    overflow-x: auto;
  }
}

/* ============================================================
   Content scroll area
   ============================================================ */

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-8);
}
.content-inner {
  max-width: var(--content-max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
  transition: max-width var(--dur) var(--ease);
}

/* ============================================================
   Card — transparent so compact and full-width read identically.
   ============================================================ */

/*
 * Cards are usable in three shapes:
 *   (a) bare content — <div class="card"><h3>..</h3><p>..</p></div>
 *       Children sit directly in the card; the card supplies the padding.
 *   (b) with head/body — <div class="card"><div class="card-head"/><div class="card-body"/></div>
 *       .card-head and .card-body bring their own padding; the outer .card
 *       drops its default to avoid double-padding (the :has() rule below).
 *   (c) padding:0 override — <div class="card" style="padding:0"> for tables or
 *       other flush-edge content.
 *
 * The "> * + *" owl selector adds breathing room between sibling blocks inside
 * a bare card (e.g. banner after a radio group), which was the missing gap
 * that made nested .banner elements look glued to their neighbour. Excludes
 * .card-head / .card-body because those already handle their own vertical
 * rhythm via the divider line.
 */
.card {
  background: transparent;
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
}
.card:has(> .card-head), .card:has(> .card-body) { padding: 0; }
/* Stacking-card vertical rhythm. Flex-row cards (`.card.row` etc.) are
   horizontal, so the inter-child top margin would push the second item
   off the cross-axis centre — exclude them. */
.card:not(.row):not(.row-start):not(.row-flex) > * + *:not(.card-head):not(.card-body) { margin-top: var(--space-5); }
.card-head {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid rgb(var(--border));
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.card-head h3 {
  margin: 0;
  font-size: var(--font-size-base);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card-head .sub { color: rgb(var(--fg-muted)); font-size: var(--font-size-sm); }
.card-head .card-actions { margin-left: auto; display: flex; gap: var(--space-2); }
.card-body { padding: var(--space-6); }
.card-body.pad-0 { padding: 0; }
/* Same vertical rhythm inside an explicit .card-body. */
.card-body > * + * { margin-top: var(--space-5); }

.stat-label {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgb(var(--fg-muted));
}
.stat-value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--btn-h);
  padding: 0 var(--space-4);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn:focus-visible {
  outline: none;
  border-color: rgb(var(--fg) / .5);
}
.btn-primary   { background: rgb(var(--accent)); color: rgb(var(--accent-fg)); }
.btn-primary:hover { background: rgb(var(--accent-hover)); }
.btn-secondary { background: rgb(var(--surface-3)); color: rgb(var(--fg)); border-color: rgb(var(--border)); }
.btn-secondary:hover { background: rgb(var(--border)); border-color: rgb(var(--border-strong)); }
.btn-ghost     { background: transparent; color: rgb(var(--fg-muted)); }
.btn-ghost:hover { background: rgb(var(--surface-3)); color: rgb(var(--fg)); }
.btn-danger    { background: rgb(var(--c-danger)); color: rgb(var(--c-danger-fg)); }
.btn-danger:hover { filter: brightness(1.08); }
.btn-icon { width: var(--btn-h); padding: 0; }
.btn i { font-size: 14px; }

.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field label {
  font-size: var(--font-size-sm);
  color: rgb(var(--fg-muted));
  font-weight: 500;
}
.input, .select, .textarea {
  background: rgb(var(--surface-2));
  color: rgb(var(--fg));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius);
  padding: 0 var(--space-4);
  height: var(--input-h);
  font-family: inherit;
  font-size: var(--font-size-sm);
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.textarea { height: auto; padding: var(--space-3) var(--space-4); line-height: 1.5; resize: vertical; min-height: 72px; }
.input::placeholder, .textarea::placeholder { color: rgb(var(--fg-subtle)); }
.input:hover, .select:hover, .textarea:hover { border-color: rgb(var(--border-strong)); }

/* User-requested focus: subtle white border, no outline, no glow. */
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: rgb(var(--fg) / .5);
  box-shadow: none;
}
.field .hint { font-size: var(--font-size-xs); color: rgb(var(--fg-subtle)); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5) var(--space-6);
}
.form-grid .col-span-2 { grid-column: 1 / -1; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}
.table th, .table td {
  text-align: left;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid rgb(var(--border));
}
.table thead th {
  color: rgb(var(--fg-muted));
  font-weight: 500;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: transparent;
}
.table tbody tr { transition: background-color var(--dur-fast) var(--ease); }
.table tbody tr:hover { background: rgb(var(--surface-3)); }
.table tbody tr:last-child td { border-bottom: none; }
.table td .muted { color: rgb(var(--fg-muted)); }
.table .num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 var(--space-3);
  border-radius: 999px;
  font-size: var(--font-size-xs);
  font-weight: 500;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--surface-3));
  color: rgb(var(--fg-muted));
}
.badge.ok   { color: rgb(var(--c-success)); border-color: rgb(var(--c-success) / .3); background: rgb(var(--c-success) / .08); }
.badge.warn { color: rgb(var(--c-warning)); border-color: rgb(var(--c-warning) / .3); background: rgb(var(--c-warning) / .08); }
.badge.err  { color: rgb(var(--c-danger));  border-color: rgb(var(--c-danger) / .3);  background: rgb(var(--c-danger) / .08); }
.badge.info { color: rgb(var(--c-info));    border-color: rgb(var(--c-info) / .3);    background: rgb(var(--c-info) / .08); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--surface-3));
  color: rgb(var(--fg-muted));
}
code.inline {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgb(var(--surface-3));
  color: rgb(var(--fg));
}

.row-flex { display: flex; align-items: center; gap: var(--space-3); }
.row-flex.wrap { flex-wrap: wrap; }
.muted { color: rgb(var(--fg-muted)); }
.subtle { color: rgb(var(--fg-subtle)); }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }

/* ============================================================
   Checkbox (native, styled via appearance:none + ::after check)
   ============================================================ */

.checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border-strong));
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  margin: 0;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.checkbox:hover { border-color: rgb(var(--fg) / .5); }
.checkbox:checked {
  background: rgb(var(--accent));
  border-color: rgb(var(--accent));
}
.checkbox:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid rgb(var(--accent-fg));
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.checkbox:indeterminate {
  background: rgb(var(--accent));
  border-color: rgb(var(--accent));
}
.checkbox:indeterminate::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 7px;
  width: 10px;
  height: 2px;
  background: rgb(var(--accent-fg));
}
.checkbox:disabled { opacity: .5; cursor: not-allowed; }

.check-field {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  color: rgb(var(--fg));
  font-size: var(--font-size-sm);
  user-select: none;
}
.check-field:has(.checkbox:disabled) { color: rgb(var(--fg-muted)); cursor: not-allowed; }

/* ============================================================
   Radio
   ============================================================ */

.radio {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border-strong));
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  margin: 0;
  transition: border-color var(--dur-fast) var(--ease);
}
.radio:hover { border-color: rgb(var(--fg) / .5); }
.radio:checked { border-color: rgb(var(--accent)); }
.radio:checked::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: rgb(var(--accent));
}
.radio:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   Switch / Toggle
   ============================================================ */

.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
  background: rgb(var(--surface-3));
  border: 1px solid rgb(var(--border-strong));
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  margin: 0;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.switch::after {
  content: '';
  position: absolute;
  left: 1px;
  top: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgb(var(--fg-muted));
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.switch:checked {
  background: rgb(var(--accent));
  border-color: rgb(var(--accent));
}
.switch:checked::after {
  transform: translateX(14px);
  background: rgb(var(--accent-fg));
}
.switch:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   File input (styled via label trick)
   ============================================================ */

.file-field {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4) 0 0;
  height: var(--input-h);
  background: rgb(var(--surface-2));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: rgb(var(--fg-muted));
  transition: border-color var(--dur-fast) var(--ease);
}
.file-field:hover { border-color: rgb(var(--border-strong)); }
.file-field input[type=file] { display: none; }
.file-field .file-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: rgb(var(--surface-3));
  color: rgb(var(--fg));
  padding: 0 var(--space-4);
  height: 100%;
  border-right: 1px solid rgb(var(--border));
  border-radius: var(--radius) 0 0 var(--radius);
}

/* ============================================================
   Chip (pressable variant of badge)
   ============================================================ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 24px;
  padding: 0 var(--space-3);
  border-radius: 999px;
  background: rgb(var(--surface-3));
  border: 1px solid rgb(var(--border));
  color: rgb(var(--fg));
  font-size: var(--font-size-xs);
  font-family: inherit;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.chip:hover { background: rgb(var(--border)); border-color: rgb(var(--border-strong)); }
.chip .close {
  color: rgb(var(--fg-subtle));
  cursor: pointer;
  font-size: 14px;
}
.chip .close:hover { color: rgb(var(--fg)); }
.chip.active { background: rgb(var(--accent)); color: rgb(var(--accent-fg)); border-color: rgb(var(--accent)); }

/* ============================================================
   Dialog (modal)
   ============================================================ */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9996;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  opacity: 0;
  animation: dlg-fade-in var(--dur) var(--ease) forwards;
}
.dialog-backdrop.closing { animation: dlg-fade-out var(--dur) var(--ease) forwards; }

@keyframes dlg-fade-in  { from { opacity: 0 } to { opacity: 1 } }
@keyframes dlg-fade-out { from { opacity: 1 } to { opacity: 0 } }

.dialog {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border-strong));
  border-radius: var(--radius-lg);
  padding: var(--space-7) var(--space-7) var(--space-6);
  max-width: 440px;
  width: 100%;
  max-height: calc(100vh - var(--space-9) * 2);   /* avoid viewport overflow */
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(.96);
  animation: dlg-scale-in var(--dur) var(--ease) forwards;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);                            /* one uniform gap between title/body/actions */
}
.dialog-backdrop.closing .dialog { animation: dlg-scale-out var(--dur) var(--ease) forwards; }

@keyframes dlg-scale-in  { from { transform: scale(.96); opacity: 0 } to { transform: scale(1); opacity: 1 } }
@keyframes dlg-scale-out { from { transform: scale(1); opacity: 1 } to { transform: scale(.96); opacity: 0 } }

.dialog h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.012em;
}
.dialog p {
  margin: 0;
  color: rgb(var(--fg-muted));
  font-size: var(--font-size-sm);
  line-height: 1.5;
}
.dialog .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}
.dialog.variant-danger h3 { color: rgb(var(--c-danger)); }

/* ============================================================
   Drawer (slide-in panel)
   ============================================================ */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 9997;
  opacity: 0;
  animation: dlg-fade-in var(--dur) var(--ease) forwards;
}
.drawer-backdrop.closing { animation: dlg-fade-out var(--dur) var(--ease) forwards; }

.drawer {
  position: fixed;
  top: 0; bottom: 0;
  right: 0;
  width: 400px;
  max-width: 100vw;
  background: rgb(var(--surface));
  border-left: 1px solid rgb(var(--border-strong));
  box-shadow: -8px 0 24px rgba(0,0,0,.4);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  animation: drw-in var(--dur) var(--ease) forwards;
}
.drawer.size-sm  { width: 320px; }
.drawer.size-md  { width: 400px; }
.drawer.size-lg  { width: 560px; }
.drawer.size-xl  { width: 720px; }
.drawer.closing  { animation: drw-out var(--dur) var(--ease) forwards; }

/* Left placement */
.drawer.left  { right: auto; left: 0; border-left: 0; border-right: 1px solid rgb(var(--border-strong)); box-shadow: 8px 0 24px rgba(0,0,0,.4); transform: translateX(-100%); animation: drw-in-left var(--dur) var(--ease) forwards; }
.drawer.left.closing { animation: drw-out-left var(--dur) var(--ease) forwards; }

@keyframes drw-in       { to { transform: translateX(0) } }
@keyframes drw-out      { to { transform: translateX(100%) } }
@keyframes drw-in-left  { to { transform: translateX(0) } }
@keyframes drw-out-left { to { transform: translateX(-100%) } }

.drawer-head {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid rgb(var(--border));
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}
.drawer-head h3 { margin: 0; font-size: var(--font-size-lg); font-weight: 600; letter-spacing: -0.012em; }
.drawer-head .close {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: rgb(var(--fg-muted));
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius);
}
.drawer-head .close:hover { background: rgb(var(--surface-2)); color: rgb(var(--fg)); }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--space-6); }
.drawer-foot {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid rgb(var(--border));
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ============================================================
   Toast stack (top-right)
   ============================================================ */

.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 360px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border-strong));
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  transform: translateX(calc(100% + 24px));
  animation: tst-in var(--dur) var(--ease) forwards;
}
.toast.closing { animation: tst-out var(--dur) var(--ease) forwards; }
@keyframes tst-in  { to { transform: translateX(0) } }
@keyframes tst-out { to { transform: translateX(calc(100% + 24px)); opacity: 0 } }

.toast .t-icon {
  flex-shrink: 0;
  width: 16px;
  margin-top: 1px;
  font-size: 16px;
}
.toast .t-body { flex: 1; min-width: 0; }
.toast .t-title { font-size: var(--font-size-sm); font-weight: 500; color: rgb(var(--fg)); margin: 0 0 2px; }
.toast .t-text  { font-size: var(--font-size-xs); color: rgb(var(--fg-muted)); line-height: 1.4; margin: 0; }
.toast .t-close {
  flex-shrink: 0;
  background: transparent;
  border: 0;
  color: rgb(var(--fg-subtle));
  cursor: pointer;
  padding: 2px;
  margin: -2px -4px -2px 0;
  font-size: 14px;
}
.toast .t-close:hover { color: rgb(var(--fg)); }

.toast.type-success .t-icon { color: rgb(var(--c-success)); }
.toast.type-error   .t-icon { color: rgb(var(--c-danger)); }
.toast.type-warning .t-icon { color: rgb(var(--c-warning)); }
.toast.type-info    .t-icon { color: rgb(var(--c-info)); }

/* ============================================================
   Banner (inline alert)
   ============================================================ */

.banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius);
  background: rgb(var(--surface));
  font-size: var(--font-size-sm);
  color: rgb(var(--fg));
}
.banner .b-icon { flex-shrink: 0; font-size: 16px; color: rgb(var(--fg-muted)); margin-top: 1px; }
.banner .b-body { flex: 1; min-width: 0; }
.banner .b-title { font-weight: 500; margin: 0 0 2px; }
.banner .b-text  { color: rgb(var(--fg-muted)); line-height: 1.5; margin: 0; }
.banner .b-action { margin-left: auto; }

.banner.type-success { border-color: rgb(var(--c-success) / .4); background: rgb(var(--c-success) / .08); }
.banner.type-success .b-icon { color: rgb(var(--c-success)); }
.banner.type-error   { border-color: rgb(var(--c-danger) / .4);  background: rgb(var(--c-danger) / .08); }
.banner.type-error   .b-icon { color: rgb(var(--c-danger)); }
.banner.type-warning { border-color: rgb(var(--c-warning) / .4); background: rgb(var(--c-warning) / .08); }
.banner.type-warning .b-icon { color: rgb(var(--c-warning)); }
.banner.type-info    { border-color: rgb(var(--c-info) / .4);    background: rgb(var(--c-info) / .08); }
.banner.type-info    .b-icon { color: rgb(var(--c-info)); }

/* ============================================================
   Empty state
   ============================================================ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-9) var(--space-6);
  gap: var(--space-4);
  color: rgb(var(--fg-muted));
}
.empty .e-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgb(var(--surface-2));
  color: rgb(var(--fg-muted));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.empty h4 { margin: 0; font-size: var(--font-size-base); font-weight: 600; color: rgb(var(--fg)); letter-spacing: -0.012em; }
.empty p  { margin: 0; font-size: var(--font-size-sm); max-width: 320px; }

/* ============================================================
   Spinner (small, inline) + global loader
   ============================================================ */

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgb(var(--fg-subtle) / .4);
  border-top-color: rgb(var(--accent));
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
.spinner.lg { width: 28px; height: 28px; border-width: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }

.global-loader {
  position: fixed;
  inset: 0;
  background: rgb(var(--bg) / .85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9995;
  display: flex;
  align-items: center;
  justify-content: center;
}
[hidden] { display: none !important; }

/* ============================================================
   Progress bar (fixed, top)
   ============================================================ */

.progress-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 10001;
  background: transparent;
}
.progress-bar .fill {
  height: 100%;
  width: 0;
  background: rgb(var(--accent));
  box-shadow: 0 0 10px rgb(var(--accent) / .6);
  transition: width var(--dur) var(--ease);
}

/* ============================================================
   Skeleton loader (shimmer placeholder)
   ============================================================ */

.skeleton {
  display: block;
  background: linear-gradient(90deg,
    rgb(var(--surface-3)) 0%,
    rgb(var(--border-strong)) 50%,
    rgb(var(--surface-3)) 100%);
  background-size: 200% 100%;
  animation: skl 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  height: 14px;
  width: 100%;
}
@keyframes skl { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

/* ============================================================
   Tooltip (hover-based, CSS-only)
   ============================================================ */

[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: rgb(var(--surface-3));
  color: rgb(var(--fg));
  border: 1px solid rgb(var(--border-strong));
  padding: 4px 8px;
  border-radius: 4px;
  font-size: var(--font-size-xs);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after { opacity: 1; transition-delay: 300ms; }

/* ============================================================
   Dropdown menu (generalized profile-popover pattern)
   ============================================================ */

.menu {
  position: absolute;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border-strong));
  border-radius: var(--radius);
  padding: var(--space-2);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 50;
  display: none;
}
.menu[data-state="open"] { display: block; }
.menu .item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  height: 28px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  background: transparent;
  border: 0;
  color: rgb(var(--fg));
  font-size: var(--font-size-sm);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.menu .item:hover { background: rgb(var(--surface-2)); }
.menu .item > i { color: rgb(var(--fg-subtle)); font-size: 14px; width: 16px; }
.menu .item.destructive { color: rgb(var(--c-danger)); }
.menu .item.destructive:hover { background: rgb(var(--c-danger) / .1); }
.menu .sep { height: 1px; background: rgb(var(--border)); margin: var(--space-2) 0; }

/* ============================================================
   Section layout helpers for showcase pages
   ============================================================ */

.showcase-section { display: flex; flex-direction: column; gap: var(--space-8); }
.demo-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-5);
}
.demo-label {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgb(var(--fg-subtle));
  margin: 0 0 var(--space-3);
  font-weight: 500;
}

/* ============================================================
   Stack / grid utilities for JSX pages (replaces Tailwind space-y-N
   and grid-cols-N). Keep this list lean — add only what pages need.
   ============================================================ */

.stack { display: flex; flex-direction: column; gap: var(--space-6); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-3); }
.stack-xs { display: flex; flex-direction: column; gap: var(--space-2); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row-start { display: flex; align-items: flex-start; gap: var(--space-3); }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--space-5); }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: var(--space-5); }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.accent-fg { color: rgb(var(--accent)); }

/* ============================================================
   Row-select table (extends .table)
   ============================================================ */

.table.selectable tbody tr.selected { background: rgb(var(--accent-soft)); }
.table th.col-check, .table td.col-check { width: 36px; padding-right: 0; }
.table th.col-action, .table td.col-action { width: 80px; text-align: right; white-space: nowrap; }

.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid rgb(var(--border));
}
.pagination .info { font-size: var(--font-size-xs); color: rgb(var(--fg-muted)); }
.pagination .nav-btns { margin-left: auto; display: flex; gap: var(--space-1); }
.pagination .p-btn {
  height: 28px;
  min-width: 28px;
  padding: 0 var(--space-3);
  background: transparent;
  border: 1px solid rgb(var(--border));
  color: rgb(var(--fg));
  font-size: var(--font-size-xs);
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.pagination .p-btn:hover:not(:disabled) { background: rgb(var(--surface-3)); }
.pagination .p-btn[aria-current="true"] { background: rgb(var(--surface-3)); border-color: rgb(var(--border-strong)); }
.pagination .p-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   Mobile header + sidebar overlay — hidden on desktop
   ============================================================ */
.mobile-header  { display: none; }
.sidebar-overlay { display: none; }

/* ============================================================
   Mobile layout  (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {

  /* Mobile top bar */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    height: var(--header-h);
    padding: 0 var(--space-5);
    background: rgb(var(--bg));
    border-bottom: 1px solid rgb(var(--border));
    flex-shrink: 0;
  }
  .mobile-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    background: transparent;
    border: 0;
    color: rgb(var(--fg-muted));
    cursor: pointer;
    border-radius: var(--radius);
    flex-shrink: 0;
    padding: 0;
    font-size: 18px;
    transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
  }
  .mobile-burger:hover { background: rgb(var(--surface-2)); color: rgb(var(--fg)); }
  .mobile-page-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: rgb(var(--fg));
    letter-spacing: var(--tracking-tight);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Collapse top-strip to tabs-only row; hide title and actions */
  .top-strip {
    grid-template-columns: 1fr;
    grid-template-areas: "tabs";
    height: auto;
    padding: var(--space-2) var(--space-5);
    overflow-x: auto;
  }
  .top-strip .title-block,
  .top-strip .strip-actions { display: none; }
  /* Keep tabs full-width on mobile */
  .top-strip .pill-tabs { justify-self: start; }

  /* Sidebar: off-screen by default, slides in on .open */
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: var(--sidebar-w);
    z-index: 50;
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
  }
  /* Disable desktop hover/focus-within expand — not meaningful on touch */
  .sidebar:hover,
  .sidebar:focus-within {
    width: var(--sidebar-w);
    box-shadow: none;
  }
  /* Open state */
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  /* Reveal all sidebar text when open (mirrors desktop :hover rules) */
  .sidebar.open .brand-name                                    { opacity: 1; }
  .sidebar.open .nav-item > span                               { opacity: 1; }
  .sidebar.open .collapsible > .nav-item .chevron              { opacity: 1; }
  .sidebar.open .collapsible[data-state="open"] > .submenu     { display: flex; }
  .sidebar.open .submenu-item                                  { opacity: 1; }
  .sidebar.open .foot-meta                                     { opacity: 1; }

  /* Main: full width, no rail offset */
  .main { margin-left: 0; }

  /* Overlay backdrop */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur) var(--ease);
  }
  .sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }
}
