/* ─────────────────────────────────────────────────────
   Liquid glass design system
   Translucent surfaces with backdrop-blur and inner highlights.
   ───────────────────────────────────────────────────── */

/* ── Design tokens ─────────────────────────────────────
   Versioned tokens — radius, elevation, motion.
   These are the only knobs that should appear in component
   styles. If you find yourself reaching for a hard-coded
   shadow / radius / duration, promote it here first.
   See DESIGN_SYSTEM.md → "Tokens" for usage guidance.
   ───────────────────────────────────────────────────── */

:root {
  /* Radius scale — applied via `rounded-[var(--radius-md)]` or via
     the `.r-{step}` utilities below. */
  --radius-sm:   0.5rem;     /* 8px  — chips, tight controls */
  --radius-md:   0.75rem;    /* 12px — inputs, small cards   */
  --radius-lg:   1rem;       /* 16px — buttons, list items   */
  --radius-xl:   1.25rem;    /* 20px — cards, panels         */
  --radius-2xl:  1.5rem;     /* 24px — modals, hero surfaces */
  --radius-pill: 9999px;     /* full round                   */

  /* Elevation scale — semantic box-shadow tokens. The names map to
     the surface's *role*, not a numeric depth, so consumers don't
     have to remember whether a modal is z-3 or z-4. */
  --elevation-flat:
    0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --elevation-raised:
    0 4px 12px -2px rgba(15, 23, 42, 0.08),
    0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --elevation-floating:
    0 12px 24px -8px rgba(15, 23, 42, 0.12),
    0 4px 8px -4px rgba(15, 23, 42, 0.06);
  --elevation-modal:
    0 40px 100px -30px rgba(0, 0, 0, 0.45),
    0 16px 40px -12px rgba(0, 0, 0, 0.18);
  --elevation-orbital:
    0 60px 160px -40px rgba(99, 102, 241, 0.35),
    0 20px 60px -20px rgba(168, 85, 247, 0.22);

  /* Motion: duration scale (matches Tailwind `duration-*` arbitrary
     values). Animations: any consumer should pick a duration token
     instead of inventing a number.

     - xs (90ms)  — micro feedback (toggle thumb, hover tint)
     - sm (150ms) — button press, popover open
     - md (240ms) — card hover, drawer slide
     - lg (360ms) — page transitions, modal enter */
  --duration-xs: 90ms;
  --duration-sm: 150ms;
  --duration-md: 240ms;
  --duration-lg: 360ms;

  /* Motion: easing curves. `standard` is the default product curve;
     `emphasized` is for entering elements; `decelerate` for arrivals;
     `accelerate` for departures. */
  --ease-standard:    cubic-bezier(0.4, 0, 0.2, 1);
  --ease-emphasized:  cubic-bezier(0.2, 0, 0, 1);
  --ease-decelerate:  cubic-bezier(0, 0, 0.2, 1);
  --ease-accelerate:  cubic-bezier(0.4, 0, 1, 1);
  --ease-ios:         cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Dark mode keeps the same radius/duration tokens; only elevation
   bumps darker so glass surfaces still feel lifted on dark grounds. */
:is(.dark) {
  --elevation-flat:
    0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --elevation-raised:
    0 4px 12px -2px rgba(0, 0, 0, 0.5),
    0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --elevation-floating:
    0 12px 24px -8px rgba(0, 0, 0, 0.6),
    0 4px 8px -4px rgba(0, 0, 0, 0.4);
  --elevation-modal:
    0 40px 100px -30px rgba(0, 0, 0, 0.7),
    0 16px 40px -12px rgba(0, 0, 0, 0.5);
}

/* Honor `prefers-reduced-motion` at the token layer — any consumer
   reading `var(--duration-md)` automatically gets 0ms when the user
   opts out. WCAG 2.3.3. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-xs: 0ms;
    --duration-sm: 0ms;
    --duration-md: 0ms;
    --duration-lg: 0ms;
  }
}

/* ── Token utility classes ─────────────────────────────
   Tiny wrappers so consumers can write `.r-md` instead of
   `[border-radius:var(--radius-md)]`. */

.r-sm   { border-radius: var(--radius-sm); }
.r-md   { border-radius: var(--radius-md); }
.r-lg   { border-radius: var(--radius-lg); }
.r-xl   { border-radius: var(--radius-xl); }
.r-2xl  { border-radius: var(--radius-2xl); }
.r-pill { border-radius: var(--radius-pill); }

.elevation-flat     { box-shadow: var(--elevation-flat); }
.elevation-raised   { box-shadow: var(--elevation-raised); }
.elevation-floating { box-shadow: var(--elevation-floating); }
.elevation-modal    { box-shadow: var(--elevation-modal); }
.elevation-orbital  { box-shadow: var(--elevation-orbital); }

/* ── Surfaces ──────────────────────────────────────── */

.liquid-surface {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(220, 225, 240, 0.35) 40%,
    rgba(240, 245, 255, 0.4) 70%,
    rgba(255, 255, 255, 0.5) 100%
  );
  border-top: 1.5px solid rgba(255, 255, 255, 0.9);
  border-left: 1.5px solid rgba(255, 255, 255, 0.7);
  border-right: 1.5px solid rgba(200, 200, 210, 0.3);
  border-bottom: 1.5px solid rgba(200, 200, 210, 0.25);
  box-shadow:
    inset 0 1px 2px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 2px 0 rgba(0, 0, 0, 0.04),
    0 4px 16px -2px rgba(0, 0, 0, 0.10),
    0 12px 40px -8px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  transition: background 0.2s, box-shadow 0.2s;
}

.liquid-surface:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.58) 0%,
    rgba(220, 225, 240, 0.42) 40%,
    rgba(240, 245, 255, 0.48) 70%,
    rgba(255, 255, 255, 0.58) 100%
  );
  box-shadow:
    inset 0 1px 2px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 2px 0 rgba(0, 0, 0, 0.04),
    0 4px 20px -2px rgba(0, 0, 0, 0.12),
    0 16px 48px -8px rgba(0, 0, 0, 0.08);
}

.dark .liquid-surface {
  background: linear-gradient(
    140deg,
    rgba(30, 41, 59, 0.7) 0%,
    rgba(15, 23, 42, 0.6) 45%,
    rgba(20, 30, 50, 0.55) 100%
  );
  border-top: 1.5px solid rgba(255, 255, 255, 0.2);
  border-left: 1.5px solid rgba(255, 255, 255, 0.12);
  border-right: 1.5px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.04);
  box-shadow:
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.12),
    0 12px 40px -12px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
}

.dark .liquid-surface:hover {
  background: linear-gradient(
    140deg,
    rgba(51, 65, 85, 0.7) 0%,
    rgba(30, 41, 59, 0.6) 45%,
    rgba(30, 41, 59, 0.55) 100%
  );
}

/* ── Workflow Node States ─────────────────────────── */
/* These override liquid-surface border/shadow on hover and selection */

.node-card-hover:hover {
  border-color: rgba(99, 102, 241, 0.6) !important;
  box-shadow:
    0 0 0 2px rgb(99, 102, 241),
    inset 0 1px 2px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 2px 0 rgba(0, 0, 0, 0.04),
    0 4px 20px -2px rgba(0, 0, 0, 0.12) !important;
}

.dark .node-card-hover:hover {
  border-color: rgba(99, 102, 241, 0.6) !important;
  box-shadow:
    0 0 0 2px rgb(99, 102, 241),
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.12),
    0 12px 40px -12px rgba(0, 0, 0, 0.5) !important;
}

.node-card-selected {
  border-color: rgba(99, 102, 241, 0.6) !important;
  box-shadow:
    0 0 0 2px rgb(99, 102, 241),
    inset 0 1px 2px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 2px 0 rgba(0, 0, 0, 0.04),
    0 4px 20px -2px rgba(0, 0, 0, 0.12) !important;
}

.dark .node-card-selected {
  border-color: rgba(99, 102, 241, 0.6) !important;
  box-shadow:
    0 0 0 2px rgb(99, 102, 241),
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.12),
    0 12px 40px -12px rgba(0, 0, 0, 0.5) !important;
}

/* Active state with colored glass border — uses --glass-accent CSS variable (R, G, B) */
.liquid-surface-active {
  --glass-accent: 99, 102, 241;
  border-color: rgba(var(--glass-accent), 0.5);
  box-shadow:
    inset 0 0 0 0.5px rgba(var(--glass-accent), 0.4),
    inset 0 1px 2px 0 rgba(255,255,255,0.7),
    inset 0 -1px 2px 0 rgba(0,0,0,0.04),
    0 0 12px -2px rgba(var(--glass-accent), 0.25),
    0 4px 16px -2px rgba(0,0,0,0.10);
}

.dark .liquid-surface-active {
  border-color: rgba(var(--glass-accent), 0.45);
  box-shadow:
    inset 0 0 0 0.5px rgba(var(--glass-accent), 0.35),
    inset 0 1px 2px 0 rgba(255,255,255,0.08),
    inset 0 -1px 2px 0 rgba(0,0,0,0.2),
    0 0 16px -2px rgba(var(--glass-accent), 0.3),
    0 4px 16px -2px rgba(0,0,0,0.3);
}

/* Indigo-accent glass selection helper */
.liquid-glass-indigo {
  --glass-accent: 99, 102, 241;
}

.liquid-surface-strong {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.58) 0%,
    rgba(215, 220, 238, 0.42) 40%,
    rgba(235, 240, 255, 0.48) 70%,
    rgba(255, 255, 255, 0.58) 100%
  );
  border-top: 1.5px solid rgba(255, 255, 255, 0.95);
  border-left: 1.5px solid rgba(255, 255, 255, 0.8);
  border-right: 1.5px solid rgba(190, 190, 205, 0.35);
  border-bottom: 1.5px solid rgba(190, 190, 205, 0.3);
  box-shadow:
    inset 0 1px 2px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 2px 0 rgba(0, 0, 0, 0.05),
    0 6px 20px -2px rgba(0, 0, 0, 0.12),
    0 16px 48px -8px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  transition: background 0.2s, box-shadow 0.2s;
}

.liquid-surface-strong:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.65) 0%,
    rgba(215, 220, 238, 0.50) 40%,
    rgba(235, 240, 255, 0.55) 70%,
    rgba(255, 255, 255, 0.65) 100%
  );
  box-shadow:
    inset 0 1px 2px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 2px 0 rgba(0, 0, 0, 0.05),
    0 6px 24px -2px rgba(0, 0, 0, 0.14),
    0 20px 56px -8px rgba(0, 0, 0, 0.10);
}

.dark .liquid-surface-strong {
  background: linear-gradient(
    140deg,
    rgba(30, 41, 59, 0.78) 0%,
    rgba(15, 23, 42, 0.68) 45%,
    rgba(20, 30, 50, 0.62) 100%
  );
  border-top: 1.5px solid rgba(255, 255, 255, 0.25);
  border-left: 1.5px solid rgba(255, 255, 255, 0.15);
  border-right: 1.5px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.05);
  box-shadow:
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.15),
    0 16px 48px -12px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
}

.dark .liquid-surface-strong:hover {
  background: linear-gradient(
    140deg,
    rgba(51, 65, 85, 0.78) 0%,
    rgba(30, 41, 59, 0.68) 45%,
    rgba(30, 41, 59, 0.62) 100%
  );
}

.liquid-surface-container {
  background: rgb(255 255 255 / 0.55);
  border: 1px solid rgb(255 255 255 / 0.6);
  box-shadow:
    0 25px 50px -12px rgb(0 0 0 / 0.06),
    inset 0 1px 2px 0 rgb(255 255 255 / 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.dark .liquid-surface-container {
  background: linear-gradient(
    140deg,
    rgba(30, 41, 59, 0.5) 0%,
    rgba(15, 23, 42, 0.4) 45%,
    rgba(15, 23, 42, 0.3) 100%
  );
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 18px 40px -26px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.liquid-divider {
  border-color: rgba(148, 163, 184, 0.26);
}

.dark .liquid-divider {
  border-color: rgba(148, 163, 184, 0.24);
}

/* ── Buttons — shared base ─────────────────────────── */

.liquid-button,
.liquid-button-primary {
  background: rgb(255 255 255 / 0.35);
  border: 1px solid rgb(255 255 255 / 0.5);
  box-shadow:
    0 8px 32px -8px rgb(0 0 0 / 0.12),
    inset 0 1px 2px 0 rgb(255 255 255 / 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s ease;
}

.dark .liquid-button,
.dark .liquid-button-primary {
  background: linear-gradient(
    140deg,
    rgba(30, 41, 59, 0.5) 0%,
    rgba(15, 23, 42, 0.4) 45%,
    rgba(15, 23, 42, 0.3) 100%
  );
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 10px 22px -16px rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ── Button — outline (secondary) hover ────────────── */

.liquid-button:hover {
  background: rgb(255 255 255 / 0.5);
  box-shadow:
    0 8px 32px -8px rgb(0 0 0 / 0.16),
    inset 0 1px 2px 0 rgb(255 255 255 / 0.3);
}

.dark .liquid-button:hover {
  background: linear-gradient(
    140deg,
    rgba(51, 65, 85, 0.55) 0%,
    rgba(30, 41, 59, 0.45) 45%,
    rgba(30, 41, 59, 0.35) 100%
  );
}

/* ── Button — primary (blue CTA) hover ─────────────── */

.liquid-button-primary:hover {
  background: rgb(37 99 235 / 0.78);
  border-color: rgb(96 165 250 / 0.5);
  box-shadow:
    0 8px 32px -8px rgb(37 99 235 / 0.4),
    inset 0 1px 2px 0 rgb(255 255 255 / 0.3);
  color: white;
}

.dark .liquid-button-primary:hover {
  background: linear-gradient(
    140deg,
    rgba(59, 130, 246, 0.78) 0%,
    rgba(37, 99, 235, 0.74) 50%,
    rgba(59, 130, 246, 0.68) 100%
  );
  border-color: rgba(147, 197, 253, 0.36);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 14px 30px -16px rgba(59, 130, 246, 0.7);
  color: white;
}


/* ── Button — destructive (red) — same glass base, fills red on hover ── */

.liquid-button-red:hover {
  background: rgb(239 68 68 / 0.78);
  border-color: rgb(252 165 165 / 0.5);
  box-shadow:
    0 8px 32px -8px rgb(239 68 68 / 0.4),
    inset 0 1px 2px 0 rgb(255 255 255 / 0.3);
  color: white;
}

.dark .liquid-button-red:hover {
  background: linear-gradient(
    140deg,
    rgba(248, 113, 113, 0.78) 0%,
    rgba(239, 68, 68, 0.74) 50%,
    rgba(248, 113, 113, 0.68) 100%
  );
  border-color: rgba(252, 165, 165, 0.36);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 14px 30px -16px rgba(248, 113, 113, 0.7);
  color: white;
}

/* ── Button — success (green) — same glass base, fills green on hover ── */

.liquid-button-green:hover {
  background: rgb(34 197 94 / 0.78);
  border-color: rgb(134 239 172 / 0.5);
  box-shadow:
    0 8px 32px -8px rgb(34 197 94 / 0.4),
    inset 0 1px 2px 0 rgb(255 255 255 / 0.3);
  color: white;
}

.dark .liquid-button-green:hover {
  background: linear-gradient(
    140deg,
    rgba(74, 222, 128, 0.78) 0%,
    rgba(34, 197, 94, 0.74) 50%,
    rgba(74, 222, 128, 0.68) 100%
  );
  border-color: rgba(134, 239, 172, 0.36);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 14px 30px -16px rgba(74, 222, 128, 0.7);
  color: white;
}

/* ── Button — gradient (primary CTA, indigo→purple) ─
   Same crystal-illuminated mechanic as the ios-glass-* variants:
   neutral glass at rest, fills with translucent indigo→purple
   gradient on hover + inner highlight + tinted drop shadow. The
   gradient is ONLY visible on hover — at rest the button looks
   identical to ios-glass-blue's neutral state. */

.liquid-button-gradient {
  /* Rest: same neutral glass as .liquid-button (so all CTAs read as
     the same family at rest — gradient is the hover signal). */
  background: rgb(255 255 255 / 0.35);
  border: 1px solid rgb(255 255 255 / 0.5);
  color: rgb(15 23 42); /* slate-900 — visible on glass at rest */
  box-shadow:
    0 8px 32px -8px rgb(0 0 0 / 0.12),
    inset 0 1px 2px 0 rgb(255 255 255 / 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.3s ease, box-shadow 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.liquid-button-gradient:hover {
  /* Hover: gradient fills + inner highlight + violet/indigo glow */
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.85) 0%,    /* indigo-500 */
    rgba(139, 92, 246, 0.85) 50%,   /* violet-500 */
    rgba(168, 85, 247, 0.85) 100%   /* purple-500 */
  );
  border-color: rgba(255, 255, 255, 0.45);
  color: #ffffff;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.6),
    inset 0 -1px 1px rgba(0, 0, 0, 0.12),
    0 12px 32px -8px rgba(99, 102, 241, 0.55),
    0 0 24px -4px rgba(168, 85, 247, 0.35);
  backdrop-filter: blur(12px) saturate(1.6);
  -webkit-backdrop-filter: blur(12px) saturate(1.6);
}

.dark .liquid-button-gradient {
  background: linear-gradient(
    140deg,
    rgba(30, 41, 59, 0.5) 0%,
    rgba(15, 23, 42, 0.4) 45%,
    rgba(15, 23, 42, 0.3) 100%
  );
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 10px 22px -16px rgba(0, 0, 0, 0.75);
}

/* ── Avatar — crystal disc ───────────────────────────
   Reusable shell that turns any avatar (image OR initials) into a
   translucent crystal puck. Same family as .liquid-button-gradient
   at rest — inner highlight on the top edge, tinted drop shadow,
   saturate boost. Interactive avatars (AvatarButton) get a brighter
   hover illuminate, matching the crystal-iluminado pattern. */

.liquid-avatar {
  position: relative;
  overflow: hidden;
  /* Slightly saturated so initials/photo colors look vivid through
     the glass, not muted. */
  filter: saturate(1.1);
  /* OUTER shadow only — the inner highlight lives in `::after` so it
     renders ABOVE the image content (an inset shadow would be hidden
     by an opaque <img>). */
  box-shadow:
    0 4px 14px -3px rgba(15, 23, 42, 0.22),
    0 1px 3px rgba(15, 23, 42, 0.08);
}

/* Specular highlight — soft white sheen across the top-left AND a
   crisp 1px inner-edge highlight, both rendered on top of the
   avatar content (image or initials) so the crystal effect survives
   even when a photo fills the disc. */
.liquid-avatar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    120% 80% at 30% 0%,
    rgba(255, 255, 255, 0.45) 0%,
    rgba(255, 255, 255, 0.12) 30%,
    transparent 60%
  );
  /* Inner edge highlight — drawn via inset box-shadow on the pseudo
     element so it sits over the image content. */
  box-shadow:
    inset 0 1.5px 2px rgba(255, 255, 255, 0.7),
    inset 0 -1px 1.5px rgba(0, 0, 0, 0.08);
  mix-blend-mode: screen;
  transition: opacity 0.25s ease, box-shadow 0.25s ease;
}

.dark .liquid-avatar {
  box-shadow:
    0 6px 18px -4px rgba(0, 0, 0, 0.55),
    0 1px 3px rgba(0, 0, 0, 0.3);
}

.dark .liquid-avatar::after {
  background: radial-gradient(
    120% 80% at 30% 0%,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.06) 30%,
    transparent 60%
  );
  box-shadow:
    inset 0 1.5px 2px rgba(255, 255, 255, 0.28),
    inset 0 -1px 1.5px rgba(0, 0, 0, 0.4);
}

/* Interactive variant — hover illuminates the sheen + adds a soft
   indigo glow, same crystal-iluminado mechanic as the buttons. */
.liquid-avatar-interactive {
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.liquid-avatar-interactive:hover {
  transform: translateY(-1px);
  /* `--avatar-glow` defaults to indigo; tone-styled avatars override
     it inline so each avatar's hover glow matches its own tint. */
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.7),
    inset 0 -1px 1.5px rgba(0, 0, 0, 0.06),
    0 8px 22px -4px var(--avatar-glow, rgba(99, 102, 241, 0.35)),
    0 2px 6px rgba(15, 23, 42, 0.12);
}

.liquid-avatar-interactive:hover::after {
  opacity: 1.4;
}

.dark .liquid-avatar-interactive:hover {
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.32),
    inset 0 -1px 1.5px rgba(0, 0, 0, 0.4),
    0 10px 26px -6px rgba(129, 132, 251, 0.45),
    0 2px 6px rgba(0, 0, 0, 0.4);
}

.dark .liquid-button-gradient:hover {
  background: linear-gradient(
    135deg,
    rgba(129, 132, 251, 0.85) 0%,
    rgba(167, 132, 246, 0.85) 50%,
    rgba(196, 125, 247, 0.85) 100%
  );
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.35),
    0 14px 36px -10px rgba(129, 132, 251, 0.65),
    0 0 28px -4px rgba(196, 125, 247, 0.45);
}

/* ── Filter pills — colored glassmorphism ──────────── */

.liquid-pill {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  border-radius: 9999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  cursor: pointer;
}

.liquid-pill-blue {
  background: rgb(59 130 246 / 0.15);
  border: 1px solid rgb(96 165 250 / 0.3);
  color: rgb(29 78 216);
}
.liquid-pill-blue:hover { background: rgb(59 130 246 / 0.25); }
.dark .liquid-pill-blue {
  background: rgb(59 130 246 / 0.2);
  border-color: rgb(96 165 250 / 0.2);
  color: rgb(147 197 253);
}
.dark .liquid-pill-blue:hover { background: rgb(59 130 246 / 0.3); }

.liquid-pill-emerald {
  background: rgb(16 185 129 / 0.15);
  border: 1px solid rgb(52 211 153 / 0.3);
  color: rgb(4 120 87);
}
.liquid-pill-emerald:hover { background: rgb(16 185 129 / 0.25); }
.dark .liquid-pill-emerald {
  background: rgb(16 185 129 / 0.2);
  border-color: rgb(52 211 153 / 0.2);
  color: rgb(110 231 183);
}
.dark .liquid-pill-emerald:hover { background: rgb(16 185 129 / 0.3); }

.liquid-pill-orange {
  background: rgb(249 115 22 / 0.15);
  border: 1px solid rgb(251 146 60 / 0.3);
  color: rgb(194 65 12);
}
.liquid-pill-orange:hover { background: rgb(249 115 22 / 0.25); }
.dark .liquid-pill-orange {
  background: rgb(249 115 22 / 0.2);
  border-color: rgb(251 146 60 / 0.2);
  color: rgb(253 186 116);
}
.dark .liquid-pill-orange:hover { background: rgb(249 115 22 / 0.3); }

.liquid-pill-purple {
  background: rgb(168 85 247 / 0.15);
  border: 1px solid rgb(192 132 252 / 0.3);
  color: rgb(107 33 168);
}
.liquid-pill-purple:hover { background: rgb(168 85 247 / 0.25); }
.dark .liquid-pill-purple {
  background: rgb(168 85 247 / 0.2);
  border-color: rgb(192 132 252 / 0.2);
  color: rgb(216 180 254);
}
.dark .liquid-pill-purple:hover { background: rgb(168 85 247 / 0.3); }

.liquid-pill-violet {
  background: rgb(139 92 246 / 0.15);
  border: 1px solid rgb(167 139 250 / 0.3);
  color: rgb(91 33 182);
}
.liquid-pill-violet:hover { background: rgb(139 92 246 / 0.25); }
.dark .liquid-pill-violet {
  background: rgb(139 92 246 / 0.2);
  border-color: rgb(167 139 250 / 0.2);
  color: rgb(196 181 253);
}
.dark .liquid-pill-violet:hover { background: rgb(139 92 246 / 0.3); }

.liquid-pill-amber {
  background: rgb(245 158 11 / 0.15);
  border: 1px solid rgb(252 211 77 / 0.3);
  color: rgb(146 64 14);
}
.liquid-pill-amber:hover { background: rgb(245 158 11 / 0.25); }
.dark .liquid-pill-amber {
  background: rgb(245 158 11 / 0.2);
  border-color: rgb(252 211 77 / 0.2);
  color: rgb(252 211 77);
}
.dark .liquid-pill-amber:hover { background: rgb(245 158 11 / 0.3); }

.liquid-pill-red { background: rgb(239 68 68 / 0.15); border: 1px solid rgb(252 165 165 / 0.3); color: rgb(153 27 27); }
.liquid-pill-red:hover { background: rgb(239 68 68 / 0.25); }
.dark .liquid-pill-red { background: rgb(239 68 68 / 0.2); border-color: rgb(252 165 165 / 0.2); color: rgb(252 165 165); }
.dark .liquid-pill-red:hover { background: rgb(239 68 68 / 0.3); }

.liquid-pill-indigo { background: rgb(99 102 241 / 0.15); border: 1px solid rgb(165 180 252 / 0.3); color: rgb(55 48 163); }
.liquid-pill-indigo:hover { background: rgb(99 102 241 / 0.25); }
.dark .liquid-pill-indigo { background: rgb(99 102 241 / 0.2); border-color: rgb(165 180 252 / 0.2); color: rgb(165 180 252); }
.dark .liquid-pill-indigo:hover { background: rgb(99 102 241 / 0.3); }

.liquid-pill-cyan { background: rgb(6 182 212 / 0.15); border: 1px solid rgb(103 232 249 / 0.3); color: rgb(21 94 117); }
.liquid-pill-cyan:hover { background: rgb(6 182 212 / 0.25); }
.dark .liquid-pill-cyan { background: rgb(6 182 212 / 0.2); border-color: rgb(103 232 249 / 0.2); color: rgb(103 232 249); }
.dark .liquid-pill-cyan:hover { background: rgb(6 182 212 / 0.3); }

.liquid-pill-teal { background: rgb(20 184 166 / 0.15); border: 1px solid rgb(94 234 212 / 0.3); color: rgb(17 94 89); }
.liquid-pill-teal:hover { background: rgb(20 184 166 / 0.25); }
.dark .liquid-pill-teal { background: rgb(20 184 166 / 0.2); border-color: rgb(94 234 212 / 0.2); color: rgb(94 234 212); }
.dark .liquid-pill-teal:hover { background: rgb(20 184 166 / 0.3); }

.liquid-pill-pink { background: rgb(236 72 153 / 0.15); border: 1px solid rgb(249 168 212 / 0.3); color: rgb(157 23 77); }
.liquid-pill-pink:hover { background: rgb(236 72 153 / 0.25); }
.dark .liquid-pill-pink { background: rgb(236 72 153 / 0.2); border-color: rgb(249 168 212 / 0.2); color: rgb(249 168 212); }
.dark .liquid-pill-pink:hover { background: rgb(236 72 153 / 0.3); }

.liquid-pill-rose { background: rgb(244 63 94 / 0.15); border: 1px solid rgb(253 164 175 / 0.3); color: rgb(159 18 57); }
.liquid-pill-rose:hover { background: rgb(244 63 94 / 0.25); }
.dark .liquid-pill-rose { background: rgb(244 63 94 / 0.2); border-color: rgb(253 164 175 / 0.2); color: rgb(253 164 175); }
.dark .liquid-pill-rose:hover { background: rgb(244 63 94 / 0.3); }

.liquid-pill-green { background: rgb(34 197 94 / 0.15); border: 1px solid rgb(134 239 172 / 0.3); color: rgb(21 128 61); }
.liquid-pill-green:hover { background: rgb(34 197 94 / 0.25); }
.dark .liquid-pill-green { background: rgb(34 197 94 / 0.2); border-color: rgb(134 239 172 / 0.2); color: rgb(134 239 172); }
.dark .liquid-pill-green:hover { background: rgb(34 197 94 / 0.3); }

.liquid-pill-yellow { background: rgb(234 179 8 / 0.15); border: 1px solid rgb(253 224 71 / 0.3); color: rgb(133 77 14); }
.liquid-pill-yellow:hover { background: rgb(234 179 8 / 0.25); }
.dark .liquid-pill-yellow { background: rgb(234 179 8 / 0.2); border-color: rgb(253 224 71 / 0.2); color: rgb(253 224 71); }
.dark .liquid-pill-yellow:hover { background: rgb(234 179 8 / 0.3); }

.liquid-pill-slate { background: rgb(100 116 139 / 0.15); border: 1px solid rgb(148 163 184 / 0.3); color: rgb(51 65 85); }
.liquid-pill-slate:hover { background: rgb(100 116 139 / 0.25); }
.dark .liquid-pill-slate { background: rgb(100 116 139 / 0.2); border-color: rgb(148 163 184 / 0.2); color: rgb(148 163 184); }
.dark .liquid-pill-slate:hover { background: rgb(100 116 139 / 0.3); }

.liquid-pill-gray { background: rgb(107 114 128 / 0.15); border: 1px solid rgb(156 163 175 / 0.3); color: rgb(55 65 81); }
.liquid-pill-gray:hover { background: rgb(107 114 128 / 0.25); }
.dark .liquid-pill-gray { background: rgb(107 114 128 / 0.2); border-color: rgb(156 163 175 / 0.2); color: rgb(156 163 175); }
.dark .liquid-pill-gray:hover { background: rgb(107 114 128 / 0.3); }

.liquid-pill-sky { background: rgb(14 165 233 / 0.15); border: 1px solid rgb(125 211 252 / 0.3); color: rgb(3 105 161); }
.liquid-pill-sky:hover { background: rgb(14 165 233 / 0.25); }
.dark .liquid-pill-sky { background: rgb(14 165 233 / 0.2); border-color: rgb(125 211 252 / 0.2); color: rgb(125 211 252); }
.dark .liquid-pill-sky:hover { background: rgb(14 165 233 / 0.3); }

.liquid-pill-fuchsia { background: rgb(217 70 239 / 0.15); border: 1px solid rgb(232 121 249 / 0.3); color: rgb(134 25 143); }
.liquid-pill-fuchsia:hover { background: rgb(217 70 239 / 0.25); }
.dark .liquid-pill-fuchsia { background: rgb(217 70 239 / 0.2); border-color: rgb(232 121 249 / 0.2); color: rgb(232 121 249); }
.dark .liquid-pill-fuchsia:hover { background: rgb(217 70 239 / 0.3); }

/* Dismiss icon inside pill — inherits pill color at reduced opacity */
.liquid-pill-dismiss {
  width: 12px;
  height: 12px;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}
.liquid-pill:hover .liquid-pill-dismiss { opacity: 0.8; }

/* ── Focus ring utilities ────────────────────────────
   Canonical focus indicator for the design system.

   Use `.focus-ring` on any interactive element — it ships the
   indigo 2px outline at /70 opacity with a 1px offset, matching
   the WCAG 1.4.11 (≥ 3:1 non-text contrast) + 2.4.7 (visible
   focus) floor documented in DESIGN_SYSTEM.md.

   The legacy `.focus-ring-{color}` classes remain for cases where
   a component owns its own accent color (e.g. emerald confirm
   buttons), but new code should default to `.focus-ring`.
   ───────────────────────────────────────────────────── */

.focus-ring:focus { outline: none; }
.focus-ring:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--color-indigo-500) 70%, transparent);
  outline-offset: 1px;
}

.focus-ring-blue:focus { outline: none; }
.focus-ring-blue:focus-visible {
  outline: 2px solid var(--color-blue-500);
  outline-offset: 2px;
}

.focus-ring-indigo:focus { outline: none; }
.focus-ring-indigo:focus-visible {
  outline: 2px solid var(--color-indigo-500);
  outline-offset: 2px;
}

.focus-ring-emerald:focus { outline: none; }
.focus-ring-emerald:focus-visible {
  outline: 2px solid var(--color-emerald-500);
  outline-offset: 2px;
}

.focus-ring-purple:focus { outline: none; }
.focus-ring-purple:focus-visible {
  outline: 2px solid var(--color-purple-500);
  outline-offset: 2px;
}

.focus-ring-amber:focus { outline: none; }
.focus-ring-amber:focus-visible {
  outline: 2px solid var(--color-amber-500);
  outline-offset: 2px;
}

/* ── iOS checkbox ────────────────────────────────────
   Shared bare-checkbox styling (indigo accent, glass border).
   Use with Tailwind size overrides: `ios-checkbox h-4 w-4`.
   ───────────────────────────────────────────────────── */

.ios-checkbox {
  border-radius: 0.25rem;
  border-color: rgba(255, 255, 255, 0.6);
  background-color: rgba(255, 255, 255, 0.4);
  color: var(--color-indigo-600);
}

.ios-checkbox:focus { outline: none; }
.ios-checkbox:focus-visible {
  outline: 2px solid var(--color-indigo-500);
  outline-offset: 2px;
}

.ios-checkbox:disabled {
  opacity: 0.5;
}

:is(.dark) .ios-checkbox {
  border-color: rgba(255, 255, 255, 0.1);
  background-color: rgba(255, 255, 255, 0.06);
}

:is(.dark) .ios-checkbox:checked {
  background-color: var(--color-indigo-500);
}

/* ── Custom scrollbar ──────────────────────────────── */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-gray-100);
}

.dark ::-webkit-scrollbar-track {
  background: var(--color-gray-800);
}

::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb {
  background: var(--color-gray-600);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-400);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-500);
}
