/* ==========================================================================
   base.css — reset + shared components for every Hajde / Vitrina surface.
   Requires tokens.css (and fonts.css). Components read semantic tokens
   (--bg, --fg, --surface, --border …) and brand aliases (--brand-*).
   ========================================================================== */

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: var(--text-md);
  line-height: var(--lh-normal);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01' 0;
}
img, picture, video, canvas, svg { display: block; max-width: 100%; }
svg.icon { display: inline-block; flex: none; vertical-align: -0.2em; }
input, button, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--brand-primary) 26%, transparent); }

/* ── Typography ────────────────────────────────────────────────────── */
h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: 700;
  color: inherit;
}
[data-product="ride"] h1, [data-product="ride"] h2, [data-product="ride"] .display { font-weight: 650; letter-spacing: -0.025em; }
h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); letter-spacing: var(--tracking-snug); }
h4 { font-size: var(--text-lg); letter-spacing: var(--tracking-snug); }
.eyebrow {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--brand-primary);
}
.lead { font-size: var(--text-lg); color: var(--fg-muted); line-height: 1.55; }
.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.small { font-size: var(--text-sm); }
.tiny { font-size: var(--text-xs); }
.num, .tabular { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.mono { font-family: var(--font-mono); }
.strong { font-weight: 700; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Focus ─────────────────────────────────────────────────────────── */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
  border-radius: 6px;
}
.btn:focus-visible, .chip:focus-visible, .input:focus-visible { outline-offset: 3px; border-radius: var(--btn-radius); }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  --btn-h: 48px;
  --btn-bg: var(--surface-2);
  --btn-fg: var(--fg);
  --btn-bd: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--btn-h);
  padding: 0 20px;
  border-radius: var(--btn-radius);
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), opacity var(--dur-fast);
}
.btn:hover { background: color-mix(in srgb, var(--btn-bg) 92%, var(--fg)); }
.btn:active { transform: scale(.975); }
.btn .icon { width: 1.25em; height: 1.25em; }
.btn-primary {
  --btn-bg: var(--brand-primary);
  --btn-fg: var(--brand-on-primary);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 6px 16px -6px color-mix(in srgb, var(--brand-primary) 70%, transparent);
}
.btn-primary:hover { background: var(--brand-primary-dark); }
.btn-accent { --btn-bg: var(--brand-accent); --btn-fg: var(--brand-on-accent); }
.btn-accent:hover { background: color-mix(in srgb, var(--brand-accent) 88%, #000); }
.btn-dark { --btn-bg: var(--brand-ink); --btn-fg: #fff; }
.btn-dark:hover { background: color-mix(in srgb, var(--brand-ink) 85%, #fff); }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--fg); --btn-bd: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { --btn-bg: var(--brand-primary-soft); --btn-fg: var(--brand-primary); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand-primary-soft) 80%, var(--brand-primary)); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.btn-success { --btn-bg: var(--success); --btn-fg: #fff; }
.btn-success:hover { background: color-mix(in srgb, var(--success) 85%, #000); }
.btn-link { --btn-bg: transparent; --btn-fg: var(--brand-primary); padding: 0 6px; min-height: 36px; }
.btn-link:hover { background: transparent; text-decoration: underline; }
.btn-sm { --btn-h: 36px; padding: 0 14px; font-size: 13px; gap: 6px; border-radius: calc(var(--btn-radius) - 4px); }
.btn-lg { --btn-h: 58px; padding: 0 28px; font-size: 17px; border-radius: calc(var(--btn-radius) + 2px); }
.btn-xl { --btn-h: 68px; padding: 0 34px; font-size: 19px; border-radius: calc(var(--btn-radius) + 4px); }
.btn-block { display: flex; width: 100%; }
.btn-pill { border-radius: var(--radius-pill); }
.btn-icon { padding: 0; width: var(--btn-h); }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; box-shadow: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--btn-fg); border-right-color: transparent;
  animation: spin .7s linear infinite;
}

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: var(--space-5); }
.card-lg { padding: var(--space-6); }
.card-flat { box-shadow: none; }
.card-raised { box-shadow: var(--shadow-md); border-color: transparent; }
.card-interactive { cursor: pointer; transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
.card-interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.card-title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 650; letter-spacing: var(--tracking-snug); line-height: var(--lh-snug); }
.card-brand { background: var(--brand-gradient); color: #fff; border: 0; box-shadow: var(--brand-glow, var(--shadow-md)); }
.card-ink { background: var(--brand-ink); color: #fff; border: 0; }
.card.is-selected { border-color: var(--brand-primary); box-shadow: 0 0 0 1px var(--brand-primary), var(--shadow-md); }

/* ── Stat / KPI ────────────────────────────────────────────────────── */
.kpi { display: grid; gap: 4px; }
.kpi-label { font-size: var(--text-xs); font-weight: 600; color: var(--fg-muted); letter-spacing: .01em; }
.kpi-value { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 650; letter-spacing: var(--tracking-tight); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-delta { font-size: var(--text-xs); font-weight: 700; color: var(--success); display: inline-flex; align-items: center; gap: 3px; }
.kpi-delta.is-down { color: var(--danger); }

/* ── Forms ─────────────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; }
.label { font-size: var(--text-sm); font-weight: 650; color: var(--fg); }
.hint { font-size: var(--text-xs); color: var(--fg-muted); }
.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: var(--input-radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  font-size: 15px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--fg-subtle); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--fg-muted)); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 4px var(--ring); outline: none; }
.input-filled { background: var(--surface-2); border-color: transparent; }
.textarea { min-height: 96px; resize: vertical; }
.select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .icon, .input-group > .input-icon { position: absolute; left: 14px; color: var(--fg-muted); pointer-events: none; }
.input-group > .input { padding-left: 44px; }
.input.is-invalid { border-color: var(--danger); }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative; width: 48px; height: 28px; flex: none;
  border-radius: 999px; background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--border);
  transition: background var(--dur-base) var(--ease-out);
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform var(--dur-base) var(--ease-spring);
}
.switch input:checked + .switch-track { background: var(--success); box-shadow: none; }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 4px var(--ring); }

/* Checkbox / radio */
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { appearance: none; width: 22px; height: 22px; flex: none; border-radius: 7px; border: 1.5px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; transition: all var(--dur-fast); }
.check input[type="radio"] { border-radius: 50%; }
.check input:checked { background: var(--brand-primary); border-color: var(--brand-primary); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border: 2.5px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.check input[type="radio"]:checked::after { width: 8px; height: 8px; border: 0; border-radius: 50%; background: #fff; transform: none; }

/* Segmented control */
.segmented {
  display: inline-flex; padding: 4px; gap: 2px;
  background: var(--surface-2); border-radius: calc(var(--btn-radius) - 2px);
  box-shadow: inset 0 0 0 1px var(--border);
}
.segmented > button, .segmented > a {
  min-height: 36px; padding: 0 14px; border-radius: calc(var(--btn-radius) - 6px);
  font-size: 14px; font-weight: 650; color: var(--fg-muted); text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}
.segmented > :hover { color: var(--fg); }
.segmented > .is-active, .segmented > [aria-pressed="true"], .segmented > [aria-selected="true"] {
  background: var(--surface); color: var(--fg); box-shadow: var(--shadow-sm);
}

/* Tabs (underline) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs > button, .tabs > a {
  position: relative; padding: 12px 14px; font-weight: 650; font-size: 14px; color: var(--fg-muted); text-decoration: none;
}
.tabs > .is-active, .tabs > [aria-selected="true"] { color: var(--fg); }
.tabs > .is-active::after, .tabs > [aria-selected="true"]::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand-primary);
}

/* ── Chips ─────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: all var(--dur-fast) var(--ease-out);
}
button.chip:hover { border-color: var(--fg-subtle); }
.chip .icon { width: 16px; height: 16px; }
.chip.is-active, .chip[aria-pressed="true"] {
  background: var(--brand-ink); border-color: var(--brand-ink); color: #fff;
}
[data-theme="dark"] .chip.is-active, [data-theme="dark"] .chip[aria-pressed="true"] { background: #fff; border-color: #fff; color: var(--brand-ink); }
.chip-brand.is-active, .chip-brand[aria-pressed="true"] { background: var(--brand-primary); border-color: var(--brand-primary); color: var(--brand-on-primary); }
.chip-sm { min-height: 28px; padding: 0 10px; font-size: 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Badges ────────────────────────────────────────────────────────── */
.badge {
  --badge-bg: var(--surface-3);
  --badge-fg: var(--fg);
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px;
  border-radius: var(--radius-pill);
  background: var(--badge-bg); color: var(--badge-fg);
  font-size: 12px; font-weight: 700; line-height: 1; letter-spacing: .01em; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.badge .icon { width: 13px; height: 13px; }
.badge-brand { --badge-bg: var(--brand-primary-soft); --badge-fg: var(--brand-primary); }
.badge-solid { --badge-bg: var(--brand-primary); --badge-fg: var(--brand-on-primary); }
.badge-accent { --badge-bg: var(--brand-accent); --badge-fg: var(--brand-on-accent); }
.badge-success { --badge-bg: var(--green-soft); --badge-fg: var(--green-ink); }
.badge-warning { --badge-bg: var(--amber-soft); --badge-fg: var(--amber-ink); }
.badge-danger { --badge-bg: var(--red-soft); --badge-fg: var(--red-ink); }
.badge-info { --badge-bg: var(--blue-soft); --badge-fg: var(--blue-ink); }
.badge-dark { --badge-bg: var(--brand-ink); --badge-fg: #fff; }
.badge-outline { --badge-bg: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }
[data-theme="dark"] .badge-success { --badge-bg: rgba(22, 163, 74, .18); --badge-fg: #4ADE80; }
[data-theme="dark"] .badge-warning { --badge-bg: rgba(245, 158, 11, .18); --badge-fg: #FBBF24; }
[data-theme="dark"] .badge-danger { --badge-bg: rgba(220, 38, 38, .2); --badge-fg: #F87171; }
[data-theme="dark"] .badge-info { --badge-bg: rgba(37, 99, 235, .2); --badge-fg: #93C5FD; }
.badge-lg { height: 30px; padding: 0 12px; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; display: inline-block; }
.dot-live { color: var(--success); background: var(--success); box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent); animation: pulse-ring 1.8s var(--ease-out) infinite; }

/* ── Avatar ────────────────────────────────────────────────────────── */
.avatar {
  --size: 40px;
  width: var(--size); height: var(--size); flex: none;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--brand-primary-soft); color: var(--brand-primary);
  font-family: var(--font-display); font-weight: 700; font-size: calc(var(--size) * .36);
  letter-spacing: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { --size: 32px; } .avatar-lg { --size: 56px; } .avatar-xl { --size: 72px; }

/* ── Lists ─────────────────────────────────────────────────────────── */
.list { display: grid; }
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px; min-height: 60px;
  border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
.list-item:last-child { border-bottom: 0; }
button.list-item, a.list-item { width: 100%; text-align: left; transition: background var(--dur-fast); border-radius: 0; }
button.list-item:hover, a.list-item:hover { background: var(--surface-2); }
.list-icon {
  width: 40px; height: 40px; flex: none; border-radius: 12px;
  display: grid; place-items: center; background: var(--surface-2); color: var(--fg);
}
.list-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.list-title { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-sub { font-size: 13px; color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border); border: 0; margin: var(--space-4) 0; }

/* ── Progress & spinner ────────────────────────────────────────────── */
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span, .progress-bar { display: block; height: 100%; width: var(--value, 0%); border-radius: inherit; background: var(--brand-primary); transition: width var(--dur-slow) var(--ease-out); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--border-strong); border-top-color: var(--brand-primary); animation: spin .8s linear infinite; }

/* ── Skeleton ──────────────────────────────────────────────────────── */
.skeleton {
  position: relative; overflow: hidden;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  min-height: 1em;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-text { height: 12px; border-radius: 6px; margin: 6px 0; }
.skeleton-circle { border-radius: 50%; }

/* ── Toasts ────────────────────────────────────────────────────────── */
.toast-stack {
  position: fixed; z-index: var(--z-toast);
  left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid; gap: 10px; justify-items: center;
  width: min(440px, calc(100% - 32px));
  pointer-events: none;
}
.toast-stack.is-top { bottom: auto; top: max(24px, env(safe-area-inset-top)); }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px 14px 12px 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--brand-ink) 94%, transparent);
  color: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
  backdrop-filter: blur(12px);
  font-size: 14px; font-weight: 600; line-height: 1.35;
  animation: toast-in var(--dur-slow) var(--ease-spring) both;
}
.toast.is-leaving { animation: toast-out var(--dur-base) var(--ease-out) both; }
.toast-icon { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .12); }
.toast-success .toast-icon { background: var(--success); }
.toast-brand .toast-icon { background: var(--brand-primary); }
.toast-accent .toast-icon { background: var(--brand-accent); color: var(--brand-on-accent); }
.toast-danger .toast-icon { background: var(--danger); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 750; }
.toast-sub { font-weight: 500; opacity: .72; font-size: 13px; }
[data-theme="dark"] .toast { background: rgba(255, 255, 255, .96); color: var(--brand-ink); }
[data-theme="dark"] .toast-icon { background: var(--surface-3); color: var(--fg); }

/* ── Banner (connection lost etc.) ─────────────────────────────────── */
.banner {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 16px; font-size: 14px; font-weight: 650;
  background: var(--amber-soft); color: var(--amber-ink);
}
.banner-dark { background: var(--brand-ink); color: #fff; }

/* ── Bottom sheet ──────────────────────────────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: var(--z-sheet);
  background: var(--overlay);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-slow) var(--ease-out);
}
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: calc(var(--z-sheet) + 1);
  left: 0; right: 0; bottom: 0;
  max-height: 88%;
  display: flex; flex-direction: column;
  background: var(--surface);
  color: var(--fg);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -12px 48px rgba(0, 0, 0, .18);
  padding: 8px 20px max(20px, env(safe-area-inset-bottom));
  transform: translateY(105%);
  transition: transform 460ms var(--ease-out);
  overflow: hidden;
}
.sheet.is-open { transform: translateY(0); }
.sheet.is-static { position: relative; transform: none; left: auto; right: auto; bottom: auto; z-index: auto; }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); margin: 4px auto 12px; flex: none; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet-title { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 650; letter-spacing: var(--tracking-snug); line-height: 1.2; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 0; }
.sheet-footer { padding-top: 14px; display: grid; gap: 10px; }

/* Modal */
.modal {
  position: fixed; z-index: var(--z-modal);
  left: 50%; top: 50%; transform: translate(-50%, -48%) scale(.98);
  width: min(520px, calc(100% - 32px)); max-height: calc(100% - 48px); overflow: auto;
  background: var(--surface); color: var(--fg);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
  padding: var(--space-6);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.modal.is-open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }

/* ── Empty state ───────────────────────────────────────────────────── */
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: var(--space-10) var(--space-6); color: var(--fg-muted); }
.empty .icon { width: 40px; height: 40px; color: var(--fg-subtle); }

/* ── Tooltip (CSS-only via data-tip) ───────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  padding: 6px 10px; border-radius: 8px; background: var(--brand-ink); color: #fff;
  font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none; z-index: 5;
}

/* ── Layout helpers ────────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: var(--gap, 12px); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--gap, 12px); }
.stack { display: grid; gap: var(--gap, 12px); align-content: start; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { display: grid; place-items: center; }
.i { display: inline-flex; vertical-align: middle; }

/* ── Scrollbars ────────────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--fg) 22%, transparent) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--fg) 20%, transparent); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--fg) 34%, transparent); border: 3px solid transparent; background-clip: padding-box; }

/* ── Keyframes ─────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); }
  100% { box-shadow: 0 0 0 10px transparent; }
}
.anim-rise { animation: rise-in var(--dur-slow) var(--ease-out) both; }
.anim-fade { animation: fade-in var(--dur-slow) var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
