/* ─────────────────────────────────────────────────────────────
   PestScope — component primitives
   Maps cleanly to Fluent UI Blazor (button, tabs, dialog, badge).
   ───────────────────────────────────────────────────────────── */

/* ════════════════════════════════════════════════════════════
   APP SHELL — desktop & tablet
   ════════════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--page-bg);
}

.app-shell__main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--page-bg);
}

.app-shell__page {
  padding: var(--space-xl) var(--space-xl) var(--space-2xl);
  max-width: 1400px;
  margin: 0 auto;
}

/* ── Sidebar (desktop) ── */
.sidebar {
  width: var(--sidebar-w-desktop);
  flex-shrink: 0;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  color: #C7DFD9;
}
.sidebar__brand {
  padding: var(--space-lg) var(--space-base);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.sidebar__brand img { width: 132px; height: auto; }
.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-xs) var(--space-sm);
  flex: 1;
}
.sidebar__nav-section {
  margin-top: var(--space-base);
  padding: 0 var(--space-md) var(--space-xs);
  font-size: var(--text-12);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(199, 223, 217, 0.55);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: #7DBCB0;
  font-size: var(--text-14);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #C7DFD9; }
.nav-item.is-active { background: var(--sidebar-active); color: var(--text-on-primary); }
.nav-item__icon { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-item__badge {
  margin-left: auto;
  background: var(--primary);
  color: var(--text-on-primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
}

.sidebar__footer {
  border-top: 1px solid rgba(199, 223, 217, 0.12);
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.user-card:hover { background: rgba(255, 255, 255, 0.06); }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--text-on-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-12); font-weight: 700; flex-shrink: 0;
  letter-spacing: 0.5px;
}
.user-card__info { display: flex; flex-direction: column; min-width: 0; }
.user-card__name { font-size: var(--text-13); font-weight: 600; color: #E2F0EE; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card__role { font-size: 11px; color: #7DBCB0; }
.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: #7DBCB0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}
.icon-btn:hover { color: #C7DFD9; background: rgba(255, 255, 255, 0.06); }
.icon-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Sidebar — tablet (icon-only rail) ── */
.sidebar--rail {
  width: var(--sidebar-w-tablet);
}
.sidebar--rail .sidebar__brand { padding: var(--space-base) 0; justify-content: center; }
.sidebar--rail .sidebar__brand img { width: 32px; }
.sidebar--rail .nav-item {
  justify-content: center;
  padding: 12px 0;
  position: relative;
}
.sidebar--rail .nav-item__label,
.sidebar--rail .nav-item__badge,
.sidebar--rail .sidebar__nav-section,
.sidebar--rail .user-card__info { display: none; }
.sidebar--rail .nav-item__icon { width: 20px; height: 20px; }
.sidebar--rail .user-card { padding: var(--space-sm); justify-content: center; }
.sidebar--rail .sidebar__footer { padding: var(--space-xs); }
/* Tooltip on hover (CSS-only) */
.sidebar--rail .nav-item[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: var(--text-13);
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  z-index: 10;
  pointer-events: none;
}

/* ════════════════════════════════════════════════════════════
   MOBILE SHELL — top bar + bottom nav + drawer
   ════════════════════════════════════════════════════════════ */
.mobile-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--page-bg);
  overflow: hidden;
}
.mobile-shell__main {
  flex: 1;
  overflow-y: auto;
  padding-bottom: calc(var(--bottomnav-h-mobile) + env(safe-area-inset-bottom, 0px));
}
.mobile-shell__page {
  padding: var(--space-base);
}

.topbar {
  height: var(--topbar-h-mobile);
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 var(--space-sm);
  gap: var(--space-xs);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar__title {
  flex: 1;
  font-size: var(--text-16);
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__action {
  width: var(--hit); height: var(--hit);
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.topbar__action:hover { background: var(--surface-hover); }
.topbar__action svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.bottomnav {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: var(--bottomnav-h-mobile);
  background: var(--surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 20;
}
.bottomnav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color var(--dur-fast) var(--ease-out);
  text-decoration: none;
}
.bottomnav__item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bottomnav__item.is-active { color: var(--primary); }
.bottomnav__item.is-active::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 28px; height: 3px;
  background: var(--primary);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.bottomnav__badge {
  position: absolute;
  top: 4px;
  left: calc(50% + 8px);
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: var(--status-red);
  color: var(--text-on-primary);
  border-radius: var(--radius-pill);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}

/* ── Drawer ── */
.drawer-scrim {
  position: absolute; inset: 0;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
  z-index: 30;
}
.drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 86%;
  max-width: 320px;
  background: var(--sidebar);
  color: #C7DFD9;
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease-out);
  z-index: 31;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.drawer.is-open { transform: translateX(0); }
.drawer.is-open + .drawer-scrim,
.drawer-scrim.is-open { opacity: 1; pointer-events: auto; }
.drawer__head {
  padding: var(--space-base);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer__nav { padding: var(--space-sm); display: flex; flex-direction: column; gap: 2px; }

/* ════════════════════════════════════════════════════════════
   PAGE HEADER / TOOLBAR
   ════════════════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-base);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}
.page-header__title-block { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.page-header__actions { display: flex; gap: var(--space-sm); align-items: center; flex-shrink: 0; }

.breadcrumb {
  display: flex; align-items: center; gap: var(--space-sm);
  font-size: var(--text-13); font-weight: 500; flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-tertiary); }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb__sep { color: var(--border); }
.breadcrumb__current { color: var(--primary); font-weight: 600; }

/* ════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-family: inherit;
  font-weight: 600;
  font-size: var(--text-14);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  white-space: nowrap;
  user-select: none;
  padding: 0 var(--space-base);
  height: 36px;
}
.btn--primary { background: var(--primary); color: var(--text-on-primary); }
.btn--primary:hover { background: var(--primary-hover); }
.btn--primary:active { background: var(--primary-pressed); }
.btn--ghost { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-hover); border-color: var(--text-tertiary); color: var(--text-primary); }
.btn--text { background: transparent; color: var(--primary); border: none; padding: 0 var(--space-sm); }
.btn--text:hover { color: var(--primary-hover); }
.btn--danger { background: var(--status-red); color: white; }
.btn--danger:hover { filter: brightness(1.08); }
.btn--lg { height: 48px; padding: 0 var(--space-lg); font-size: var(--text-15); }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn--lg svg { width: 18px; height: 18px; }

.btn--icon {
  width: 36px; padding: 0;
}
.btn--icon.btn--lg { width: 48px; }

/* ════════════════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}
.card--inset { padding: var(--space-base); }

/* KPI / summary card */
.kpi {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-base) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 0;
}
.kpi__label { font-size: var(--text-12); font-weight: 600; color: var(--text-secondary); letter-spacing: 0.06em; text-transform: uppercase; }
.kpi__value { font-size: var(--text-30); font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi__sub   { font-size: var(--text-13); color: var(--text-tertiary); }
.kpi__delta { font-size: var(--text-13); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.kpi__delta--up { color: var(--status-green); }
.kpi__delta--down { color: var(--status-red); }

.kpi-strip {
  display: grid;
  gap: var(--space-base);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ════════════════════════════════════════════════════════════
   LIST ROW (single primitive for all lists)
   ════════════════════════════════════════════════════════════ */
.list { display: flex; flex-direction: column; }
.list--bordered { border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.list--bordered .list-row + .list-row { border-top: 1px solid var(--border-subtle); }

.list-row {
  display: flex;
  align-items: center;
  gap: var(--space-base);
  padding: var(--space-md) var(--space-lg);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.list-row:hover { background: var(--surface-hover); }
.list-row__leading { flex-shrink: 0; display: flex; align-items: center; gap: var(--space-sm); }
.list-row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row__title { font-size: var(--text-15); font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row__sub { font-size: var(--text-13); color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row__meta { font-size: var(--text-13); color: var(--text-tertiary); }
.list-row__trailing { flex-shrink: 0; display: flex; align-items: center; gap: var(--space-md); }

.list-row--compact { padding: var(--space-sm) var(--space-base); }
.list-row--compact .list-row__title { font-size: var(--text-14); }
.list-row--button { -webkit-appearance: none; appearance: none; }

/* ════════════════════════════════════════════════════════════
   STATUS PILLS & DOTS
   ════════════════════════════════════════════════════════════ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-12);
  font-weight: 600;
  background: var(--surface-soft);
  color: var(--primary);
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.pill--no-dot::before { display: none; }
.pill--green  { background: var(--status-green-soft);  color: var(--status-green); }
.pill--orange { background: var(--status-orange-soft); color: var(--status-orange); }
.pill--red    { background: var(--status-red-soft);    color: var(--status-red); }
.pill--blue   { background: var(--status-blue-soft);   color: var(--status-blue); }
.pill--neutral{ background: var(--surface-2); color: var(--text-secondary); }
.pill--brand  { background: var(--surface-soft); color: var(--primary); }

/* Generic horizontal-scroll wrapper for legacy/dense tables (FluentDataGrid
   editors) that don't have a proper compact-row alternative yet. The grid
   keeps its fixed column widths, the wrapper provides momentum scrolling on
   touch devices and a soft scroll-cue shadow on the trailing edge. */
.scroll-x-on-compact {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
@media (max-width: 1023px) {
  .scroll-x-on-compact > * { min-width: 720px; }
}

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dot--green { background: var(--status-green); }
.dot--orange { background: var(--status-orange); }
.dot--red { background: var(--status-red); }
.dot--blue { background: var(--status-blue); }

.status-dots { display: inline-flex; gap: 4px; }

/* ════════════════════════════════════════════════════════════
   TABS — overflow-aware
   ════════════════════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: var(--space-lg);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: var(--text-14);
  font-weight: 600;
  padding: 0 0 12px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
  font-family: inherit;
}
.tab:hover { color: var(--text-primary); }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.tab__count {
  display: inline-block;
  margin-left: 6px;
  font-size: var(--text-12);
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════════
   FORM CONTROLS
   ════════════════════════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: var(--text-13); font-weight: 600; color: var(--text-primary); }
.field__hint  { font-size: var(--text-12); color: var(--text-tertiary); }
.field__row   { display: flex; justify-content: space-between; align-items: center; }
.input, .select, .textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-14);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--text-tertiary); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.textarea { resize: vertical; min-height: 96px; }

.search {
  position: relative;
}
.search > svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-tertiary);
  stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}
.search > input {
  width: 100%;
  padding-left: 40px;
}

/* Segmented control */
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}
.segmented__item {
  background: transparent;
  border: none;
  font: inherit;
  font-size: var(--text-13);
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.segmented__item:hover { color: var(--text-primary); }
.segmented__item.is-active { background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* Chips */
.chip-row {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
  scroll-snap-type: x mandatory;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: var(--text-13);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  scroll-snap-align: start;
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  font-family: inherit;
}
.chip:hover { border-color: var(--text-tertiary); }
.chip.is-active { background: var(--primary); border-color: var(--primary); color: var(--text-on-primary); }
.chip__swatch { width: 8px; height: 8px; border-radius: 50%; }
.chip__count {
  margin-left: 2px;
  opacity: 0.7;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.chip.is-active .chip__count { opacity: 0.85; }

/* ViewListPanel compact chip-row (between toolbar / topbar and the list).
   Adds vertical breathing room and matches the handoff sticky-row spacing. */
.view-list__chip-row {
  flex: 1;
  min-width: 0;
}
.view-list__compact-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-sm) 0 var(--space-md);
}
/* Filter button stays on the same row as the tab chips — drop the bar's own
   top/bottom margin so they share a single baseline. */
.view-list__compact-row > .mobile-filter-bar {
  margin: 0;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   BOTTOM SHEETS — peek / full / action
   ════════════════════════════════════════════════════════════ */
.sheet-scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 24;
  animation: sheet-scrim-in var(--dur-base) var(--ease-out);
}
.sheet {
  position: absolute;
  left: 0; right: 0;
  background: var(--surface);
  border-top-left-radius: var(--radius-2xl);
  border-top-right-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sheet);
  z-index: 25;
  display: flex;
  flex-direction: column;
  transition: bottom var(--dur-slow) var(--ease-out);
}
.sheet--peek {
  bottom: var(--bottomnav-h-mobile);
  max-height: 60vh;
  animation: sheet-slide-up var(--dur-base) var(--ease-out);
}
.sheet--full {
  top: 0; bottom: 0;
  border-radius: 0;
  z-index: 35;
  animation: sheet-scrim-in var(--dur-base) var(--ease-out);
}
.sheet--action {
  bottom: 0;
  max-height: 50vh;
  z-index: 35;
  animation: sheet-slide-up var(--dur-base) var(--ease-out);
}

@keyframes sheet-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes sheet-slide-down {
  /* No explicit `from` — the underlying transform (incl. inline style left over
     from a swipe-drag) is used as the start, so the animation interpolates from
     the current position rather than snapping back to translateY(0) first. */
  to { transform: translateY(100%); }
}
@keyframes sheet-scrim-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes sheet-scrim-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Exit animations — Sheet.razor adds .is-closing for one tick before unmounting. */
.sheet--peek.is-closing,
.sheet--action.is-closing {
  animation: sheet-slide-down var(--dur-base) var(--ease-out) forwards;
}
.sheet--full.is-closing {
  animation: sheet-scrim-out var(--dur-base) var(--ease-out) forwards;
}
.sheet-scrim.is-closing {
  animation: sheet-scrim-out var(--dur-base) var(--ease-out) forwards;
}

@media (prefers-reduced-motion: reduce) {
  .sheet-scrim,
  .sheet--peek,
  .sheet--full,
  .sheet--action,
  .sheet-scrim.is-closing,
  .sheet--peek.is-closing,
  .sheet--full.is-closing,
  .sheet--action.is-closing { animation: none; }
}
.sheet__handle {
  width: 36px; height: 4px;
  background: var(--text-tertiary);
  opacity: 0.4;
  border-radius: var(--radius-pill);
  margin: var(--space-sm) auto;
  flex-shrink: 0;
}
.sheet__head {
  display: flex;
  align-items: center;
  gap: var(--space-base);
  padding: var(--space-md) var(--space-base);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.sheet__title { flex: 1; font-size: var(--text-16); font-weight: 700; }
.sheet__body { flex: 1; overflow-y: auto; padding: var(--space-base); }
.sheet__footer {
  flex-shrink: 0;
  padding: var(--space-md) var(--space-base);
  padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: var(--space-md);
  background: var(--surface);
}
.sheet__footer .btn { flex: 1; }

/* ════════════════════════════════════════════════════════════
   STATES — loading / empty / error placeholders
   Used by EmptyState / LoadingState / ErrorState in Core.UI.
   ════════════════════════════════════════════════════════════ */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-2xl) var(--space-base);
  text-align: center;
  color: var(--text-secondary);
}
.state--block {
  min-height: 240px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.state--loading {
  flex-direction: row;
  gap: var(--space-md);
  padding: var(--space-md);
}
.state__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
}
.state--error.state--warn .state__icon {
  background: var(--status-orange-soft, var(--surface-2));
  color: var(--status-orange, var(--text-tertiary));
}
.state__title {
  margin: 0;
  font-size: var(--text-15);
  font-weight: 700;
  color: var(--text-primary);
}
.state__description {
  margin: 0;
  max-width: 360px;
  font-size: var(--text-13);
  line-height: 1.5;
}
.state__action {
  margin-top: var(--space-sm);
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  background: var(--primary);
  border: none;
  color: var(--text-on-primary);
  font-size: var(--text-13);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.state__action:hover { filter: brightness(0.95); }
.state__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: state-spin 0.8s linear infinite;
}
.state__label { font-size: var(--text-13); }
@keyframes state-spin {
  to { transform: rotate(360deg); }
}

/* ════════════════════════════════════════════════════════════
   MOBILE FILTER BAR — chip-row of active filters + sheet trigger
   Lives inline in the list flow above the rows. Compact viewport only;
   table view has its own ColumnFilterRow.
   ════════════════════════════════════════════════════════════ */
.mobile-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-sm) 0;
}
.mobile-filter-bar__chips {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.mobile-filter-bar__chips::-webkit-scrollbar { display: none; }
.mobile-filter-bar__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft, var(--surface-2));
  border: 1px solid var(--primary-soft, var(--border-subtle));
  color: var(--primary, var(--text-primary));
  font-size: var(--text-12);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  scroll-snap-align: start;
  font-family: inherit;
}
.mobile-filter-bar__chip__label { font-weight: 500; opacity: 0.8; }
.mobile-filter-bar__chip__value { font-weight: 700; }
.mobile-filter-bar__chip svg { opacity: 0.7; }
.mobile-filter-bar__open-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: var(--text-13);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.mobile-filter-bar__open-btn.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-primary);
}
.mobile-filter-bar__open-btn__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--text-on-primary);
  color: var(--primary);
  font-size: var(--text-11);
  font-weight: 700;
}

/* Filter sheet body — handoff "MobileA_FilterSheet" structure:
   search input on top, then a t-micro-labelled chip-row per filterable column. */
.filter-sheet {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.filter-sheet__search {
  margin-bottom: 0;
}
.filter-sheet__group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-sheet__group-label {
  /* .t-micro is already supplied by markup; this only adds spacing reset. */
  margin: 0;
}
.filter-sheet__chip-row {
  flex-wrap: wrap;
  overflow-x: visible;
  scroll-snap-type: none;
}
/* Footer split: ghost cancel narrower, primary apply wider — like handoff (1:2). */
.sheet__footer .filter-sheet__cancel { flex: 1; }
.sheet__footer .filter-sheet__apply { flex: 2; }

/* Filter sheets need more vertical room than a typical action sheet. */
.sheet--action:has(.filter-sheet) {
  max-height: 85vh;
}

/* ════════════════════════════════════════════════════════════
   FLOATING ACTION CLUSTER (canvas controls)
   ════════════════════════════════════════════════════════════ */
.fab-cluster {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  display: inline-flex;
  padding: 4px;
  gap: 2px;
}
.fab {
  width: var(--hit); height: var(--hit);
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.fab:hover { background: var(--surface-hover); }
.fab svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fab--solo {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
}

/* ════════════════════════════════════════════════════════════
   TABLE (desktop)
   ════════════════════════════════════════════════════════════ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-13);
}
.table th {
  text-align: left;
  font-size: var(--text-12);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: var(--space-md) var(--space-base);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-subtle);
}
.table td {
  padding: var(--space-md) var(--space-base);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-hover); }
.table--filter th { padding: var(--space-sm) var(--space-base); background: var(--surface); }

/* ════════════════════════════════════════════════════════════
   MISC
   ════════════════════════════════════════════════════════════ */
.divider { height: 1px; background: var(--border-subtle); border: none; margin: var(--space-base) 0; }
.spacer { flex: 1; }

.stack { display: flex; flex-direction: column; gap: var(--space-base); }
.stack--sm { gap: var(--space-sm); }
.stack--lg { gap: var(--space-lg); }
.row { display: flex; gap: var(--space-base); align-items: center; }
.row--end { justify-content: flex-end; }
.row--between { justify-content: space-between; }

.muted { color: var(--text-secondary); }
.subtle { color: var(--text-tertiary); }
