/* =========================================================================
   Inventory Catalog — design system
   Clean, minimal, professional. Light + dark. Token-driven.
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Space Grotesk', var(--font-sans);
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  --sidebar-w: 264px;
  --content-max: 1180px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Hue table for badges / thumbnails (data-hue 0..7). */
  --dur: 0.2s;
}

:root,
[data-theme='light'] {
  color-scheme: light;
  --bg: #f6f7f9;
  --bg-grad-1: #eef1f6;
  --bg-grad-2: #f8f9fb;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --surface-hover: #f3f4f8;
  --border: rgba(17, 24, 39, 0.09);
  --border-strong: rgba(17, 24, 39, 0.16);
  --text: #0f1729;
  --text-2: #51596a;
  --text-3: #64748b; /* WCAG AA: ~4.5:1 on white/app surfaces */
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-weak: rgba(79, 70, 229, 0.1);
  --accent-text: #4338ca;
  --primary: #111726;
  --primary-hover: #232c40;
  --primary-text: #ffffff;
  --danger: #dc2626;
  --danger-text: #dc2626;
  --danger-weak: rgba(220, 38, 38, 0.1);
  --success: #16a34a;
  --ring: rgba(79, 70, 229, 0.4);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 14px -2px rgba(16, 24, 40, 0.1);
  --shadow-lg: 0 16px 40px -12px rgba(16, 24, 40, 0.2);
  --shadow-xl: 0 28px 70px -18px rgba(16, 24, 40, 0.3);
  --skeleton-1: rgba(17, 24, 39, 0.06);
  --skeleton-2: rgba(17, 24, 39, 0.12);
  --scrim: rgba(15, 23, 42, 0.45);
}

[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0a0c11;
  --bg-grad-1: #0e1118;
  --bg-grad-2: #0a0c11;
  --surface: #14181f;
  --surface-2: #181d26;
  --surface-hover: #1e242f;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e9edf4;
  --text-2: #a6afbf;
  --text-3: #6b7587;
  --accent: #818cf8;
  --accent-2: #a5b4fc;
  --accent-weak: rgba(129, 140, 248, 0.15);
  --accent-text: #c7d2fe;
  --primary: #f3f4f6;
  --primary-hover: #ffffff;
  --primary-text: #0a0c11;
  --danger: #f87171;
  --danger-text: #fca5a5;
  --danger-weak: rgba(248, 113, 113, 0.14);
  --success: #4ade80;
  --ring: rgba(129, 140, 248, 0.55);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px -4px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 48px -16px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 32px 80px -20px rgba(0, 0, 0, 0.7);
  --skeleton-1: rgba(255, 255, 255, 0.05);
  --skeleton-2: rgba(255, 255, 255, 0.1);
  --scrim: rgba(0, 0, 0, 0.6);
}

[data-hue='0'] { --bh: 244; }
[data-hue='1'] { --bh: 158; }
[data-hue='2'] { --bh: 22; }
[data-hue='3'] { --bh: 338; }
[data-hue='4'] { --bh: 199; }
[data-hue='5'] { --bh: 272; }
[data-hue='6'] { --bh: 45; }
[data-hue='7'] { --bh: 214; }

/* ---------- Reset / base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html { -webkit-text-size-adjust: 100%; font-size: 16px; }
/* Accessibility: user-adjustable text size (drives all rem-based sizing). */
html[data-text-size='lg'] { font-size: 18px; }
html[data-text-size='xl'] { font-size: 20px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01';
}

#root { min-height: 100dvh; }

a { color: inherit; text-decoration: none; }

button { font: inherit; color: inherit; cursor: pointer; }

img { display: block; max-width: 100%; }

input, textarea, select, button { font-family: inherit; }

h1, h2, h3, h4 { line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; }

::selection { background: var(--accent-weak); color: var(--accent-text); }

/* Focus ring hugs each element's own border-radius (no forced 4px snap).
   outline-offset eases in for a soft, non-jarring appearance. */
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
  transition: outline-offset 0.15s var(--ease-out);
}
/* Soft companion ring on rounded interactive surfaces so focus reads as a
   smooth double border that follows the corner radius. */
.collection-card:focus-visible,
.btn:focus-visible,
.icon-btn:focus-visible {
  box-shadow: 0 0 0 4px var(--accent-weak);
}
.collection-card:hover:focus-visible {
  box-shadow: var(--shadow-lg), 0 0 0 4px var(--accent-weak);
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 2000;
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: 12px; }

.is-num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* ---------- App shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100dvh;
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
}

.app-shell__sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.app-shell__drawer {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(82vw, var(--sidebar-w));
  z-index: 1200;
  background: var(--surface);
  box-shadow: var(--shadow-xl);
}
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: var(--scrim);
  backdrop-filter: blur(2px);
}

.app-shell__main { display: flex; flex-direction: column; min-width: 0; }

.app-shell__content {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-8) var(--sp-12);
}
@media (max-width: 700px) {
  .app-shell__content { padding: var(--sp-5) var(--sp-4) var(--sp-10); }
}

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--sp-5) var(--sp-3);
  gap: var(--sp-2);
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px var(--sp-4);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.sidebar__section { display: flex; flex-direction: column; gap: 2px; }
.sidebar__heading {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding: var(--sp-4) 12px var(--sp-2);
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 0.92rem;
  transition: color var(--dur), background var(--dur);
  isolation: isolate;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.is-active { color: var(--text); font-weight: 600; }
.nav-item__active {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--accent-weak);
  border-radius: 10px;
}
.nav-item__icon { color: var(--accent); flex-shrink: 0; }
.nav-item:not(.is-active) .nav-item__icon { color: var(--text-3); }
.nav-item__label { flex: 1; }
.nav-item__count {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  background: var(--surface-hover);
  padding: 1px 8px;
  border-radius: var(--r-pill);
}
.sidebar__foot {
  margin-top: auto;
  padding: var(--sp-4) 12px var(--sp-2);
  font-size: 0.78rem;
  color: var(--text-3);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 12px var(--sp-8);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
@media (max-width: 700px) { .topbar { padding: 10px var(--sp-4); } }
.topbar__spacer { flex: 1; }
.topbar__menu { display: none; }
@media (max-width: 900px) { .topbar__menu { display: inline-grid; } }
.admin-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent-weak);
  padding: 5px 11px;
  border-radius: var(--r-pill);
}
.btn__text { white-space: nowrap; }
@media (max-width: 480px) { .btn__text { display: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.12s var(--ease-out), background var(--dur), border-color var(--dur),
    box-shadow var(--dur), color var(--dur);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn--primary {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); box-shadow: var(--shadow-md); }

.btn--soft {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.btn--soft:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--border-strong); }

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

.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover:not(:disabled) { filter: brightness(0.94); }

.btn--danger-ghost { background: transparent; color: var(--danger-text); margin-right: auto; }
.btn--danger-ghost:hover:not(:disabled) { background: var(--danger-weak); }

.btn--icon-text { padding: 0 11px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-2);
  transition: background var(--dur), color var(--dur), transform 0.12s var(--ease-out);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn--sm { width: 36px; height: 36px; border-radius: var(--r-sm); }
.icon-btn--danger:hover { background: var(--danger-weak); color: var(--danger-text); }

/* ---------- Page / Home ---------- */
.page { animation: page-in 0.4s var(--ease-out); }
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.home__hero {
  padding: var(--sp-8) 0 var(--sp-10);
  text-align: center;
}
.demo-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent-weak);
  padding: 6px 13px;
  border-radius: var(--r-pill);
  margin-bottom: var(--sp-5);
}
.home__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, var(--text), color-mix(in srgb, var(--text) 65%, var(--text-3)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.home__subtitle {
  margin-top: var(--sp-3);
  font-size: 1.1rem;
  color: var(--text-2);
}

.home__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-5);
}
.collection-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  height: 100%;
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out),
    border-color 0.2s var(--ease-out);
  position: relative;
  overflow: hidden;
}
.collection-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity 0.25s var(--ease-out);
}
.collection-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.collection-card:hover::before { opacity: 1; }
.collection-card__top { display: flex; align-items: flex-start; justify-content: space-between; }
.collection-card__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--accent-weak);
  color: var(--accent);
}
.collection-card[data-accent='emerald'] .collection-card__icon { background: hsl(158 60% 50% / 0.14); color: hsl(158 64% 38%); }
[data-theme='dark'] .collection-card[data-accent='emerald'] .collection-card__icon { color: hsl(158 60% 60%); }
.collection-card__count {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-display);
  line-height: 1;
}
.collection-card__count small { font-size: 0.7rem; font-weight: 500; color: var(--text-3); margin-top: 3px; }
.collection-card__title { font-size: 1.2rem; }
.collection-card__desc { color: var(--text-2); font-size: 0.92rem; flex: 1; }
.collection-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-text);
}
.collection-card:hover .collection-card__cta svg { transform: translateX(3px); }
.collection-card__cta svg { transition: transform 0.2s var(--ease-out); }

/* ---------- Collection header ---------- */
.collection__head { margin-bottom: var(--sp-6); }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-3);
  margin-bottom: var(--sp-4);
}
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--accent-text); }
.collection__title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.collection__title { font-size: clamp(1.6rem, 3.5vw, 2.1rem); }
.collection__desc { color: var(--text-2); margin-top: 4px; max-width: 60ch; }
.collection__count {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}
.collection__count strong { font-size: 1.5rem; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.collection__count span { font-size: 0.85rem; color: var(--text-3); }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.toolbar__controls { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }

.searchbar {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 240px;
  height: 44px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur), box-shadow var(--dur);
}
.searchbar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-weak);
}
.searchbar__icon { color: var(--text-3); flex-shrink: 0; }
.searchbar__input {
  flex: 1;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  padding: 0 10px;
  outline: none;
}
.searchbar__input::placeholder { color: var(--text-3); }
.searchbar__input::-webkit-search-cancel-button { display: none; }
.searchbar__clear {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--surface-hover);
  color: var(--text-2);
}
.searchbar__clear:hover { color: var(--text); }
.searchbar__kbd {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 7px;
  background: var(--surface-2);
}
.searchbar__count {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  margin-left: 8px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

/* Sort + view + dropdown */
.sort-control { display: inline-flex; gap: 6px; }
.sort-control__label { font-weight: 500; }

.dropdown { position: relative; }
.dropdown__menu {
  position: absolute;
  top: calc(100% + 8px);
  min-width: 190px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 200;
}
.dropdown__menu--start { left: 0; }
.dropdown__menu--end { right: 0; }
.menu-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  color: var(--text-2);
  text-align: left;
}
.menu-item:hover { background: var(--surface-hover); color: var(--text); }
.menu-item.is-active { color: var(--accent-text); font-weight: 600; }
.menu-item svg { color: var(--accent); }

.view-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  border-radius: var(--r-md);
}
.view-toggle__btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 32px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  transition: background 0.18s var(--ease-out), color 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}
.view-toggle__btn:hover:not(.is-active) { color: var(--text); background: var(--surface-hover); }
.view-toggle__btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--border) 90%, transparent), 0 1px 2px rgba(16, 24, 40, 0.08);
}

/* ---------- Filter chips ---------- */
.filter-chips {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.filter-chips__label { font-size: 0.8rem; font-weight: 600; color: var(--text-3); }
.filter-chips__list { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.84rem;
  font-weight: 500;
  transition: border-color var(--dur), color var(--dur), background var(--dur);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip--active { color: var(--accent-text); border-color: var(--accent); background: var(--accent-weak); font-weight: 600; }
.chip__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.chip--clear { color: var(--text-3); }
.chip--clear:hover { color: var(--danger-text); border-color: var(--danger); }
.chip--more { color: var(--accent-text); font-weight: 600; border-style: dashed; }
.chip--more:hover { background: var(--accent-weak); border-color: var(--accent); }

/* ---------- Card grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-4);
}
@media (max-width: 480px) { .card-grid { grid-template-columns: 1fr; } }

/* ---------- list view (one item per line) ---------- */
.record-list { display: flex; flex-direction: column; gap: 12px; }
.record-row {
  position: relative;
  display: flex; align-items: stretch;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.record-row:hover { box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 30%, var(--border-strong)); transform: translateY(-2px); }
.record-row__main {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 18px;
  background: none; border: none; cursor: pointer; text-align: left; font: inherit; color: inherit;
  border-radius: var(--r-lg);
}
.record-row__main:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.record-row__title-wrap { flex: 0 0 auto; width: 290px; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.record-row__title {
  margin: 0; font-family: var(--font-display); font-size: 1.02rem; font-weight: 650; line-height: 1.25; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.record-row__fields { flex: 1; min-width: 0; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 32px; }
.record-row__field { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.record-row__field dt { font-size: 0.68rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; }
.record-row__field dd { margin: 0; font-size: 0.92rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-row__actions { display: flex; align-items: center; gap: 6px; padding-right: 14px; opacity: 0; transition: opacity var(--dur) var(--ease-out); }
.record-row:hover .record-row__actions, .record-row:focus-within .record-row__actions { opacity: 1; }
@media (max-width: 760px) {
  .record-row__main { flex-wrap: wrap; gap: 12px 16px; }
  .record-row__title-wrap { width: auto; flex: 1 1 60%; }
  .record-row__fields { flex: 1 1 100%; gap: 8px 22px; }
  .record-row__actions { opacity: 1; }
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.22s var(--ease-out), border-color 0.22s var(--ease-out),
    transform 0.22s var(--ease-out);
  overflow: hidden;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border-strong));
}
.card__main {
  display: flex;
  gap: var(--sp-4);
  width: 100%;
  padding: var(--sp-4);
  text-align: left;
  background: transparent;
}
.card__content { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.card__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card__title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__meta { display: flex; flex-direction: column; gap: 5px; }
.card__meta-item {
  display: grid;
  grid-template-columns: minmax(72px, 38%) 1fr;
  gap: 10px;
  font-size: 0.84rem;
}
.card__meta-item dt { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__meta-item dd { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(4px);
  border-radius: var(--r-sm);
  padding: 2px;
}
.card:hover .card__actions,
.card:focus-within .card__actions { opacity: 1; transform: none; }

/* ---------- Thumbnail ---------- */
.thumb {
  position: relative;
  flex-shrink: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  background: linear-gradient(140deg,
    hsl(var(--bh, 244) 70% 92%),
    hsl(calc(var(--bh, 244) + 30) 75% 86%));
}
[data-theme='dark'] .thumb {
  background: linear-gradient(140deg,
    hsl(var(--bh, 244) 40% 28%),
    hsl(calc(var(--bh, 244) + 30) 45% 22%));
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb--sm { width: 40px; height: 40px; border-radius: var(--r-sm); }
.thumb--md { width: 72px; height: 72px; }
.thumb--lg { width: 104px; height: 104px; border-radius: var(--r-lg); }
.thumb__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 1rem;
  color: hsl(var(--bh, 244) 55% 38%);
}
[data-theme='dark'] .thumb__fallback { color: hsl(var(--bh, 244) 70% 80%); }
.thumb--lg .thumb__fallback { font-size: 1.6rem; }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: hsl(var(--bh, 244) 85% 95%);
  color: hsl(var(--bh, 244) 48% 32%);
}
[data-theme='dark'] .badge {
  background: hsl(var(--bh, 244) 50% 50% / 0.18);
  color: hsl(var(--bh, 244) 70% 78%);
}
.badge--subtle { font-size: 0.72rem; padding: 2px 9px; }
.badge--empty { background: transparent; color: var(--text-3); font-weight: 500; }

/* ---------- Data table ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  z-index: 1;
}
.data-table th.is-num, .data-table td.is-num { text-align: right; font-variant-numeric: tabular-nums; }
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
}
.data-table th:not(.is-num) .th-sort { justify-content: flex-start; }
.data-table th.is-num .th-sort { justify-content: flex-end; }
.data-table th > span { padding: 12px 16px; display: inline-block; }
.th-sort__icon { color: var(--text-3); display: inline-flex; opacity: 0.5; }
.th-sort:hover .th-sort__icon { opacity: 1; }
.data-table th.is-sorted { color: var(--text); }
.data-table th.is-sorted .th-sort__icon { color: var(--accent); opacity: 1; }
.data-table tbody td { padding: 11px 16px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-row { cursor: pointer; transition: background 0.12s; }
.data-row:hover { background: var(--surface-hover); }
.cell-title { font-weight: 600; }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }
.row-actions { display: inline-flex; gap: 2px; opacity: 0.4; transition: opacity var(--dur); }
.data-row:hover .row-actions { opacity: 1; }
.cell-link { color: var(--accent-text); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.cell-link:hover { text-decoration: underline; }
.bool-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: 0.76rem;
  font-weight: 600;
}
.bool-pill--yes { background: hsl(152 60% 50% / 0.15); color: hsl(152 55% 32%); }
.bool-pill--no { background: var(--surface-hover); color: var(--text-3); }
[data-theme='dark'] .bool-pill--yes { color: hsl(152 60% 62%); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  background: var(--scrim);
  backdrop-filter: blur(4px);
  overflow-y: auto;
}
.modal {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  max-height: calc(100dvh - 2 * var(--sp-4));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal--sm { max-width: 420px; }
.modal--md { max-width: 560px; }
.modal--lg { max-width: 720px; }
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
}
.modal__title { font-size: 1.15rem; }
.modal__body { padding: var(--sp-6); overflow-y: auto; }
.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.confirm-message { color: var(--text-2); }

/* ---------- Detail view ---------- */
.detail { display: flex; flex-direction: column; gap: var(--sp-6); }
.detail__hero { display: flex; align-items: center; gap: var(--sp-4); }
.detail__heading { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.detail__title { font-size: 1.4rem; }
.detail__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
@media (max-width: 560px) { .detail__grid { grid-template-columns: 1fr; } }
.detail__row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 16px;
  background: var(--surface-2);
}
.detail__row--wide { grid-column: 1 / -1; }
.detail__row dt { font-size: 0.76rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.detail__row dd { font-size: 0.95rem; color: var(--text); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: var(--sp-4); }
.form--grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
}
@media (max-width: 560px) { .form--grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--wide, .form__image-row { grid-column: 1 / -1; }
.field--grow { flex: 1; }
.field--inline { justify-content: center; }
.field__label { font-size: 0.84rem; font-weight: 600; color: var(--text-2); }
.field__req { color: var(--danger-text); }
.input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-weak); }
.input--error { border-color: var(--danger); }
.textarea { height: auto; padding: 11px 13px; resize: vertical; min-height: 72px; line-height: 1.5; }
.field__error { display: flex; align-items: center; gap: 5px; font-size: 0.8rem; color: var(--danger-text); }
.form__actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: var(--sp-3); margin-top: var(--sp-2); }
.form-error { display: flex; align-items: center; gap: 6px; color: var(--danger-text); font-size: 0.86rem; }
.form__image-row { display: flex; gap: var(--sp-4); align-items: flex-start; }

.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .input { padding-right: 60px; }
.input-affix__btn {
  position: absolute;
  right: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-hover);
}
.auth-demo-note {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: var(--sp-4);
  background: var(--accent-weak);
  border-radius: var(--r-md);
  font-size: 0.86rem;
  color: var(--text-2);
}
.auth-demo-note svg { color: var(--accent); flex-shrink: 0; margin-top: 2px; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: var(--r-pill);
  background: var(--border-strong);
  transition: background var(--dur);
}
.switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease-out);
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 4px var(--accent-weak); }
.switch__label { font-size: 0.9rem; font-weight: 500; }

/* ---------- Empty / error states ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-3);
  padding: var(--sp-12) var(--sp-4);
}
.empty-state__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: var(--r-lg);
  background: var(--surface-hover);
  color: var(--text-3);
  margin-bottom: var(--sp-2);
}
.empty-state__icon--error { background: var(--danger-weak); color: var(--danger-text); }
.empty-state__title { font-size: 1.15rem; }
.empty-state__message { color: var(--text-2); max-width: 40ch; }
.empty-state .btn { margin-top: var(--sp-3); }

/* ---------- Toasts ---------- */
.toast-region {
  position: fixed;
  bottom: var(--sp-5);
  right: var(--sp-5);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-width: min(92vw, 380px);
}
@media (max-width: 560px) { .toast-region { left: var(--sp-4); right: var(--sp-4); bottom: var(--sp-4); max-width: none; } }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 500;
}
.toast__icon { flex-shrink: 0; }
.toast--success .toast__icon { color: var(--success); }
.toast--error .toast__icon { color: var(--danger-text); }
.toast--info .toast__icon { color: var(--accent); }
.toast span { flex: 1; }
.toast__close {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  color: var(--text-3);
}
.toast__close:hover { background: var(--surface-hover); color: var(--text); }

/* ---------- Skeletons ---------- */
.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--skeleton-1) 25%, var(--skeleton-2) 37%, var(--skeleton-1) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.card--skeleton { display: flex; gap: var(--sp-4); padding: var(--sp-4); }
.skeleton--thumb { width: 72px; height: 72px; border-radius: var(--r-md); flex-shrink: 0; }
.card-skeleton__body { flex: 1; display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.skeleton--line { height: 12px; }
.skeleton--chip { height: 20px; width: 80px; border-radius: var(--r-pill); }
.table-skeleton { padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: var(--sp-4); }
.table-skeleton__row { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--sp-4); }

/* ---------- Standalone entrance animations ----------
   (The Vite build animates these with framer-motion instead.) */
.modal-backdrop { animation: backdrop-in 0.18s ease both; }
.modal { animation: modal-in 0.28s var(--ease-out) both; }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
.toast { animation: toast-in 0.24s var(--ease-out) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: none; } }
.app-shell__drawer { animation: drawer-in 0.3s var(--ease-out) both; }
.drawer-scrim { animation: backdrop-in 0.2s ease both; }
@keyframes drawer-in { from { transform: translateX(-100%); } to { transform: none; } }

/* ---------- Home hero glow ---------- */
.home__hero { position: relative; }
.home__hero::before {
  content: '';
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 560px;
  max-width: 92vw;
  height: 320px;
  background: radial-gradient(circle at center, var(--accent-weak), transparent 70%);
  filter: blur(24px);
  opacity: 0.85;
  z-index: -1;
  pointer-events: none;
}

/* ---------- Content pages ---------- */
.content-page { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--sp-10); padding-top: var(--sp-2); }
.cp-hero { text-align: center; padding: var(--sp-8) 0 var(--sp-2); position: relative; }
.cp-hero::before {
  content: ''; position: absolute; inset: -20px 0 auto 50%; transform: translateX(-50%);
  width: 460px; max-width: 90vw; height: 240px;
  background: radial-gradient(circle at center, var(--accent-weak), transparent 70%);
  filter: blur(22px); z-index: -1; opacity: 0.8; pointer-events: none;
}
.cp-eyebrow { display: inline-block; font-size: 0.76rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-text); background: var(--accent-weak); padding: 5px 13px; border-radius: var(--r-pill); margin-bottom: var(--sp-4); }
.cp-hero__title { font-family: var(--font-display); font-size: clamp(2.2rem, 6vw, 3.4rem); letter-spacing: -0.03em; }
.cp-hero__subtitle { margin: var(--sp-3) auto 0; font-size: 1.15rem; color: var(--text-2); max-width: 48ch; }
.cp-heading { font-size: 1.4rem; margin-bottom: var(--sp-4); letter-spacing: -0.02em; }
.cp-prose p { color: var(--text-2); font-size: 1.05rem; line-height: 1.75; margin-bottom: var(--sp-4); }
.cp-prose p:last-child { margin-bottom: 0; }
.cp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-3); }
.cp-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-5); text-align: center; box-shadow: var(--shadow-sm); }
.cp-stat__value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; }
.cp-stat__label { color: var(--text-3); font-size: 0.85rem; margin-top: 4px; }
.cp-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.cp-list li { display: flex; gap: 11px; align-items: flex-start; color: var(--text); font-size: 1.02rem; }
.cp-list li svg { color: var(--accent); flex-shrink: 0; margin-top: 3px; }
.cp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-4); }
.cp-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--shadow-sm); }
.cp-card__icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--accent-weak); color: var(--accent); margin-bottom: var(--sp-3); }
.cp-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.cp-card p { color: var(--text-2); font-size: 0.92rem; }
.cp-contact { display: flex; flex-direction: column; gap: var(--sp-2); }
.cp-contact__item { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: 14px var(--sp-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); transition: border-color 0.2s var(--ease-out), transform 0.2s var(--ease-out); }
.cp-contact__item:hover { border-color: var(--accent); transform: translateY(-1px); }
.cp-contact__label { color: var(--text-3); font-weight: 600; font-size: 0.85rem; }
.cp-contact__value { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--accent-text); }
.cp-contact__item:hover .cp-contact__value svg { transform: translateX(3px); }
.cp-contact__value svg { transition: transform 0.2s var(--ease-out); }

/* ---------- Footer ---------- */
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; width: 100%; max-width: var(--content-max); margin: var(--sp-10) auto 0; padding: var(--sp-6) var(--sp-8); border-top: 1px solid var(--border); }
@media (max-width: 700px) { .site-footer { padding: var(--sp-5) var(--sp-4); } }
.site-footer__brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; color: var(--text-2); }
.site-footer__brand svg { color: var(--accent); }
.site-footer__links { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
.site-footer__links a { font-size: 0.88rem; color: var(--text-3); transition: color 0.15s; }
.site-footer__links a:hover { color: var(--accent-text); }

/* ---------- Scroll reveal ----------
   The hidden state is gated behind `html.js-reveal`, which the script adds only
   when motion is allowed. So if JS is disabled or fails, content stays visible
   (graceful degradation — animations never hide data). */
html.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
  will-change: opacity, transform;
}
html.js-reveal [data-reveal].is-revealed { opacity: 1; transform: none; }

/* Inventory sections: larger lift + gentle per-item stagger so the grid / list
   reveals as a wave on scroll (scroll-animations). */
html.js-reveal .card-grid > [data-reveal],
html.js-reveal .record-list > [data-reveal] {
  transform: translateY(26px) scale(0.985);
  transition: opacity 0.5s var(--ease-out), transform 0.55s var(--ease-out);
}
html.js-reveal .card-grid > [data-reveal]:nth-child(2),
html.js-reveal .record-list > [data-reveal]:nth-child(2) { transition-delay: 0.04s; }
html.js-reveal .card-grid > [data-reveal]:nth-child(3),
html.js-reveal .record-list > [data-reveal]:nth-child(3) { transition-delay: 0.08s; }
html.js-reveal .card-grid > [data-reveal]:nth-child(4),
html.js-reveal .record-list > [data-reveal]:nth-child(4) { transition-delay: 0.12s; }
html.js-reveal .card-grid > [data-reveal]:nth-child(5),
html.js-reveal .record-list > [data-reveal]:nth-child(5) { transition-delay: 0.16s; }
html.js-reveal .card-grid > [data-reveal]:nth-child(6),
html.js-reveal .record-list > [data-reveal]:nth-child(6) { transition-delay: 0.2s; }
html.js-reveal .card-grid > [data-reveal].is-revealed,
html.js-reveal .record-list > [data-reveal].is-revealed { transform: none; }

/* ---------- Scroll progress bar ---------- */
.scroll-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 1600;
  pointer-events: none;
}

/* ---------- Motion preferences (OS setting OR the in-app "Reduced" toggle) --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .skeleton { animation: none; background: var(--skeleton-1); }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .scroll-progress { display: none; }
}
html[data-motion='off'] *,
html[data-motion='off'] *::before,
html[data-motion='off'] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
html[data-motion='off'] .skeleton { animation: none; background: var(--skeleton-1); }
html[data-motion='off'] [data-reveal] { opacity: 1 !important; transform: none !important; }
html[data-motion='off'] .scroll-progress { display: none; }

/* ---------- High-contrast mode (in-app toggle) ---------- */
html[data-contrast='high'] {
  --text-2: #2a3140;
  --text-3: #434c5e;
  --border: rgba(17, 24, 39, 0.22);
  --border-strong: rgba(17, 24, 39, 0.4);
  --ring: rgba(79, 70, 229, 0.7);
}
[data-theme='dark'][data-contrast='high'] {
  --text-2: #d6dce6;
  --text-3: #aeb6c4;
  --border: rgba(255, 255, 255, 0.24);
  --border-strong: rgba(255, 255, 255, 0.42);
  --ring: rgba(129, 140, 248, 0.85);
}
html[data-contrast='high'] :focus-visible { outline-width: 3px; }

/* ---------- Accessibility menu ---------- */
.a11y-menu { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 230px; padding: 4px; }
.a11y-menu__title {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3); padding: 4px 4px 0;
}
.a11y-row { display: flex; flex-direction: column; gap: 6px; }
.a11y-row__label { font-size: 0.82rem; font-weight: 600; color: var(--text-2); }
.seg { display: flex; gap: 3px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.seg__btn {
  flex: 1; padding: 6px 8px; border-radius: var(--r-sm); font-size: 0.82rem; font-weight: 600;
  color: var(--text-2); background: transparent; transition: background var(--dur), color var(--dur);
}
.seg__btn:hover { color: var(--text); }
.seg__btn.is-active { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-sm); }
.a11y-menu__reset {
  margin-top: 2px; padding: 7px; border-radius: var(--r-sm); font-size: 0.8rem; font-weight: 600;
  color: var(--text-2); background: var(--surface-hover);
}
.a11y-menu__reset:hover { color: var(--text); }
