/* ==========================================================================
   AllianceVare - shared shell stylesheet
   --------------------------------------------------------------------------
   Single source of truth for every screen in this site.

   Design tokens follow the VareSuite convention established by
   salesvare-web / taskvare-web / talentvare-web (src/index.css): a shadcn
   token block on :root, overridden under .dark. Only --primary differs
   per product:

     SalesVare    #EE4E34   oklch(0.64 0.20  32)
     TaskVare     oklch(0.49 0.16 145)
     TalentVare   #173E8F   oklch(0.39 0.14 262)
     AdminCenter  #9B2C6E   oklch(0.48 0.16 348)
     AllianceVare #00808F   oklch(0.55 0.10 209)  <- 53 degrees clear of the
                                                     nearest sibling hue

   Component styles are transcriptions of the real React components:
     navbar       -> src/components/navbar/navbar-desktop.tsx
     tab sidebar  -> src/components/tab-sidebar.tsx  (+ ui/sidebar.tsx)
     table        -> src/components/app-table.tsx    (+ ui/table.tsx)
     badges       -> src/components/status-badge.tsx (+ ui/badge.tsx)
     buttons      -> src/components/ui/button.tsx
     cards        -> src/components/ui/card.tsx
     dialog       -> src/components/ui/dialog.tsx
   ========================================================================== */

/* ==========================================================================
   1. Design tokens
   ========================================================================== */
:root {
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: #00808F;
  --primary-rgb: 0 128 143;
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --radius: 0.625rem;

  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-border: oklch(0.922 0 0);

  /* Radius scale from the @theme inline block */
  --radius-sm: calc(var(--radius) * 0.6);
  --radius-md: calc(var(--radius) * 0.8);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) * 1.4);
  --radius-2xl: calc(var(--radius) * 1.8);
  --radius-3xl: calc(var(--radius) * 2.2);
  --radius-4xl: calc(var(--radius) * 2.6);

  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* app-table.tsx hardcodes the header cell background - tinted to the
     product primary the same way SalesVare/TalentVare tint theirs. */
  --table-head-bg: #e8f4f6;

  --sidebar-width: 14rem;
  --navbar-height: 3.5rem;

  /* Hero banner (modules/home/page.tsx HeroBanner) */
  --hero-gradient: linear-gradient(135deg, rgba(205,235,239,0.96) 0%, rgba(238,249,250,0.98) 50%, rgba(200,232,237,0.95) 100%);
  --hero-shadow: 0 24px 80px -52px rgba(0,128,143,0.55);
  --hero-blob-1: rgba(255,255,255,0.45);
  --hero-panel-bg: rgba(255,255,255,0.55);
  --hero-panel-ring: rgba(255,255,255,0.6);
  --hero-pill-bg: rgba(255,255,255,0.7);
  --hero-pill-fg: var(--primary);

  /* Semantic status colours, lifted from status-badge.tsx (Tailwind palette) */
  --ok-bg: #d1fae5;        /* emerald-100 */
  --ok-fg: #047857;        /* emerald-700 */
  --warn-bg: #fef3c7;      /* amber-100  */
  --warn-fg: #b45309;      /* amber-700  */
  --info-bg: #dbeafe;      /* blue-100   */
  --info-fg: #1d4ed8;      /* blue-700   */
  --violet-bg: #ede9fe;    /* violet-100 */
  --violet-fg: #6d28d9;    /* violet-700 */
}

.dark {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: #00808F;
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);

  --sidebar: oklch(0.205 0 0);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(1 0 0 / 10%);

  --table-head-bg: #10262b;

  --hero-gradient: linear-gradient(135deg, rgba(0,128,143,0.5) 0%, rgba(0,90,102,0.6) 50%, rgba(0,62,71,0.6) 100%);
  --hero-blob-1: rgb(var(--primary-rgb) / 0.12);
  --hero-panel-bg: rgba(255,255,255,0.05);
  --hero-panel-ring: rgba(255,255,255,0.1);
  --hero-pill-bg: rgba(255,255,255,0.1);
  --hero-pill-fg: var(--primary-foreground);

  --ok-bg: rgba(2, 44, 34, 0.5);
  --ok-fg: #34d399;
  --warn-bg: rgba(69, 26, 3, 0.5);
  --warn-fg: #fbbf24;
  --info-bg: rgba(23, 37, 84, 0.5);
  --info-fg: #60a5fa;
  --violet-bg: rgba(46, 16, 101, 0.5);
  --violet-fg: #a78bfa;
}

/* ==========================================================================
   2. Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  font-family: 'Poppins', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* text-xs is the body size across the suite; text-sm is a heading token. */
body {
  background: var(--background);
  color: var(--foreground);
  font-size: 0.75rem;
  line-height: 1rem;
}

* { scrollbar-width: thin; scrollbar-color: oklch(0.85 0 0) transparent; }
.dark * { scrollbar-color: oklch(0.3 0 0) transparent; }

img, svg { display: block; }
/* Every inline <svg> here is a 24x24 Lucide glyph referenced from the sprite.
   Without an intrinsic size an SVG that carries only a viewBox falls back to
   300x150, which silently blows out whatever flex row it sits in - so the base
   size is set here and the .icon-* / component rules below override it. */
svg { flex-shrink: 0; width: 1rem; height: 1rem; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; }

[data-switch-panel][hidden] { display: none !important; }
/* Section switcher - the strip of pills above a panel, the same shape as the
   navbar tabs. Driven by initSectionSwitchers() in shell.js. */
.section-switch {
  display: inline-flex; gap: 0.25rem; flex-shrink: 0;
  padding: 0.25rem; border-radius: var(--radius-lg);
  background: var(--muted);
}
.section-switch-btn {
  padding: 0.375rem 0.75rem;
  border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--muted-foreground);
  font-size: 0.75rem; font-weight: 500; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.section-switch-btn:hover { color: var(--foreground); }
.section-switch-btn[data-active] {
  background: var(--background); color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.dark .section-switch-btn[data-active] { background: color-mix(in oklab, var(--card) 90%, transparent); }
/* A switched panel still has to fill the page and let its table scroll. */
.switch-panel { display: flex; flex-direction: column; gap: 0.75rem; flex: 1; min-height: 0; }
[hidden] { display: none !important; }

.icon      { width: 1rem;     height: 1rem; }
.icon-xs   { width: 0.75rem;  height: 0.75rem; }
.icon-sm   { width: 0.875rem; height: 0.875rem; }
.icon-lg   { width: 1.25rem;  height: 1.25rem; }
.icon-xl   { width: 1.5rem;   height: 1.5rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted-foreground); }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 0.5rem; }
.stack { display: flex; flex-direction: column; gap: 0.5rem; }
.grow { flex: 1; min-width: 0; }

/* App shell: h-svh flex column, navbar sticky, main scrolls */
.app-shell { display: flex; flex-direction: column; height: 100svh; overflow: hidden; }
.route-shell { display: flex; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; }

/* ==========================================================================
   3. Navbar - components/navbar/navbar-desktop.tsx
   ========================================================================== */
.navbar {
  position: sticky; top: 0; z-index: 50; width: 100%;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 80%, transparent);
  background: color-mix(in oklab, var(--background) 80%, transparent);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

.navbar-inner {
  display: none;
  min-height: var(--navbar-height);
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
}
@media (min-width: 768px) { .navbar-inner { display: grid; } }

/* The sibling apps ship a wordmark SVG. AllianceVare has no artwork yet, so
   the logo is an inline mark + text: it inherits the page font and recolours
   for dark mode without a second asset. */
.navbar-logo { display: flex; height: 2rem; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; }
/* An <img>, not a currentColor glyph - the suite mark carries its own
   gradients, so it renders identically in both themes and needs no recolour
   rule. Sizing only. */
.brand-mark { width: 1.5rem; height: 1.5rem; flex-shrink: 0; }
.brand-word {
  font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.02em;
  color: var(--foreground); white-space: nowrap;
}
.brand-word b { font-weight: 600; color: var(--primary); }
.dark .brand-word b { color: color-mix(in srgb, var(--primary) 100%, white 30%); }
.brand--lg .brand-mark { width: 2.25rem; height: 2.25rem; }
.brand--lg .brand-word { font-size: 1.375rem; }

.navbar-tabs { display: flex; min-width: 0; width: 100%; align-items: center; justify-content: center; }
.tabs-list {
  display: inline-flex; align-items: center; justify-content: center;
  height: 2rem; padding: 0.25rem; gap: 0.375rem;
  border-radius: var(--radius-xl);
  background: var(--muted);
  color: var(--muted-foreground);
}
.tab {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  height: calc(100% - 1px);
  gap: 0.375rem;
  padding: 0.125rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.75rem; font-weight: 500; line-height: 1rem; white-space: nowrap;
  color: color-mix(in oklab, var(--foreground) 60%, transparent);
  transition: all 0.15s ease;
}
.tab:hover { color: var(--foreground); }
.dark .tab { color: var(--muted-foreground); }
.dark .tab:hover { color: var(--foreground); }

.tab[data-active] {
  border-color: rgb(var(--primary-rgb) / 0.15);
  background: rgb(var(--primary-rgb) / 0.1);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.dark .tab[data-active] {
  border-color: rgb(var(--primary-rgb) / 0.35);
  background: rgb(var(--primary-rgb) / 0.25);
  color: var(--primary-foreground);
}

.tab-dot {
  margin-left: 0.125rem; width: 0.375rem; height: 0.375rem;
  border-radius: 9999px; background: var(--primary);
}
.dark .tab-dot { background: var(--primary-foreground); }

.navbar-actions { display: flex; width: 100%; align-items: center; justify-content: flex-end; gap: 0.5rem; }

.action-btn {
  position: relative;
  display: flex; width: 2rem; height: 2rem; align-items: center; justify-content: center;
  border-radius: 9999px;
  color: var(--muted-foreground);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.action-btn:hover,
.action-btn[aria-expanded="true"] { background: var(--muted); color: var(--foreground); }

.notif-dot {
  position: absolute; right: 0.5rem; top: 0.5rem;
  width: 0.5rem; height: 0.5rem; border-radius: 9999px; background: var(--primary);
}

.navbar-separator {
  align-self: center; width: 1px; height: 2rem;
  background: color-mix(in oklab, var(--border) 80%, transparent);
}

.avatar {
  display: flex; width: 2rem; height: 2rem; flex-shrink: 0;
  align-items: center; justify-content: center;
  overflow: hidden; border-radius: 9999px;
  background: var(--muted); color: var(--muted-foreground);
  font-size: 0.75rem; font-weight: 500;
}
.avatar-lg { width: 2.25rem; height: 2.25rem; }
.avatar-xl { width: 3rem; height: 3rem; font-size: 0.875rem; }
.avatar--primary { background: rgb(var(--primary-rgb) / 0.12); color: var(--primary); }
.dark .avatar--primary { background: rgb(var(--primary-rgb) / 0.3); color: var(--primary-foreground); }

.theme-sun, .theme-moon { transition: transform 0.2s ease; }
.theme-moon { position: absolute; transform: scale(0) rotate(90deg); }
.dark .theme-sun { transform: scale(0) rotate(-90deg); }
.dark .theme-moon { transform: scale(1) rotate(0deg); }


/* ==========================================================================
   3b. Mobile navbar + drawer - navbar/navbar-mobile.tsx + ui/sheet.tsx
   --------------------------------------------------------------------------
   Same split the React apps use: below 768px the tab bar is replaced by a
   hamburger that opens a left Sheet holding the module list, with a module's
   secondary navigation nested under it so there is never a second drawer.
   The action cluster (theme, reminders, suite, avatar) stays on the right.
   ========================================================================== */
.navbar-mobile {
  display: flex; min-height: var(--navbar-height);
  align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.5rem 1rem;
}
@media (min-width: 768px) { .navbar-mobile { display: none; } }

.navbar-mobile-start { display: flex; align-items: center; gap: 0.375rem; min-width: 0; }
.navbar-mobile-end { display: flex; align-items: center; gap: 0.125rem; }

/* Backdrop + panel. Hidden rather than unmounted, so the open/close state is
   a single attribute and the markup is built once with the navbar. */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 90;
  display: none;
  background: color-mix(in oklab, var(--foreground) 40%, transparent);
}
.drawer-backdrop[data-open="true"] { display: block; }
@media (min-width: 768px) { .drawer-backdrop { display: none !important; } }

.drawer {
  position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 91;
  display: flex; flex-direction: column;
  width: 18rem; max-width: calc(100vw - 3rem);
  border-inline-end: 1px solid var(--border);
  background: var(--background);
  box-shadow: var(--shadow-lg);
  transform: translateX(-100%);
  transition: transform 0.2s ease;
}
.drawer[data-open="true"] { transform: translateX(0); }
@media (min-width: 768px) { .drawer { display: none; } }

.drawer-head {
  display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 0.75rem;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 80%, transparent);
  padding: 0.875rem 1rem;
}
.drawer-title { font-size: 0.875rem; font-weight: 600; letter-spacing: -0.01em; }
.drawer-nav { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 0.125rem; overflow-y: auto; padding: 0.5rem; }
.drawer-foot { flex-shrink: 0; border-top: 1px solid color-mix(in oklab, var(--border) 80%, transparent); padding: 0.5rem; }
.drawer-label {
  padding: 0.25rem 0.75rem;
  font-size: 0.625rem; font-weight: 500; color: var(--muted-foreground);
}

.drawer-item {
  display: flex; width: 100%; align-items: center; gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border: 0; border-radius: var(--radius-md);
  background: transparent; color: color-mix(in oklab, var(--foreground) 70%, transparent);
  font-size: 0.8125rem; font-weight: 500; text-align: start; cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.drawer-item:hover { background: var(--muted); color: var(--foreground); }
.drawer-item[data-active] { background: rgb(var(--primary-rgb) / 0.1); color: var(--primary); }
.drawer-item[data-soon] { opacity: 0.45; cursor: not-allowed; }
.drawer-item[data-soon]:hover { background: transparent; }
.drawer-item .truncate { min-width: 0; flex: 1; }
.drawer-item .count {
  margin-inline-start: auto;
  font-size: 0.6875rem; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
}
.drawer-item[data-active] .count { color: inherit; }
.drawer-chevron { flex-shrink: 0; transition: transform 0.2s ease; }
.drawer-item[aria-expanded="false"] .drawer-chevron { transform: rotate(-90deg); }

/* A module's own sections, indented under its row - the same trick the React
   drawer uses so a secondary sidebar is never needed on a phone. */
.drawer-sub {
  display: flex; flex-direction: column; gap: 0.125rem;
  margin: 0.125rem 0 0.25rem 1rem;
  padding-inline-start: 0.5rem;
  border-inline-start: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
}
.drawer-sub .drawer-item { padding: 0.5rem 0.625rem; font-size: 0.75rem; }

/* The drawer is a modal surface: stop the page behind it from scrolling. */
body[data-drawer-open] { overflow: hidden; }

/* ==========================================================================
   4. Dropdowns / popovers - ui/dropdown-menu.tsx
   ========================================================================== */
.dropdown { position: relative; }
.dropdown-panel {
  position: absolute; right: 0; top: calc(100% + 0.375rem); z-index: 60;
  display: none; flex-direction: column;
  min-width: 14rem; padding: 0.25rem;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--popover); color: var(--popover-foreground);
  box-shadow: var(--shadow-lg);
}
.dropdown[data-open="true"] .dropdown-panel { display: flex; }
.dropdown-panel--sm    { min-width: 10rem; }
.dropdown-panel--suite { min-width: 12rem; padding: 0.5rem; }
.dropdown-panel--wide  { min-width: 22.5rem; padding: 0.5rem; max-height: 24rem; overflow-y: auto; }
.dropdown-panel--left  { right: auto; left: 0; }

/* Filters popover - the suite convention. One outline button reading
   "funnel  Filters  (n)" opens a 360px panel holding every filter for the
   page; the count badge shows how many are currently applied. Transcribed
   from salesvare-web modules/{clients,contacts,opportunities}/page.tsx. */
.dropdown-panel--filter { min-width: 22.5rem; padding: 1rem; gap: 1rem; }
.dropdown-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  font-size: 0.75rem; font-weight: 600;
}
.filters-grid { display: grid; gap: 0.75rem; }
/* Tighter than .field: these labels sit at 10px like the React FilterCombobox. */
.filters-grid .field { gap: 0.375rem; }
.filters-grid .field-label {
  font-size: 0.625rem; font-weight: 500; color: var(--muted-foreground);
}
.filter-range { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.filters-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding-top: 0.25rem;
}
/* The applied-count pill on the trigger. Sized off the React Badge:
   h-5, min-w-5, rounded-full, 10px, primary on a tinted ground. */
.filter-count {
  display: inline-flex; align-items: center; justify-content: center;
  height: 1.25rem; min-width: 1.25rem; padding: 0 0.25rem;
  border-radius: 9999px;
  font-size: 0.625rem; font-weight: 600; line-height: 1;
  color: var(--primary); background: rgb(var(--primary-rgb) / 0.12);
}
.dark .filter-count {
  color: color-mix(in srgb, var(--primary) 100%, white 35%);
  background: rgb(var(--primary-rgb) / 0.24);
}
.filter-btn[data-dirty] { border-color: rgb(var(--primary-rgb) / 0.45); }

.dropdown-item {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem; line-height: 1rem; text-align: left;
  transition: background-color 0.12s ease;
}
.dropdown-item:hover { background: var(--accent); color: var(--accent-foreground); }
.dropdown-item svg { color: var(--muted-foreground); }
.dropdown-item--destructive,
.dropdown-item--destructive svg { color: var(--destructive); }

.dropdown-label {
  padding: 0.25rem 0.375rem;
  font-size: 0.625rem; font-weight: 500; color: var(--muted-foreground);
}
.dropdown-separator { height: 1px; margin: 0.25rem -0.25rem; background: var(--border); }
.dropdown-user { display: flex; align-items: center; gap: 0.75rem; padding: 0.375rem 0.5rem; }
.dropdown-user-name  { font-size: 0.75rem; font-weight: 500; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-user-email { font-size: 0.625rem; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Suite app marks in the switcher and the mobile drawer. The initials-badge
   fallback these replaced is gone: the real artwork is in brands/. */
.suite-mark { width: 1.25rem; height: 1.25rem; flex-shrink: 0; object-fit: contain; }

/* VareSuite users are on Windows - show Ctrl, never the Mac key. */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.25rem; height: 1.25rem; padding: 0 0.25rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--muted); color: var(--muted-foreground);
  font-size: 0.625rem; font-weight: 500;
}

/* Notification row inside the bell dropdown */
.notif {
  display: flex; gap: 0.625rem; align-items: flex-start;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  text-align: left;
}
.notif:hover { background: var(--accent); }
.notif-icon {
  display: flex; width: 1.5rem; height: 1.5rem; flex-shrink: 0;
  align-items: center; justify-content: center;
  border-radius: 9999px;
  background: rgb(var(--primary-rgb) / 0.1); color: var(--primary);
}
.dark .notif-icon { background: rgb(var(--primary-rgb) / 0.3); color: var(--primary-foreground); }
.notif-icon--warn { background: var(--warn-bg); color: var(--warn-fg); }
.notif-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.125rem; }
.notif-title { font-size: 0.75rem; font-weight: 500; line-height: 1.125rem; }
.notif-desc  { font-size: 0.6875rem; color: var(--muted-foreground); line-height: 1rem; }
.notif-time  { font-size: 0.625rem; color: var(--muted-foreground); }

/* ==========================================================================
   5. Buttons - ui/button.tsx
   ========================================================================== */
.btn {
  display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center;
  height: 2rem; gap: 0.375rem;
  padding: 0 0.625rem;
  border: 1px solid transparent; border-radius: var(--radius-lg);
  background: var(--primary); color: var(--primary-foreground);
  font-size: 0.75rem; font-weight: 500; white-space: nowrap;
  transition: all 0.15s ease;
}
.btn:hover { background: color-mix(in srgb, var(--primary) 85%, transparent); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { pointer-events: none; opacity: 0.5; }
.btn svg { width: 1rem; height: 1rem; }

.btn--sm { height: 1.75rem; gap: 0.25rem; padding: 0 0.625rem; border-radius: min(var(--radius-md), 12px); }
.btn--sm svg { width: 0.875rem; height: 0.875rem; }
.btn--lg { height: 2.25rem; padding: 0 1rem; }
.btn--block { width: 100%; }

.btn--outline { border-color: var(--border); background: var(--background); color: var(--foreground); }
.btn--outline:hover { background: var(--muted); }
.dark .btn--outline { border-color: var(--input); background: color-mix(in oklab, var(--input) 30%, transparent); }

.btn--secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn--secondary:hover { background: color-mix(in oklab, var(--secondary) 80%, transparent); }

.btn--ghost { background: transparent; color: inherit; }
.btn--ghost:hover { background: var(--muted); color: var(--foreground); }

.btn--destructive {
  background: color-mix(in oklab, var(--destructive) 10%, transparent);
  color: var(--destructive);
}
.btn--destructive:hover { background: color-mix(in oklab, var(--destructive) 20%, transparent); }

.btn--destructive-solid { background: var(--destructive); color: #fff; }
.btn--destructive-solid:hover { background: color-mix(in srgb, var(--destructive) 85%, transparent); }

.btn--icon    { width: 2rem;    padding: 0; }
.btn--icon-sm { width: 1.75rem; height: 1.75rem; padding: 0; border-radius: min(var(--radius-md), 12px); }

/* ==========================================================================
   6. Badges - ui/badge.tsx + status-badge.tsx
   ========================================================================== */
.badge {
  display: inline-flex; width: fit-content; height: 1.25rem; flex-shrink: 0;
  align-items: center; justify-content: center; gap: 0.25rem;
  overflow: hidden;
  padding: 0.125rem 0.5rem;
  border: 1px solid transparent; border-radius: var(--radius-4xl);
  font-size: 0.6875rem; font-weight: 500; white-space: nowrap;
}
.badge svg { width: 0.75rem; height: 0.75rem; }

.badge--approved  { background: var(--ok-bg);   color: var(--ok-fg); }
.badge--pending   { background: var(--warn-bg); color: var(--warn-fg); }
.badge--info      { background: var(--info-bg); color: var(--info-fg); }
.badge--violet    { background: var(--violet-bg); color: var(--violet-fg); }
.badge--rejected  { background: color-mix(in oklab, var(--destructive) 10%, transparent); color: var(--destructive); }
.badge--secondary { background: var(--secondary); color: var(--secondary-foreground); }
.badge--muted     { background: var(--muted); color: var(--muted-foreground); }
.badge--outline   { border-color: var(--border); color: var(--foreground); }
.badge--primary   { background: rgb(var(--primary-rgb) / 0.12); color: var(--primary); }
.dark .badge--primary { background: rgb(var(--primary-rgb) / 0.3); color: var(--primary-foreground); }

/* ==========================================================================
   7. Cards - ui/card.tsx
   ========================================================================== */
.card {
  display: flex; flex-direction: column; gap: 1rem;
  overflow: hidden;
  padding: 1rem 0;
  border-radius: var(--radius-xl);
  background: var(--card); color: var(--card-foreground);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--foreground) 10%, transparent);
  font-size: 0.75rem;
}
.card--flush { padding: 0; }
.card-header { display: flex; flex-direction: column; gap: 0.25rem; padding: 0 1rem; }
.card-title  { font-size: 0.875rem; font-weight: 500; line-height: 1.375; }
.card-desc   { font-size: 0.75rem; color: var(--muted-foreground); }
.card-body   { padding: 0 1rem; }

.panel-card {
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in oklab, var(--border) 70%, transparent);
}
.dark .panel-card { background: color-mix(in oklab, var(--card) 75%, transparent); }

/* ==========================================================================
   8. Page scaffolding
   ========================================================================== */
.page {
  display: flex; flex-direction: column; gap: 1.25rem;
  overflow-y: auto; padding: 1rem;
}
@media (min-width: 640px)  { .page { gap: 1.5rem; padding: 1.5rem; } }
@media (min-width: 768px)  { .page { min-height: 0; flex: 1; } }
@media (min-width: 1280px) { .page { padding: 1.75rem 2rem; } }

.page-inset {
  display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 1rem;
  overflow: hidden; padding: 1rem;
}
@media (min-width: 768px) { .page-inset { padding: 1.5rem; } }
.page-inset--scroll { overflow-y: auto; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; column-gap: 0.5rem; row-gap: 0.75rem; }
.page-head-title { min-width: 0; margin-right: auto; }
.page-title { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.025em; line-height: 1.75rem; }
.page-sub { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 0.125rem; }
.page-head-actions { display: flex; flex-wrap: nowrap; align-items: center; column-gap: 0.5rem; row-gap: 0.5rem; }
.page-head-actions .input-group { flex: 1 1 8rem; min-width: 8rem; }
.page-head-actions > :not(.input-group) { flex-shrink: 0; }
.section-title { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.025em; line-height: 1.75rem; }

.toolbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ==========================================================================
   9. Tab sidebar - components/tab-sidebar.tsx
   ========================================================================== */
.with-sidebar { display: flex; min-height: 0; width: 100%; flex: 1; overflow: hidden; }

.tab-sidebar {
  display: none; width: var(--sidebar-width); flex-shrink: 0; flex-direction: column;
  border-right: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  background: color-mix(in oklab, var(--background) 95%, transparent);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}
@media (min-width: 768px) { .tab-sidebar { display: flex; } }

.tab-sidebar-content { display: flex; min-height: 0; flex: 1; flex-direction: column; overflow-y: auto; padding-top: 0.5rem; }
.tab-sidebar-group { padding: 0.75rem 0.5rem; }
.tab-sidebar-group-label {
  padding: 0 0.5rem 0.5rem;
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.08em;
  color: color-mix(in oklab, var(--muted-foreground) 80%, transparent);
}
.tab-sidebar-menu { display: flex; flex-direction: column; gap: 0.25rem; }
.tab-sidebar-item {
  display: flex; height: 2.5rem; width: 100%; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-lg);
  font-size: 0.75rem; font-weight: 500; line-height: 1.25;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.tab-sidebar-item:hover { background: rgb(var(--primary-rgb) / 0.08); color: var(--primary); }
.dark .tab-sidebar-item:hover { background: rgb(var(--primary-rgb) / 0.15); color: var(--primary-foreground); }
.tab-sidebar-item[data-active] { background: rgb(var(--primary-rgb) / 0.1); color: var(--primary); }
.dark .tab-sidebar-item[data-active] { background: rgb(var(--primary-rgb) / 0.2); color: var(--primary-foreground); }
.tab-sidebar-item .count {
  margin-left: auto;
  font-size: 0.6875rem; font-weight: 600; color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}
.tab-sidebar-item[data-active] .count { color: inherit; }

.tab-sidebar-item[data-soon] { opacity: 0.45; cursor: default; }
.tab-sidebar-item[data-soon]:hover { background: transparent; color: inherit; }
.tab-sidebar-item[data-soon] .count { font-weight: 400; }

.tab-sidebar-footer { border-top: 1px solid var(--sidebar-border); padding: 0.75rem 0.5rem; }

/* ==========================================================================
   10. Table - app-table.tsx + ui/table.tsx
   --------------------------------------------------------------------------
   Layout follows the documented AppTable pattern:
     border box     -> flex flex-1 flex-col overflow-hidden rounded-lg border
     scroll viewport-> flex-1 overflow-auto  (table at natural height inside)
   Never put a height on .data-table itself - rows would stretch to fill.
   ========================================================================== */
.table-box {
  display: flex; min-height: 0; flex: 1; flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.table-box--auto { flex: 0 0 auto; }
.table-scroll { min-height: 0; flex: 1; overflow: auto; }

.data-table { width: 100%; border-bottom: 1px solid var(--border); font-size: 0.75rem; table-layout: fixed; }
.data-table thead tr { border-bottom: 1px solid var(--border); }
.data-table th {
  position: sticky; top: 0; z-index: 30;
  height: 2rem; padding: 0 0.5rem;
  background: var(--table-head-bg);
  text-align: start; vertical-align: middle;
  font-weight: 500; white-space: nowrap; color: var(--foreground);
  box-shadow: 0 1px 0 var(--border);
  border-right: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
}
.data-table th:last-child { border-right: 0; }
.data-table th[data-sortable] { cursor: pointer; user-select: none; }
.data-table th[data-sortable]:hover { color: var(--primary); }
.data-table th .sort-caret { display: inline-block; margin-left: 0.25rem; opacity: 0.35; }
.data-table th[data-sort] .sort-caret { opacity: 1; color: var(--primary); }

.data-table tbody tr {
  height: 2rem;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.12s ease;
}
.data-table tbody tr:last-child { border-bottom: 0; }
.data-table tbody tr[data-clickable] { cursor: pointer; }
.data-table tbody tr:hover { background: color-mix(in oklab, var(--muted) 50%, transparent); }
.data-table tbody tr[data-selected] { background: color-mix(in oklab, var(--muted) 70%, transparent); }
.data-table td {
  padding: 0.375rem 0.5rem;
  vertical-align: middle; white-space: nowrap;
  border-right: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  overflow: hidden; text-overflow: ellipsis;
}
.data-table td:last-child { border-right: 0; }
.data-table .cell-actions { text-align: center; }
.data-table tfoot td {
  background: color-mix(in oklab, var(--muted) 60%, transparent);
  font-weight: 600;
  border-top: 1px solid var(--border);
  position: sticky; bottom: 0; z-index: 20;
}

/* Empty state: a sticky sibling of the table, NOT a colSpan row - a wide
   colSpan row scrolls the message off-screen horizontally. */
.table-empty {
  position: sticky; left: 0; right: 0;
  display: flex; flex-direction: column; gap: 0.5rem;
  height: 10rem; align-items: center; justify-content: center;
  font-size: 0.875rem; color: var(--muted-foreground);
}
.table-empty svg { width: 1.5rem; height: 1.5rem; opacity: 0.5; }
.table-empty .hint { font-size: 0.75rem; }

.table-footer {
  position: sticky; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.75rem;
  background: var(--background);
  padding: 0.75rem 1rem;
}
.table-footer-count { white-space: nowrap; font-size: 0.75rem; color: var(--muted-foreground); }
.table-footer-size  { display: flex; align-items: center; justify-content: center; gap: 0.5rem; white-space: nowrap; }
.table-footer-pages { display: flex; align-items: center; justify-content: flex-end; gap: 0.25rem; }

.page-link {
  display: inline-flex; min-width: 2rem; height: 2rem;
  align-items: center; justify-content: center; gap: 0.25rem;
  padding: 0 0.5rem;
  border: 1px solid transparent; border-radius: var(--radius-md);
  font-size: 0.75rem; font-weight: 500;
  transition: all 0.15s ease;
}
.page-link:hover { background: var(--muted); }
.page-link[data-active] { border-color: var(--border); background: var(--background); box-shadow: var(--shadow-sm); }
.page-link[aria-disabled="true"] { pointer-events: none; opacity: 0.5; }

/* ==========================================================================
   11. Form controls - ui/input.tsx, ui/select.tsx, ui/input-group.tsx
   ========================================================================== */
.input, .select {
  display: flex; height: 2rem; width: 100%; align-items: center;
  padding: 0 0.625rem;
  border: 1px solid var(--input); border-radius: var(--radius-lg);
  background: var(--background); color: var(--foreground);
  font-size: 0.75rem;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.input:focus-visible, .select:focus-visible {
  outline: none; border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 50%, transparent);
}
.input::placeholder { color: var(--muted-foreground); }
.input:disabled, .select:disabled { opacity: 0.5; cursor: not-allowed; }
.dark .input, .dark .select { background: color-mix(in oklab, var(--input) 30%, transparent); }

.input[aria-invalid="true"], .select[aria-invalid="true"] {
  border-color: var(--destructive);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--destructive) 18%, transparent);
}

.select { appearance: none; padding-right: 1.75rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.5rem center; background-size: 0.875rem;
}
.select--sm { height: 1.75rem; min-width: 4.5rem; font-size: 0.75rem; }

textarea.input { height: auto; min-height: 4.5rem; padding: 0.5rem 0.625rem; line-height: 1.25rem; resize: vertical; }

.input-group { position: relative; display: flex; width: 100%; max-width: 24rem; align-items: center; }
.input-group svg { position: absolute; left: 0.625rem; width: 0.875rem; height: 0.875rem; color: var(--muted-foreground); pointer-events: none; }
.input-group .input { padding-left: 1.875rem; }

/* Field / FieldGroup (ui/field.tsx) */
.field { display: flex; flex-direction: column; gap: 0.375rem; }
.field-label { font-size: 0.75rem; font-weight: 500; }
.field-label .req { color: var(--destructive); }
.field-hint { font-size: 0.6875rem; color: var(--muted-foreground); }
.field-error { font-size: 0.6875rem; color: var(--destructive); }
.field-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 768px)  { .field-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1280px) { .field-grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.field--full { grid-column: 1 / -1; }

.checkbox {
  display: inline-flex; width: 1rem; height: 1rem; flex-shrink: 0;
  align-items: center; justify-content: center;
  border: 1px solid var(--input); border-radius: var(--radius-sm);
  background: var(--background); color: transparent;
}
.checkbox[data-checked] { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.checkbox svg { width: 0.75rem; height: 0.75rem; }

/* ==========================================================================
   12. Shared blocks
   ========================================================================== */
.split-row { display: flex; min-height: 0; flex: 1; gap: 1rem; overflow: hidden; }
.split-main { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; }
.split-side {
  display: none; width: 24rem; flex-shrink: 0; flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--card);
}
@media (min-width: 1024px) { .split-side { display: flex; } }
.split-side-head { flex-shrink: 0; border-bottom: 1px solid var(--border); padding: 0.875rem 1rem; }
.split-side-body { min-height: 0; flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.split-side-foot { flex-shrink: 0; border-top: 1px solid var(--border); padding: 0.75rem 1rem; }

/* A bordered sub-panel. shrink-0 is deliberate: an overflow-hidden flex child
   inside a scrollable flex column collapses to its border height without it. */
.subpanel { flex-shrink: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.subpanel-head {
  display: flex; align-items: center; gap: 0.75rem;
  background: color-mix(in oklab, var(--muted) 50%, transparent);
  border-bottom: 1px solid var(--border);
  padding: 0.625rem 0.875rem;
}
.subpanel-title { font-size: 0.8125rem; font-weight: 600; letter-spacing: -0.01em; }
.subpanel-body { padding: 0.25rem 0; }
.subpanel-body--pad { padding: 0.875rem; }
.subpanel-empty { padding: 1.25rem 0.875rem; text-align: center; color: var(--muted-foreground); font-size: 0.75rem; }

.progress { height: 0.375rem; width: 100%; overflow: hidden; border-radius: 9999px; background: var(--muted); }
.progress-fill { height: 100%; border-radius: 9999px; background: var(--primary); transition: width 0.3s ease; }
.dark .progress-fill { background: color-mix(in srgb, var(--primary) 100%, white 25%); }

.owner-chip {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background: rgb(var(--primary-rgb) / 0.08); color: var(--primary);
  font-size: 0.625rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
}
.dark .owner-chip { background: rgb(var(--primary-rgb) / 0.25); color: var(--primary-foreground); }
.owner-chip--muted { background: var(--muted); color: var(--muted-foreground); }

.callout {
  display: flex; gap: 0.625rem; flex-shrink: 0;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-lg);
  font-size: 0.6875rem; line-height: 1.125rem;
}
.callout--info { background: rgb(var(--primary-rgb) / 0.06); color: var(--foreground); box-shadow: inset 0 0 0 1px rgb(var(--primary-rgb) / 0.15); }
.dark .callout--info { background: rgb(var(--primary-rgb) / 0.18); }
.callout--warn { background: var(--warn-bg); color: var(--warn-fg); }
.callout--ok   { background: var(--ok-bg);   color: var(--ok-fg); }
.callout--danger {
  background: color-mix(in oklab, var(--destructive) 10%, transparent);
  color: var(--destructive);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--destructive) 25%, transparent);
}
.callout svg { flex-shrink: 0; width: 0.875rem; height: 0.875rem; margin-top: 0.0625rem; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1rem; font-size: 0.75rem; }
.kv dt { color: var(--muted-foreground); white-space: nowrap; }
.kv dd { text-align: right; font-weight: 500; word-break: break-word; }

.timeline { display: flex; flex-direction: column; }
.timeline-item { position: relative; display: flex; gap: 0.75rem; padding-bottom: 1rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ''; position: absolute; left: 0.59375rem; top: 1.375rem; bottom: 0;
  width: 1px; background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  display: flex; width: 1.25rem; height: 1.25rem; flex-shrink: 0;
  align-items: center; justify-content: center;
  border-radius: 9999px;
  background: var(--muted); color: var(--muted-foreground);
  z-index: 1;
}
.timeline-dot--primary { background: rgb(var(--primary-rgb) / 0.12); color: var(--primary); }
.dark .timeline-dot--primary { background: rgb(var(--primary-rgb) / 0.3); color: var(--primary-foreground); }
.timeline-dot--ok { background: var(--ok-bg); color: var(--ok-fg); }
.timeline-dot--danger { background: color-mix(in oklab, var(--destructive) 12%, transparent); color: var(--destructive); }
.timeline-dot svg { width: 0.6875rem; height: 0.6875rem; }
.timeline-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.125rem; }
.timeline-text { font-size: 0.75rem; line-height: 1.125rem; }
.timeline-time { font-size: 0.625rem; color: var(--muted-foreground); }

.upload {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border: 1px dashed color-mix(in oklab, var(--border) 90%, transparent);
  border-radius: var(--radius-lg);
}
.upload-name { min-width: 0; flex: 1; }
.upload[data-filled] { border-style: solid; border-color: color-mix(in oklab, var(--ok-fg) 40%, transparent); background: color-mix(in oklab, var(--ok-bg) 60%, transparent); }

.file-chip {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-md);
  background: var(--muted);
  font-size: 0.6875rem;
}

.doc-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
}
.doc-row:last-child { border-bottom: 0; }
.doc-icon {
  display: flex; width: 1.75rem; height: 1.75rem; flex-shrink: 0;
  align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: rgb(var(--primary-rgb) / 0.1); color: var(--primary);
}
.dark .doc-icon { background: rgb(var(--primary-rgb) / 0.3); color: var(--primary-foreground); }
.doc-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.0625rem; }
.doc-name { font-size: 0.75rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 0.625rem; color: var(--muted-foreground); }

.crumbs { display: flex; align-items: center; gap: 0.375rem; font-size: 0.75rem; color: var(--muted-foreground); }
.crumbs a:hover { color: var(--foreground); text-decoration: underline; }
.crumbs svg { width: 0.75rem; height: 0.75rem; }
/* An optional crumb and its separator travel together. The [hidden] rule has
   to be restated: the UA sheet's display:none loses to the rule above it. */
.crumb-group { display: flex; align-items: center; gap: 0.375rem; }
.crumb-group[hidden] { display: none; }

/* The KPI card row that used to sit above every table was removed on request.
   Only the label typography survives, reused as a field label in the detail
   panel - the .stat / .stat-row / .stat-value / .stat-foot rules are gone so
   the row cannot quietly reappear. */
.stat-label { font-size: 0.6875rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-foreground); }


/* Kanban board - salesvare-web modules/opportunities/kanban-board.tsx.
   A horizontally scrolling row of fixed-width columns, each with its own
   vertical scroll, so a long column never stretches the page. */
.btn-group { display: inline-flex; }
.btn-group > .btn { border-radius: 0; }
.btn-group > .btn:first-child { border-start-start-radius: var(--radius-md); border-end-start-radius: var(--radius-md); }
.btn-group > .btn:last-child  { border-start-end-radius: var(--radius-md); border-end-end-radius: var(--radius-md); }
.btn-group > .btn + .btn { margin-inline-start: -1px; }
.btn-group > .btn[aria-pressed="true"] { position: relative; z-index: 1; }

.kanban {
  display: flex; gap: 0.75rem; flex: 1; min-height: 0;
  overflow-x: auto; padding-bottom: 0.25rem;
}
.kanban-col { display: flex; flex-direction: column; gap: 0.5rem; width: 18rem; flex-shrink: 0; min-height: 0; }
.kanban-col-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0 0.25rem; flex-shrink: 0;
}
.kanban-col-name { display: flex; align-items: center; gap: 0.375rem; min-width: 0; font-size: 0.75rem; font-weight: 500; }
.kanban-col-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-dot { width: 0.5rem; height: 0.5rem; border-radius: 9999px; flex-shrink: 0; }
.kanban-dot--muted    { background: var(--muted-foreground); }
.kanban-dot--info     { background: var(--info-fg); }
.kanban-dot--violet   { background: var(--violet-fg); }
.kanban-dot--pending  { background: var(--warn-fg); }
.kanban-dot--approved { background: var(--ok-fg); }
.kanban-dot--primary  { background: var(--primary); }
.kanban-dot--rejected { background: var(--destructive); }
.kanban-col-count { font-size: 0.625rem; font-weight: 500; color: var(--muted-foreground); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.kanban-col-total { padding: 0 0.25rem; font-size: 0.625rem; color: var(--muted-foreground); font-variant-numeric: tabular-nums; flex-shrink: 0; }

.kanban-drop {
  display: flex; flex-direction: column; gap: 0.5rem;
  flex: 1; min-height: 7.5rem; padding: 0.5rem;
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: color-mix(in oklab, var(--muted) 40%, transparent);
  overflow-y: auto;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.kanban-drop[data-over="true"] { border-color: rgb(var(--primary-rgb) / 0.5); background: rgb(var(--primary-rgb) / 0.05); }
/* A column the dragged card is not allowed to enter - the pipeline moves one
   stage at a time, so most columns are refused for any given card. */
.kanban-drop[data-blocked="true"] {
  border-color: color-mix(in oklab, var(--destructive) 40%, transparent);
  background: color-mix(in oklab, var(--destructive) 5%, transparent);
}
.kanban-empty { margin: auto; font-size: 0.625rem; color: var(--muted-foreground); }

.kanban-card {
  display: flex; flex-direction: column; gap: 0.125rem;
  padding: 0.5rem 0.75rem 0.625rem;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--card); box-shadow: var(--shadow-sm);
  cursor: pointer; transition: box-shadow 0.15s ease;
}
.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-card[draggable="true"] { cursor: grab; }
.kanban-card[draggable="true"]:active { cursor: grabbing; }
.kanban-card[data-dragging="true"] { opacity: 0.4; }
.kanban-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.kanban-card-code { font-size: 0.625rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.kanban-card-client { margin-top: 0.25rem; font-size: 0.6875rem; font-weight: 500; line-height: 1.0625rem; }
/* Two lines, then ellipsis - a long scope must not make one card taller
   than the rest of the column. */
.kanban-card-scope {
  font-size: 0.625rem; color: var(--muted-foreground); line-height: 1rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kanban-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  margin-top: 0.375rem; font-size: 0.625rem; font-variant-numeric: tabular-nums;
}
.kanban-card-amount { font-weight: 500; }
.kanban-card-date { color: var(--muted-foreground); flex-shrink: 0; }
.kanban-card-meta { font-size: 0.625rem; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.identity { display: flex; align-items: center; gap: 0.875rem; min-width: 0; }
.identity-name { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.02em; }
.identity-meta { font-size: 0.6875rem; color: var(--muted-foreground); }

.chip {
  padding: 0.0625rem 0.375rem;
  border-radius: var(--radius-sm);
  background: var(--muted); color: var(--muted-foreground);
  font-size: 0.625rem; white-space: nowrap;
}
.chip-row { display: inline-flex; gap: 0.25rem; flex-wrap: wrap; }

/* Transvare product tag picker - a checkable catalogue, not a combobox: the
   list is short, and the description is the only context a partner user gets
   for deciding which product an opportunity is being sold against. */
.tag-picker {
  display: grid; gap: 0.375rem;
  max-height: 11rem; overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid var(--input); border-radius: var(--radius-md);
  background: var(--background);
}
.tag-option {
  display: grid; grid-template-columns: auto 1fr; gap: 0 0.5rem; align-items: center;
  padding: 0.375rem 0.5rem; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s ease;
}
.tag-option:hover { background: var(--muted); }
.tag-option[data-checked] { background: rgb(var(--primary-rgb) / 0.08); }
.tag-option input { width: 0.875rem; height: 0.875rem; accent-color: var(--primary); cursor: pointer; }
.tag-option-name { font-size: 0.75rem; font-weight: 500; }
.tag-option-desc { grid-column: 2; font-size: 0.6875rem; color: var(--muted-foreground); line-height: 1rem; }
.tag-option[data-retired] .tag-option-name { color: var(--muted-foreground); }

/* The read-only twin: product tags rendered in a table cell or a card. */
.tag-list { display: inline-flex; gap: 0.25rem; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center;
  padding: 0.0625rem 0.375rem; border-radius: var(--radius-sm);
  font-size: 0.625rem; font-weight: 500; white-space: nowrap;
  color: var(--primary); background: rgb(var(--primary-rgb) / 0.1);
}
.dark .tag { color: color-mix(in srgb, var(--primary) 100%, white 30%); background: rgb(var(--primary-rgb) / 0.2); }

/* A table cell holds exactly one fact. Two facts get two columns - stacking a
   muted second line under the first makes it unsortable, unfilterable and
   invisible to the CSV export, so the stacked-cell rule that used to live here
   was removed deliberately. Split the column instead. */

/* ==========================================================================
   13. Pipeline rail - the six BRD stages plus the Closed Lost terminal
   ========================================================================== */
.rail { display: flex; align-items: stretch; gap: 0.25rem; overflow-x: auto; padding-bottom: 0.25rem; }
.rail-step {
  position: relative; flex: 1 1 0; min-width: 6.75rem;
  display: flex; flex-direction: column; gap: 0.25rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-md);
  background: var(--muted); color: var(--muted-foreground);
}
.rail-step-name { font-size: 0.6875rem; font-weight: 600; white-space: nowrap; }
.rail-step-meta { font-size: 0.625rem; opacity: 0.85; white-space: nowrap; }
.rail-step[data-state="done"] { background: var(--ok-bg); color: var(--ok-fg); }
.rail-step[data-state="current"] { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-sm); }
.rail-step[data-state="lost"] { background: color-mix(in oklab, var(--destructive) 12%, transparent); color: var(--destructive); }
/* A populated step on the admin partner detail is a link into that stage.
   text-decoration is reset because the crumbs rule underlines bare anchors. */
a.rail-step { text-decoration: none; transition: filter 0.15s ease, box-shadow 0.15s ease; }
a.rail-step:hover { filter: brightness(1.06); box-shadow: var(--shadow-md); }

/* Report stage columns get a faint tint so the pipeline reads left to right */
.stage-col { background: rgb(var(--primary-rgb) / 0.03); }
.dark .stage-col { background: rgb(var(--primary-rgb) / 0.07); }

/* ==========================================================================
   14. Dialog / sheet - ui/dialog.tsx
   ========================================================================== */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: none;
  align-items: center; justify-content: center;
  padding: 1rem;
  background: color-mix(in oklab, var(--foreground) 45%, transparent);
  backdrop-filter: blur(2px);
}
.dialog-backdrop[data-open="true"] { display: flex; }

.dialog {
  display: flex; width: 100%; max-width: 34rem; max-height: 90vh; flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: var(--popover); color: var(--popover-foreground);
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.35);
}
.dialog--wide { max-width: 44rem; }
.dialog--sm { max-width: 26rem; }

.dialog-head {
  display: flex; flex-shrink: 0; align-items: flex-start; gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
}
.dialog-title { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.02em; }
.dialog-desc  { margin-top: 0.125rem; font-size: 0.75rem; color: var(--muted-foreground); }
.dialog-close { margin-left: auto; }

.dialog-body {
  display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 1.25rem;
  overflow-y: auto;
  padding: 1.25rem;
}
.dialog-foot {
  display: flex; flex-shrink: 0; align-items: center; justify-content: flex-end; gap: 0.5rem;
  border-top: 1px solid var(--border);
  padding: 0.875rem 1.25rem;
}
.dialog-foot--split { justify-content: space-between; }

/* ==========================================================================
   15. Switch - ui/switch.tsx
   ========================================================================== */
.switch {
  position: relative;
  display: inline-flex; width: 2rem; height: 1.125rem; flex-shrink: 0;
  align-items: center;
  padding: 0.125rem;
  border-radius: 9999px;
  background: color-mix(in oklab, var(--muted-foreground) 40%, transparent);
  transition: background-color 0.15s ease;
}
.switch::after {
  content: ''; display: block;
  width: 0.875rem; height: 0.875rem;
  border-radius: 9999px; background: var(--background);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}
.switch[data-checked] { background: var(--primary); }
.switch[data-checked]::after { transform: translateX(0.875rem); }
.switch[data-disabled] { opacity: 0.5; }

.switch-field {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.switch-field-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.0625rem; }

/* ==========================================================================
   16. Toasts - sonner
   ========================================================================== */
.toaster {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 200;
  display: flex; flex-direction: column; gap: 0.5rem;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 0.625rem;
  min-width: 16rem; max-width: 24rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-lg);
  background: var(--popover); color: var(--popover-foreground);
  box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in oklab, var(--border) 80%, transparent);
  font-size: 0.75rem; line-height: 1.125rem;
  animation: toast-in 0.18s ease;
  pointer-events: auto;
}
.toast svg { width: 1rem; height: 1rem; flex-shrink: 0; margin-top: 0.0625rem; }
.toast--ok svg { color: var(--ok-fg); }
.toast--error svg { color: var(--destructive); }
.toast--info svg { color: var(--primary); }
.toast-title { font-weight: 500; }
.toast-desc { color: var(--muted-foreground); font-size: 0.6875rem; }
@keyframes toast-in { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   17. Auth screen - routes/(auth)
   ========================================================================== */
.auth { display: grid; min-height: 100svh; grid-template-columns: 1fr; background: var(--background); }
@media (min-width: 1024px) { .auth { grid-template-columns: 1.1fr 1fr; } }

.auth-aside {
  display: none; position: relative; overflow: hidden;
  flex-direction: column; justify-content: space-between;
  padding: 3rem;
  background: var(--hero-gradient);
}
@media (min-width: 1024px) { .auth-aside { display: flex; } }
.auth-aside .hero-blob { position: absolute; pointer-events: none; border-radius: 9999px; filter: blur(64px); }
.auth-headline { position: relative; font-size: 2.25rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; max-width: 20ch; }
.auth-sub { position: relative; margin-top: 1rem; font-size: 0.875rem; line-height: 1.5rem; color: color-mix(in oklab, var(--foreground) 72%, transparent); max-width: 46ch; }
.dark .auth-sub { color: color-mix(in oklab, var(--foreground) 85%, transparent); }

.auth-stages { position: relative; display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 2rem; }
.auth-stage {
  padding: 0.25rem 0.625rem; border-radius: 9999px;
  background: var(--hero-pill-bg); color: var(--hero-pill-fg);
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
}

.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1.5rem; }
.auth-card { width: 100%; max-width: 22rem; display: flex; flex-direction: column; gap: 1.25rem; }
.auth-title { font-size: 1.375rem; font-weight: 600; letter-spacing: -0.025em; }
.auth-desc { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 0.25rem; }
.auth-foot { font-size: 0.6875rem; color: var(--muted-foreground); text-align: center; }
.auth-foot a { color: var(--primary); font-weight: 500; }
.auth-divider { display: flex; align-items: center; gap: 0.625rem; font-size: 0.625rem; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.12em; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Demo account picker - this prototype has no auth server, so the sign-in
   screen offers the seeded identities instead of a password check. */
.demo-list { display: flex; flex-direction: column; gap: 0.375rem; }
.demo-account {
  display: flex; align-items: center; gap: 0.625rem; width: 100%;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  text-align: left;
  transition: all 0.15s ease;
}
.demo-account:hover { border-color: var(--primary); background: rgb(var(--primary-rgb) / 0.05); }
.demo-account-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.demo-account-name { font-size: 0.75rem; font-weight: 500; }
.demo-account-meta { font-size: 0.625rem; color: var(--muted-foreground); }

/* ==========================================================================
   18. Home hero - modules/home/page.tsx
   ========================================================================== */
.hero {
  position: relative; flex-shrink: 0; overflow: hidden;
  border: 1px solid rgb(var(--primary-rgb) / 0.15);
  border-radius: var(--radius-3xl);
  background: var(--hero-gradient);
  box-shadow: var(--hero-shadow);
  padding: 1.75rem 1.5rem;
}
.dark .hero { border-color: rgb(var(--primary-rgb) / 0.2); }
@media (min-width: 640px) { .hero { padding: 2.25rem; } }

.hero-blob { position: absolute; pointer-events: none; border-radius: 9999px; filter: blur(64px); }
.hero-blob--1 { left: -4rem; top: -2.5rem; width: 14rem; height: 14rem; background: var(--hero-blob-1); }
.hero-blob--2 { bottom: -3rem; right: 0; width: 18rem; height: 18rem; background: rgb(var(--primary-rgb) / 0.15); }

.hero-inner { position: relative; display: flex; flex-direction: column; gap: 1.75rem; }
@media (min-width: 1024px) { .hero-inner { flex-direction: row; align-items: center; justify-content: space-between; gap: 2.5rem; } }

.hero-copy { display: flex; flex-direction: column; gap: 1rem; align-items: flex-start; }
.hero-pill {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: var(--hero-pill-bg); color: var(--hero-pill-fg);
  box-shadow: var(--shadow-sm);
  font-size: 0.625rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.18em;
}
.hero-greeting { font-size: 1.875rem; line-height: 1.15; font-weight: 600; letter-spacing: -0.025em; color: var(--foreground); }
@media (min-width: 640px)  { .hero-greeting { font-size: 2.25rem; } }
@media (min-width: 1280px) { .hero-greeting { font-size: 3rem; } }

.hero-meta {
  display: flex; flex-wrap: wrap; align-items: center;
  column-gap: 1.25rem; row-gap: 0.5rem;
  font-size: 0.75rem;
  color: color-mix(in oklab, var(--foreground) 75%, transparent);
}
.dark .hero-meta { color: color-mix(in oklab, var(--foreground) 85%, transparent); }
.hero-meta > div { display: inline-flex; align-items: center; gap: 0.5rem; }
.hero-meta svg { color: var(--primary); }
.dark .hero-meta svg { color: var(--primary-foreground); }

.hero-clock {
  display: flex; flex-shrink: 0; align-items: center; gap: 1.25rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-2xl);
  background: var(--hero-panel-bg);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--hero-panel-ring);
  backdrop-filter: blur(4px);
}
.hero-clock-block { text-align: center; }
.hero-clock-value {
  font-size: 2.25rem; line-height: 1.1; font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: -0.025em;
  color: var(--foreground);
}
@media (min-width: 640px) { .hero-clock-value { font-size: 3rem; } }
.hero-clock-label { margin-top: 0.375rem; font-size: 0.625rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.22em; color: var(--muted-foreground); }
.hero-clock-divider { width: 1px; height: 3.5rem; background: color-mix(in oklab, var(--foreground) 10%, transparent); }

/* Quick links (modules/home QuickLinkCard) */
/* minmax(0,1fr), not the implicit minmax(auto,1fr): the pipeline rail inside
   is a wide flex row, and an auto-min track lets it push the whole column
   past the viewport instead of scrolling inside it. */
.home-grid { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .home-grid { gap: 1.5rem; } }
@media (min-width: 1024px) { .home-grid { min-height: 0; flex: 1; grid-template-columns: minmax(0,1.7fr) minmax(300px,0.95fr); } }
.home-panel { display: flex; flex-direction: column; gap: 1rem; min-height: 0; min-width: 0; }
.home-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }

.count-pill {
  display: flex; min-width: 1.5rem; height: 1.5rem; padding: 0 0.375rem; flex-shrink: 0;
  align-items: center; justify-content: center;
  border-radius: 9999px;
  background: rgb(var(--primary-rgb) / 0.1); color: var(--primary);
  font-size: 0.6875rem; font-weight: 600;
}
.dark .count-pill { background: rgb(var(--primary-rgb) / 0.3); color: var(--primary-foreground); }

/* One column on a phone: two 170px tracks squeeze the icon and the label
   into each other, and the card stops being tappable as one thing. */
.quicklinks { display: grid; gap: 0.75rem; grid-template-columns: 1fr; }
@media (min-width: 640px)  { .quicklinks { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1024px) { .quicklinks { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.quicklink-card {
  display: flex; height: 100%; align-items: center; gap: 0.875rem;
  padding: 1rem;
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in oklab, var(--border) 70%, transparent);
  transition: all 0.15s ease;
}
.dark .quicklink-card { background: color-mix(in oklab, var(--card) 75%, transparent); }
.quicklink-card:hover { box-shadow: var(--shadow-md), 0 0 0 1px rgb(var(--primary-rgb) / 0.35); transform: translateY(-1px); }
.quicklink-icon {
  display: flex; width: 2.5rem; height: 2.5rem; flex-shrink: 0;
  align-items: center; justify-content: center;
  border-radius: var(--radius-lg);
  background: rgb(var(--primary-rgb) / 0.1); color: var(--primary);
}
.dark .quicklink-icon { background: rgb(var(--primary-rgb) / 0.3); color: var(--primary-foreground); }
.quicklink-text { display: flex; flex-direction: column; min-width: 0; }
.quicklink-label { font-size: 0.875rem; font-weight: 600; letter-spacing: -0.01em; }
.quicklink-eyebrow { font-size: 0.6875rem; color: var(--muted-foreground); }

/* Scroll container for the reminder feed on Home */
.feed-scroll { min-height: 0; flex: 1; overflow-y: auto; padding-right: 0.25rem; }
.feed-list { display: flex; flex-direction: column; gap: 0.625rem; }
.feed-card {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.875rem;
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow-sm), 0 0 0 1px color-mix(in oklab, var(--border) 70%, transparent);
}
.dark .feed-card { background: color-mix(in oklab, var(--card) 75%, transparent); }
.feed-icon {
  display: flex; width: 2rem; height: 2rem; flex-shrink: 0;
  align-items: center; justify-content: center;
  border-radius: var(--radius-lg);
  background: rgb(var(--primary-rgb) / 0.1); color: var(--primary);
}
.dark .feed-icon { background: rgb(var(--primary-rgb) / 0.3); color: var(--primary-foreground); }
.feed-icon--warn { background: var(--warn-bg); color: var(--warn-fg); }
.feed-body { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; flex: 1; }
.feed-title { font-size: 0.8125rem; line-height: 1.25; font-weight: 600; letter-spacing: -0.015em; }
.feed-desc { font-size: 0.75rem; line-height: 1.125rem; color: var(--muted-foreground); }
.feed-empty { padding: 2rem 1rem; text-align: center; color: var(--muted-foreground); }

/* ==========================================================================
   19. Prototype ribbon
   ========================================================================== */
.mock-ribbon {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.375rem 1.5rem;
  background: var(--warn-bg); color: var(--warn-fg);
  font-size: 0.6875rem; font-weight: 500;
}
.mock-ribbon svg { width: 0.75rem; height: 0.75rem; }
.mock-ribbon a { text-decoration: underline; }
.mock-ribbon .grow { flex: 1; }

/* ==========================================================================
   18. Responsive rules
   --------------------------------------------------------------------------
   Everything above is written mobile-first; this block holds the places where
   a desktop layout has to actively change shape, gathered together so the
   breakpoints are reviewable in one place. Breakpoint is 768px, the same
   MOBILE_BREAKPOINT the React apps use in hooks/use-mobile.ts.
   ========================================================================== */

/* --- Page header ---------------------------------------------------------
   The title takes the whole first row on a phone so the search box and the
   (now icon-only) controls share the next one - app-table.tsx does the same
   with `w-full sm:w-auto` on the title slot. */
@media (max-width: 767px) {
  .page-head-title { width: 100%; margin-right: 0; }
  .page-head-actions { width: 100%; flex-wrap: wrap; }
  .page-title { font-size: 1.125rem; line-height: 1.5rem; }
}
/* On a phone there are too many controls to sit beside the search box, and a
   wrapped row that strands one button on its own reads as a mistake. Search
   takes a full row; the icon-only controls share the next one and stretch to
   fill it. */
@media (max-width: 639px) {
  .page-head-actions .input-group { flex: 1 1 100%; max-width: none !important; }
  /* Icon-only, so they keep their natural width and sit in a left-aligned
     row - stretching them to fill made Export and Create twice the size of
     the view toggle beside them. */
  .page-head-actions > :not(.input-group) { flex: 0 0 auto; }
  .page-head-actions { justify-content: flex-start; }
}

/* A button label that collapses to its icon on a narrow screen, matching
   `<span className="hidden sm:inline">` in the React toolbars. Buttons whose
   icon is not self-explanatory (dialog actions, Done, Clear filters) simply
   do not use this class. */
@media (max-width: 639px) {
  .btn-text { display: none; }
  .btn--icon-collapse { padding-inline: 0.5rem; }
}

/* --- Detail split --------------------------------------------------------
   Below 1024 the side panel used to be display:none, which hid the whole
   Details column on tablets and phones. It now stacks under the main column
   and the row scrolls as one, instead of two independent scroll areas. */
.split-side { display: flex; }
@media (max-width: 1023px) {
  .split-row {
    flex-direction: column;
    overflow-y: auto;
    gap: 0.75rem;
  }
  .split-main { overflow: visible; flex: 0 0 auto; }
  .split-side { width: 100%; overflow: visible; }
  .split-side-body { overflow: visible; }
}

/* --- Tables --------------------------------------------------------------
   The table itself already scrolls horizontally. The footer is what needs
   compacting: "Rows per page" is dropped and the range loses its prefix,
   exactly as app-table.tsx does at `sm:`. */
@media (max-width: 639px) {
  .table-footer-size { display: none; }
  .table-footer { grid-template-columns: 1fr auto; gap: 0.5rem; padding-inline: 0.75rem; }
  .table-footer-count .table-footer-showing { display: none; }
}

/* --- Filters popover -----------------------------------------------------
   360px is wider than a phone viewport, and the panel is anchored to its
   trigger's right edge - so widening it in place pushes it off the LEFT of
   the screen. On a phone it stops being a popover and becomes a bottom
   sheet instead, which is what the React apps use for panels at this width
   and is the half of the screen a thumb can actually reach. */
@media (max-width: 639px) {
  .dropdown-panel--filter {
    position: fixed; inset-inline: 0.75rem; top: auto; bottom: 0.75rem;
    min-width: 0; width: auto; max-height: 75svh; overflow-y: auto;
  }
  .dropdown-panel--wide { min-width: 0; width: calc(100vw - 2rem); }
}

/* --- Kanban --------------------------------------------------------------
   Columns stay a fixed width and the board scrolls; on a phone they narrow so
   more than one edge is visible, which is what makes it read as a board. */
@media (max-width: 639px) {
  .kanban-col { width: 15rem; }
}

/* --- Section switcher ----------------------------------------------------
   Scrolls rather than wraps: a wrapped pill strip stops looking like tabs. */
@media (max-width: 639px) {
  .section-switch { max-width: 100%; overflow-x: auto; }
  .section-switch-btn { white-space: nowrap; }
}

/* --- Dialogs -------------------------------------------------------------
   Full height on a phone, so a long form is not a 90vh box inside a 100vh
   screen with dead space top and bottom. */
@media (max-width: 639px) {
  .dialog-backdrop { padding: 0.5rem; align-items: flex-end; }
  .dialog { max-height: calc(100svh - 1rem); }
  .dialog-body { padding: 1rem; gap: 1rem; }
  .dialog-head, .dialog-foot { padding-inline: 1rem; }
  .dialog-foot { flex-direction: column-reverse; align-items: stretch; }
  .dialog-foot .btn { justify-content: center; }
  .dialog-foot--split { flex-direction: column-reverse; }
}

/* --- Detail grid ---------------------------------------------------------
   The partner detail's two columns. Single column until there is room for
   both, which on a phone is the difference between two readable stacks and
   two 60px slivers. */
.detail-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.detail-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
@media (min-width: 1024px) {
  .detail-grid { grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); }
}

/* --- Auth ----------------------------------------------------------------
   The sign-in card is already single-column below 1024; it just needs to stop
   being vertically centred on a short screen or the demo accounts scroll off. */
@media (max-width: 1023px) {
  .auth { align-items: flex-start; }
}
