/* ─────────────────────────────────────────────────────────────────
   inima-gcp-webapp-template — design system (second-brain UI-v2)
   Vendored VERBATIM from second-brain template/ (tokens + primitives +
   layout concatenated). Class vocabulary: .btn--*, .field-input, .pill,
   .card, .tbl, .modal, .sidebar shell. Light default + dark peer via
   html[data-theme]. Icons: SVG sprite (sprite.js) using <use href=#i-*>.
   ───────────────────────────────────────────────────────────────── */

/* ===== tokens.css ===== */
/* ───────────────────────────────────────────────────────────────────────────────
   Web App Starter — design tokens (brand-agnostic)
   Drop in, customize the variables flagged "CUSTOMIZE" below, and you're done.
   Origin: Second Brain UI refresh, 2026-05.
   ─────────────────────────────────────────────────────────────────── */

/* ─── Light (default) ─────────────────────────────────────────────────── */
:root,
html[data-theme="light"] {

  /* CUSTOMIZE — brand accent (primary action color) */
  --accent:           #3b82f6;
  --accent-strong:    #2563eb;
  --accent-soft:      rgba(59,130,246,.10);
  --accent-focus:     rgba(59,130,246,.32);
  --gradient-accent:  linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);

  /* CUSTOMIZE — surface ramp (8 stops, neutral) */
  --bg:               #fafafa;   /* page canvas */
  --surface-1:        #ffffff;   /* card */
  --surface-2:        #f5f5f5;   /* nested / hover */
  --surface-3:        #ebebeb;   /* active row / hover-stronger */
  --surface-4:        #dcdcdc;   /* pressed / divider-strong */
  --surface-overlay:  rgba(20,20,20,.36);

  /* CUSTOMIZE — text ramp */
  --text-1:           #1a1a1a;   /* primary */
  --text-2:           #555555;   /* secondary */
  --text-3:           #8a8a8a;   /* tertiary */
  --text-disabled:    #b3b3b3;   /* fails AA intentionally — disabled controls */
  --text-on-accent:   #ffffff;

  /* CUSTOMIZE — borders */
  --border:           #e4e4e4;
  --border-strong:    #c8c8c8;

  /* Semantic — tuned for AA against light surfaces.
     Note: --info is independent of --accent so a green-accent project still
     gets a recognizable blue "info" alert. Override --info to alias --accent
     if you want them coupled. */
  --success:          #047857;   --success-soft: rgba(16,185,129,.12);
  --warning:          #d97706;   --warning-soft: rgba(245,158,11,.14); --warning-fg: #92400e;
  --danger:           #b91c1c;   --danger-soft:  rgba(239,68,68,.12);
  --info:             #2563eb;   --info-soft:    rgba(59,130,246,.10);

  /* Radii */
  --r-xs:   4px;
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   18px;
  --r-2xl:  24px;
  --r-pill: 999px;

  /* Spacing scale (4px base) — use everywhere padding/margin/gap is needed */
  --s-1:    4px;
  --s-2:    8px;
  --s-3:    12px;
  --s-4:    16px;
  --s-5:    20px;
  --s-6:    24px;
  --s-7:    32px;
  --s-8:    40px;
  --s-9:    56px;
  --s-10:   72px;

  /* Z-index scale — single source of truth.
     Tooltip sits ABOVE modal so it can label modal controls. */
  --z-base:    1;
  --z-sticky:  10;
  --z-panel:   90;
  --z-modal:   100;
  --z-toast:   110;
  --z-tooltip: 120;
  --z-cmdk:    130;

  /* Elevation (M3-style — quiet shadows) */
  --elev-0: none;
  --elev-1: 0 1px 2px rgba(20,18,12,.06);
  --elev-2: 0 4px 12px rgba(20,18,12,.08);
  --elev-3: 0 12px 32px rgba(20,18,12,.12);
  --elev-5: 0 24px 64px rgba(20,18,12,.20);

  /* Focus ring — single token, used by every interactive element on :focus */
  --ring: 0 0 0 3px var(--accent-focus);

  /* State layers (M3) — overlay opacities for hover/pressed/selected */
  --state-hover-opacity:    .06;
  --state-pressed-opacity:  .10;
  --state-selected-opacity: .14;

  /* Motion. Use --d-fast for state changes (button hover, focus),
     --d-base for menus/dropdowns, --d-slow for cards, --d-emph for
     modals/panels. Use --ease-spring only for press / micro affordances. */
  --ease-emph:     cubic-bezier(.2,.0,.0,1);
  --ease-standard: cubic-bezier(.2,.0,.2,1);
  --ease-spring:   cubic-bezier(.34,1.56,.64,1);
  --d-fast:    120ms;
  --d-base:    200ms;
  --d-slow:    320ms;
  --d-emph:    400ms;

  /* CUSTOMIZE — typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Type ramp (1.2 modular, rounded to integers) */
  --t-xs:   11px;   --t-sm:   12px;   --t-md:   13px;   --t-base: 14px;
  --t-lg:   16px;   --t-xl:   20px;   --t-2xl:  26px;   --t-3xl:  32px;
  --t-4xl:  44px;   --t-5xl:  60px;

  /* Line heights */
  --lh-tight: 1.15;
  --lh-snug:  1.3;
  --lh-base:  1.5;
  --lh-loose: 1.7;

  /* Layout */
  --sidebar-w-expanded: 240px;
  --sidebar-w-collapsed: 56px;
  --view-padding: 24px;
}

/* ─── Dark (peer theme) ───────────────────────────────────────────────── */
html[data-theme="dark"] {
  --accent:          #60a5fa;
  --accent-strong:   #3b82f6;
  --accent-soft:     rgba(96,165,250,.16);
  --accent-focus:    rgba(96,165,250,.36);
  --gradient-accent: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);

  --bg:              #0a0a0a;
  --surface-1:       #161616;
  --surface-2:       #1f1f1f;
  --surface-3:       #2a2a2a;
  --surface-4:       #393939;
  --surface-overlay: rgba(0,0,0,.60);

  --text-1:          #f4f4f4;
  --text-2:          #b5b5b5;
  --text-3:          #8a8a8a;
  --text-disabled:   #5a5a5a;

  --border:          #262626;
  --border-strong:   #3a3a3a;

  --success:         #34d399;   --success-soft: rgba(52,211,153,.18);
  --warning:         #fbbf24;   --warning-soft: rgba(251,191,36,.18); --warning-fg: #fbbf24;
  --danger:          #f87171;   --danger-soft:  rgba(248,113,113,.18);
  --info:            #60a5fa;   --info-soft:    rgba(96,165,250,.16);

  /* Dark-mode shadows: most of the perceived "lift" comes from --surface-* being
     lighter than --bg. These shadows add a faint ambient halo on top. */
  --elev-1: 0 0 0 1px rgba(255,255,255,.02), 0 1px 2px rgba(0,0,0,.30);
  --elev-2: 0 0 0 1px rgba(255,255,255,.02), 0 4px 12px rgba(0,0,0,.32);
  --elev-3: 0 0 0 1px rgba(255,255,255,.03), 0 12px 32px rgba(0,0,0,.40);
  --elev-5: 0 0 0 1px rgba(255,255,255,.04), 0 24px 64px rgba(0,0,0,.55);
}

/* ─── Resets ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-1);
  font-size: var(--t-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--d-base) var(--ease-standard), color var(--d-base) var(--ease-standard);
}
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Reduce motion — kill transitions + non-essential animations, but keep
   spinner/skeleton/progress-stripe so loading affordances stay legible. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
  .spinner,
  .skeleton,
  .progress-fill.is-striped {
    animation-duration: revert !important;
  }
  /* Skeleton: replace shimmer with a static surface so reduce-motion users
     still see "this is a loading placeholder". */
  .skeleton { background: var(--surface-2) !important; animation: none !important; }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }

/* Focus ring — element keeps its own border-radius. We just paint an outline
   that follows the element's shape via outline-offset. */
:focus-visible {
  outline: 2px solid var(--accent-focus);
  outline-offset: 2px;
}

/* Forced-colors mode (Windows High Contrast, etc.) — ensure interactive
   chrome remains visible when system colors override our palette. */
@media (forced-colors: active) {
  .btn, .pill, .field-input, .input-group, .tag-input,
  .card, .menu, .modal, .panel, .toast, .crumb,
  .alert, .banner, .tooltip {
    border: 1px solid CanvasText;
  }
  .btn--primary, .pill--accent, .menu-item.is-active {
    forced-color-adjust: none;
  }
}

/* ===== primitives.css ===== */
/* ───────────────────────────────────────────────────────────────────────────────
   Web App Starter — primitives
   All components inherit their colors from currentColor / tokens.
   No brand color is hard-coded here. Customize tokens.css to re-skin.
   ─────────────────────────────────────────────────────────────────── */

/* ─── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-size: var(--t-md);
  font-weight: 600;
  line-height: 1;
  background: var(--surface-2);
  color: var(--text-1);
  border: 1px solid var(--border);
  transition: background var(--d-fast) var(--ease-standard),
              border-color var(--d-fast) var(--ease-standard),
              transform var(--d-fast) var(--ease-spring);
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: scale(.98); }
.btn[disabled], .btn:disabled { opacity: .5; pointer-events: none; }
/* If you need a tooltip explaining WHY a button is disabled, use
   aria-disabled="true" + a wrapper instead — pointer-events: none here
   prevents tooltips from firing on the button itself. */
.btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

.btn--primary  { background: var(--accent); color: var(--text-on-accent); border-color: transparent; }
.btn--primary:hover { background: var(--accent-strong); }

.btn--ghost    { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text-1); }

.btn--danger   { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 25%, transparent); }

.btn--gradient {
  background: var(--gradient-accent);
  color: var(--text-on-accent);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(0,0,0,.10);
}
.btn--gradient:hover {
  background: linear-gradient(135deg, var(--accent-strong) 0%, var(--accent-strong) 100%);
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}

.btn--sm  { padding: 5px 10px; font-size: var(--t-sm); }
.btn--lg  { padding: 11px 20px; font-size: var(--t-base); border-radius: var(--r-md); }
.btn--icon { padding: 6px; width: 32px; height: 32px; justify-content: center; }

/* ─── Pills / Badges ──────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: var(--t-xs); font-weight: 600;
  line-height: 1.4; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.pill--accent  { background: var(--accent-soft);  color: var(--accent);  }
.pill--info    { background: var(--info-soft);    color: var(--info);    }
.pill--success { background: var(--success-soft); color: var(--success); }
.pill--warning { background: var(--warning-soft); color: var(--warning-fg); }
.pill--danger  { background: var(--danger-soft);  color: var(--danger);  }
.pill--outline { background: transparent; border: 1px solid var(--border); color: var(--text-2); }
.pill .dot     { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }

/* ─── Card ────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--elev-1);
}
.card--interactive {
  cursor: pointer;
  transition: border-color var(--d-fast) var(--ease-standard),
              box-shadow var(--d-fast) var(--ease-standard),
              transform var(--d-fast) var(--ease-standard);
}
.card--interactive:hover {
  border-color: var(--border-strong);
  box-shadow: var(--elev-2);
  transform: translateY(-1px);
}
.card--hero {
  background: var(--gradient-accent);
  color: var(--text-on-accent);
  border-color: transparent;
  border-radius: var(--r-xl);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* ─── Field ───────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: var(--t-xs);
  color: var(--text-3);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.field-input {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-1);
  padding: 9px 12px;
  font-size: var(--t-base);
  font-family: inherit;
  outline: none;
  transition: border-color var(--d-fast) var(--ease-standard),
              box-shadow var(--d-fast) var(--ease-standard);
}
.field-input:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.field-help { font-size: var(--t-xs); color: var(--text-3); }

/* Required-field marker — drives off data attribute so consumers don't
   have to inline an asterisk span. */
.field-label[data-required]::after { content: ' *'; color: var(--danger); margin-left: 2px; }

/* Validation messages — distinct from .field-help so a field can carry BOTH
   a passive hint AND an error message stacked. */
.field-error,
.field-success {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--t-xs); font-weight: 500;
  margin-top: -2px;
}
.field-error { color: var(--danger); }
.field-success { color: var(--success); }
.field-error svg, .field-success svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ─── Tabs (segmented + underlined variants) ──────────────────────────── */
.tabs {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.tab {
  padding: 6px 14px;
  border-radius: calc(var(--r-md) - 4px);
  font-size: var(--t-sm); font-weight: 600;
  color: var(--text-2);
  transition: background var(--d-fast) var(--ease-standard), color var(--d-fast) var(--ease-standard);
}
.tab:hover { color: var(--text-1); }
.tab--active {
  background: var(--surface-1);
  color: var(--text-1);
  box-shadow: var(--elev-1);
}

.tabs-underline { display: flex; border-bottom: 1px solid var(--border); }
.tab-underline {
  padding: 10px 14px; font-size: var(--t-md); color: var(--text-2);
  position: relative; cursor: pointer;
}
.tab-underline:hover { color: var(--text-1); }
.tab-underline.is-active { color: var(--text-1); font-weight: 600; }
.tab-underline.is-active::after {
  content: '';
  position: absolute; left: 14px; right: 14px; bottom: -1px;
  height: 2px; background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* ─── Alert ───────────────────────────────────────────────────────────── */
.alert {
  display: flex; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: var(--t-md);
  background: var(--info-soft);
  color: var(--text-1);
  border: 1px solid color-mix(in srgb, var(--info) 30%, transparent);
}
.alert--success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert--warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert--danger  { background: var(--danger-soft);  border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

/* ─── Avatar ──────────────────────────────────────────────────────────── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-on-accent);
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar--xs { width: 18px; height: 18px; font-size: 9px; }
.avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.avatar--md { width: 32px; height: 32px; font-size: 12px; }
.avatar--lg { width: 44px; height: 44px; font-size: 16px; }
.avatar--xl { width: 64px; height: 64px; font-size: 22px; }

/* Named gradient variants — useful for deterministic per-user colors.
   Hash the user id to pick one. Keep the count small enough to be memorable. */
.avatar--violet  { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.avatar--rose    { background: linear-gradient(135deg, #fb7185, #be123c); }
.avatar--amber   { background: linear-gradient(135deg, #fbbf24, #b45309); }
.avatar--emerald { background: linear-gradient(135deg, #34d399, #047857); }
.avatar--cyan    { background: linear-gradient(135deg, #22d3ee, #0e7490); }
.avatar--slate   { background: linear-gradient(135deg, #64748b, #334155); }

.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface-1); margin-left: -6px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack-more {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-2);
  font-size: 10px; font-weight: 600;
  box-shadow: 0 0 0 2px var(--surface-1);
  margin-left: -6px;
}

/* Group avatar — 2-4 micro-portraits in a tile for team avatars */
.avatar--group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
  background: var(--surface-1);
  overflow: hidden;
  padding: 0;
}
.avatar--group img { border-radius: 0; }

/* ─── Divider with label ──────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.divider-label {
  display: flex; align-items: center; gap: 10px;
  font-size: var(--t-xs); color: var(--text-3);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
  margin: 14px 0 6px;
}
.divider-label::before, .divider-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ─── Inbox row (Front-style list item) ───────────────────────────────── */
.inbox-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background var(--d-fast) var(--ease-standard);
}
.inbox-row:hover { background: var(--surface-2); }
.inbox-row--unread { border-left-color: var(--accent); }
.inbox-row--unread .inbox-row-title { font-weight: 600; color: var(--text-1); }
.inbox-row--selected { background: var(--accent-soft); border-left-color: var(--accent); }
.inbox-row-title { color: var(--text-1); }
.inbox-row-sub   { font-size: var(--t-sm); color: var(--text-2); margin-top: 2px; }
.inbox-row-time  { font-size: var(--t-xs); color: var(--text-3); margin-left: auto; flex-shrink: 0; }

/* ─── Modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--surface-overlay);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: var(--z-modal);
  animation: overlayIn var(--d-base) var(--ease-emph);
}
.modal {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--elev-5);
  /* padding:0 keeps the head/body/foot flush; overflow:hidden clips them to
     the rounded corners so the foot's surface background doesn't bleed past
     the radius as square bottom corners. The body keeps its own overflow-y. */
  padding: 0;
  overflow: hidden;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 64px);
  display: flex; flex-direction: column;
  animation: modalIn var(--d-emph) var(--ease-emph);
}
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: var(--t-lg); font-weight: 600; letter-spacing: -.01em; }

/* Generic close button — usable in modal-head, panel-head, toast, banner, etc.
   Always pair with aria-label="Close" since the icon alone isn't a label. */
.close {
  margin-left: auto;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background var(--d-fast), color var(--d-fast);
}
.close:hover { background: var(--surface-2); color: var(--text-1); }
.close--sm { width: 24px; height: 24px; }
.modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.modal-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn   { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ─── Panel (right slide-over) ────────────────────────────────────────── */
.panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 380px;
  background: var(--surface-1);
  border-left: 1px solid var(--border);
  box-shadow: var(--elev-3);
  display: flex; flex-direction: column;
  z-index: var(--z-panel);
  animation: panelIn var(--d-emph) var(--ease-emph);
}
.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.panel-body { flex: 1; overflow-y: auto; padding: 14px 18px; }
.panel-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

@keyframes panelIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ─── Icon size helper ────────────────────────────────────────────────── */
.ico { width: 1em; height: 1em; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.ico--xs { width: 12px; height: 12px; }
.ico--sm { width: 14px; height: 14px; }
.ico--md { width: 16px; height: 16px; }
.ico--lg { width: 18px; height: 18px; }
.ico--xl { width: 22px; height: 22px; }
.ico--2xl { width: 28px; height: 28px; }

/* ─── Inputs (extended set) ───────────────────────────────────────────── */
/* The basic .field-input is in the Field section above. These add:
   - search input with leading icon
   - textarea
   - select chevron styling
   - input states (error, success)
   - input with prefix/suffix */
.input-search {
  position: relative;
}
.input-search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-family: inherit; font-size: var(--t-base);
  outline: none;
}
.input-search input:focus { border-color: var(--accent); background: var(--surface-1); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-search .ico {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-3); pointer-events: none;
}

textarea.field-input {
  resize: vertical; min-height: 80px;
  font-family: inherit; line-height: var(--lh-base);
}

select.field-input {
  appearance: none;
  /* Chevron painted via mask + currentColor, so it tracks --text-1
     in both themes (and any host re-skin). */
  background-image: none;
  padding-right: 32px;
  position: relative;
}
/* Wrapper-less chevron — paint into the right padding via a layered linear gradient mask.
   Simpler: use background-image with currentColor via mask. We need a wrapper so the
   chevron can use currentColor. For consumers who can't wrap, fall back to a neutral
   SVG that tracks --text-2 via mask. */
.select-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
}
.select-wrap::after {
  content: '';
  position: absolute;
  right: 12px; top: 50%;
  width: 14px; height: 14px;
  transform: translateY(-50%);
  background: currentColor;
  color: var(--text-2);
  pointer-events: none;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat center / contain;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat center / contain;
}
.select-wrap select { width: 100%; }

.field-input.is-error   { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.field-input.is-success { border-color: var(--success); }
.field-help.is-error   { color: var(--danger); }
.field-help.is-success { color: var(--success); }
.field-input:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }

/* Input with prefix/suffix */
.input-group {
  display: flex; align-items: stretch;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  transition: border-color var(--d-fast) var(--ease-standard), box-shadow var(--d-fast) var(--ease-standard);
}
.input-group:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.input-group input {
  flex: 1; background: transparent; border: 0; outline: none;
  padding: 9px 12px; color: var(--text-1); font-family: inherit; font-size: var(--t-base);
}
.input-group .input-prefix,
.input-group .input-suffix,
.input-group .prefix,
.input-group .suffix {
  display: inline-flex; align-items: center;
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--text-3); font-size: var(--t-sm); font-family: var(--font-mono);
  white-space: nowrap;
}
.input-group .input-prefix, .input-group .prefix { border-right: 1px solid var(--border); }
.input-group .input-suffix, .input-group .suffix { border-left: 1px solid var(--border); }
/* A button placed in the suffix slot (eg "Copy") gets borderless treatment */
.input-group .input-suffix .btn { padding: 6px 10px; border-radius: 0; }

/* ─── Toggle controls ─────────────────────────────────────────────────── */
/* Checkbox — paint via :checked + ::after */
.check {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: var(--t-sm); color: var(--text-1);
  user-select: none;
}
.check input[type="checkbox"] { display: none; }
.check .check-box {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong); border-radius: 4px;
  background: var(--surface-1);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background var(--d-fast), border-color var(--d-fast);
}
.check input:checked + .check-box {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.check input:checked + .check-box::after { content: '✓'; font-size: 11px; font-weight: 700; line-height: 1; }
.check input:disabled + .check-box { opacity: .5; }

/* Radio — paint via :checked + ::after */
.radio {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: var(--t-sm); color: var(--text-1);
  user-select: none;
}
.radio input[type="radio"] { display: none; }
.radio .radio-circle {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong); border-radius: 50%;
  background: var(--surface-1);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color var(--d-fast);
}
.radio input:checked + .radio-circle { border-color: var(--accent); }
.radio input:checked + .radio-circle::after {
  content: ''; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent);
}

/* Switch — sliding toggle. Built around a real <input type="checkbox"> so it's
   keyboard-accessible (Space toggles), tabbable, and form-submits.
   Markup:  <label class="switch"><input type="checkbox"><span class="switch-track"></span></label> */
.switch {
  position: relative; display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.switch input[type="checkbox"] {
  position: absolute; opacity: 0; width: 100%; height: 100%;
  margin: 0; cursor: pointer;
}
.switch .switch-track {
  position: relative; display: inline-block;
  width: 36px; height: 20px;
  background: var(--surface-3);
  border-radius: var(--r-pill);
  transition: background var(--d-fast);
}
.switch .switch-track::after {
  content: ''; position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--surface-1); border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
  transition: transform var(--d-fast) var(--ease-spring), background var(--d-fast);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }
.switch input:disabled + .switch-track { opacity: .5; cursor: not-allowed; }

/* ─── Dropdown menu (popover) ────────────────────────────────────────── */
.menu {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--elev-3);
  padding: 6px;
  min-width: 200px;
  display: flex; flex-direction: column; gap: 1px;
  animation: menuIn var(--d-fast) var(--ease-emph);
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-section {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 10px 4px;
}
.menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: var(--t-sm); color: var(--text-1);
  cursor: pointer; text-decoration: none;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger:hover { background: var(--danger-soft); }
.menu-item .menu-item-icon { width: 14px; height: 14px; color: var(--text-3); flex-shrink: 0; }
.menu-item.is-danger .menu-item-icon { color: var(--danger); }
.menu-item .menu-item-shortcut {
  margin-left: auto; font-family: var(--font-mono); font-size: 11px;
  color: var(--text-3);
}
.menu-divider { height: 1px; background: var(--border); margin: 4px -6px; }

/* ─── Tooltip ─────────────────────────────────────────────────────────── */
/* Tooltip sits ABOVE modals (z-tooltip > z-modal) so it can label modal controls.
   Pair the trigger with aria-describedby pointing at the tooltip id. */
.tooltip {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  background: var(--text-1); color: var(--bg);
  border-radius: var(--r-xs);
  font-size: var(--t-xs); font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  position: absolute;
  z-index: var(--z-tooltip);
  box-shadow: var(--elev-2);
}
.tooltip::after {
  content: ''; position: absolute;
  width: 0; height: 0;
}
.tooltip.is-top    { bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); }
.tooltip.is-top::after {
  top: 100%; left: 50%; transform: translateX(-50%);
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 5px solid var(--text-1);
}
.tooltip.is-bottom { top: calc(100% + 6px); left: 50%; transform: translateX(-50%); }
.tooltip.is-bottom::after {
  bottom: 100%; left: 50%; transform: translateX(-50%);
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-bottom: 5px solid var(--text-1);
}
.tooltip.is-left   { right: calc(100% + 6px); top: 50%; transform: translateY(-50%); }
.tooltip.is-left::after {
  left: 100%; top: 50%; transform: translateY(-50%);
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
  border-left: 5px solid var(--text-1);
}
.tooltip.is-right  { left: calc(100% + 6px); top: 50%; transform: translateY(-50%); }
.tooltip.is-right::after {
  right: 100%; top: 50%; transform: translateY(-50%);
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
  border-right: 5px solid var(--text-1);
}

/* ─── Toast (bottom-right notification) ───────────────────────────────── */
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px 10px 12px;
  background: var(--text-1); color: var(--bg);
  border-radius: var(--r-md);
  box-shadow: var(--elev-3);
  font-size: var(--t-sm);
  max-width: 380px;
  animation: toastIn var(--d-emph) var(--ease-emph);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--accent); }
.toast.is-success .toast-icon { color: var(--success); }
.toast.is-warning .toast-icon { color: var(--warning); }
.toast.is-danger  .toast-icon { color: var(--danger); }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-action { color: var(--accent); font-weight: 600; cursor: pointer; padding: 2px 8px; border-radius: var(--r-xs); }
.toast-action:hover { background: var(--surface-3); }
.toast-close { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); cursor: pointer; border-radius: var(--r-xs); }
.toast-close:hover { color: var(--bg); background: rgba(255,255,255,.08); }

/* Lighter "surface" variant for less aggressive notifications */
.toast--surface {
  background: var(--surface-1); color: var(--text-1);
  border: 1px solid var(--border);
  box-shadow: var(--elev-3);
}
.toast--surface .toast-close { color: var(--text-3); }
.toast--surface .toast-close:hover { background: var(--surface-2); color: var(--text-1); }

.toast-region {
  position: fixed; bottom: 22px; right: 22px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: var(--z-toast);
  pointer-events: none;
}
.toast-region .toast { pointer-events: auto; }

/* ─── Skeleton (loading placeholder) ─────────────────────────────────── */
.skeleton {
  display: block;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-xs);
}
.skeleton--text { height: 12px; }
.skeleton--h    { height: 20px; }
.skeleton--block { height: 80px; border-radius: var(--r-sm); }
.skeleton--circle { border-radius: 50%; aspect-ratio: 1; width: 32px; }
@keyframes skeletonShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Spinner ─────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
.spinner--lg { width: 24px; height: 24px; border-width: 3px; }
.spinner--xl { width: 36px; height: 36px; border-width: 3.5px; }
/* For use inside .btn--primary / accent surfaces — flips the contrast */
.spinner--on-accent {
  border-color: rgba(255,255,255,.3);
  border-top-color: #fff;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Progress (linear) ──────────────────────────────────────────────── */
.progress {
  width: 100%; height: 6px;
  background: var(--surface-3); border-radius: var(--r-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--accent);
  border-radius: var(--r-pill);
  transition: width var(--d-base) var(--ease-standard);
}
.progress--lg { height: 10px; }
.progress--sm { height: 4px; }
.progress-fill.is-success { background: var(--success); }
.progress-fill.is-warning { background: var(--warning); }
.progress-fill.is-danger  { background: var(--danger); }
.progress-fill.is-striped {
  background-image: linear-gradient(45deg, rgba(255,255,255,.18) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.18) 50%, rgba(255,255,255,.18) 75%, transparent 75%, transparent);
  background-size: 14px 14px;
  animation: progressStripe 1s linear infinite;
}
@keyframes progressStripe { from { background-position: 0 0; } to { background-position: 14px 0; } }

/* ─── Status dot ──────────────────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  vertical-align: middle;
}
.status-dot.is-online { background: var(--success); box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 25%, transparent); }
.status-dot.is-busy   { background: var(--danger); }
.status-dot.is-away   { background: var(--warning); }
.status-dot.is-offline { background: var(--text-3); }

/* ─── Tag input (chips + free text) ──────────────────────────────────── */
.tag-input {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 4px 6px;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-sm);
  min-height: 36px; align-items: center;
}
.tag-input:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.tag-input .tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: var(--r-xs);
  font-size: var(--t-xs); font-weight: 600;
}
.tag-input .tag .x { cursor: pointer; opacity: .65; }
.tag-input .tag .x:hover { opacity: 1; }
.tag-input input {
  flex: 1; min-width: 80px;
  border: 0; outline: none; background: transparent;
  font-family: inherit; font-size: var(--t-sm); color: var(--text-1);
  padding: 4px;
}

/* ─── Keyboard shortcut (kbd) ────────────────────────────────────────── */
.kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--r-xs);
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: var(--text-2);
  line-height: 1.4;
}

/* ─── Code (inline + block) ──────────────────────────────────────────── */
.code-inline,
:not(pre) > code {
  font-family: var(--font-mono); font-size: .9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: var(--r-xs);
  color: var(--text-1);
}
.code-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-family: var(--font-mono); font-size: var(--t-md);
  line-height: 1.6;
  overflow-x: auto;
  color: var(--text-1);
}
.code-block .c-keyword { color: var(--accent); font-weight: 600; }
.code-block .c-string  { color: var(--success); }
.code-block .c-comment { color: var(--text-3); font-style: italic; }
.code-block .c-number  { color: var(--warning); }

/* ─── Empty state ────────────────────────────────────────────────────── */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-3);
}
.empty-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-md);
  background: var(--surface-2); color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.empty-icon svg { width: 24px; height: 24px; }
.empty-title { font-size: var(--t-lg); font-weight: 700; color: var(--text-1); }
.empty-sub { font-size: var(--t-sm); color: var(--text-2); max-width: 360px; line-height: 1.5; }
.empty-cta { margin-top: 6px; }

/* ─── Table ──────────────────────────────────────────────────────────── */
.tbl {
  width: 100%; border-collapse: collapse;
  font-size: var(--t-sm);
}
.tbl thead th {
  position: sticky; top: 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px; text-align: left;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3);
  z-index: 1;
}
.tbl thead th.is-sortable { cursor: pointer; }
.tbl thead th.is-sortable:hover { color: var(--text-2); }
.tbl thead th.is-sortable::after {
  content: '↕'; margin-left: 6px; opacity: .4;
}
.tbl thead th.is-sorted-asc::after { content: '↑'; opacity: 1; color: var(--accent); }
.tbl thead th.is-sorted-desc::after { content: '↓'; opacity: 1; color: var(--accent); }
.tbl tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.tbl tbody tr:hover { background: var(--surface-2); cursor: pointer; }
.tbl tbody tr.is-selected { background: var(--accent-soft); }
.tbl tbody tr:last-child td { border-bottom: 0; }

/* ─── Breadcrumb ─────────────────────────────────────────────────────── */
.crumb {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--t-sm); color: var(--text-3);
}
.crumb a { color: var(--text-3); text-decoration: none; }
.crumb a:hover { color: var(--text-1); text-decoration: underline; }
.crumb .sep { color: var(--text-disabled); }
.crumb .crumb-active { color: var(--text-2); font-weight: 600; }

/* ─── Pagination ─────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 4px;
}
.pagination button {
  min-width: 32px; height: 32px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-2);
  font-size: var(--t-sm); font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center;
}
.pagination button:hover { color: var(--text-1); border-color: var(--border-strong); }
.pagination button.is-active { background: var(--accent); color: var(--text-on-accent); border-color: transparent; }
.pagination button:disabled { opacity: .4; pointer-events: none; }
.pagination .ellipsis { color: var(--text-3); padding: 0 4px; }

/* ─── Banner (full-width notice at top of canvas) ────────────────────── */
.banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: var(--accent-soft); color: var(--text-1);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  font-size: var(--t-sm);
}
.banner.is-warning { background: var(--warning-soft); border-bottom-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.banner.is-danger  { background: var(--danger-soft); border-bottom-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.banner .banner-action { margin-left: auto; }

/* ─── Step indicator (progress dots) ─────────────────────────────────── */
.steps {
  display: flex; gap: 6px;
}
.steps .step {
  height: 4px; flex: 1; max-width: 60px;
  background: var(--surface-3);
  border-radius: 2px;
}
.steps .step.is-done    { background: var(--accent); }
.steps .step.is-current { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ─── Accordion / collapsible ────────────────────────────────────────── */
.accordion-item {
  border-bottom: 1px solid var(--border);
}
.accordion-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0;
  cursor: pointer;
  font-weight: 600;
}
.accordion-head .chev {
  width: 14px; height: 14px; color: var(--text-3);
  transition: transform var(--d-fast) var(--ease-standard);
}
.accordion-item.is-open .accordion-head .chev { transform: rotate(90deg); }
.accordion-body {
  display: none;
  padding: 0 0 12px;
  font-size: var(--t-sm); color: var(--text-2); line-height: var(--lh-loose);
}
.accordion-item.is-open .accordion-body { display: block; }

/* ─── Table density + striping + sticky-col (extends .tbl above) ───────── */
.tbl--compact thead th,
.tbl--compact tbody td { padding: 6px 12px; font-size: var(--t-sm); }
.tbl--spacious thead th,
.tbl--spacious tbody td { padding: 14px 18px; }
.tbl--striped tbody tr:nth-child(even) { background: var(--surface-2); }
.tbl--striped tbody tr:hover { background: var(--surface-3); }
.tbl--bordered { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.tbl--bordered td, .tbl--bordered th { border-right: 1px solid var(--border); }
.tbl--bordered td:last-child, .tbl--bordered th:last-child { border-right: 0; }
.tbl .tbl-sticky-col { position: sticky; left: 0; background: inherit; z-index: 1; }
.tbl tbody tr.is-expanded + tr.tbl-expanded-row > td {
  background: var(--surface-2);
  padding: 14px 18px;
  border-top: 0;
}

/* ─── Banner (sub-1024 degraded mode) ─────────────────────────────────── */
/* Add this manually to your layout — it doesn't auto-mount. */
.banner--degraded {
  display: none;
  background: var(--warning-soft); color: var(--warning-fg);
  border-bottom: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  padding: 8px 16px; font-size: var(--t-sm); text-align: center;
}
@media (max-width: 1023px) {
  .banner--degraded { display: block; }
}

/* ─── Mention chip (inline @user) ─────────────────────────────────────── */
.mention {
  display: inline-flex; align-items: baseline;
  padding: 0 4px; border-radius: var(--r-xs);
  background: var(--accent-soft); color: var(--accent);
  font-weight: 600; text-decoration: none;
  font-size: .95em;
}
.mention:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }

/* ─── Date input + mini-calendar grid ─────────────────────────────────── */
/* Easiest path: style native <input type="date"> as a .field-input — done.
   For range pickers / mini-calendars, use the .calendar grid below. */
input[type="date"].field-input,
input[type="time"].field-input,
input[type="datetime-local"].field-input {
  font-family: inherit;
  /* Reserve room for the native picker icon, keep height consistent */
  min-height: 38px;
}
/* Hide the native chevron in webkit (it tints poorly in dark mode), keep
   click target intact via the input itself */
input[type="date"].field-input::-webkit-calendar-picker-indicator,
input[type="time"].field-input::-webkit-calendar-picker-indicator,
input[type="datetime-local"].field-input::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: .55; filter: invert(0);
}
html[data-theme="dark"] input[type="date"].field-input::-webkit-calendar-picker-indicator,
html[data-theme="dark"] input[type="time"].field-input::-webkit-calendar-picker-indicator,
html[data-theme="dark"] input[type="datetime-local"].field-input::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

/* Mini-calendar — drop inside a .popover to make a custom date picker.
   Pure CSS scaffold; JS owns "what day is selected / today". */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 10px;
  background: var(--surface-1);
  border-radius: var(--r-md);
  width: 252px;
}
.calendar-head {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 4px 8px;
  font-weight: 600;
}
.calendar-head .nav {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border-radius: var(--r-sm); color: var(--text-3);
}
.calendar-head .nav:hover { background: var(--surface-2); color: var(--text-1); }
.calendar-dow {
  font-size: 10px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em;
  text-align: center; padding: 4px 0;
}
.calendar-day {
  display: inline-flex; align-items: center; justify-content: center;
  height: 30px; border-radius: var(--r-sm);
  font-size: var(--t-sm); color: var(--text-1);
  cursor: pointer;
}
.calendar-day:hover { background: var(--surface-2); }
.calendar-day.is-other-month { color: var(--text-disabled); }
.calendar-day.is-today { border: 1px solid var(--accent); }
.calendar-day.is-selected { background: var(--accent); color: var(--text-on-accent); font-weight: 600; }
.calendar-day.is-in-range { background: var(--accent-soft); color: var(--accent); border-radius: 0; }
.calendar-day:disabled { color: var(--text-disabled); cursor: not-allowed; }

/* ─── Popover (shared base for menus / pickers / mention pickers) ────── */
.popover {
  position: absolute;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--elev-3);
  z-index: var(--z-modal);
  animation: menuIn var(--d-fast) var(--ease-emph);
}

/* ─── Command palette (.cmdk) ────────────────────────────────────────── */
/* Cmd+K style overlay. Renders centered, narrower than .modal.
   Compose: .cmdk-overlay > .cmdk > .cmdk-input + .cmdk-body + .cmdk-foot */
.cmdk-overlay {
  position: fixed; inset: 0;
  background: var(--surface-overlay);
  backdrop-filter: blur(4px);
  display: grid; place-items: start center;
  padding-top: 14vh;
  z-index: var(--z-cmdk);
  animation: overlayIn var(--d-base) var(--ease-emph);
}
.cmdk {
  width: 100%; max-width: 600px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--elev-5);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 70vh;
  animation: modalIn var(--d-emph) var(--ease-emph);
}
.cmdk-input {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.cmdk-input svg { width: 18px; height: 18px; color: var(--text-3); flex-shrink: 0; }
.cmdk-input input {
  flex: 1; border: 0; outline: none; background: transparent;
  font-family: inherit; font-size: var(--t-lg); color: var(--text-1);
}
.cmdk-input .kbd { margin-left: auto; }
.cmdk-body { flex: 1; overflow-y: auto; padding: 6px; }
.cmdk-empty { padding: 32px 18px; text-align: center; color: var(--text-3); font-size: var(--t-sm); }
.cmdk-section {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); padding: 12px 10px 4px;
}
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: var(--r-sm);
  font-size: var(--t-md); color: var(--text-1);
  cursor: pointer;
}
.cmdk-item:hover,
.cmdk-item.is-focused { background: var(--surface-2); }
/* Keyboard focus uses a ring rather than a bg color, so it can be told
   apart from mouse hover (esp. when both are present). */
.cmdk-item.is-focused { background: var(--accent-soft); }
.cmdk-item .cmdk-icon { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; }
.cmdk-item.is-focused .cmdk-icon { color: var(--accent); }
.cmdk-item .cmdk-meta { margin-left: auto; font-size: var(--t-xs); color: var(--text-3); }
.cmdk-item .cmdk-hl { color: var(--accent); font-weight: 700; }
.cmdk-foot {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: var(--t-xs); color: var(--text-3);
}
.cmdk-foot .hint { display: inline-flex; align-items: center; gap: 6px; }

/* ─── Dropzone + file tiles (uploads) ────────────────────────────────── */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 28px 20px;
  text-align: center;
  color: var(--text-2);
  transition: border-color var(--d-fast), background var(--d-fast);
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.dropzone-icon {
  width: 36px; height: 36px;
  color: var(--text-3);
  margin: 0 auto 10px;
  display: inline-flex; align-items: center; justify-content: center;
}
.dropzone-title { font-weight: 600; color: var(--text-1); font-size: var(--t-md); }
.dropzone-sub { font-size: var(--t-xs); color: var(--text-3); margin-top: 4px; }

.upload-tile {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.upload-tile-icon {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.upload-tile-body { flex: 1; min-width: 0; }
.upload-tile-name { font-size: var(--t-sm); font-weight: 600; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-tile-meta { font-size: var(--t-xs); color: var(--text-3); margin-top: 2px; }
.upload-tile .progress { margin-top: 6px; }

/* File tile (after upload — image/doc/etc thumbnail) */
.file-tile {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--d-fast), box-shadow var(--d-fast);
}
.file-tile:hover { border-color: var(--border-strong); box-shadow: var(--elev-1); }
.file-tile-thumb {
  aspect-ratio: 4 / 3; border-radius: var(--r-sm);
  background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3);
}
.file-tile-thumb svg { width: 32px; height: 32px; }
.file-tile-name { font-size: var(--t-sm); font-weight: 600; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-tile-meta { font-size: var(--t-xs); color: var(--text-3); }

/* ─── Segmented control (radio-as-tabs) ──────────────────────────────── */
.segmented {
  display: inline-flex;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 3px; gap: 2px;
}
.segmented label {
  position: relative;
  padding: 6px 14px;
  border-radius: calc(var(--r-md) - 4px);
  font-size: var(--t-sm); font-weight: 600;
  color: var(--text-2); cursor: pointer;
  transition: color var(--d-fast), background var(--d-fast);
}
.segmented label:hover { color: var(--text-1); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked),
.segmented input:checked + label {
  background: var(--surface-1); color: var(--text-1);
  box-shadow: var(--elev-1);
}

/* ─── Stepper (numeric +/-) ──────────────────────────────────────────── */
.stepper {
  display: inline-flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  overflow: hidden;
}
.stepper button {
  width: 32px;
  background: var(--surface-2); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--t-base); font-weight: 700;
}
.stepper button:hover { background: var(--surface-3); color: var(--text-1); }
.stepper input {
  width: 56px; text-align: center; border: 0; outline: none;
  background: var(--surface-1); color: var(--text-1);
  font-family: inherit; font-size: var(--t-md);
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
}
.stepper:focus-within { border-color: var(--accent); box-shadow: var(--ring); }

/* ===== layout.css ===== */
/* ───────────────────────────────────────────────────────────────────────────────
   Web App Starter — layout
   App shell with collapsible sidebar, command bar, view header, canvas.
   Set data-collapsed="true" on .sidebar to toggle icon-only mode.
   ─────────────────────────────────────────────────────────────────── */

.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  position: relative;             /* anchor for .sidebar-collapse */
  width: var(--sidebar-w-expanded);
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 14px 10px;
  gap: 4px;
  flex-shrink: 0;
  transition: width var(--d-base) var(--ease-standard);
  /* Keep overflow visible so the .sidebar-collapse chevron (which sits at
     right: -9px) isn't clipped. Scroll happens on the inner .sidebar-scroll
     wrapper, OR — if you don't need scroll — leave as-is. */
  overflow: visible;
}
/* Optional scroll wrapper. Use this when sidebar content overflows. */
.sidebar-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.sidebar[data-collapsed="true"] {
  width: var(--sidebar-w-collapsed);
  padding: 14px 0;
  align-items: center;
}
.sidebar[data-collapsed="true"] .sidebar-item-label,
.sidebar[data-collapsed="true"] .sidebar-group-label,
.sidebar[data-collapsed="true"] .sidebar-title,
.sidebar[data-collapsed="true"] .sidebar-workspace,
.sidebar[data-collapsed="true"] .sidebar-item-count,
.sidebar[data-collapsed="true"] .sidebar-cmd-label,
.sidebar[data-collapsed="true"] .sidebar-cmd-kbd { display: none; }
.sidebar[data-collapsed="true"] .sidebar-item { justify-content: center; padding: 7px 10px; }
.sidebar[data-collapsed="true"] .sidebar-cmd { padding: 8px; }

.sidebar-head {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 14px;
}
.sidebar-mark {
  width: 32px; height: 32px;
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-mark svg { width: 100%; height: 100%; }
.sidebar-title { font-weight: 600; letter-spacing: -.01em; font-size: var(--t-base); }
.sidebar-workspace {
  font-size: var(--t-xs); color: var(--text-3);
  padding: 4px 8px; border-radius: var(--r-sm);
  cursor: pointer;
}

/* Sidebar command-bar trigger */
.sidebar-cmd {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-3);
  margin: 4px 4px 14px;
}
.sidebar-cmd:hover { border-color: var(--border-strong); }
.sidebar-cmd-icon { width: 14px; height: 14px; flex-shrink: 0; }
.sidebar-cmd-label { flex: 1; font-size: var(--t-sm); }
.sidebar-cmd-kbd {
  font-family: var(--font-mono); font-size: var(--t-xs);
  background: var(--surface-3); padding: 2px 6px; border-radius: var(--r-xs);
  color: var(--text-2);
}

/* Sidebar groups + items */
.sidebar-group { display: flex; flex-direction: column; gap: 1px; }
.sidebar-group-label {
  padding: 12px 12px 4px;
  font-size: 10px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--text-2); font-size: var(--t-md);
  cursor: pointer;
  position: relative;
}
.sidebar-item:hover { background: var(--surface-2); color: var(--text-1); }
.sidebar-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.sidebar-item-icon {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  opacity: .9;
}
.sidebar-item.is-active .sidebar-item-icon { opacity: 1; }
.sidebar-item-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-item-count {
  font-size: var(--t-xs); color: var(--text-3);
  background: var(--surface-3); padding: 1px 7px; border-radius: var(--r-pill);
}
.sidebar-item.is-active .sidebar-item-count { background: var(--accent); color: var(--text-on-accent); }
.sidebar-item-badge {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  margin-left: auto;
}

/* Sidebar collapse toggle — anchored to .sidebar (position: relative above) */
.sidebar-collapse {
  position: absolute; top: 18px; right: -9px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface-1); border: 1px solid var(--border);
  color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  z-index: var(--z-sticky);
  transition: transform var(--d-fast) var(--ease-standard);
}
.sidebar-collapse:hover { color: var(--text-1); border-color: var(--border-strong); }
.sidebar[data-collapsed="true"] .sidebar-collapse { transform: rotate(180deg); }

/* Sidebar footer */
.sidebar-foot {
  margin-top: auto;
  display: flex; flex-direction: column;
  gap: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ─── Canvas ──────────────────────────────────────────────────────────── */
.canvas {
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ─── Command bar (top of canvas) ─────────────────────────────────────── */
.cmd-bar-wrap { padding: 14px 24px 0; }
.cmd-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-3);
  box-shadow: var(--elev-1);
  transition: box-shadow var(--d-fast) var(--ease-standard);
}
.cmd-bar:hover { box-shadow: var(--elev-2); border-color: var(--border-strong); }
.cmd-bar input {
  flex: 1; background: transparent; border: 0; outline: none;
  color: var(--text-1); font-size: var(--t-md); font-family: inherit;
}
.cmd-bar-kbd {
  font-family: var(--font-mono); font-size: var(--t-xs);
  background: var(--surface-3); padding: 2px 6px; border-radius: var(--r-xs);
  color: var(--text-2);
}

/* ─── View header ─────────────────────────────────────────────────────── */
.view-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px;
  padding: 18px 24px 14px;
}
.view-header-left { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.view-crumb {
  font-size: var(--t-sm); color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
}
.view-crumb .sep { color: var(--text-disabled); }
.view-title { font-size: var(--t-2xl); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.view-header-right { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ─── Filter row ──────────────────────────────────────────────────────── */
.filter-row {
  display: flex; align-items: center; gap: 10px;
  padding: 0 24px 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--text-2); font-size: var(--t-sm); cursor: pointer;
}
.filter-chip:hover { color: var(--text-1); border-color: var(--border-strong); }
.filter-chip.is-active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.filter-chip .x { color: var(--text-3); margin-left: 2px; }

/* ─── Canvas body ─────────────────────────────────────────────────────── */
.canvas-body {
  flex: 1;
  padding: 0 24px 24px;
  overflow: auto;
}

/* ─── Responsive (degraded under 1024px) ──────────────────────────────── */
/* Below 1024 the layout auto-collapses the sidebar. Optionally render a
   .banner--degraded element at the top of .canvas to inform the user. */
@media (max-width: 1023px) {
  .sidebar { width: var(--sidebar-w-collapsed); padding: 14px 0; align-items: center; }
  .sidebar .sidebar-item-label,
  .sidebar .sidebar-group-label,
  .sidebar .sidebar-title,
  .sidebar .sidebar-cmd-label,
  .sidebar .sidebar-cmd-kbd,
  .sidebar .sidebar-item-count { display: none; }
}

/* ─────────────────────────────────────────────────────────────────────────
   App-shell extras (AppShell.tsx) — small additions on top of the vendored
   second-brain layout. Token-driven so they theme automatically.
   ───────────────────────────────────────────────────────────────────────── */
.lang-switch { display: flex; gap: 2px; padding: 2px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-sm); }
.lang-switch button { padding: 4px 8px; font-size: var(--t-xs); font-weight: 600;
  color: var(--text-3); border-radius: var(--r-xs); }
.lang-switch button:hover { color: var(--text-1); }
.lang-switch button.active { background: var(--surface-1); color: var(--accent); }

.sidebar-foot-row { display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-2); }
.sidebar-hint { padding: var(--s-3); font-size: var(--t-xs); color: var(--text-3); }
.sidebar-crumb { padding: var(--s-2) var(--s-3); font-size: var(--t-xs); color: var(--text-3);
  border-top: 1px solid var(--border); }

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.sidebar-user-meta { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-name { font-size: var(--t-sm); font-weight: 600; color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-mail { font-size: var(--t-xs); color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════════════════════
   Pinnable / resizable sidebar additions + user-menu popover
   (extends the vendored second-brain .sidebar layout)
   ═══════════════════════════════════════════════════════════════════════════ */

.sidebar { overflow: visible; }              /* let the user-menu popover escape */
.sidebar-title-wrap { flex: 1; min-width: 0; }
.sidebar-collapse.is-pinned { color: var(--accent); }

/* drag-to-resize handle (between sidebar and main, only when pinned/expanded) */
.sidebar-resize {
  width: 6px; margin-left: -3px; flex-shrink: 0; z-index: 6;
  cursor: col-resize; background: transparent;
  transition: background var(--d-fast) var(--ease-standard);
}
.sidebar-resize:hover, .sidebar-resize:active { background: var(--accent-soft); }

/* language switch (used inside the user menu) */
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.lang-switch button {
  padding: 5px 9px; font-size: var(--t-xs); font-weight: 700;
  background: var(--surface-1); color: var(--text-2);
  border: none; border-left: 1px solid var(--border); cursor: pointer; line-height: 1; font-family: inherit;
}
.lang-switch button:first-child { border-left: none; }
.lang-switch button.active { background: var(--accent); color: var(--text-on-accent); }
.lang-switch button:not(.active):hover { background: var(--surface-2); }

/* ── User menu (sidebar foot) ─────────────────────────────────────────────── */
.user-menu { position: relative; }
.user-menu-trigger {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 6px 8px; border-radius: var(--r-sm);
  background: none; border: none; cursor: pointer; font-family: inherit; text-align: left;
  color: var(--text-1);
}
.user-menu-trigger:hover { background: var(--surface-2); }
.user-menu-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.user-menu-name { font-size: var(--t-md); color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: capitalize; }
.user-menu-role { font-size: var(--t-xs); color: var(--text-3); text-transform: capitalize; }
.user-menu-chev { color: var(--text-3); transition: transform var(--d-fast) var(--ease-standard); flex-shrink: 0; }
.user-menu-chev.is-open { transform: rotate(180deg); }
.sidebar[data-collapsed="true"] .user-menu-trigger { justify-content: center; padding: 6px 0; }

.user-menu-pop {
  position: absolute; bottom: calc(100% + 8px); left: 0; right: 0;
  min-width: 240px;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--elev-3);
  padding: 8px; z-index: 1000;
}
.sidebar[data-collapsed="true"] .user-menu-pop { right: auto; width: 264px; }
.user-menu-profile { display: flex; align-items: center; gap: 12px; padding: 8px 8px 12px; }
.user-menu-pinfo { display: flex; flex-direction: column; min-width: 0; }
.user-menu-pname { font-size: var(--t-base); font-weight: 700; color: var(--text-1); }
.user-menu-pemail { font-size: var(--t-sm); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.user-menu-prole { font-size: var(--t-xs); color: var(--accent); font-weight: 600; text-transform: capitalize; margin-top: 2px; }
.user-menu-div { height: 1px; background: var(--border); margin: 4px 0; }
.user-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 8px; border-radius: var(--r-sm);
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: var(--t-md); color: var(--text-1); text-align: left;
}
.user-menu-item:hover { background: var(--surface-2); }
.user-menu-item.is-danger { color: var(--danger, var(--vhigh)); }
.user-menu-item.is-danger:hover { background: var(--danger-soft, var(--vhigh-bg)); }
.user-menu-ico { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-2); }
.user-menu-item.is-danger .user-menu-ico { color: var(--danger, var(--vhigh)); }
.user-menu-ico svg { width: 17px; height: 17px; }
.user-menu-lang { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.user-menu-lang .lang-switch { margin-left: auto; }

/* ── App-shell layout utilities (AppShell.tsx) ──────────────────────────── */
/* Spacer that reserves the sidebar's collapsed-rail width when sidebar floats */
.sidebar-spacer { width: var(--sidebar-w-collapsed); flex-shrink: 0; }
/* Floating (unpinned) sidebar — overlays the main content */
.sidebar.is-float {
  position: fixed; top: 0; bottom: 0; left: 0;
  z-index: var(--z-panel);
}
/* Main content area — mirrors .canvas but named for semantic <main> */
.main-content {
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── Global utility classes ──────────────────────────────────────────────── */
/* flex-1: let an element grow to fill available space */
.flex-1 { flex: 1; min-width: 0; }
/* sr-only: visually hidden but accessible to screen readers */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
