/* ============================================================
   FlightBarN — Main Application Stylesheet
   Design tokens live in variables.css, linked before this file by App.razor.
   ============================================================ */

/* Font loading lives in App.razor's <link> (with preconnect hints, non-render-blocking) —
   Inter + Vazirmatn + Noto Sans Arabic, weights 400-800. Do not @import fonts here too;
   a CSS @import is render-blocking and duplicates that request. */

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Native form controls inherit no styling by default in most browsers —
   without this reset, <button> renders with the OS's default white/grey
   face and border, which is why unstyled buttons look "white". */
button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

html {
  font-family: var(--font-sans);
  line-height: var(--leading-normal);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
  overflow-x: hidden;
}

/* Set for a single frame by FlightBarN.applyTheme (app.js) so the theme
   flips in one clean step instead of hundreds of staggered colour fades. */
.theme-switching,
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
  transition: none !important;
}

/* Smooth anchor scrolling only for people who haven't asked the OS for
   reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* Branded text selection instead of the OS default blue. */
::selection {
  background: rgba(var(--color-primary-rgb), .22);
  color: inherit;
}

/* Keyboard focus baseline — every interactive element gets a visible ring
   when reached by keyboard (never on mouse click: :focus-visible). Specific
   components (.btn, .form-control, .segmented…) refine this further down. */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Remove the 300ms tap delay and grey flash on touch devices — taps feel
   immediate, the :active styles below provide the feedback instead. */
a, button, [role="button"], label, summary {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Numbers line up in columns (AWB weights, charges, rates, totals). Only where
   digits stack vertically — big standalone figures (stat tiles, hero numbers)
   keep proportional digits, which look tighter at display sizes. */
.table td,
.stat-mini__value,
.detail-value {
  font-variant-numeric: tabular-nums;
}

/* Visually hidden but read by screen readers (chart data tables, labels). */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* [dir="rtl"] (see variables.css) overrides font-family and line-height on
   <html> — an attribute selector outranks a type selector, so it wins
   regardless of source order. body must NOT set its own font-family or
   line-height: an element's own explicit declaration always beats whatever
   it would otherwise inherit, so either property set here would silently
   defeat the RTL override no matter what <html> says. This was exactly the
   bug — Persian/Arabic pages were inheriting Vazirmatn/Noto Sans Arabic
   (and relaxed line-height) from html correctly in theory, but body's own
   rules clobbered both before any content ever saw them, and every RTL
   page silently rendered in cramped Inter/system-ui instead. */
body {
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  color: var(--text-primary);
  background-color: var(--bg-app);
  min-height: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbars — themed to match light/dark instead of the OS default ──── */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--bg-app);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-app); }
::-webkit-scrollbar-thumb {
  background-color: var(--border-strong);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-app);
}
::-webkit-scrollbar-thumb:hover { background-color: var(--text-tertiary); }
::-webkit-scrollbar-corner { background: var(--bg-app); }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); }

p { margin-bottom: var(--space-4); color: var(--text-secondary); }
a { color: var(--text-link); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--text-link-hover); }
small { font-size: var(--text-xs); }
code { font-family: var(--font-mono); font-size: 0.85em; background: var(--bg-code); padding: 0.1em 0.35em; border-radius: var(--radius-sm); }

/* ── Application Shell ──────────────────────────────────────── */
.app-shell {
  display: grid;
  /* minmax(0, 1fr) — not bare 1fr — so this track can shrink below the
     intrinsic (max-content) width of whatever's inside main; a bare 1fr
     track's implicit minimum is auto, which lets wide content silently
     blow out the layout instead of wrapping/scrolling within its own box. */
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--topbar-height) 1fr var(--footer-height);
  grid-template-areas:
    "sidebar topbar"
    "sidebar main"
    "sidebar footer";
  /* height, not min-height — the grid must be capped at exactly the
     viewport, not just "at least" it. With min-height, a row can grow
     past 100dvh to fit tall page content (long dashboards, forms), which
     drags the "sidebar" grid area (it spans all three rows) along with
     it — so the sidebar's own overflow:hidden/sticky positioning no
     longer has a bounded box to stick within, and it scrolls off with
     the page instead of staying pinned. With a fixed height, the middle
     row is capped and .main-content's own overflow-y:auto (see below)
     takes over the scrolling instead of the whole shell growing. */
  height: 100dvh;
  /* On-screen movement (the main column slides as the sidebar narrows) →
     ease-in-out, not ease-out. */
  transition: grid-template-columns var(--duration-slow) var(--ease-in-out);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background-color: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: sticky;
  top: 0;
  height: 100dvh;
  transition: width var(--transition-slow);
  z-index: var(--z-sticky);
  border-inline-end: 1px solid rgba(255,255,255,.04);
}

.sidebar__logo {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-3);
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

.sidebar__logo-mark {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #21a0ad, #0a505c);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 2px 8px rgba(15, 123, 138, .35);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -.5px;
}

.sidebar__logo-text {
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--transition-slow);
}

.sidebar-collapsed .sidebar__logo-text { opacity: 0; width: 0; }

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-3) 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
}

.sidebar__section-label {
  font-size: 0.65rem;
  font-weight: var(--font-semibold);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-sidebar);
  padding: var(--space-4) var(--space-4) var(--space-2);
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--transition-slow);
}

.sidebar-collapsed .sidebar__section-label { opacity: 0; height: 0; padding: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  margin: 1px var(--space-2);
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--duration-press) var(--ease-out);
  white-space: nowrap;
  position: relative;
  user-select: none;
}

/* The sidebar collapse toggle is a real <button class="nav-item"> (keyboard
   reachable) — reset the native button box so it matches the link items. */
button.nav-item {
  width: calc(100% - 2 * var(--space-2));
  border: none;
  background: transparent;
  font: inherit;
  text-align: start;
}

.nav-item:hover {
  background-color: var(--bg-sidebar-hover);
  color: var(--text-sidebar-hover);
}

.nav-item:active { transform: scale(0.98); }

.nav-item:focus-visible {
  outline: 2px solid var(--color-primary-300);
  outline-offset: -2px;
}

/* Active page: a soft brand tint + a short accent bar on the leading edge
   (Linear / Vercel style) instead of a solid teal block — reads instantly
   without shouting over every other item. */
.nav-item.active {
  background-color: rgba(33, 160, 173, .16);
  color: var(--text-sidebar-active);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  inset-inline-start: calc(-1 * var(--space-2));
  top: 50%;
  width: 3px;
  height: 18px;
  margin-top: -9px;
  border-start-end-radius: 3px;
  border-end-end-radius: 3px;
  background: var(--color-primary-300);
  animation: nav-indicator-in var(--duration-normal) var(--ease-out);
}
.nav-item.active .nav-item__icon { color: var(--color-primary-300); }

@keyframes nav-indicator-in {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}

.nav-item__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .8;
}

.nav-item.active .nav-item__icon { opacity: 1; }

.nav-item__label {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-slow);
}

.sidebar-collapsed .nav-item__label { opacity: 0; width: 0; }

.nav-item__badge {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  background: var(--color-primary-600);
  color: #fff;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.nav-item__chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform var(--transition-normal);
}

.nav-item.expanded .nav-item__chevron { transform: rotate(90deg); }

.nav-sub {
  padding-inline-start: calc(var(--space-4) + 18px + var(--space-3));
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--transition-slow);
}

.nav-sub.open { max-height: 500px; }

.sidebar__footer {
  padding: var(--space-2) 0;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

/* Collapse toggle: the chevrons point the way the sidebar will move. */
.sidebar__collapse .nav-item__icon { display: inline-flex; transition: transform var(--duration-slow) var(--ease-in-out); }
.sidebar-collapsed .sidebar__collapse .nav-item__icon { transform: rotate(180deg); }
[dir="rtl"] .sidebar__collapse .nav-item__icon { transform: scaleX(-1); }
[dir="rtl"] .sidebar-collapsed .sidebar__collapse .nav-item__icon { transform: scaleX(-1) rotate(180deg); }

/* ── Sidebar groups (NavSection) ─────────────────────────────────
   Collapsible with a grid-rows 0fr ↔ 1fr transition (animates real height,
   no max-height guess). The group holding the current page is always open. */
.nav-main { padding-bottom: var(--space-1); }

.nav-section { margin-top: var(--space-1); }

.nav-section__head {
  width: calc(100% - 2 * var(--space-2));
  margin: 0 var(--space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3) var(--space-1);
  border-radius: var(--radius-md);
  background: none;
  border: none;
  color: rgba(195, 204, 215, .55);
  font-size: 0.6875rem;
  font-weight: var(--font-semibold);
  letter-spacing: .07em;
  text-transform: uppercase;
  text-align: start;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition-fast);
}
.nav-section__head:hover { color: var(--text-sidebar-hover); }
.nav-section__head:focus-visible { outline: 2px solid var(--color-primary-300); outline-offset: -2px; }
.nav-section__title { overflow: hidden; text-overflow: ellipsis; }

.nav-section__chevron {
  flex-shrink: 0;
  opacity: .7;
  transition: transform var(--duration-normal) var(--ease-out);
}
.nav-section--closed .nav-section__chevron { transform: rotate(-90deg); }
[dir="rtl"] .nav-section--closed .nav-section__chevron { transform: rotate(90deg); }

/* The group you are in is labelled a little brighter. */
.nav-section:has(.nav-item.active) .nav-section__head { color: var(--text-sidebar); }

.nav-section__body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows var(--duration-normal) var(--ease-out);
}
.nav-section__inner { min-height: 0; overflow: hidden; }
.nav-section--closed .nav-section__body { grid-template-rows: 0fr; }
.nav-section--closed:has(.nav-item.active) .nav-section__body { grid-template-rows: 1fr; }
.nav-section--closed:has(.nav-item.active) .nav-section__chevron { transform: none; }

/* ── Icon rail (collapsed sidebar) ─────────────────────────────────
   The pattern Linear / Vercel / GitHub / Supabase use: every entry is a
   40×40 square centred in the rail, the active one a filled square with
   the accent bar on the rail's outer edge, groups split by a short centred
   hairline, labels only in the hover/focus tooltip. Labels are removed
   from layout entirely — at width 0 they still took flex space (flex: 1)
   and pushed every icon off-centre. */
.sidebar-collapsed .sidebar__logo { justify-content: center; padding: 0; gap: 0; }
.sidebar-collapsed .sidebar__logo-text { display: none; }

.sidebar-collapsed .nav-section__head { display: none; }
.sidebar-collapsed .nav-section__body { grid-template-rows: 1fr; }
.sidebar-collapsed .nav-section { margin: 0; }
.sidebar-collapsed .nav-section::before {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  margin: var(--space-2) auto;
  background: rgba(255, 255, 255, .09);
}
.sidebar-collapsed .nav-main { padding-bottom: 0; }

.sidebar-collapsed .nav-item {
  width: 40px;
  height: 40px;
  margin: 2px auto;
  padding: 0;
  gap: 0;
  justify-content: center;
  border-radius: 10px;
}
.sidebar-collapsed .nav-item__label,
.sidebar-collapsed .nav-item__badge,
.sidebar-collapsed .nav-item .badge { display: none; }
.sidebar-collapsed .nav-item__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.sidebar-collapsed .nav-item.active { background: rgba(33, 160, 173, .22); }
/* (64px rail − 40px square) / 2 = 12px: the bar sits flush on the rail's outer edge. */
.sidebar-collapsed .nav-item.active::before { inset-inline-start: -12px; height: 20px; margin-top: -10px; }

.sidebar-collapsed .sidebar__footer { display: flex; justify-content: center; }

/* ── Topbar tools + profile ─────────────────────────────────────── */
.topbar__tools {
  display: flex;
  align-items: center;
  gap: 2px;
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 38px;
  padding: 0 var(--space-2) 0 3px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--duration-press) var(--ease-out);
}
[dir="rtl"] .profile-trigger { padding: 0 3px 0 var(--space-2); }
.profile-trigger:hover { background: var(--bg-surface-sunken); border-color: var(--border-default); }
.profile-trigger:active { transform: scale(0.97); }
.profile-trigger[aria-expanded="true"] { background: var(--bg-surface-sunken); border-color: var(--border-default); }

.profile-trigger__avatar {
  background: linear-gradient(135deg, var(--color-primary-400), var(--color-primary-700));
  color: #fff;
  font-size: var(--text-sm);
  box-shadow: 0 0 0 2px var(--bg-topbar);
}
.profile-trigger__name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}
.profile-trigger__chevron { color: var(--text-tertiary); transition: transform var(--duration-normal) var(--ease-out); }
.profile-trigger[aria-expanded="true"] .profile-trigger__chevron { transform: rotate(180deg); }

@media (max-width: 1100px) {
  .profile-trigger__name { display: none; }
}

/* ── Top Bar ────────────────────────────────────────────────── */
.topbar {
  grid-area: topbar;
  background-color: var(--bg-topbar);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  box-shadow: var(--shadow-xs);
}

.topbar__toggle {
  /* Hidden by default — this hamburger only controls the off-canvas mobile
     drawer (see the 768px breakpoint below), so it has zero visible effect
     at desktop widths. The sidebar's own Collapse/Expand link handles the
     desktop icon-only mode instead. */
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.topbar__toggle:hover {
  background-color: var(--bg-surface-sunken);
  color: var(--text-primary);
}

.topbar__search {
  flex: 1;
  max-width: 420px;
  /* Flex items default to min-width:auto (their content's intrinsic width),
     which silently overrides flex-shrink — without this override, the
     placeholder text below refuses to shrink and the row overflows. */
  min-width: 0;
}

.topbar__search-input {
  width: 100%;
  height: 36px;
  background: var(--bg-surface-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 0 var(--space-4) 0 calc(var(--space-4) + 20px);
  font-size: var(--text-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.topbar__search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), .15);
}

/* Search box rendered as a <button> that opens the command palette. */
.topbar__search-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  text-align: start;
  color: var(--text-tertiary);
}

.topbar__search-trigger:hover {
  border-color: var(--border-strong);
}

.topbar__search-trigger span {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-inline-start: auto;
}

.topbar__action-btn {
  /* Was 24px wide — a sliver of a hit target with the hover square clipped
     tight against the icon. 34px gives a proper square button. */
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  position: relative;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--duration-press) var(--ease-out);
}

.topbar__action-btn:hover {
  background-color: var(--bg-surface-sunken);
  color: var(--text-primary);
}

.topbar__action-btn:active { transform: scale(0.92); }

/* Theme toggle: both icons/labels are rendered; the applied theme picks the
   pair (display:none also removes the other label from the a11y tree). */
.theme-toggle__icon { display: inline-flex; animation: icon-swap-in var(--duration-normal) var(--ease-out); }
.theme-toggle__icon--to-light,
.theme-toggle__label--to-light { display: none; }
[data-theme="dark"] .theme-toggle__icon--to-dark,
[data-theme="dark"] .theme-toggle__label--to-dark { display: none; }
[data-theme="dark"] .theme-toggle__icon--to-light { display: inline-flex; }
[data-theme="dark"] .theme-toggle__label--to-light { display: inline; }

/* Language + theme controls on the sign-in page. */
.auth-shell__content { position: relative; }
.auth-shell__controls {
  position: absolute;
  top: var(--space-4);
  inset-inline-end: var(--space-4);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
/* Narrow screens: the card fills the width, so leave a strip above it for the controls. */
@media (max-width: 768px) {
  .auth-shell .auth-shell__content { padding-top: calc(var(--space-8) + 40px); }
}

/* Theme / language icon swap — the new icon settles in instead of popping. */
.topbar__action-btn > svg {
  animation: icon-swap-in var(--duration-normal) var(--ease-out);
}

@keyframes icon-swap-in {
  from { opacity: 0; transform: scale(.6) rotate(-30deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}

.topbar__action-btn .badge-dot {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  width: 8px;
  height: 8px;
  background: var(--color-danger-500);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-topbar);
  animation: badge-pop 320ms var(--ease-out);
}

/* Unread dot pops in when a notification arrives, so the change is noticed
   without being loud. */
@keyframes badge-pop {
  0%   { transform: scale(.4); opacity: 0; }
  60%  { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); }
}

.topbar__divider {
  width: 1px;
  height: 24px;
  background: var(--border-default);
  margin: 0 var(--space-1);
}

/* ── Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.breadcrumb__item { display: flex; align-items: center; gap: var(--space-1); }
.breadcrumb__item a { color: var(--text-tertiary); }
.breadcrumb__item a:hover { color: var(--text-primary); }
.breadcrumb__item.active { color: var(--text-primary); font-weight: var(--font-medium); }
.breadcrumb__sep { color: var(--text-disabled); }

/* ── Skip link — first Tab stop on every page; jumps keyboard users past the
   sidebar's ~40 links straight into the page. Invisible until focused. ── */
.skip-link {
  position: fixed;
  top: var(--space-3);
  inset-inline-start: var(--space-3);
  z-index: var(--z-overlay);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-primary-600);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  box-shadow: var(--shadow-lg);
  transform: translateY(calc(-100% - var(--space-4)));
  transition: transform var(--duration-normal) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(0); }

.main-content:focus { outline: none; }

/* ── Main Content Area ──────────────────────────────────────── */
.main-content {
  grid-area: main;
  min-width: 0;
  padding: var(--space-6);
  overflow-y: auto;
  overflow-x: hidden;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* Title + subtitle wrapper — the accent bar below spans this whole block
   (both lines), not just the title, so it reads as one unit. */
.page-header > div:first-child {
  position: relative;
  padding-inline-start: var(--space-3);
}

/* Small brand-colour accent bar — gives every page header a bit of
   character instead of sitting as flat black-on-white text with nothing
   around it. Stretches the full height of the title + subtitle together.
   Purely decorative, safe regardless of title length or whether a
   subtitle is present. */
.page-header > div:first-child::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 3px;
  bottom: 3px;
  width: 4px;
  border-radius: var(--radius-full);
  background: linear-gradient(180deg, var(--color-primary-400), var(--color-primary-700));
}

.page-header__title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
}

/* Blazor's <FocusOnNavigate Selector="h1"> (Routes.razor) sets tabindex="-1" and calls
   .focus() on the page's h1 after every navigation — a real accessibility feature (screen
   readers announce the new page title), not something to remove. But it's programmatic, never
   reachable via Tab, so the visible focus ring it produces is just noise, not a usable
   keyboard-navigation cue. Safe to drop outright, on every h1 app-wide (including the
   standalone auth/error pages, which don't use .page-header__title). */
h1:focus {
  outline: none;
}

.page-header__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.page-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  grid-area: footer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  border-top: 1px solid var(--border-default);
  background-color: var(--bg-surface);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* Bottom action bar for long forms/lists. Uses position:fixed, not sticky — a first attempt
   with sticky (bounded to .main-content's own scrollport) did not reliably stay pinned in
   practice (reported twice: it drifted with scroll and landed mid-list instead of at the true
   bottom), so this pins directly to the viewport instead, which has no scroll-container/
   containing-block ambiguity to get wrong. Anchored to the "main" grid column specifically
   (inset-inline-start reserves the sidebar's current width, toggled by .sidebar-collapsed —
   see the two overrides below) so it never overlaps the sidebar, and sits just above the
   persistent .footer row rather than on top of it. Pages using this class must reserve
   matching bottom space (e.g. a spacer div) so the bar never covers their own last row. */
.sticky-actions-bar {
  position: fixed;
  inset-inline-start: var(--sidebar-width);
  inset-inline-end: 0;
  bottom: var(--footer-height);
  z-index: var(--z-sticky);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  transition: inset-inline-start var(--transition-slow);
}

.app-shell.sidebar-collapsed .sticky-actions-bar {
  inset-inline-start: var(--sidebar-collapsed-width);
}

/* ── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  /* No overflow:hidden here — it used to double as corner-clipping for
     .card-header/.card-footer/.table-container, but that also silently
     clipped anything that needs to pop out of the card (SearchableSelect
     dropdowns, menus, tooltips). Those edge elements round their own
     corners below instead; see [dir] rules further down for RTL. */
}

.card-header:first-child {
  border-start-start-radius: var(--radius-xl);
  border-start-end-radius: var(--radius-xl);
}

.card-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.card-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

.card-body { padding: var(--space-6); }

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-default);
  background-color: var(--bg-surface-sunken);
}

.card-footer:last-child {
  border-end-start-radius: var(--radius-xl);
  border-end-end-radius: var(--radius-xl);
}

/* ── Rate accordion — ranked quote list on the Rate Calculator. Each row is its own
   standalone card, stacked with a gap; every row opens/closes independently (not
   single-open), all closed by default — see Expand all/Collapse all controls. ── */
.rate-accordion {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.rate-accordion__item {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.rate-accordion__header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  background: none;
  border: none;
  cursor: pointer;
  text-align: start;
  color: inherit;
  font: inherit;
}
.rate-accordion__header:hover { background: var(--bg-surface-sunken); }
.rate-accordion__item--open > .rate-accordion__header {
  background: var(--bg-surface-sunken);
  border-bottom: 1px solid var(--border-default);
}
.rate-accordion__summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  min-width: 0;
}
.rate-accordion__body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Stat card */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-sm);
}

/* Dashboard Quick Access tiles */
.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-3);
}

.quick-link-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  color: var(--text-primary);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--duration-normal) var(--ease-out);
}

/* Lift only for a real mouse — on touch screens :hover sticks after a tap
   and leaves the tile floating. */
@media (hover: hover) and (pointer: fine) {
  .quick-link-tile:hover {
    border-color: var(--color-primary-300);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: var(--text-primary);
  }
  .quick-link-tile:hover .quick-link-tile__icon {
    background: var(--color-primary-600);
    color: #fff;
  }
}

.quick-link-tile:active {
  transform: scale(0.97);
  transition-duration: var(--duration-press);
}

.quick-link-tile__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-primary-50);
  color: var(--color-primary-600);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.quick-link-tile__label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

.stat-card__label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.stat-card__value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: var(--space-1) 0;
  line-height: 1;
}

.stat-card__change {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.stat-card__change.up { color: var(--color-success-600); }
.stat-card__change.down { color: var(--color-danger-600); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  letter-spacing: -0.005em;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--duration-press) var(--ease-out),
    opacity var(--transition-fast);
  line-height: 1;
  user-select: none;
}

/* Icons inside buttons must never shrink or drift out of vertical center,
   regardless of surrounding whitespace/line breaks in the markup. */
.btn svg { flex-shrink: 0; }

.btn:active { transform: scale(0.97); }

.btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.btn:disabled, .btn.disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

/* Busy state (see data-busy-submit in app.js): label and busy content share
   one grid cell so the button never changes size, and cross-fade with a
   touch of blur so it reads as one control morphing, not two swapping. */
.btn:has(> .btn__busy) { display: inline-grid; }
.btn.w-full:has(> .btn__busy) { display: grid; }
.btn__label,
.btn__busy {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition:
    opacity var(--duration-normal) var(--ease-out),
    filter var(--duration-normal) var(--ease-out),
    transform var(--duration-normal) var(--ease-out);
}
.btn__busy,
.btn.is-busy .btn__label {
  opacity: 0;
  filter: blur(2px);
  transform: scale(.96);
}
.btn.is-busy .btn__busy {
  opacity: 1;
  filter: none;
  transform: none;
}
.btn.is-busy,
.btn.is-busy:disabled {
  opacity: 1;
  cursor: progress;
  pointer-events: none;
}
.btn-primary .spinner,
.btn-danger .spinner,
.btn-success .spinner {
  border-color: rgba(255, 255, 255, .35);
  border-top-color: #fff;
}

/* Show/hide-password toggle sitting in an .input-addon slot. */
.password-toggle {
  cursor: pointer;
  color: var(--text-tertiary);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}
.password-toggle:hover { color: var(--text-primary); background: var(--bg-surface); }
.password-toggle[aria-pressed="true"] { color: var(--color-primary-600); }
.password-toggle > svg { animation: icon-swap-in var(--duration-normal) var(--ease-out); }

.btn-sm { padding: 6px var(--space-3); font-size: var(--text-xs); gap: 6px; }
.btn-lg { padding: var(--space-3) var(--space-6); font-size: var(--text-md); }
.btn-icon { padding: var(--space-2); aspect-ratio: 1; }
.btn-icon-sm { padding: 6px; aspect-ratio: 1; }

/* Variants */
.btn-primary {
  background-color: var(--color-primary-600);
  border-color: var(--color-primary-600);
  color: #fff;
  box-shadow: 0 1px 2px rgba(var(--color-primary-rgb), .25), inset 0 1px 0 rgba(255,255,255,.12);
}
.btn-primary:hover {
  background-color: var(--color-primary-700);
  border-color: var(--color-primary-700);
  box-shadow: 0 2px 6px rgba(var(--color-primary-rgb), .3), inset 0 1px 0 rgba(255,255,255,.12);
}
.btn-primary:active { background-color: var(--color-primary-800); box-shadow: inset 0 1px 3px rgba(0,0,0,.2); }

.btn-secondary {
  background-color: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background-color: var(--bg-surface-sunken); border-color: var(--border-strong); }

.btn-danger {
  background-color: var(--color-danger-600);
  border-color: var(--color-danger-600);
  color: #fff;
  box-shadow: 0 1px 2px rgba(169,44,44,.25);
}
/* Hover darkens the base colour itself rather than borrowing the -700 step —
   -700 doubles as the "text on a tint" colour and is lifted to a pastel in
   dark mode, which would turn the button pale with white text on hover. */
.btn-danger:hover { background-color: color-mix(in srgb, var(--color-danger-600) 82%, #000); border-color: color-mix(in srgb, var(--color-danger-600) 82%, #000); box-shadow: 0 2px 6px rgba(169,44,44,.3); }

.btn-success {
  background-color: var(--color-success-600);
  border-color: var(--color-success-600);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15,115,73,.25);
}
.btn-success:hover { background-color: color-mix(in srgb, var(--color-success-600) 82%, #000); border-color: color-mix(in srgb, var(--color-success-600) 82%, #000); box-shadow: 0 2px 6px rgba(15,115,73,.3); }

.btn-ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background-color: var(--bg-surface-sunken); color: var(--text-primary); }
.btn-ghost:active { background-color: var(--border-default); }

.btn-link {
  background: none;
  border: none;
  color: var(--text-link);
  padding: 0;
  font-size: inherit;
  box-shadow: none;
}
.btn-link:hover { color: var(--text-link-hover); text-decoration: underline; }
.btn-link:active { transform: none; }

/* ── Segmented control ──────────────────────────────────────────
   Exclusive-choice toggle (2-4 options), e.g. Outbound/Incoming or
   Single-Leg/Multi-Leg. Renders as one unified pill-track control
   instead of two independent buttons floating side by side. ── */
.segmented {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  gap: 2px;
  background: var(--bg-surface-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
}

.segmented__option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--duration-press) var(--ease-out);
}

.segmented__option svg { flex-shrink: 0; }

.segmented__option:hover:not(.segmented__option--active) { color: var(--text-primary); }
.segmented__option:active { transform: scale(0.96); }

.segmented__option:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
}

.segmented__option--active {
  background: var(--bg-surface);
  color: var(--color-primary-700);
  box-shadow: var(--shadow-xs);
}
[data-theme="dark"] .segmented__option--active { color: var(--color-primary-400); }

/* ── Form Controls ──────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-5); }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.form-label.required::after {
  content: ' *';
  color: var(--color-danger-500);
}

.form-control-static {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  height: 38px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
}

.form-control {
  width: 100%;
  height: 38px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-family: inherit;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
}

.form-control:hover:not(:disabled):not(:focus) {
  border-color: var(--border-strong);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
}

.form-control::placeholder { color: var(--text-tertiary); opacity: 1; }

/* Invalid fields keep a red ring while focused instead of switching to the
   teal brand ring, so the error never disappears from view while fixing it. */
.form-control.is-invalid:focus,
.form-control.invalid:focus {
  border-color: var(--color-danger-500);
  box-shadow: 0 0 0 3px rgba(207, 59, 59, .18);
}

/* Blazor's EditForm marks bad fields with .invalid (not .is-invalid). */
.form-control.invalid { border-color: var(--color-danger-500); }

/* Validation messages slide in under the field instead of shoving the
   layout down in one jump. */
.validation-message,
.form-error {
  animation: field-message-in var(--duration-normal) var(--ease-out);
}

@keyframes field-message-in {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

.form-control:disabled {
  background-color: var(--bg-surface-sunken);
  color: var(--text-disabled);
  cursor: not-allowed;
}

.form-control.is-invalid { border-color: var(--color-danger-500); }
.form-control.is-valid { border-color: var(--color-success-500); }

textarea.form-control {
  height: auto;
  padding: var(--space-2) var(--space-3);
  resize: vertical;
  min-height: 80px;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-inline-end: calc(var(--space-3) + 20px);
}

/* background-position has no logical keyword (still physical-only in CSS), so the chevron
   needs an explicit flip for RTL. */
[dir="rtl"] select.form-control {
  background-position: left var(--space-3) center;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.form-error,
.validation-message {
  font-size: var(--text-xs);
  color: var(--color-danger-600);
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.input-group {
  position: relative;
  display: flex;
}

.input-group .form-control { flex: 1; }

.input-addon {
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  background: var(--bg-surface-sunken);
  border: 1px solid var(--border-input);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.input-addon:first-child {
  border-inline-end: none;
  border-start-start-radius: var(--radius-md);
  border-end-start-radius: var(--radius-md);
}

.input-addon:last-child {
  border-inline-start: none;
  border-start-end-radius: var(--radius-md);
  border-end-end-radius: var(--radius-md);
}

.input-group .form-control:not(:first-child):not(:last-child) { border-radius: 0; }
.input-group .form-control:first-child { border-start-start-radius: var(--radius-md); border-end-start-radius: var(--radius-md); }
.input-group .form-control:last-child { border-start-end-radius: var(--radius-md); border-end-end-radius: var(--radius-md); }

/* ── Filter / toolbar bars (search + status filters + Clear) — a filter
   bar sits on a faint tinted background so it reads as a distinct
   "controls" surface rather than just another data card, and its search
   box becomes a single seamless pill instead of a two-tone icon-square +
   input. Scoped to .filter-bar specifically — the generic .input-group /
   .input-addon used elsewhere (forms, dialogs) is untouched. ── */
.card:has(.filter-bar) {
  background: var(--bg-surface-sunken);
  box-shadow: none;
}
.filter-bar .input-group,
.filter-bar select.form-control {
  border-radius: var(--radius-full);
}
.filter-bar .input-addon {
  background: var(--bg-surface);
  border-inline-end: none;
  color: var(--text-tertiary);
}
.filter-bar .input-addon:first-child {
  border-start-start-radius: var(--radius-full);
  border-end-start-radius: var(--radius-full);
  padding-inline-start: var(--space-4);
}
.filter-bar .input-addon + .form-control {
  background: var(--bg-surface);
  border-start-end-radius: var(--radius-full);
  border-end-end-radius: var(--radius-full);
}
.filter-bar select.form-control {
  padding-inline-start: var(--space-4);
}
.filter-bar .input-group:focus-within {
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), .15);
}
.filter-bar .input-group:focus-within .input-addon,
.filter-bar .input-group:focus-within .form-control {
  border-color: var(--border-focus);
}

/* The Clear button used to just be a bare ghost icon with no border of
   its own — easy to miss and lifeless next to the pill-shaped controls
   above. A neutral outline at rest, a soft danger tint on hover (it is,
   after all, a destructive-ish "reset everything" action). */
.filter-bar__clear-btn {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-tertiary);
}
.filter-bar__clear-btn:hover {
  background: var(--color-danger-50);
  border-color: var(--color-danger-500);
  color: var(--color-danger-600);
}

/* Checkbox & Radio */
.form-check { display: flex; align-items: center; gap: var(--space-2); }
.form-check-input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary-600);
  cursor: pointer;
  flex-shrink: 0;
}
.form-check-label { font-size: var(--text-sm); color: var(--text-primary); cursor: pointer; }

/* Toggle switch */
.toggle { display: flex; align-items: center; gap: var(--space-3); cursor: pointer; }
.toggle__track {
  width: 40px;
  height: 22px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  position: relative;
  transition: background-color var(--transition-fast);
  flex-shrink: 0;
}
.toggle__track::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: var(--radius-full);
  /* The knob moves across the track — on-screen movement → ease-in-out. */
  transition: transform var(--duration-normal) var(--ease-in-out);
  box-shadow: var(--shadow-sm);
}
input:checked + .toggle__track { background: var(--color-primary-600); }
input:focus-visible + .toggle__track { box-shadow: var(--focus-ring); }
input:checked + .toggle__track::after { transform: translateX(18px); }
/* translateX always moves toward physical right — flip the slide direction in RTL since
   inset-inline-start already put the resting position on the correct (right) side there. */
[dir="rtl"] input:checked + .toggle__track::after { transform: translateX(-18px); }

/* ── Table ──────────────────────────────────────────────────── */
.table-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  /* Scroll-shadow hint (Lea Verou technique) — two solid-colour "cover"
     gradients (background-attachment: local, so they scroll with the
     content and reveal/hide themselves at each edge) plus two shadow
     gradients (background-attachment: scroll, fixed to the viewport of
     the container) that only show once there's actually more to scroll
     to on that side. Pure CSS, no JS scroll listener, and a harmless
     no-op when the table already fits (nothing to reveal). This is what
     tells a phone user "swipe for more columns" instead of a table that
     looks cut off with no affordance at all. */
  background:
    linear-gradient(to right, var(--bg-surface) 30%, rgba(0,0,0,0)) 0 0,
    linear-gradient(to left, var(--bg-surface) 30%, rgba(0,0,0,0)) 100% 0,
    linear-gradient(to right, rgba(0,0,0,.10), rgba(0,0,0,0)) 0 0,
    linear-gradient(to left, rgba(0,0,0,.10), rgba(0,0,0,0)) 100% 0;
  background-repeat: no-repeat;
  background-size: 32px 100%, 32px 100%, 12px 100%, 12px 100%;
  background-attachment: local, local, scroll, scroll;
}

.card > .table-container:first-child {
  border-start-start-radius: var(--radius-xl);
  border-start-end-radius: var(--radius-xl);
}

.card > .table-container:last-child {
  border-end-start-radius: var(--radius-xl);
  border-end-end-radius: var(--radius-xl);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table thead tr {
  background-color: var(--bg-surface-sunken);
  border-bottom: 2px solid var(--border-default);
}

.table th {
  padding: var(--space-3) var(--space-4);
  text-align: start;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}

.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background-color var(--transition-fast); }
.table tbody tr:hover { background-color: var(--bg-surface-sunken); }
.table tbody tr.selected { background-color: var(--color-primary-50); }
[data-theme="dark"] .table tbody tr.selected { background-color: rgba(var(--color-primary-rgb), .14); }

.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text-primary); }

/* Keep the row-actions column visible without horizontal scrolling on wide tables. */
.table th:last-child,
.table td:last-child {
  position: sticky;
  inset-inline-end: 0;
  background: var(--bg-surface);
  box-shadow: -1px 0 0 var(--border-default);
}

.table thead th:last-child {
  background: var(--bg-surface-sunken);
  z-index: 1;
}

.table tbody tr:hover td:last-child { background: var(--bg-surface-sunken); }

[dir="rtl"] .table th:last-child,
[dir="rtl"] .table td:last-child {
  box-shadow: 1px 0 0 var(--border-default);
}

/* Base state for the compaction helper below (documented further down,
   inside the @media block) — hidden on desktop, where the two source
   columns already read fine side by side. Declared here, ahead of the
   @media override, so the mobile rule actually wins the cascade instead
   of being shadowed by an equal-specificity rule declared later in the
   file. */
.mobile-paren { display: none; }

/* ══════════════════════════════════════════════════════════════════════════
   Responsive Data Tables — card view on mobile
   Opt-in: add class="table--responsive-cards" to any <table class="table">.
   Below 768px each <tr> becomes a self-contained bordered card laid out in
   up to three zones — every column stays visible (nothing is dropped) and
   there's no horizontal scrolling left to do. Reserve this for row-dense
   listing tables (AWB, Flights, Manifests, Customers, Rate Sheets, …) where
   6+ columns make the plain overflow-x:auto scroll every other .table gets
   genuinely painful on a phone; short 2-3 column tables are fine with the
   default scroll and don't need this.

   Cell roles (attributes on <td>, all optional except data-primary). Each
   role carries its own flex `order`, so <td>s can stay in whatever column
   order the desktop <thead> already uses — e.g. a Status column that's
   6th in the desktop table can still be marked data-badge and it will
   still visually dock next to the headline on mobile without having to
   reorder the markup (and break the desktop th/td column pairing):
     data-primary   Required, exactly one per row. The card's headline
                     (AWB number, a name, …) — bold, own line.
     data-badge     A status pill. Docks onto the headline's own line,
                     pinned to the trailing edge.
     data-secondary A muted subtitle line directly under the headline —
                     e.g. a route or a second identifier. No label prefix.
     data-label="…" Everything else: a plain "label ⟷ value" detail row.
                     The header text has to be duplicated here — once thead
                     is hidden there's no other way to carry the column
                     name into the stacked layout.
     data-meta      Small muted text anchored to the footer's leading edge
                     (secondary counts/metrics, e.g. "12 pcs · 480 kg").
     data-value     The footer's emphasized trailing metric (e.g. a total).
                     Shares its line with data-meta and the actions cell.
     (none of the above, no data-label)
                     Treated as the trailing actions cell (icon buttons) —
                     right-aligned, comfortably tappable, no label.

   Optional: data-tone="success|warning|danger|info|primary" on the <tr>
   itself paints a thin accent bar on the card's leading edge — a fast,
   pre-attentive way to scan status by colour before reading the badge
   text. Purely decorative; omit it and the card still works. ── */
@media (max-width: 768px) {
  .table--responsive-cards thead { display: none; }

  .table--responsive-cards,
  .table--responsive-cards tbody {
    display: block;
    width: 100%;
  }

  .table--responsive-cards tbody {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .table--responsive-cards tr {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: var(--space-3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    background: var(--bg-surface);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
  }

  .table--responsive-cards tr.table-row--clickable {
    cursor: pointer;
    padding-inline-end: calc(var(--space-4) + 18px);
  }
  .table--responsive-cards tr.table-row--clickable:active {
    background-color: var(--bg-surface-sunken);
  }
  /* Trailing chevron — the same "there's more, tap to open" affordance a
     native list row gives you, without pulling in an icon component. */
  .table--responsive-cards tr.table-row--clickable::after {
    content: '\203A';
    position: absolute;
    top: 50%;
    inset-inline-end: var(--space-3);
    transform: translateY(-50%);
    font-size: 19px;
    line-height: 1;
    color: var(--text-disabled);
    pointer-events: none;
  }
  [dir="rtl"] .table--responsive-cards tr.table-row--clickable::after {
    content: '\2039';
  }

  .table--responsive-cards tr.selected,
  .table--responsive-cards tr.table-row--selected {
    border-color: var(--color-primary-400);
    background-color: var(--color-primary-50) !important;
  }
  [data-theme="dark"] .table--responsive-cards tr.selected,
  [data-theme="dark"] .table--responsive-cards tr.table-row--selected {
    background-color: rgba(var(--color-primary-rgb), .14) !important;
  }

  /* Optional colour-coded accent bar, see data-tone in the block comment above. */
  .table--responsive-cards tr[data-tone] { border-inline-start-width: 3px; }
  .table--responsive-cards tr[data-tone="success"] { border-inline-start-color: var(--color-success-500); }
  .table--responsive-cards tr[data-tone="warning"] { border-inline-start-color: var(--color-warning-500); }
  .table--responsive-cards tr[data-tone="danger"]  { border-inline-start-color: var(--color-danger-500); }
  .table--responsive-cards tr[data-tone="info"]    { border-inline-start-color: var(--color-info-500); }
  .table--responsive-cards tr[data-tone="primary"] { border-inline-start-color: var(--color-primary-500); }

  /* Un-stick the desktop "keep actions visible while scrolling" trick —
     there's no horizontal scroll left in card mode, so a lingering
     position:sticky here would just clip against the wrong axis. */
  .table--responsive-cards td {
    position: static !important;
    box-shadow: none !important;
    background: transparent !important;
    min-width: 0;
  }

  /* ── Default zone: a plain detail row — label at the start, value at the end ── */
  .table--responsive-cards td {
    order: 4;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    flex: 1 1 100%;
    text-align: end;
    padding: var(--space-2) 0;
    border-bottom: 1px dashed var(--border-default);
  }
  .table--responsive-cards td:last-child { border-bottom: none; padding-bottom: 0; }

  .table--responsive-cards td[data-label]:not([data-primary]):not([data-secondary]):not([data-badge]):not([data-meta]):not([data-value])::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: .04em;
    text-align: start;
  }

  /* ── Header zone: headline (grows to fill the line) + optional badge
     (pinned to the trailing edge of that same line). Both close the header
     with a divider by default; when a data-secondary subtitle follows,
     that line's own divider takes over instead (:has() — evergreen browsers
     only, an acceptable floor for an internal enterprise tool). ── */
  .table--responsive-cards td[data-primary] {
    order: 1;
    flex: 1 1 auto;
    justify-content: flex-start;
    text-align: start;
    padding: 0 0 var(--space-2);
    border-bottom: 1px solid var(--border-default);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .table--responsive-cards td[data-badge] {
    order: 2;
    flex: 0 0 auto;
    padding: 0 0 var(--space-2);
    border-bottom: 1px solid var(--border-default);
  }
  .table--responsive-cards tr:has(td[data-secondary]) td[data-primary],
  .table--responsive-cards tr:has(td[data-secondary]) td[data-badge] {
    border-bottom: none;
    padding-bottom: 0;
  }

  /* ── Subtitle zone: full-width muted line right under the headline ── */
  .table--responsive-cards td[data-secondary] {
    order: 3;
    flex: 1 1 100%;
    justify-content: flex-start;
    text-align: start;
    padding: 0 0 var(--space-3);
    margin-bottom: var(--space-1);
    border-bottom: 1px solid var(--border-default);
    font-size: var(--text-xs);
    color: var(--text-secondary);
  }

  /* ── Footer zone: small meta text + an emphasized value, sharing one
     line pinned to the card's bottom; both undo the dashed row divider
     and instead pick up a single solid rule above the whole zone. ── */
  .table--responsive-cards td[data-meta],
  .table--responsive-cards td[data-value] {
    flex: 0 1 auto;
    border-bottom: none;
    border-top: 1px solid var(--border-default);
    padding-top: var(--space-3);
    margin-top: var(--space-1);
  }
  .table--responsive-cards td[data-meta] {
    order: 5;
    flex-grow: 1;
    justify-content: flex-start;
    text-align: start;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
  }
  .table--responsive-cards td[data-value] {
    order: 6;
    justify-content: flex-end;
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    color: var(--text-primary);
  }

  /* ── Trailing actions cell — no data-label/role at all, icon buttons,
     right-aligned, sized comfortably for a fingertip. ── */
  .table--responsive-cards td:not([data-label]):not([data-primary]):not([data-secondary]):not([data-badge]):not([data-meta]):not([data-value]) {
    order: 7;
    flex: 0 0 auto;
    justify-content: flex-end;
    border-top: 1px solid var(--border-default);
    border-bottom: none;
    padding-top: var(--space-3);
    margin-top: var(--space-1);
  }
  .table--responsive-cards td:not([data-label]):not([data-primary]):not([data-secondary]):not([data-badge]):not([data-meta]):not([data-value]) .btn {
    min-height: 36px;
    min-width: 36px;
  }
  /* If the actions cell trails a meta/value line it's already inside that
     shared footer line — no second divider on top of it. */
  .table--responsive-cards td[data-meta] ~ td:not([data-label]):not([data-primary]):not([data-secondary]):not([data-badge]):not([data-meta]):not([data-value]),
  .table--responsive-cards td[data-value] ~ td:not([data-label]):not([data-primary]):not([data-secondary]):not([data-badge]):not([data-meta]):not([data-value]) {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
  }

  /* ── Extra compaction helpers — layered on top of the roles above, for
     the common "bilingual name" / "two short tag columns" / "admin sort
     order" patterns on MasterData list pages (Countries, Cities, States,
     IataAreas, Airlines, RouteSegments, …):

     .td-mobile-hide   Put on a <td> that's a genuinely separate desktop
                        column (e.g. a standalone "Persian Name" column)
                        but is redundant in card mode once its value has
                        been folded into another cell via .mobile-paren
                        below. Hidden only here — the desktop <table>
                        column is untouched.
     .mobile-paren      Hidden on desktop (where the two columns already
                        read fine side by side); shown inline, muted, only
                        in card mode — so "Bahrain" + a separate "بحرین"
                        column becomes one line, "Bahrain (بحرین)".
     [data-pair]         Add alongside data-label on two adjacent short/
                        tag-style columns (e.g. Region + IATA Area, or a
                        run of capability badges) so they sit two-per-row
                        instead of each claiming a full-width dashed row.

     A page-level "display order" column doesn't need this at all — just
     reassign it from data-label to the existing data-meta role (see
     above) with a sort-icon + number instead of a text label; it's purely
     an admin sort key, not something worth a whole row on a phone. ── */
  .table--responsive-cards td.td-mobile-hide { display: none; }
  .mobile-paren { display: inline; }
  .table--responsive-cards td[data-label][data-pair] {
    flex: 1 1 calc(50% - var(--space-3) / 2);
  }
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1.5;
}

.badge-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.badge-remove-btn:hover { opacity: 1; }

.badge-primary { background: var(--color-primary-100); color: var(--color-primary-700); }
.badge-success { background: var(--color-success-50); color: var(--color-success-700); }
.badge-warning { background: var(--color-warning-50); color: var(--color-warning-600); }
.badge-danger  { background: var(--color-danger-50);  color: var(--color-danger-700); }
.badge-info    { background: var(--color-info-50);    color: var(--color-info-600); }
.badge-neutral { background: var(--bg-surface-sunken); color: var(--text-secondary); border: 1px solid var(--border-default); }

[data-theme="dark"] .badge-primary { background: rgba(33,160,173,.18); color: var(--color-primary-300); }
[data-theme="dark"] .badge-success { background: rgba(47,174,118,.18); color: #86dcb4; }
[data-theme="dark"] .badge-warning { background: rgba(245,165,36,.18); color: #ffd485; }
[data-theme="dark"] .badge-danger  { background: rgba(227,93,93,.18); color: #f4a9a9; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  border: 1px solid transparent;
  animation: field-message-in var(--duration-normal) var(--ease-out);
}

.alert-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.alert-body { flex: 1; }
.alert-title { font-weight: var(--font-semibold); margin-bottom: 2px; }

.alert-success { background: var(--color-success-50); border-color: var(--color-success-500); color: var(--color-success-700); }
.alert-warning { background: var(--color-warning-50); border-color: var(--color-warning-500); color: var(--color-warning-600); }
.alert-danger  { background: var(--color-danger-50);  border-color: var(--color-danger-500);  color: var(--color-danger-700); }
.alert-info    { background: var(--color-info-50);    border-color: var(--color-info-500);    color: var(--color-info-600); }

/* ── Modal ──────────────────────────────────────────────────────────────── */

/* Backdrop — frosted glass overlay */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  /* Rich dark tint + blur — content behind is visible but clearly deemphasised */
  background: rgba(10, 12, 20, 0.50);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  animation: modal-backdrop-enter 0.20s ease both;
}

@keyframes modal-backdrop-enter {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Panel */
.modal {
  background: var(--bg-surface);
  border-radius: 18px;
  /* Layered shadow — deep lift */
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.07),
    0 2px 4px  rgba(0, 0, 0, 0.06),
    0 8px 20px rgba(0, 0, 0, 0.12),
    0 24px 48px rgba(0, 0, 0, 0.16);
  border: 1px solid var(--border-default);
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Slide up + subtle scale — same pattern as Linear / Vercel */
  animation: modal-panel-enter 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
  transform-origin: center 60%;
}

@keyframes modal-panel-enter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.975);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Size variants */
.modal-sm   { max-width: 400px; }
.modal-lg   { max-width: 740px; }
.modal-xl   { max-width: 980px; }
.modal-full {
  max-width:  calc(100dvw - var(--space-8));
  max-height: calc(100dvh - var(--space-6));
  border-radius: 14px;
}

/* Header */
.modal-header {
  padding: var(--space-5) var(--space-5) var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  /* Very subtle top gradient on the header — adds depth */
  background: linear-gradient(
    to bottom,
    var(--bg-surface-raised) 0%,
    var(--bg-surface) 100%
  );
}

.modal-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Close button — always top-right, pill shape */
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-surface-sunken);
  border-color: var(--border-default);
}

.modal-close:active {
  transform: scale(0.93);
}

/* Body */
.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
}

/* Thin, elegant scrollbar inside modal */
.modal-body::-webkit-scrollbar {
  width: 5px;
}
.modal-body::-webkit-scrollbar-track {
  background: transparent;
  margin: var(--space-2) 0;
}
.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 99px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* Footer */
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-shrink: 0;
  background: var(--bg-surface-sunken);
}

/* Dark-mode refinements */
[data-theme="dark"] .modal {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.07),
    0 2px 4px  rgba(0, 0, 0, 0.30),
    0 12px 28px rgba(0, 0, 0, 0.45),
    0 32px 64px rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.65);
}

/* ══════════════════════════════════════════════════════════════════════════
   Reconnect overlay (#components-reconnect-modal, markup in App.razor)
   Blazor adds components-reconnect-show / -failed / -rejected to the root;
   each class reveals its own .reconnect__state panel.
   ══════════════════════════════════════════════════════════════════════════ */
.reconnect {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-overlay) + 10);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: rgba(10, 12, 20, 0.45);
  backdrop-filter: blur(6px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
}

.reconnect.components-reconnect-show,
.reconnect.components-reconnect-failed,
.reconnect.components-reconnect-rejected {
  display: flex;
  /* Short network blips reconnect within a second — hold the overlay back
     so they never flash a dialog at the user. */
  animation: fadeIn var(--duration-normal) var(--ease-out) 400ms both;
}

.reconnect.components-reconnect-failed,
.reconnect.components-reconnect-rejected { animation-delay: 0ms; }

.reconnect__panel {
  width: 100%;
  max-width: 380px;
  padding: var(--space-8) var(--space-6) var(--space-6);
  border-radius: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-2xl);
  text-align: center;
  animation: modal-panel-enter var(--duration-slow) var(--ease-out) 400ms both;
}

.reconnect__state { display: none; flex-direction: column; align-items: center; gap: var(--space-3); }
.components-reconnect-show     .reconnect__state--show,
.components-reconnect-failed   .reconnect__state--failed,
.components-reconnect-rejected .reconnect__state--rejected { display: flex; }

.reconnect__icon {
  width: 56px;
  height: 56px;
  margin-bottom: var(--space-1);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-50);
}
.reconnect__icon--warn {
  background: var(--color-warning-50);
  color: var(--color-warning-600);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
}
.reconnect__title   { font-size: var(--text-lg); }
.reconnect__message { font-size: var(--text-sm); color: var(--text-secondary); margin: 0; }
.reconnect__attempt { font-size: var(--text-xs); color: var(--text-tertiary); margin: 0; font-variant-numeric: tabular-nums; }
.reconnect .btn     { margin-top: var(--space-2); min-width: 160px; }

/* ══════════════════════════════════════════════════════════════════════════
   Command Palette (.cmdk) — Ctrl+K / "/" quick navigation
   ══════════════════════════════════════════════════════════════════════════ */
.cmdk-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh var(--space-5) var(--space-5);
  background: rgba(10, 12, 20, 0.50);
  backdrop-filter: blur(10px) saturate(160%);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  /* Deliberately no open animation — the palette is keyboard-driven (Ctrl+K
     / "/") and used many times a day; any entrance delay makes it feel slow.
     Raycast / Linear do the same. */
}

.cmdk {
  width: 100%;
  max-width: 560px;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.07),
    0 8px 20px rgba(0, 0, 0, 0.12),
    0 24px 48px rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

[data-theme="dark"] .cmdk {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.07),
    0 12px 28px rgba(0, 0, 0, 0.45),
    0 32px 64px rgba(0, 0, 0, 0.35);
}

.cmdk__input {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-default);
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.cmdk__input input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--text-md);
  color: var(--text-primary);
  font-family: inherit;
}

.cmdk__input input::placeholder { color: var(--text-tertiary); }

.cmdk__kbd {
  font-size: 10px;
  color: var(--text-tertiary);
  border: 1px solid var(--border-default);
  border-radius: 5px;
  padding: 1px 6px;
  flex-shrink: 0;
}

.cmdk__list {
  overflow-y: auto;
  padding: var(--space-2);
}

.cmdk__group {
  padding: var(--space-3) var(--space-3) var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.cmdk__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.cmdk__item.sel,
.cmdk__item:hover {
  background: var(--bg-surface-sunken);
}

/* Selected row gets a brand accent bar so the keyboard cursor is obvious at
   a glance, not just a faint grey wash. */
.cmdk__item.sel {
  box-shadow: inset 3px 0 0 var(--color-primary-500);
}
[dir="rtl"] .cmdk__item.sel {
  box-shadow: inset -3px 0 0 var(--color-primary-500);
}

.cmdk__item-label { flex: 1; }

.cmdk__item-go {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.cmdk__foot {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-default);
  background: var(--bg-surface-sunken);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.cmdk__foot kbd {
  border: 1px solid var(--border-default);
  border-radius: 4px;
  padding: 0 5px;
  margin-inline-end: 2px;
  font-family: var(--font-mono);
}

/* ══════════════════════════════════════════════════════════════════════════
   SearchableSelect  (.ss)
   Enterprise combobox — replaces <select> for all large lookup lists.
   States: closed (.ss-trigger) → open (.ss--open: search box + dropdown)
   ══════════════════════════════════════════════════════════════════════════ */

/* Container — must be position:relative so dropdown anchors to it */
.ss {
  position: relative;
  display: block;
  width: 100%;
}

/* ── CLOSED TRIGGER ─────────────────────────────────────────────────────── */

/* .ss-trigger is now a plain <div> wrapper, not a <button> — the clear (X)
   badge used to be nested INSIDE this button, which is invalid HTML (buttons
   can't contain interactive content) and caused real, hard-to-kill focus/
   click-bubbling bugs (clicking the badge kept re-opening the dropdown with
   the old value still selected). .ss-trigger-open below is the actual
   clickable button now; the clear badge and caret are its SIBLINGS, not its
   children, so there is no nesting ambiguity at all. */
.ss-trigger {
  width: 100%;
  height: var(--input-height, 38px);
  padding: 0 var(--space-3) 0 var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-input, var(--bg-surface));
  border: 1px solid var(--border-input, var(--border-default));
  border-radius: var(--radius-md);
  text-align: start;
  color: var(--text-primary);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-size: var(--text-sm);
  min-width: 0;
}

.ss-trigger:hover {
  border-color: var(--color-primary-400);
}

.ss-trigger:focus-within {
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
}

.ss-trigger-open {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  text-align: start;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.ss-trigger-open:disabled {
  cursor: not-allowed;
}

.ss-trigger-open:focus-visible {
  outline: none;
}

.ss-trigger-placeholder {
  flex: 1;
  color: var(--text-placeholder, var(--text-tertiary));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ss-trigger-code {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-primary-600);
  background: var(--color-primary-50);
  border: 1px solid var(--color-primary-100);
  padding: 1px 6px;
  border-radius: 5px;
}

.ss-trigger-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.ss-caret {
  flex-shrink: 0;
  color: var(--text-tertiary);
  margin-inline-start: auto;
  transition: transform 0.15s ease;
}

.ss--open .ss-caret {
  transform: rotate(180deg);
}

/* Clear (X) badge on the closed trigger, shown only when a value is selected —
   takes over the auto-margin push so it and the caret sit together at the
   trailing edge (the caret's own auto-margin would otherwise split the free
   space between the two, spreading them apart). */
.ss-trigger-clear {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text-tertiary);
  cursor: pointer;
  margin-inline-start: auto;
  transition: background 0.12s ease, color 0.12s ease;
}

.ss-trigger-clear:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.ss-trigger-clear:hover {
  background: var(--bg-surface-sunken);
  color: var(--text-primary);
}

.ss-trigger-clear ~ .ss-caret {
  margin-inline-start: 0;
}

/* ── OPEN STATE — SEARCH INPUT ──────────────────────────────────────────── */

.ss-search-box {
  width: 100%;
  height: var(--input-height, 38px);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  background: var(--bg-input, var(--bg-surface));
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-md);
  box-shadow: var(--focus-ring);
}

.ss-search-icon {
  flex-shrink: 0;
  color: var(--color-primary);
}

.ss-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-width: 0;
}

.ss-search-input::placeholder {
  color: var(--text-placeholder, var(--text-tertiary));
}

.ss-clear-btn {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  background: transparent;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.ss-clear-btn:hover {
  background: var(--bg-surface-sunken);
  color: var(--text-primary);
}

/* Click-outside close is handled by a document-level JS listener
   (FlightBarN.addSsOutsideClickListener) instead of a full-viewport overlay
   div — a fixed overlay covering the page was found to swallow wheel-scroll
   on the page behind it once .main-content became the sole scrolling
   element. See SearchableSelect.razor. */

/* ── DROPDOWN ───────────────────────────────────────────────────────────── */

.ss-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline: 0;
  z-index: 100;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow:
    0 4px 6px -2px rgba(0,0,0,0.05),
    0 10px 24px -4px rgba(0,0,0,0.12),
    0 20px 40px -8px rgba(0,0,0,0.08);
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-1);
  /* Smooth appear, growing out of the trigger above it */
  animation: ss-dropdown-enter var(--duration-fast) var(--ease-out) both;
  transform-origin: top center;
}

@keyframes ss-dropdown-enter {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* Thin elegant scrollbar */
.ss-dropdown::-webkit-scrollbar { width: 4px; }
.ss-dropdown::-webkit-scrollbar-track { background: transparent; }
.ss-dropdown::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 99px;
}

/* ── OPTION BUTTON ──────────────────────────────────────────────────────── */

.ss-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 7px var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  text-align: start;
  cursor: pointer;
  background: transparent;
  color: var(--text-primary);
  transition: background 0.10s ease;
  min-width: 0;
}

.ss-option:hover,
.ss-option--focused {
  background: var(--bg-surface-hover, var(--bg-surface-sunken));
}

.ss-option--selected {
  background: var(--color-primary-50);
  color: var(--color-primary-700);
  font-weight: 500;
}

.ss-option--selected.ss-option--focused,
.ss-option--selected:hover {
  background: var(--color-primary-100);
}

.ss-option-code {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-primary-600);
  background: var(--color-primary-50);
  border: 1px solid var(--color-primary-100);
  padding: 1px 6px;
  border-radius: 4px;
  min-width: 36px;
  text-align: center;
}

.ss-option--selected .ss-option-code {
  background: var(--color-primary-100);
  border-color: var(--color-primary-200);
}

.ss-option-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ss-option-check {
  flex-shrink: 0;
  color: var(--color-primary);
  margin-inline-start: auto;
}

/* ── EMPTY STATE ────────────────────────────────────────────────────────── */

.ss-empty {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  justify-content: center;
}

.ss-empty em { color: var(--text-secondary); font-style: normal; font-weight: 500; }

/* ── OVERFLOW COUNT ─────────────────────────────────────────────────────── */

.ss-count {
  padding: var(--space-2) var(--space-3);
  font-size: 0.72rem;
  color: var(--text-tertiary);
  text-align: center;
  border-top: 1px solid var(--border-default);
  margin-top: var(--space-1);
}

/* ── DISABLED ───────────────────────────────────────────────────────────── */

.ss--disabled { pointer-events: none; opacity: 0.55; }

/* ── DARK MODE ──────────────────────────────────────────────────────────── */

[data-theme="dark"] .ss-dropdown {
  box-shadow:
    0 4px 6px rgba(0,0,0,0.25),
    0 12px 28px rgba(0,0,0,0.40);
  border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .ss-option--selected {
  background: rgba(var(--color-primary-rgb, 59,130,246), 0.15);
  color: var(--color-primary-300);
}

[data-theme="dark"] .ss-trigger-code,
[data-theme="dark"] .ss-option-code {
  background: rgba(var(--color-primary-rgb, 59,130,246), 0.12);
  border-color: rgba(var(--color-primary-rgb, 59,130,246), 0.25);
  color: var(--color-primary-300);
}

/* ── Toast Notifications ────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  inset-inline-end: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 280px;
  max-width: 380px;
  pointer-events: auto;
  /* Rises from the bottom where the stack lives (direction-agnostic, so it
     reads the same in LTR and RTL) and leaves sideways toward the screen
     edge it is docked to — enter and exit stay spatially consistent. */
  --toast-exit-x: 24px;
  /* `backwards`, not `both`: a forwards fill would pin opacity/transform at
     the keyframe's end values and override the .toast--leaving exit
     transition below. */
  animation: toast-enter 360ms var(--ease-out) backwards;
  transition:
    opacity var(--duration-normal) var(--ease-out),
    transform var(--duration-normal) var(--ease-out);
  border-inline-start-width: 3px;
}

[dir="rtl"] .toast { --toast-exit-x: -24px; }

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Set by ToastService ~200ms before the toast is removed from the DOM. */
.toast--leaving {
  opacity: 0;
  transform: translateX(var(--toast-exit-x)) scale(.98);
  pointer-events: none;
}

.toast--success { border-inline-start-color: var(--color-success-500); }
.toast--warning { border-inline-start-color: var(--color-warning-500); }
.toast--danger  { border-inline-start-color: var(--color-danger-500); }
.toast--info    { border-inline-start-color: var(--color-info-500); }

.toast__icon { flex-shrink: 0; width: 20px; height: 20px; }
.toast__body { flex: 1; }
.toast__title { font-weight: var(--font-semibold); font-size: var(--text-sm); }
.toast__message { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 2px; }
.toast__close { flex-shrink: 0; cursor: pointer; color: var(--text-tertiary); }
.toast__close:hover { color: var(--text-primary); }

.toast--success .toast__icon { color: var(--color-success-500); }
.toast--warning .toast__icon { color: var(--color-warning-500); }
.toast--danger  .toast__icon { color: var(--color-danger-500); }
.toast--info    .toast__icon { color: var(--color-info-500); }

/* ── Page Loader ────────────────────────────────────────────── */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-surface);
  z-index: var(--z-overlay);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  /* Held back 150ms: quick operations finish before the overlay would show,
     so it never flashes the whole screen white for a blink. */
  animation: fadeIn var(--duration-normal) var(--ease-out) 150ms both;
}

.page-loader__logo {
  width: 48px;
  height: 48px;
  background: var(--color-primary-600);
  border-radius: var(--radius-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: #fff;
}

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-top-color: var(--color-primary-600);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

/* ── Loading overlay ────────────────────────────────────────── */
/* Covers a card/section while a background operation runs, so it's obvious the app
   is working (vs. stuck) instead of only a small spinner inside a disabled button. */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  z-index: 5;
  border-radius: inherit;
  animation: fadeIn var(--duration-normal) var(--ease-out) 120ms both;
}

.loading-overlay__text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ── Skeleton Loading ───────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--border-default) 25%,
    var(--bg-surface-sunken) 50%,
    var(--border-default) 75%
  );
  background-size: 200% 100%;
  border-radius: var(--radius-md);
  animation: shimmer 1.5s infinite;
}

.skeleton-text { height: 14px; margin-bottom: var(--space-2); }
.skeleton-text:last-child { width: 60%; }
.skeleton-circle { border-radius: 50%; }
.skeleton-card { height: 120px; border-radius: var(--radius-xl); }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs { border-bottom: 2px solid var(--border-default); display: flex; gap: 0; }

.tab {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.tab:hover { color: var(--text-primary); background: linear-gradient(to top, var(--bg-surface-sunken), transparent); }
.tab.active { color: var(--color-primary-600); border-bottom-color: var(--color-primary-600); }
[data-theme="dark"] .tab.active { color: var(--color-primary-400); border-bottom-color: var(--color-primary-400); }

/* Tab content settles in when switching tabs — the change of context is
   felt without slowing anyone down (opacity + a few px only). */
.tab-panel,
[role="tabpanel"] {
  animation: tab-panel-in var(--duration-normal) var(--ease-out);
}

@keyframes tab-panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
  animation: empty-state-in 320ms var(--ease-out) both;
}

@keyframes empty-state-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Recent Activity list (dashboard) ──────────────────────────────────── */
.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.activity-list__item + .activity-list__item {
  border-top: 1px solid var(--border-default);
}
.activity-list__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  color: inherit;
  text-decoration: none;
  transition: background-color var(--transition-fast);
}
.activity-list__link:hover {
  background: var(--bg-surface-sunken);
  color: inherit;
}
.activity-list__icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.activity-list__icon--primary { background: var(--color-primary-50); color: var(--color-primary-600); }
.activity-list__icon--success { background: var(--color-success-50); color: var(--color-success-700); }
.activity-list__icon--danger  { background: var(--color-danger-50);  color: var(--color-danger-700); }
.activity-list__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.activity-list__text {
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.activity-list__meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}
.activity-list__time {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
}

.empty-state__icon {
  width: 64px;
  height: 64px;
  color: var(--text-disabled);
  margin-bottom: var(--space-4);
}

.empty-state__title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state__message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 400px;
  margin-bottom: var(--space-6);
}

/* ── Avatar ─────────────────────────────────────────────────── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background-color: var(--color-primary-100);
  color: var(--color-primary-700);
  font-weight: var(--font-semibold);
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-xs  { width: 24px; height: 24px; font-size: var(--text-xs); }
.avatar-sm  { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-md  { width: 40px; height: 40px; font-size: var(--text-sm); }
.avatar-lg  { width: 48px; height: 48px; font-size: var(--text-md); }
.avatar-xl  { width: 64px; height: 64px; font-size: var(--text-lg); }
.avatar-2xl { width: 96px; height: 96px; font-size: var(--text-2xl); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Dropdown ───────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-1));
  inset-inline-end: 0;
  min-width: 180px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  overflow: hidden;
  /* Grows out of its trigger (top, inline-end corner), never from centre. */
  animation: dropdown-enter var(--duration-normal) var(--ease-out) both;
  transform-origin: top right;
}

@keyframes dropdown-enter {
  from { opacity: 0; transform: translateY(-4px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

[dir="rtl"] .dropdown-menu { transform-origin: top left; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.dropdown-item:hover { background-color: var(--bg-surface-sunken); }
.dropdown-item.danger { color: var(--color-danger-600); }

.dropdown-item.active { color: var(--color-primary-600); font-weight: var(--font-medium); }
.lang-native-name { flex: 1; }
.dropdown-item.danger:hover { background-color: var(--color-danger-50); }
.dropdown-divider { height: 1px; background: var(--border-default); margin: var(--space-1) 0; }
.dropdown-header { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); font-weight: var(--font-semibold); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .06em; }

/* ── Progress ───────────────────────────────────────────────── */
.progress-bar-track {
  height: 6px;
  background: var(--border-default);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--color-primary-600);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

/* ── Nav-item tooltip (collapsed sidebar only) ──────────────────
   A real DOM node appended to <body> by app.js (showNavTooltip/hideNavTooltip),
   not a ::after pseudo-element on the nav item itself. .sidebar/.sidebar__nav
   both need overflow:hidden for the width-collapse transition and internal
   scrolling — a tooltip positioned as their descendant gets clipped/hidden the
   moment it needs to extend past the collapsed sidebar's narrow width, however
   it's positioned. A node in <body> is never a descendant of the clipped
   container, so it's never subject to that overflow regardless of position. */
.nav-tooltip {
  position: fixed;
  /* Always the dark chip, in both themes — it sits next to the dark rail. */
  background: #1b242e;
  color: #eef3f7;
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: var(--z-tooltip);
  transform: translate(-4px, -50%);
  transition: opacity 125ms var(--ease-out), transform 125ms var(--ease-out);
}
.nav-tooltip.nav-tooltip--rtl { transform: translate(4px, -50%); }
.nav-tooltip.visible { opacity: 1; transform: translate(0, -50%); }

/* Arrow pointing back at the rail. */
.nav-tooltip::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -5px;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  background: inherit;
  border-left: 1px solid rgba(255, 255, 255, .08);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  transform: rotate(45deg);
}
.nav-tooltip.nav-tooltip--rtl::before {
  left: auto;
  right: -5px;
  transform: rotate(-135deg);
}

/* ── Auth Layout ────────────────────────────────────────────── */
.auth-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-app);
}

.auth-shell__brand {
  background: linear-gradient(135deg, var(--color-primary-700), var(--color-primary-900));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-16);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.auth-shell__brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: .5;
}

.auth-shell__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-8);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-default);
}

/* Slide-indicator dots for the mobile KPI carousel — hidden by default,
   shown only inside the mobile media query below (desktop shows the full
   4-up grid, no carousel, so no dots). */
.carousel-dots { display: none; }

/* Compact "3/12" pagination indicator — hidden by default, shown only on
   mobile (see the mobile media query below) in place of "Page 3 of 12". */
.pagination-footer__page-compact { display: none; }

/* Placed after the base rules above so the cascade actually applies —
   a same-specificity override defined earlier in source order than the
   base rule it targets loses the cascade regardless of the media query. */
@media (max-width: 768px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-shell__brand { display: none; }
}

/* ── Divider ────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-5) 0;
}

.divider-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0;
}

.divider-label::before, .divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-default);
}

.divider-label span {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  justify-content: center;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--bg-surface);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--duration-press) var(--ease-out);
  padding: 0 var(--space-2);
  font-variant-numeric: tabular-nums;
}

.page-btn:hover { border-color: var(--color-primary-500); color: var(--color-primary-600); }
.page-btn:active:not(:disabled) { transform: scale(0.94); }
.page-btn.active { background: var(--color-primary-600); border-color: var(--color-primary-600); color: #fff; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

@keyframes modal-sheet-enter {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* ── Reduced motion ─────────────────────────────────────────────
   For people who asked the OS for less motion (vestibular disorders,
   motion sickness): every movement/scale animation becomes a short plain
   fade — reduced, not removed, so state changes are still perceivable.
   Spinners keep turning (they communicate "working"), only slower. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }

  .modal, .modal-backdrop, .toast, .dropdown-menu, .ss-dropdown,
  .grid-filter-popover, .empty-state, .page-loader, .sidebar-backdrop {
    animation: fadeIn 140ms linear both !important;
  }

  .toast {
    transition: opacity 140ms linear !important;
  }
  .toast--leaving { transform: none; }

  .spinner {
    animation: spin 1.4s linear infinite !important;
  }

  .skeleton {
    animation: none !important;
  }

  .btn:active, .nav-item:active, .quick-link-tile:active,
  .segmented__option:active, .page-btn:active, .topbar__action-btn:active,
  .attachment-card:active {
    transform: none !important;
  }
}

/* ── Utilities ──────────────────────────────────────────────── */
.d-flex        { display: flex; }
.d-grid        { display: grid; }
.d-block       { display: block; }
.d-inline      { display: inline; }
.d-inline-flex { display: inline-flex; }
.d-none        { display: none !important; }

.flex-1   { flex: 1; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }

.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

.pt-4 { padding-top: var(--space-4); }
.pb-4 { padding-bottom: var(--space-4); }
.px-4 { padding-inline: var(--space-4); }
.py-3 { padding-block: var(--space-3); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.ms-auto { margin-inline-start: auto; }
.me-auto { margin-inline-end: auto; }

.text-start   { text-align: start; }
.text-center  { text-align: center; }
.text-end     { text-align: end; }
.text-xs      { font-size: var(--text-xs); }
.text-sm      { font-size: var(--text-sm); }
.text-md      { font-size: var(--text-md); }
.text-lg      { font-size: var(--text-lg); }
.font-medium  { font-weight: var(--font-medium); }
.font-semibold{ font-weight: var(--font-semibold); }
.font-bold    { font-weight: var(--font-bold); }
.text-muted   { color: var(--text-secondary); }
.text-primary-color { color: var(--color-primary-600); }
.text-danger  { color: var(--color-danger-600); }
.text-success { color: var(--color-success-600); }
.text-warning { color: var(--color-warning-600); }

.w-full  { width: 100%; }
.h-full  { height: 100%; }
.min-h-0 { min-height: 0; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rounded-full { border-radius: var(--radius-full); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-xl   { border-radius: var(--radius-xl); }

.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

.cursor-pointer { cursor: pointer; }
.select-none    { user-select: none; }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.border-b    { border-bottom: 1px solid var(--border-default); }
.border-t    { border-top: 1px solid var(--border-default); }
.border      { border: 1px solid var(--border-default); }

.opacity-50  { opacity: .5; }
.opacity-75  { opacity: .75; }

/* ── Responsive ─────────────────────────────────────────────── */
/* NOTE: there used to be a @media (max-width: 1024px) rule here that force-
   collapsed the sidebar at tablet widths, unconditionally, regardless of the
   .sidebar-collapsed class. Because it targeted the same elements as the
   manual collapse toggle with equal-or-higher specificity, it silently made
   the Collapse/Expand button a no-op on any window narrower than 1024px
   (including many non-maximized laptop windows). Removed — the manual
   .app-shell.sidebar-collapsed toggle now works at every width down to the
   768px breakpoint below, where the sidebar switches to an off-canvas drawer. */

@media (max-width: 768px) {
  /* The fixed bottom nav replaces the footer's role on mobile — the footer
     row is dropped entirely to avoid a confusing double bar.
     minmax(0, 1fr) — NOT bare 1fr — because a bare 1fr track's implicit
     minimum is auto (content-based): any wide descendant (a KPI row, a
     dense table) would force this single track past the viewport width,
     silently clipped rather than scrolled since overflow-x is hidden. */
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--topbar-height) 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }
  .sidebar {
    position: fixed;
    inset-inline-start: calc(-1 * var(--sidebar-width));
    width: var(--sidebar-width) !important;
    z-index: var(--z-drawer);
    transition: inset-inline-start 320ms var(--ease-drawer);
  }
  .sidebar.mobile-open {
    box-shadow: var(--shadow-2xl);
  }
  .sidebar.mobile-open {
    inset-inline-start: 0;
  }
  .sidebar__logo-text, .nav-item__label, .sidebar__section-label { display: initial; }
  .main-content { padding: var(--space-4); padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + var(--space-8)); }
  /* No sidebar column left to reserve (off-canvas drawer instead), and the persistent
     .footer row is dropped in favor of .bottom-nav here (see its own comment above) —
     clear that instead of --footer-height. */
  .sticky-actions-bar {
    inset-inline-start: 0;
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  }
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }

  /* Below 768px the sidebar becomes an off-canvas drawer, but it's opened via
     BottomNav's "More" button instead of a topbar hamburger — a second
     redundant control just eats space the quick-search box can use.
     .topbar__search is flex:1, so it grows to fill the freed width. */
  .topbar__toggle { display: none; }
  .sidebar__footer { display: none; }
  .footer { display: none; }

  /* Tighter topbar on narrow phones — less side padding, and the "Ctrl K"
     shortcut hint is meaningless without a physical keyboard, so it's
     dropped instead of eating space the search placeholder needs. The
     action icons/avatar never shrink (small, and more important to stay
     fully reachable than the search placeholder text is to stay unclipped). */
  .topbar { padding: 0 var(--space-3); gap: var(--space-2); }
  .topbar__search-trigger .cmdk__kbd { display: none; }
  .topbar__actions { flex-shrink: 0; }

  /* Dimmed backdrop behind the off-canvas drawer — tap outside to close. */
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-drawer) - 1);
    background: rgba(10, 12, 20, 0.50);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: modal-backdrop-enter 0.20s ease both;
  }
  [data-theme="dark"] .sidebar-backdrop { background: rgba(0, 0, 0, 0.65); }

  /* .topbar and .bottom-nav both use var(--z-sticky) — with equal z-index,
     the one later in DOM order wins ties, which is .bottom-nav here. That
     traps every dropdown opened from the topbar (language switcher,
     notifications, profile menu) inside the topbar's stacking context,
     permanently behind the bottom nav, no matter what z-index the dropdown
     itself uses. Bumping the topbar above it (but still below the
     off-canvas drawer's --z-drawer, which must stay on top of everything
     when open) fixes every topbar dropdown at once. */
  .topbar { z-index: 250; }

  /* ── Bottom Nav ─────────────────────────────────────────────── */
    .bottom-nav {
        direction: ltr;
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        z-index: var(--z-sticky);
        display: flex;
        align-items: stretch;
        height: var(--bottom-nav-height);
        padding-bottom: env(safe-area-inset-bottom);
        background: var(--bg-surface);
        border-top: 1px solid var(--border-1, var(--color-border));
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    }
  [data-theme="dark"] .bottom-nav { box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3); }

  .bottom-nav__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-secondary);
    font-size: var(--text-xs, 0.72rem);
    transition: color var(--transition-fast), transform var(--duration-press) var(--ease-out);
    min-width: 0;
  }
  .bottom-nav__item:active { transform: scale(0.94); }
  .bottom-nav__item:not(.bottom-nav__item--center).active svg {
    animation: icon-swap-in var(--duration-normal) var(--ease-out);
  }
  .bottom-nav__item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .bottom-nav__item.active,
  .bottom-nav__item:hover {
    color: var(--color-primary-600);
  }

  /* ── Center item — raised neon diamond (Dashboard) ────────────────────
     A rotated square renders as a diamond; the icon is counter-rotated
     back to upright. No text label — the shape is absolutely positioned
     and centered on its own, independent of any normal-flow content, so
     it displays fully regardless of label length in either language.
     Positioned to poke above the bar's top edge like a FAB notch, with a
     glow ring matching the button accent color. */
  .bottom-nav__item--center {
    position: relative;
    color: var(--text-secondary);
  }
  .bottom-nav__center-shape {
    position: absolute;
    top: -14px;
    /* Deliberately the physical `left`, not the logical inset-inline-start —
       horizontal centering must NOT flip with direction. inset-inline-start
       flips to `right` in RTL while translateX(-50%) stays a physical
       leftward shift either way, so the two combined double up instead of
       cancelling out, landing the shape off-center toward Manifest in RTL. */
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary-400), var(--color-primary-700));
    box-shadow:
      0 0 0 4px var(--bg-surface),
      0 4px 10px rgba(var(--color-primary-rgb), .5),
      0 0 16px rgba(var(--color-primary-rgb), .55),
      inset 0 1px 0 rgba(255, 255, 255, .35);
    transition: box-shadow var(--transition-fast), background var(--transition-fast);
  }
  .bottom-nav__center-shape svg {
    transform: rotate(-45deg);
    color: #fff;
  }
  .bottom-nav__item--center.active .bottom-nav__center-shape,
  .bottom-nav__item--center:hover .bottom-nav__center-shape {
    box-shadow:
      0 0 0 4px var(--bg-surface),
      0 4px 14px rgba(var(--color-primary-rgb), .65),
      0 0 22px rgba(var(--color-primary-rgb), .75),
      inset 0 1px 0 rgba(255, 255, 255, .45);
  }
  .bottom-nav__item--center.active,
  .bottom-nav__item--center:hover {
    color: var(--color-primary-600);
  }

  /* ── Page header — stacks on mobile, actions become a full-width row ── */
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }
  .page-header__actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .page-header__actions .btn {
    /* Two per row instead of forcing every button onto one squeezed row —
       pages with 4+ conditional actions (e.g. AWB Detail once Arrived/
       Delivered/Amend/Print/Back are all visible at once) were shrinking
       buttons past the point of being legible or tappable. */
    flex: 1 1 calc(50% - var(--space-2) / 2);
    justify-content: center;
    min-height: 44px;
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
  }

  /* ── AWB Detail workflow actions — the single primary next-step button
     (Issue / Mark Delivered) gets its own full-width row and is pushed to
     the top of the stack via `order`, so it reads as the one obvious
     thing to do; everything else (Back, Print, Amend, Mark Arrived) shares
     the 2-per-row grid below it. Scoped to the --workflow modifier (only
     AWB Detail's action bar carries it) — every other page's page-header
     also has exactly one .btn-primary (its "New X" button), which must
     stay a normal 50%-grid tile, not blow up to full width. ── */
  .page-header__actions--workflow .btn-primary {
    order: -1;
    flex: 1 1 100%;
  }

  /* The overflow ("more actions") trigger is a small square icon button,
     not a 50%-wide grid tile — it opts out of the rule above entirely.
     Higher specificity (child combinator) wins regardless of source order. */
  .page-header__actions--workflow .dropdown {
    flex: 0 0 auto;
  }
  .page-header__actions--workflow .dropdown > .btn {
    flex: 0 0 auto;
    width: 44px;
    padding: 0;
  }

  /* ── KPI row — horizontal snap carousel instead of a cramped 2-column
     grid. Scoped to .kpi-row (opt-in on top of the generic .grid-cols-N
     utility) — used by Dashboard and Reports, and any future page with a
     row of stat-cards. ── */
  .kpi-row {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--space-4);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: var(--space-3);
    margin-inline: calc(-1 * var(--space-4));
    padding-inline: var(--space-4);
    padding-bottom: var(--space-2);
  }
  .kpi-row::-webkit-scrollbar { display: none; }
  /* Exactly 2 whole cards fill the content width (flush with the page's
     left/right edges, same as every other container) — no partial card
     peeking at the trailing edge. A dot indicator below communicates that
     more cards are reachable by swiping. */
  .kpi-row .stat-card {
    flex: 0 0 calc((100% - var(--space-3)) / 2);
    scroll-snap-align: start;
  }
  .carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: var(--space-2);
    margin-bottom: var(--space-2);
  }
  .carousel-dots__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-1, var(--color-border));
    transition: background-color .2s ease, width .2s ease;
  }
  .carousel-dots__dot.active {
    background: var(--color-primary-600);
    width: 16px;
    border-radius: var(--radius-full);
  }

  /* ── Rate Calculator — input card and result panel stack full-width;
     the weight-facts strip becomes a tidy 2-column grid instead of wrap. ── */
  .rate-calc-layout > .card:first-child {
    flex: 1 1 100% !important;
    min-width: 0 !important;
  }
  .rate-calc-layout > div[style*="flex: 1"] {
    flex: 1 1 100% !important;
    min-width: 0 !important;
  }

  /* ── Price Formulas — list card and the detail/tester side panel stack
     full-width instead of squeezing side by side into a narrow screen. ── */
  .price-formulas-layout {
    flex-direction: column;
  }
  .price-formulas-layout > .card {
    flex: 1 1 100% !important;
    min-width: 0 !important;
    width: 100%;
  }

  /* ── AWB Detail / AWB New wizard step 1 — Shipper/Consignee cards stack
     full-width instead of each keeping a 340-360px minimum, which alone
     exceeds most phone viewport widths and was silently clipped by the
     overflow-x: hidden safety net rather than reachable by scrolling. ── */
  .awb-detail-layout > .card,
  .awb-new-layout > .card {
    flex: 1 1 100% !important;
    min-width: 0 !important;
  }

  /* ── Pagination footer — one compact row: rows-per-page select, a short
     "3/12" page indicator instead of "Page 3 of 12", and icon-only
     prev/next. Verbose labels that made this tall/wrap on narrow screens
     are dropped entirely rather than shrunk. ── */
  .pagination-footer {
    flex-wrap: nowrap;
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
  }
  .pagination-footer__left,
  .pagination-footer__right {
    flex-wrap: nowrap;
    gap: var(--space-2);
  }
  .pagination-footer__total,
  .pagination-footer__rows-label,
  .pagination-footer__page-text {
    display: none;
  }
  .pagination-footer__page-compact {
    display: inline-block;
    font-variant-numeric: tabular-nums;
  }
  .pagination-footer select {
    height: 30px;
    font-size: var(--text-xs);
    padding: 0 var(--space-1);
    min-width: 44px;
  }
  .pagination-footer .btn-xs {
    width: 30px;
    height: 30px;
    padding: 0;
  }

  /* ── Filter bars (search + selects + Clear) — the search box gets its own
     full-width row, every select/SearchableSelect after it shares rows
     flexibly instead of a fixed px width forcing one-per-row, and the Clear
     button collapses to an icon square instead of an icon+text pill. ── */
  .filter-bar {
    gap: var(--space-2);
  }
  .filter-bar > div:first-child {
    flex: 1 1 100% !important;
    min-width: 0 !important;
  }
  .filter-bar > select,
  .filter-bar > div:not(:first-child) {
    flex: 1 1 140px !important;
    width: auto !important;
    min-width: 0 !important;
  }
  .filter-bar__clear-btn {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
  }
  .filter-bar__clear-text {
    display: none;
  }
  .rate-stat-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
  .rate-stat-row .stat-mini { min-width: 0; width: 100%; }

  /* ── AWB wizard — compact step indicator replaces the 6-circle strip,
     which needs ~420px minimum and cramps badly under 768px. ── */
  .step-indicator-desktop { display: none; }
  .step-indicator-mobile { display: block; }

  /* ── Charges summary — one item per line instead of a dense pipe-
     separated run-on sentence. ── */
  .charges-summary { display: flex; flex-direction: column; gap: var(--space-1); }
  .charges-summary__sep { display: none; }

  /* ── AWB Detail — total-charge strip. The total is already one line in
     the Charges detail-grid, but on a long scrolling phone screen it gets
     lost among a dozen other label/value pairs. This duplicates it as a
     single emphasized "receipt total" band — desktop has enough visual
     hierarchy already (bold + larger grid) so this stays mobile-only. ── */
  .total-charge-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-5);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), .10) 0%, var(--bg-surface-sunken) 100%);
  }
  .total-charge-strip__label {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: .05em;
  }
  .total-charge-strip__value {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-primary-700);
    font-variant-numeric: tabular-nums;
  }
  [data-theme="dark"] .total-charge-strip__value { color: var(--color-primary-300); }
}

/* Hidden on desktop/tablet — see .total-charge-strip comment above. */
@media (min-width: 769px) {
  .total-charge-strip { display: none; }
}

@media (min-width: 769px) {
  .step-indicator-mobile { display: none; }
}

.step-progress-track {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-bg-secondary, var(--bg-surface-sunken));
  overflow: hidden;
}
.step-progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-normal);
}

@media (min-width: 769px) {
  .bottom-nav, .sidebar-backdrop { display: none !important; }
}

@media (max-width: 480px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
  .auth-card { padding: var(--space-5); }
  .modal {
    border-radius: 14px;
    max-height: 92dvh;
    /* It is docked to the bottom as a sheet here, so it should arrive from
       the bottom too — on the iOS-style drawer curve. */
    animation: modal-sheet-enter 380ms var(--ease-drawer) both;
  }
  .modal-backdrop {
    padding: var(--space-3);
    align-items: flex-end;   /* Sheet from bottom on mobile */
  }
  .modal-footer {
    flex-direction: column-reverse;
    gap: var(--space-2);
  }
  .modal-footer .btn { width: 100%; justify-content: center; }
}

/* ── RTL Specifics ──────────────────────────────────────────── */
[dir="rtl"] .nav-item__chevron { transform: rotate(180deg); }

/* Generic mirror for directional icons (back/forward arrows, breadcrumb chevrons) that have
   no logical-property equivalent — apply this class at the call site when the icon's
   direction is meaningful (not e.g. a generic "expand" caret already handled elsewhere). */
[dir="rtl"] .icon-mirror { transform: scaleX(-1); }
[dir="rtl"] .nav-item.expanded .nav-item__chevron { transform: rotate(90deg); }

/* ── Rate Import UI ─────────────────────────────────────────── */
.upload-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-3);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-xl);
  padding: 3rem 2rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  text-align: center;
}
.upload-dropzone:hover,
.upload-dropzone--active {
  border-color: var(--color-primary);
  background: rgba(79,70,229,.04);
}
.upload-dropzone__icon { color: var(--color-text-muted); }
.upload-dropzone__title { font-size: 1rem; font-weight: 500; }
.upload-dropzone__hint  { font-size: .8rem; color: var(--color-text-muted); }

.import-summary { display: flex; flex-direction: column; gap: .5rem; max-width: 540px; }
.import-summary__row {
  display: flex; gap: 1rem; padding: .5rem .75rem;
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
}
.import-summary__label { flex: 0 0 140px; font-size: .8rem; color: var(--color-text-muted); font-weight: 500; }
.import-summary__value { font-size: .9rem; }

.step-circle {
  font-size: .8rem; font-weight: 600;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s;
}
.step-circle--active  { background: var(--color-primary); color: #fff; }
.step-circle--done    { background: var(--color-success);  color: #fff; }
.step-circle--pending { background: var(--color-bg-secondary); color: var(--color-text-muted); border: 1px solid var(--color-border); }

.table-row--warning td { background: rgba(245,158,11,.05); }
.table-row--danger td { background: rgba(239,68,68,.06); }
.table-row--success-tint td { background: rgba(34,197,94,.06); }
.form-control-xs { padding: .15rem .4rem; font-size: .78rem; height: auto; }

/* ── Print Styles ───────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .footer, .toast-container, .modal-backdrop, .bottom-nav, .breadcrumb { display: none !important; }
  .app-shell { display: block; }
  .main-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  a { color: inherit; text-decoration: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── Cargo / Rate Engine UI Utilities ───────────────────────── */

/* Table interaction */
.sortable-col { cursor: pointer; user-select: none; }
.sortable-col:hover { color: var(--color-primary-600); }
.table-row--clickable { cursor: pointer; transition: background 0.1s; }
.table-row--clickable:hover { background-color: var(--bg-surface-sunken); }
.table-row--selected { background-color: var(--color-primary-50) !important; }
[data-theme="dark"] .table-row--selected { background-color: rgba(var(--color-primary-rgb), .14) !important; }

/* DataGrid<TItem> — per-column header content wrapper + compact filter-toggle icon +
   its popover (replaces the old always-visible .grid-filter-row under the header — a
   whole extra <tr> with a <select>/<input> under every column). This is the
   Ant Design Table / MUI DataGrid pattern: a small icon inline in the header that
   toggles a compact popover anchored to that header cell, with only one open at a
   time. Also the client-side group-header divider row. Nothing in .filter-bar covers
   an in-table row/header like this (.filter-bar is the card-level bar above the
   table), so these are genuinely new rather than a reuse of an existing class. */
.grid-th-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.grid-th-content__label { display: inline-flex; align-items: center; }

.grid-filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: none;
  padding: 0;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.1s, color 0.1s;
}
.grid-filter-toggle:hover { background-color: var(--bg-surface-sunken); color: var(--text-primary); }
.grid-filter-toggle:active { background-color: var(--border-default); }
.grid-filter-toggle--active {
  background-color: rgba(var(--color-primary-rgb), 0.14);
  color: var(--color-primary-600);
}
.grid-filter-toggle--active:hover { background-color: rgba(var(--color-primary-rgb), 0.22); }

.grid-filter-popover {
  /* position:fixed + top/left set by FlightBarN.positionFixedPopover() (app.js) —
     .table-container has overflow-x:auto + overflow-y:hidden for its horizontal-scroll
     shadow effect, which clips ANY position:absolute descendant that overflows its box
     no matter the offset values. Fixed positioning escapes that entirely by anchoring to
     the viewport instead of the scrolling ancestor. */
  position: fixed;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 200px;
  padding: var(--space-2);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow:
    0 4px 6px -2px rgba(0,0,0,0.05),
    0 10px 24px -4px rgba(0,0,0,0.12),
    0 20px 40px -8px rgba(0,0,0,0.08);
  font-weight: var(--font-normal);
  text-transform: none;
  letter-spacing: normal;
  cursor: default;
  animation: dropdown-enter var(--duration-fast) var(--ease-out) both;
  transform-origin: top center;
}
.grid-filter-popover .form-control-sm { width: 100%; min-width: 0; }
.grid-filter-popover__clear {
  align-self: flex-end;
  font-size: var(--text-xs);
  padding: 0;
}
[data-theme="dark"] .grid-filter-popover {
  box-shadow:
    0 4px 6px rgba(0,0,0,0.25),
    0 12px 28px rgba(0,0,0,0.40);
  border-color: rgba(255,255,255,0.1);
}

.grid-group-row td {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .04em;
  background-color: var(--bg-surface-sunken);
  border-bottom: 1px solid var(--border-default);
}

/* Status dots */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
}
.status-dot--active   { background-color: var(--color-success-500); box-shadow: 0 0 0 2px var(--color-success-100); }
.status-dot--inactive { background-color: var(--color-secondary-400); }
[data-theme="dark"] .status-dot--active   { box-shadow: 0 0 0 2px rgba(15,115,73,.2); }

/* Stat mini cards — used in rate calculator result panel */
.stat-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.5rem 0.75rem;
  background: var(--bg-surface-sunken);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-1);
  min-width: 120px;
}
.stat-mini__label { font-size: var(--text-xs); color: var(--text-secondary); font-weight: var(--font-medium); }
.stat-mini__value { font-size: var(--text-sm); font-weight: var(--font-bold); color: var(--text-primary); }
.stat-mini--highlight { border-color: var(--color-warning-400); background: var(--color-warning-50); }
.stat-mini--highlight .stat-mini__value { color: var(--color-warning-700); }
.stat-mini--primary { border-color: var(--color-primary-400); background: var(--color-primary-50); }
.stat-mini--primary .stat-mini__value { color: var(--color-primary-700); }
[data-theme="dark"] .stat-mini--highlight { background: rgba(169,103,7,.12); border-color: rgba(169,103,7,.4); }
[data-theme="dark"] .stat-mini--highlight .stat-mini__value { color: #ffd485; }
[data-theme="dark"] .stat-mini--primary { background: rgba(var(--color-primary-rgb), .14); border-color: rgba(var(--color-primary-rgb), .4); }
[data-theme="dark"] .stat-mini--primary .stat-mini__value { color: var(--color-primary-300); }

/* Accent card — final total highlight */
.card--accent {
  border-color: var(--color-primary-300);
  background: linear-gradient(135deg, var(--color-primary-50) 0%, var(--bg-surface) 100%);
}
[data-theme="dark"] .card--accent {
  border-color: rgba(var(--color-primary-rgb), .4);
  background: linear-gradient(135deg, rgba(var(--color-primary-rgb), .08) 0%, var(--bg-surface) 100%);
}

/* Monospace utility */
.font-mono { font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', monospace); }

/* Text color utilities */
.text-primary { color: var(--color-primary-600); }
[data-theme="dark"] .text-primary { color: var(--color-primary-400); }

/* Spacing utilities */
.ml-1 { margin-inline-start: 0.25rem; }
.ml-2 { margin-inline-start: 0.5rem; }
.mt-1 { margin-top: 0.25rem; }

/* Table size variants */
.table-sm th, .table-sm td { padding: 0.375rem 0.75rem; font-size: var(--text-xs); }

/* ── Form Layout Grids ─────────────────────────────────────────── */
.form-grid {
  display: grid;
  gap: var(--space-5);
}
.form-grid--2 { grid-template-columns: repeat(2, 1fr); }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.form-grid--4 { grid-template-columns: repeat(4, 1fr); }
.form-group--full { grid-column: 1 / -1; }

@media (max-width: 768px) {
  .form-grid--2,
  .form-grid--3,
  .form-grid--4 { grid-template-columns: 1fr; }
}

/* ── Detail View Grid ──────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-5);
}
.detail-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.detail-label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.detail-value {
  font-size: var(--text-sm);
  color: var(--text-primary);
}

@media (max-width: 768px) {
  /* ── Detail-grid (Goods & Route / Charges / Tracking / Void, …) — on
     mobile the grid always falls back to one column (nothing fits the
     220px minmax track twice), which left every field as its own
     full-height stacked block: label line, then value line, then a big
     gap, repeated for several fields per card. Compact it into a
     single-line "label ⟷ value" row per field instead — same divider
     language the responsive table cards already use. Placed here, after
     the base rule above, so it actually wins the cascade at this width
     instead of being overridden by it. ── */
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .detail-item {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-2) 0;
    border-bottom: 1px dashed var(--border-default);
  }
  .detail-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
  .detail-item .detail-label {
    flex-shrink: 0;
  }
  .detail-item .detail-value {
    text-align: end;
  }

  /* Opt-out for long free-text fields (remarks, descriptions) —
     right-aligning a wrapped paragraph next to its label reads badly, so
     these keep the stacked layout: label above, value below, both
     start-aligned. Mark a field with class="detail-item detail-item--stack". */
  .detail-item--stack {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
  }
  .detail-item--stack .detail-value {
    text-align: start;
  }
}

/* ── Party card (Shipper / Consignee) — a compact contact-card layout:
   the ID docks as a small pill in the card header (opposite the title),
   the name is a single bold headline, and address/phone are tight icon
   rows below. Same markup at every width — this reads well compact on
   desktop too, not just as a mobile fallback. ── */
.party-card .card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
/* Keep the id badge fully visible on a narrow card — the title truncates
   with an ellipsis instead of pushing the badge off the edge. */
.party-card .card-header .card-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.party-card__id-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  padding: 3px var(--space-2);
  border-radius: var(--radius-full);
  background: var(--bg-surface-sunken);
  border: 1px solid var(--border-default);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  white-space: nowrap;
}
.party-card__id-badge svg { color: var(--text-tertiary); }
.party-card__name {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}
.party-card__row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.party-card__row svg {
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--text-tertiary);
}

/* ── Breadcrumb aliases ─────────────────────────────────────────── */
.breadcrumb__link { color: var(--text-tertiary); text-decoration: none; }
.breadcrumb__link:hover { color: var(--text-primary); }
.breadcrumb__current { color: var(--text-primary); font-weight: var(--font-medium); }

/* ── Toggle (checkbox as switch label) ─────────────────────────── */
.toggle-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-top: var(--space-2);
}
.toggle-group label { font-size: var(--text-sm); cursor: pointer; }

/* Alert variants */
.alert { padding: 0.625rem 1rem; border-radius: var(--radius-md); border: 1px solid transparent; display: flex; align-items: flex-start; gap: 0.5rem; }
.alert-danger  { background: var(--color-danger-50);  border-color: var(--color-danger-200);  color: var(--color-danger-700); }
.alert-info    { background: var(--color-info-50);    border-color: var(--color-info-200);    color: var(--color-info-700); }
.alert-success { background: var(--color-success-50); border-color: var(--color-success-200); color: var(--color-success-700); }
[data-theme="dark"] .alert-danger  { background: rgba(169,44,44,.1);  border-color: rgba(169,44,44,.3);  color: #f4a9a9; }
[data-theme="dark"] .alert-info    { background: rgba(14,165,233,.1); border-color: rgba(14,165,233,.3); color: #38bdf8; }
[data-theme="dark"] .alert-success { background: rgba(15,115,73,.1);  border-color: rgba(15,115,73,.3);  color: #86dcb4; }

/* justify-between utility */
.justify-between { justify-content: space-between; }

/* Text size 2xl as utility */
.text-2xl { font-size: var(--text-2xl); }

/* Form control small */
.form-control-sm { padding: 0.25rem 0.5rem; font-size: var(--text-xs); min-height: 30px; }

/* Button extra-small */
.btn-xs { padding: 0.1rem 0.45rem; font-size: 0.7rem; min-height: 24px; border-radius: var(--radius-sm); }

/* Inline form hint (inside label row) */
.form-hint-inline { font-size: var(--text-xs); color: var(--text-tertiary); font-weight: var(--font-normal); margin-inline-start: 0.5rem; }

/* Destination break-points entry grid */
.dest-breaks-grid {
  display: grid;
  gap: 0.5rem;
}
.dest-break-row {
  display: grid;
  grid-template-columns: 70px 1fr 40px;
  align-items: center;
  gap: 0.5rem;
}
.dest-break-label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

/* ── Attachment Checklist — clickable upload cards ─────────────── */
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: var(--space-3);
}
.attachment-cell { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.attachment-cell--wide { grid-column: 1 / -1; }

.attachment-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-2);
  min-height: 104px;
  padding: var(--space-3) var(--space-2);
  border: 1.5px dashed var(--border-default);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .08s;
}
.attachment-card:hover { border-color: var(--color-primary-400); background: var(--bg-surface-sunken); }
.attachment-card:active { transform: scale(0.97); }
.attachment-card--done {
  border-style: solid;
  border-color: var(--color-success-300, var(--color-success-500));
  background: var(--color-success-50, rgba(16,185,129,.06));
}
[data-theme="dark"] .attachment-card--done { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.35); }
.attachment-card--uploading { pointer-events: none; }
.attachment-card--disabled { cursor: default; opacity: .6; }
.attachment-card--disabled:hover { border-color: var(--border-default); background: none; }

.attachment-card__icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg-surface-sunken);
  color: var(--text-secondary);
  overflow: hidden;
  flex-shrink: 0;
}
.attachment-card--done .attachment-card__icon { background: transparent; color: var(--color-success-600, var(--color-success-500)); }
.attachment-card__icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.attachment-card__label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.attachment-card__badge {
  position: absolute;
  top: 6px; inset-inline-end: 6px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px;
  background: var(--color-primary-600);
  color: #fff;
  font-size: 10px; font-weight: var(--font-semibold);
  display: flex; align-items: center; justify-content: center;
}
.attachment-card__spinner-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-surface);
  opacity: .85;
  border-radius: inherit;
}
.attachment-card--add { color: var(--text-tertiary); }
.attachment-card--add:hover { color: var(--color-primary-600); }
.attachment-card--form {
  cursor: default;
  align-items: stretch;
  text-align: start;
  justify-content: flex-start;
  border-style: solid;
  border-color: var(--color-primary-300, var(--color-primary-400));
}
.attachment-card--form:hover { background: none; }

.attachment-files { display: flex; flex-direction: column; gap: var(--space-1); }
.attachment-file-chip {
  display: flex; align-items: center; gap: var(--space-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0.25rem 0.5rem;
}
.attachment-file-chip__name {
  font-size: var(--text-xs);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}

@media (max-width: 480px) {
  .attachment-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: var(--space-2); }
  .attachment-card { min-height: 88px; padding: var(--space-2); }
  .attachment-card__icon { width: 34px; height: 34px; }
}

/* ── Activity Log — lazy-loaded collapsible timeline ───────────── */
.activity-log__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-4);
  color: var(--text-primary);
  font: inherit;
}
.activity-log__toggle:hover { background: var(--bg-surface-sunken); }

.activity-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.activity-timeline__item {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}
.activity-timeline__icon {
  width: 26px; height: 26px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg-surface-sunken);
  color: var(--color-primary-600);
}
.activity-timeline__body { flex: 1; min-width: 0; }
