/* ============================================================================
 *  Restock responsive shell — one stylesheet, two shells.
 *  Mobile (< 768px)  → field-rep app surface (bottom tab bar, card stack)
 *  Desktop (≥ 768px) → manager dashboard (sidebar, multi-column)
 *  Tenant theming via CSS custom props on <html data-tenant="...">
 * ========================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;   /* data figures align across tables/KPIs */
  letter-spacing: -0.01em;
  line-height: 1.5;          /* base reading rhythm — dense numeric components override (1.05–1.1) */
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ============================================================================
 *  Restock design system (v5 — May 2026)
 *  Tone-down pass: ONE neutral palette across all tenants, with each tenant
 *  overriding only the single accent color (--brand / --accent / --brand-accent).
 *  Per Jacob: tenants get light customization (name + logo + accent color),
 *  not full visual rebrand. Everything else is locked Restock brand.
 * ========================================================================== */

/* ---- Default (light) palette — applied to all tenants ------------------- */
:root {
  /* Neutral palette — unchanged across tenants */
  --bg:            #ffffff;
  --surface:       #f3f5f9;
  --surface-2:     #eaeef4;
  --surface-muted: #f0f3f8;
  --border:        #e6eaf1;
  --text:          #0c1422;
  --text-muted:    #586274;

  /* Default accent (when tenant has not picked one) */
  --brand-accent:  #2563eb;
  --brand:         var(--brand-accent);
  --brand-2:       var(--brand-accent);
  --accent:        var(--brand-accent);

  /* Tenant brand color — reserved for explicit brand surfaces (wordmark, hero).
     Functional UI accent is --brand/--accent (Restock blue by default).
     Defaults to the functional accent unless a tenant overrides it below. */
  --tenant-color:  var(--brand-accent);

  /* Status colors — locked */
  --status-success: #16a34a;
  --status-warning: #ea580c;
  --status-error:   #dc2626;
  --status-info:    var(--brand-accent);

  /* Refreshed card system — Quiet Luxe++ elevation (soft, layered depth). */
  --radius-card:   16px;
  --shadow-card:   0 1px 2px rgba(16,24,40,.04), 0 4px 12px -2px rgba(16,24,40,.06);
  --shadow-md:     0 10px 26px -8px rgba(16,24,40,.14), 0 3px 8px -3px rgba(16,24,40,.07);
  --shadow-hover:  0 16px 38px -12px rgba(15,23,42,.20), 0 6px 14px -6px rgba(15,23,42,.12);

  /* App canvas (Quiet Luxe++) — a deeper near-white so white cards float with
     real elevation. --bg stays white (white-background lock untouched). */
  --canvas: #f4f6f9;
}

/* ---- White-background lock (per spec) ---------------------------------- */
/* The product locks to a white background; OS dark-mode must NOT darken the app.
   This used to flip to a near-black palette here and rely on theme.js to undo it
   asynchronously — which left an all-black flash (or a persistent black screen on
   any empty/slow page) for dark-mode users. Keep the light palette under dark mode. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: light;
    --bg:            #ffffff;
    --surface:       #f3f5f9;
    --surface-2:     #eaeef4;
    --surface-muted: #f0f3f8;
    --border:        #e6eaf1;
    --text:          #0c1422;
    --text-muted:    #586274;
    --canvas:        #f4f6f9;
  }
}

/* ---- Tenant accent overrides — accent color ONLY ----------------------- */
html[data-tenant="liquid-death"]   { --brand-accent: #2563eb; --tenant-name: "Liquid Death";   --tenant-tagline: "Murder Your Thirst"; }
html[data-tenant="el-jefe-energy"] { --brand-accent: #ef4444; --tenant-name: "El Jefe Energy"; --tenant-tagline: "Fuel for the Fearless"; }
html[data-tenant="bevco-wholesale"]{ --brand-accent: #0891b2; --tenant-name: "TriMason";       --tenant-tagline: "Modern DSD"; }
html[data-tenant="fresh-start"]    { --brand-accent: #2563eb; --tenant-name: "My Account";    --tenant-tagline: "Build it your way"; }
html[data-tenant="restock-default"]  { --brand-accent: #2563eb; --tenant-name: "Restock";        --tenant-tagline: "Route-accounting + payments"; }
html[data-tenant="supplier-demo"]  { --brand-accent: #0d9488; --tenant-name: "Supplier Demo"; }
html[data-tenant="distributor-demo"]{--brand-accent: #7c3aed; --tenant-name: "Distributor Demo"; }

/* Re-alias inside the override (so the cascade picks up the new accent) */
html[data-tenant] {
  --brand:  var(--brand-accent);
  --accent: var(--brand-accent);
}

/* ---------- Reset typography ------------------------------------------- */
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
/* Heading type scale (fallback — only applies where nothing more specific or
   inline sizes the heading; uses the locked --fs tokens so bare headings stop
   inheriting inconsistent browser UA sizes). */
h1 { font-size: var(--fs-5); line-height: 1.2; font-weight: 700; letter-spacing: -0.03em; }   /* 28px */
h2 { font-size: var(--fs-4); line-height: 1.25; }  /* 20px */
h3 { font-size: var(--fs-3); line-height: 1.3; }   /* 16px */
h4 { font-size: var(--fs-2); line-height: 1.35; }  /* 14px */
h5 { font-size: 13px;        line-height: 1.4; }
h6 { font-size: var(--fs-1); line-height: 1.4; }   /* 12px */
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; background: none; color: inherit; cursor: pointer; }

/* ---------- Shared utility classes ------------------------------------- */
.surface  { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.surface-2{ background: var(--surface-2); border-radius: 8px; }

/* ---- Refreshed card system (UI uplift — rounded, soft shadow) ---------- */
.r-card        { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.r-card--pad   { padding: 20px 22px; }
.r-card__head  { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.r-card__title { font-weight: 650; font-size: 14px; }
.r-card__sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.r-clickable   { cursor: pointer; transition: box-shadow .15s, border-color .15s, background .12s; }
.r-clickable:hover { box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); }
.r-pill-group  { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 999px; }
.r-pill        { border: 0; background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: all .15s; min-height: 32px; }
.r-pill.is-active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(10,10,10,.14); }
.r-listrow     { display: flex; align-items: center; gap: 12px; padding: 13px 20px; border-bottom: 1px solid var(--border); transition: background .12s; }
.r-listrow:last-child { border-bottom: 0; }
.r-listrow.r-clickable:hover { background: var(--surface-2); }
.r-tag         { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.r-stat-grid   { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Shopall-style KPI card: icon chip + info/open affordance up top, big number,
   colored delta chip pinned to the foot so a whole row aligns. Color-neutral —
   the chip itself only borrows --brand on hover for clickable tiles. */
.r-stat        { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 20px 22px; }
.r-stat__top   { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.r-stat__ic    { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2); color: var(--text-muted); flex-shrink: 0; transition: background .15s, color .15s; }
.r-stat__ic svg { width: 20px; height: 20px; }
.r-stat.r-clickable:hover .r-stat__ic { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.r-stat__info  { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; color: color-mix(in srgb, var(--text-muted) 60%, var(--border)); cursor: help; }
.r-stat__info svg { width: 16px; height: 16px; }
.r-stat__open  { display: inline-flex; align-items: center; justify-content: center; color: color-mix(in srgb, var(--text-muted) 60%, var(--border)); transition: color .15s, transform .15s; }
.r-stat__open svg { width: 18px; height: 18px; }
.r-stat.r-clickable:hover .r-stat__open { color: var(--brand); transform: translateX(2px); }
.r-stat__label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; }
.r-stat__value { font-size: 30px; font-weight: 720; margin-top: 6px; line-height: 1.0; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.r-stat__foot  { margin-top: auto; padding-top: 11px; }
.r-stat__delta { font-size: 11px; color: var(--text-muted); }
@media (min-width: 768px) { .r-stat-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---- Next best action card (D·Refined overview) ----------------------- */
.r-nba { position: relative; overflow: hidden; border-radius: var(--radius-card); padding: 20px; color: #fff;
  background: radial-gradient(130% 120% at 88% 8%, rgba(147,197,253,.34), transparent 50%), linear-gradient(135deg, #2563eb 0%, #1d4ed8 60%, #1e3a8a 100%);
  box-shadow: 0 10px 30px rgba(37,99,235,.28); }
.r-nba__tag   { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: rgba(255,255,255,.18); padding: 5px 10px; border-radius: 999px; }
.r-nba__title { margin: 13px 0 6px; font-size: 17px; font-weight: 750; line-height: 1.3; }
.r-nba__body  { margin: 0; font-size: 13px; line-height: 1.5; color: rgba(255,255,255,.85); }
.r-nba__go    { margin-top: 15px; display: inline-flex; align-items: center; gap: 7px; background: #fff; color: var(--brand); border: 0; border-radius: 10px; padding: 10px 15px; font-weight: 700; font-size: 13px; cursor: pointer; min-height: 40px; transition: background .15s, transform .12s; }
.r-nba__go:hover { background: rgba(255,255,255,.92); transform: translateX(2px); }
.r-nba.is-scanning { background: var(--surface-2); color: var(--text-muted); box-shadow: none; border: 1px solid var(--border); }
.r-nba.is-scanning .r-nba__tag { background: var(--surface); color: var(--text-muted); }
.r-nba.is-scanning .r-nba__title { color: var(--text); }

.muted    { color: var(--text-muted); }
.dim      { opacity: 0.7; }
.pill     { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; border: 1px solid var(--border); background: var(--surface-2); }
.pill-brand   { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand); border-color: transparent; }
.pill-success { background: color-mix(in srgb, #10b981 16%, transparent); color: #10b981; border-color: transparent; }
.pill-warning { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #f59e0b; border-color: transparent; }
.pill-danger  { background: color-mix(in srgb, #ef4444 16%, transparent); color: #ef4444; border-color: transparent; }

/* ---- Delta chips (Shopall-style KPI deltas) — tinted pill w/ caret -------
   Reuses the locked --status-* tokens, so colors never drift from the system.
   Opt-in: <span class="r-delta r-delta--up">▲ 12%</span>. The base muted
   .r-stat__delta still works for plain-text deltas. */
.r-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 650; line-height: 1; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.r-delta__ic { width: 11px; height: 11px; flex-shrink: 0; }
.r-delta--up   { color: var(--status-success); background: color-mix(in srgb, var(--status-success) 13%, transparent); }
.r-delta--down { color: var(--status-error);   background: color-mix(in srgb, var(--status-error) 13%, transparent); }
.r-delta--flat { color: var(--text-muted);      background: var(--surface-2); }

/* ---- Status dot + label (Shopall-style table/status cells) ---------------
   <span class="r-status"><i class="r-dot r-dot--success"></i> Active</span> */
.r-status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; }
.r-dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; background: var(--text-muted); }
.r-dot--success { background: var(--status-success); }
.r-dot--warning { background: var(--status-warning); }
.r-dot--error   { background: var(--status-error); }
.r-dot--info    { background: var(--status-info); }
.r-dot--neutral { background: color-mix(in srgb, var(--text-muted) 55%, var(--border)); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; border: 1px solid var(--border); background: var(--surface-2); transition: all 0.15s; min-height: 44px; min-height: max(44px, 2.5rem); }
.btn:hover { background: var(--surface); border-color: var(--text-muted); }
.btn-primary { background: var(--brand); color: white; border-color: transparent; }
.btn-primary:hover { background: var(--brand); opacity: 0.92; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 6px 10px; font-size: 12px; min-height: 32px; }

.input { width: 100%; padding: 10px 12px; font-size: 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); min-height: 44px; }
.input:focus { outline: 2px solid var(--brand-accent); outline-offset: -1px; }
.input::placeholder { color: var(--text-muted); opacity: 0.7; }

/* Tenant header mark: consistent Inter typography across all tenants. */
.tenant-mark {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ============================================================================
 *  RESPONSIVE SHELL — two parallel layouts in same DOM, media-query swap
 * ========================================================================== */

.mobile-shell  { display: block; }
.desktop-shell { display: none;  }
@media (min-width: 768px) {
  .mobile-shell  { display: none;  }
  .desktop-shell { display: block; }
}

/* ─────────────────────────────────────────────────────────────────────
 *  MOBILE SHELL  (< 768px)  — iPhone-style app surface
 * ─────────────────────────────────────────────────────────────────── */
.mobile-shell {
  --m-tabbar-h: 64px;          /* single source of truth for the bottom tab bar height (excl. safe area) */
  min-height: 100vh;           /* fallback for browsers without dvh support */
  min-height: 100dvh;
  /* reserve = tab bar + device home indicator + small gap so the last card never hides behind the bar */
  padding-bottom: calc(var(--m-tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px);
  /* Match the desktop Shopall canvas: subtle cool-gray surface so white cards
     visibly float (mobile previously inherited white --bg, leaving cards flat). */
  background: var(--canvas);
}
.m-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; padding-top: calc(14px + env(safe-area-inset-top, 0px));
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.m-topbar h1 { font-size: 18px; font-weight: 700; }
.m-topbar .tenant-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 11px; font-weight: 600;
}
.m-section { padding: 18px; }
.m-section + .m-section { padding-top: 0; }
.m-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; margin-bottom: 12px;
}
.m-kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-kpi { padding: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.m-kpi .label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }
.m-kpi .value { font-size: 22px; font-weight: 720; margin-top: 4px; line-height: 1.1; letter-spacing: -0.02em; }
.m-kpi .delta { font-size: 11px; color: #10b981; margin-top: 2px; }

.m-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  min-height: var(--m-tabbar-h, 64px);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.m-tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 4px; font-size: 10px; gap: 4px;
  color: var(--text-muted); font-weight: 500;
  min-height: var(--m-tabbar-h, 64px);
  overflow: hidden; white-space: nowrap; text-align: center;
}
.m-tabbar a.active { color: var(--brand); }
.m-tabbar svg { width: 22px; height: 22px; }

/* ─────────────────────────────────────────────────────────────────────
 *  FLOATING ACTION BUTTONS  — Help FAB (D2-OV8) + build-phase feedback Note
 *  The Help FAB owns the bottom-right corner and (re)starts the walkthrough,
 *  replacing the old topbar "?". The feedback "Note" button stacks above it,
 *  but only when the FAB is present (body.has-help-fab) — login / god-view /
 *  feedback.html have no shell, so the Note button keeps the corner there.
 *  --m-tabbar-h is scoped to .mobile-shell; the FAB mounts on <body>, so the
 *  64px fallback applies. --fab-bottom lifts above the tab bar on mobile.
 * ─────────────────────────────────────────────────────────────────── */
:root {
  --fab-bottom: 24px;   /* primary (Help) FAB corner offset */
  --fab-stack:  56px;   /* one stacked slot = FAB height (44) + gap (12) */
}
@media (max-width: 767px) {
  :root { --fab-bottom: calc(var(--m-tabbar-h, 64px) + env(safe-area-inset-bottom, 0px) + 14px); }
}
.r-help-fab {
  position: fixed; right: 16px; bottom: var(--fab-bottom); z-index: 190;
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 18px 0 13px;
  border: 1px solid var(--border); border-radius: var(--radius-full, 9999px);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow-hover);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.r-help-fab:hover { transform: translateY(-1px); background: var(--surface-2); }
.r-help-fab:active { transform: translateY(0); }
.r-help-fab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.r-help-fab__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 13px;
}
/* With the Help FAB mounted, lift the feedback Note button + its panel above it
 * (overrides feedback.js's own bottom by selector specificity — no JS coupling). */
.has-help-fab .afb-btn   { bottom: calc(var(--fab-bottom) + var(--fab-stack)); }
.has-help-fab .afb-panel { bottom: calc(var(--fab-bottom) + var(--fab-stack) + 48px); }

/* ─────────────────────────────────────────────────────────────────────
 *  DESKTOP SHELL  (≥ 768px)  — manager dashboard
 * ─────────────────────────────────────────────────────────────────── */
.d-app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.d-sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.d-sidebar .logo {
  padding: 20px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.d-sidebar .logo .mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--tenant-color); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
}
.d-sidebar nav { padding: 14px 8px; flex: 1; overflow-y: auto; }
.d-sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 6px; font-size: 13px;
  color: var(--text-muted); font-weight: 500;
}
.d-sidebar nav a:hover { background: var(--surface-2); color: var(--text); }
.d-sidebar nav a.active { background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand); }
.d-sidebar nav a svg { width: 16px; height: 16px; }
.d-sidebar nav .nav-section {
  margin-top: 18px; padding: 4px 10px; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 600; opacity: 0.6;
}

.d-main { display: flex; flex-direction: column; min-width: 0; }
.d-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.d-topbar .crumbs { font-size: 13px; color: var(--text-muted); }
.d-topbar .tenant-picker {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border); font-size: 13px;
  cursor: pointer;
}
.d-content { padding: 28px 30px; flex: 1; background: var(--canvas); }

@media (min-width: 1024px) {
  .d-app { grid-template-columns: 260px 1fr; }
}

/* ============================================================================
 *  Shopall-style shell uplift (Stage 1) — sidebar nav icons + bottom user card,
 *  topbar centered search + icon cluster. LAYOUT/STRUCTURE only: every icon uses
 *  stroke:currentColor, so it inherits the muted nav color and turns brand on
 *  .active automatically — no color tokens are introduced or changed.
 * ========================================================================== */
.d-sidebar nav a svg { flex-shrink: 0; opacity: .92; }
.d-sidebar nav a .nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Count badge — opt-in; only emitted where a real count exists (never faked). */
.nav-badge { font-size: 10.5px; font-weight: 700; line-height: 1; padding: 3px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); flex-shrink: 0; }
.d-sidebar nav a.active .nav-badge { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand); }

/* Bottom user card (replaces the bare "Switch tenant" row) */
.d-sidebar__foot { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.d-usercard { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 10px; text-align: left; transition: background .12s; }
.d-usercard:hover { background: var(--surface-2); }
.d-usercard__avatar { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--tenant-color); }
.d-usercard__meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.d-usercard__name { font-size: 13px; font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-usercard__sub { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-usercard__chev { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.d-switch { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border-radius: 8px; font-size: 12px; color: var(--text-muted); transition: background .12s, color .12s; }
.d-switch:hover { background: var(--surface-2); color: var(--text); }

/* Topbar — 3-zone: breadcrumb · centered search · icon cluster */
.d-topbar .crumbs { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-topbar .cmdk-trigger { width: auto; flex: 0 1 340px; }
.d-topbar .topbar-actions { flex: 1 1 0; justify-content: flex-end; }
.topbar-ic { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 9px; color: var(--text-muted); transition: background .12s, color .12s; }
.topbar-ic:hover { background: var(--surface-2); color: var(--text); }
.topbar-ic svg { width: 18px; height: 18px; }
@media (max-width: 900px) {
  .d-topbar .crumbs { display: none; }
  .d-topbar .cmdk-trigger { flex: 1 1 auto; }
}

/* ----- Tenant picker dialog (mobile = bottom sheet, desktop = dropdown) - */
.picker-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.5);
  display: none;
}
.picker-overlay.open { display: flex; }
.picker-sheet {
  background: var(--surface); color: var(--text);
  border-radius: 16px 16px 0 0;
  width: 100%; max-width: 480px;
  margin: auto auto 0; padding: 22px;
}
@media (min-width: 768px) {
  .picker-sheet { border-radius: 14px; margin: auto; }
}
.picker-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px; border-radius: 12px; border: 1px solid var(--border); margin-top: 8px;
  cursor: pointer; background: var(--surface-2);
}
.picker-row:hover { border-color: var(--brand); }
.picker-row.active { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.picker-row .swatch { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; color: white; flex-shrink: 0; }

/* ---------- ⌘K command palette ----------------------------------------- */
/* Top-bar launcher (replaces the old dead search input) */
.cmdk-trigger {
  display: flex; align-items: center; gap: 8px;
  width: 280px; min-height: 36px; padding: 0 10px 0 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text-muted);
  font-size: 13px; cursor: text; text-align: left;
}
.cmdk-trigger:hover { border-color: color-mix(in srgb, var(--brand-accent) 40%, var(--border)); }
.cmdk-trigger svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.7; }
.cmdk-trigger .cmdk-trigger-label { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cmdk-trigger kbd {
  font: 600 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 5px; padding: 3px 6px; flex-shrink: 0;
}

/* Overlay + panel */
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10,10,10,0.45); backdrop-filter: blur(3px);
  display: none; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
}
.cmdk-overlay.open { display: flex; }
.cmdk-panel {
  width: 100%; max-width: 560px; max-height: 64vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 24px 64px rgba(10,10,10,0.28);
  animation: cmdkIn 0.14s ease-out;
}
@keyframes cmdkIn { from { opacity: 0; transform: translateY(-8px) scale(0.985); } to { opacity: 1; transform: none; } }

.cmdk-search { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cmdk-search-ic { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }
.cmdk-input {
  flex: 1; border: 0; outline: none; background: transparent;
  font-size: 16px; color: var(--text); padding: 0; min-height: 24px;
}
.cmdk-input::placeholder { color: var(--text-muted); }
.cmdk-kbd, .cmdk-foot kbd {
  font: 600 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 5px; padding: 3px 6px;
}

.cmdk-list { overflow-y: auto; padding: 6px; flex: 1; }
.cmdk-group {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); padding: 12px 10px 4px;
}
.cmdk-row {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 10px; border-radius: 10px; border: 0; background: transparent;
  color: var(--text); font-size: 14px; text-align: left; cursor: pointer;
}
.cmdk-row.is-active { background: color-mix(in srgb, var(--brand-accent) 12%, transparent); }
.cmdk-glyph { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px; background: var(--surface-2); color: var(--text-muted); flex-shrink: 0; }
.cmdk-glyph svg { width: 15px; height: 15px; }
.cmdk-row.is-active .cmdk-glyph { color: var(--brand-accent); }
.cmdk-swatch { width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0; }
.cmdk-label { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cmdk-rowhint { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.cmdk-empty { padding: 28px 16px; text-align: center; color: var(--text-muted); font-size: 14px; }
.cmdk-foot {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  padding: 10px 16px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-muted);
}
.cmdk-foot span { display: inline-flex; align-items: center; gap: 5px; }

@media (max-width: 767px) {
  .cmdk-overlay { padding: 8vh 12px 12px; }
  .cmdk-panel { max-height: 76vh; }
}

/* ---------- Kanban (Key Accounts) -------------------------------------- */
.kanban {
  display: grid;
  grid-auto-flow: column; grid-auto-columns: 280px;
  gap: 12px; overflow-x: auto;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 768px) {
  .kanban { grid-auto-columns: 1fr; grid-template-columns: repeat(8, 1fr); }
}
.kanban-col {
  background: var(--surface-muted); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; min-height: 60vh;
  display: flex; flex-direction: column; gap: 8px;
}
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 700;
  padding: 4px 4px 8px; border-bottom: 1px solid var(--border);
}
.kanban-col-header .count {
  background: var(--surface); border-radius: 999px; padding: 2px 8px; color: var(--text);
  text-transform: none; letter-spacing: 0;
}
.kanban-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; cursor: grab;
  display: flex; flex-direction: column; gap: 6px;
}
.kanban-card.health-green  { border-left: 3px solid #10b981; }
.kanban-card.health-yellow { border-left: 3px solid #f59e0b; }
.kanban-card.health-red    { border-left: 3px solid #ef4444; }
.kanban-card .name  { font-size: 13px; font-weight: 600; }
.kanban-card .meta  { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.kanban-card .value { font-size: 13px; font-weight: 700; color: var(--brand); }

/* ---------- Tables ----------------------------------------------------- */
/* Shopall-style data table: airy rows, quiet uppercase headers, soft row
   separators that fade out at the card edge, smooth hover. Color-neutral —
   the row fill is just --surface-2; --brand is only ever borrowed by an
   in-cell link, never the row. `.restock-table` (the shared JS fallback
   renderers) is aliased to the exact same look so every table matches. */
table.data, table.restock-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td,
table.restock-table th, table.restock-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid color-mix(in srgb, var(--border) 75%, transparent); vertical-align: middle; }
table.data th, table.restock-table th { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; white-space: nowrap; border-bottom-color: var(--border); }
table.data tbody tr, table.restock-table tbody tr { transition: background .12s; }
table.data tbody tr:hover, table.restock-table tbody tr:hover { background: var(--surface-2); cursor: pointer; }
table.data tbody tr:last-child td, table.restock-table tbody tr:last-child td { border-bottom: none; }
table.data .num, table.restock-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Standalone table card — rounded, bordered, clipped container for tables that
   aren't already nested inside a .card/.panel. Pairs with the borderless last
   row above for a clean bottom edge. */
.r-tablecard { border: 1px solid var(--border); border-radius: var(--radius-card); background: #fff; box-shadow: var(--shadow-card); overflow: hidden; }

/* Identity column: small rounded avatar + name (+ optional sub line). Neutral —
   the avatar fill is the tenant color, initials in white; falls back to brand. */
.r-avatar      { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.r-avatar__img { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--tenant-color, var(--brand)); object-fit: cover; }
.r-avatar__name{ font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-avatar__sub { font-size: 11px; color: var(--text-muted); font-weight: 400; line-height: 1.2; }

/* Segmented tab / view switcher (Shopall pill row). Active tab borrows --brand
   text on a white chip; the track is neutral. Namespaced .r-seg so it never
   collides with the per-host .seg / .view-tabs already in the app. */
.r-seg         { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.r-seg__btn    { appearance: none; border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 13px; font-weight: 500; padding: 6px 13px; border-radius: 7px; cursor: pointer; transition: background .12s, color .12s, box-shadow .12s; white-space: nowrap; }
.r-seg__btn:hover { color: var(--text); }
.r-seg__btn.is-active, .r-seg__btn[aria-selected="true"] { background: #fff; color: var(--brand); box-shadow: var(--shadow-card); }

/* Row kebab (⋯) actions trigger. */
.r-rowmenu     { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; color: var(--text-muted); cursor: pointer; border: 0; background: transparent; transition: background .12s, color .12s; }
.r-rowmenu:hover { background: var(--surface-2); color: var(--text); }
.r-rowmenu svg { width: 18px; height: 18px; }

/* Pagination footer. Active page borrows a faint --brand wash + brand border. */
.r-pager        { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.r-pager__pages { display: inline-flex; gap: 4px; }
.r-pager__btn   { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--border); background: #fff; border-radius: 8px; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; transition: background .12s, border-color .12s; }
.r-pager__btn:hover:not(:disabled) { background: var(--surface-2); }
.r-pager__btn.is-active { background: color-mix(in srgb, var(--brand) 10%, transparent); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.r-pager__btn:disabled { opacity: .45; cursor: default; }

/* ---------- KPI strip -------------------------------------------------- */
.kpi-strip { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .kpi-strip { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px){ .kpi-strip { grid-template-columns: repeat(5, 1fr); } }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px;
}
.kpi .label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }
.kpi .value { font-size: 28px; font-weight: 720; margin-top: 4px; line-height: 1.05; letter-spacing: -0.03em; }
.kpi .delta { font-size: 11px; color: #10b981; margin-top: 4px; }

/* ---------- Provenance banner (LD only) ------------------------------- */
.banner-real {
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
}

/* ---------- Empty state ----------------------------------------------- */
.empty {
  padding: 40px 20px; text-align: center;
  background: var(--surface); border: 1px dashed var(--border); border-radius: 12px;
}
.empty .icon {
  width: 48px; height: 48px; border-radius: 999px;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px; color: var(--text-muted);
}
.empty h3 { font-size: 16px; margin-bottom: 6px; }
.empty p  { font-size: 13px; color: var(--text-muted); max-width: 380px; margin: 0 auto 16px; }

/* ============================================================================
 *  DESIGN TOKENS — locked at end of Phase 0. Use these everywhere in new code.
 *  Rule: no hardcoded px values for space/radius/font-size in new code.
 * ========================================================================== */
:root {
  /* Spacing scale (4px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  /* Radius scale */
  --radius-1: 4px;
  --radius-2: 8px;
  --radius-3: 12px;
  --radius-4: 16px;
  --radius-full: 9999px;
  /* Font scale */
  --fs-1: 12px;
  --fs-2: 14px;
  --fs-3: 16px;
  --fs-4: 20px;
  --fs-5: 28px;
  --fs-6: 36px;
  /* Motion */
  --t-fast: 150ms;
  --t-base: 200ms;
  --t-slow: 320ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

/* ============================================================================
 *  Button hierarchy — never more than one primary action visible at a time.
 * ========================================================================== */
.btn-secondary  { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-tertiary   { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-tertiary:hover { color: var(--text); background: var(--surface-2); }
.btn-destructive{ background: #DC2626; color: #fff; border-color: transparent; }
.btn-destructive:hover { background: #B91C1C; }

/* ============================================================================
 *  Hover-coupled distributor highlighting — bidirectional via data-distributor-id
 *  Triggered by setting [data-coupled-hover="<id>"] on a common ancestor.
 *  Default: matching id stays at full opacity, others dim to 0.30.
 *  Transition: 200ms ease. Reduced-motion respected globally below.
 * ========================================================================== */
[data-distributor-id] {
  transition: opacity var(--t-base) var(--ease),
              filter   var(--t-base) var(--ease),
              stroke-width var(--t-base) var(--ease);
}

/* When a coupled hover is active, dim everything by default */
[data-coupled-hover] [data-distributor-id] { opacity: 0.30; }
/* …then restore the matching id. Handled in JS by adding a class .is-hovered
 * on every node with the matching id. We use a class because [attr=value]
 * matching needs an explicit selector — JS does the lift centrally. */
[data-coupled-hover] [data-distributor-id].is-hovered {
  opacity: 1;
  filter: saturate(1.18) brightness(1.05);
}
/* Slight stroke bump on map polygons that match */
svg [data-distributor-id].is-hovered { stroke-width: 1.4; stroke: var(--text); }

/* Card with left border = distributor color, set inline via --dp-color */
.dp-card {
  position: relative;
  border-left: 4px solid var(--dp-color, var(--border));
  padding-left: var(--space-3);
  transition: transform var(--t-base) var(--ease);
}
.dp-card:hover { transform: translateY(-1px); }

/* Row tint in Reports tables — 8% alpha of distributor color */
.dp-row-tinted        { background: color-mix(in srgb, var(--dp-color) 8%, transparent); }
.dp-row-tinted:hover  { background: color-mix(in srgb, var(--dp-color) 14%, transparent); }

/* Reusable swatch + dot for distributor cells */
.dp-swatch { width: 14px; height: 14px; border-radius: var(--radius-1); background: var(--dp-color, var(--border)); flex-shrink: 0; }
.dp-dot    { width: 10px; height: 10px; border-radius: var(--radius-full); background: var(--dp-color, var(--border)); flex-shrink: 0; }

/* Focus-visible standard — never remove without replacement */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-1); }

/* Reduced motion — respect user preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Print stylesheet — for PDF reports, invoices, contracts */
@media print {
  .d-sidebar, .d-topbar, .m-tabbar, .m-topbar, .r-help-fab { display: none !important; }
  body { background: white; color: black; }
  .surface { border-color: #ddd; box-shadow: none; }
  .btn { display: none; }
}

/* ===========================================================================
 *  Beta reconciliation ledger — clean-audit polish (additive; edits no
 *  existing selector). Type hierarchy via --fs-*, spacing via --space-*.
 * ======================================================================== */
.recon-head { display:flex; align-items:flex-end; justify-content:space-between; gap:var(--space-3); flex-wrap:wrap; margin-bottom:var(--space-5); }
.recon-head h1 { font-size:var(--fs-5); line-height:1.1; margin:0 0 var(--space-1); letter-spacing:-0.01em; }
.recon-sub { font-size:var(--fs-2); color:var(--text-muted); margin:0; }
.recon-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:var(--space-3); margin-bottom:var(--space-5); }
@media (max-width:640px){ .recon-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); } }

.recon-bar { height:8px; border-radius:var(--radius-full); background:var(--surface-muted); overflow:hidden; margin:var(--space-2) 0 var(--space-1); }
.recon-bar__fill { height:100%; background:var(--brand-accent,#2563eb); border-radius:var(--radius-full); transition:width .3s ease; }

.recon-group { border:1px solid var(--border); border-radius:var(--radius-3); margin-bottom:var(--space-4); overflow:hidden; }
.recon-group__head { display:flex; align-items:center; justify-content:space-between; gap:var(--space-3); padding:var(--space-3) var(--space-4); background:var(--surface-muted); }
.recon-group__title { display:flex; align-items:center; gap:var(--space-2); font-weight:650; font-size:var(--fs-3); }
.recon-group__meta { font-size:var(--fs-1); color:var(--text-muted); }
.recon-source { font-size:var(--fs-1); font-weight:600; text-transform:uppercase; letter-spacing:.05em; padding:2px var(--space-2); border-radius:var(--radius-full); border:1px solid var(--border); }
.recon-source[data-erp="VIP"] { color:#1d4ed8; border-color:#bfdbfe; background:#eff6ff; }
.recon-source[data-erp="Encompass"] { color:#9333ea; border-color:#e9d5ff; background:#faf5ff; }

.recon-pill { font-size:var(--fs-1); font-weight:600; padding:2px var(--space-2); border-radius:var(--radius-full); white-space:nowrap; }
.recon-pill--open { color:#b45309; background:#fffbeb; border:1px solid #fde68a; }
.recon-pill--balanced { color:#15803d; background:#f0fdf4; border:1px solid #bbf7d0; }
.recon-record-btn { font-size:var(--fs-1); padding:3px var(--space-3); }

.recon-empty { text-align:center; padding:var(--space-7) var(--space-4); color:var(--text-muted); }
.recon-empty h3 { font-size:var(--fs-4); margin:0 0 var(--space-2); color:var(--text); }

.recon-m-card { border:1px solid var(--border); border-radius:var(--radius-3); padding:var(--space-3); margin-bottom:var(--space-2); }
.recon-m-card__top { display:flex; align-items:center; justify-content:space-between; gap:var(--space-2); }
.recon-m-card__meta { font-size:var(--fs-1); color:var(--text-muted); margin-top:var(--space-1); }

/* ── God-view usage heat map (Phase 2) ───────────────────────────────── */
.hm-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
@media (min-width: 768px) { .hm-kpis { grid-template-columns: repeat(4, 1fr); } }
.hm-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.hm-kpi__l { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.hm-kpi__v { font-size: 22px; font-weight: 700; margin-top: 2px; }
.hm-kpi__s { font-size: 11px; color: var(--text-muted); }
.hm-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.hm-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.hm-table th, .hm-table td { padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--border); }
.hm-table thead th { background: var(--surface-2); font-weight: 600; text-transform: capitalize; position: sticky; top: 0; }
.hm-rowh, .hm-corner { text-align: left !important; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; white-space: nowrap; }
.hm-cell { font-variant-numeric: tabular-nums; }
.hm-total { font-weight: 700; }
.hm-empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.hm-empty h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.hm-m-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.hm-m-row__top { display: flex; justify-content: space-between; font-size: 12px; }
.hm-m-bar { height: 6px; background: var(--surface-2); border-radius: 999px; margin-top: 4px; overflow: hidden; }
.hm-m-bar__fill { height: 100%; background: var(--brand); border-radius: 999px; }

/* ============================================================================
 *  Quiet Luxe++ — UI uplift (additive; cascades last)
 *  Depth + motion + button craft + focus polish, layered on the existing card
 *  system. The refined tokens (canvas / shadows / neutrals) do the rest globally.
 * ========================================================================== */

/* Cards gain gentle motion; CLICKABLE cards lift on hover (list rows do not). */
.r-card, .r-stat, .r-tablecard {
  transition: box-shadow .22s var(--ease), transform .22s var(--ease), border-color .18s var(--ease);
}
.r-card.r-clickable:hover, .r-stat.r-clickable:hover, .r-tablecard.r-clickable:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-hover);
}

/* Primary button — subtle gradient + depth + press feedback (uses tenant --brand). */
.btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 88%, #fff), var(--brand));
  box-shadow: 0 6px 16px -5px color-mix(in srgb, var(--brand) 55%, transparent), inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .12s var(--ease), box-shadow .2s var(--ease), filter .2s;
}
.btn-primary:hover {
  opacity: 1; filter: brightness(1.05); transform: translateY(-1px);
  box-shadow: 0 11px 24px -6px color-mix(in srgb, var(--brand) 60%, transparent), inset 0 1px 0 rgba(255,255,255,.22);
}
.btn-primary:active { transform: translateY(0); filter: brightness(.98); }

/* Inputs — soft focus ring instead of a hard outline. */
.input:focus, .input:focus-visible {
  outline: none; border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-accent) 22%, transparent);
}

/* ---- Component refinements (adjust pass) ------------------------------- */

/* Sidebar nav: gradient active state + a left accent bar + smoother motion. */
.d-sidebar nav a { border-radius: 8px; transition: background .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease); }
.d-sidebar nav a.active {
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 15%, transparent), color-mix(in srgb, var(--brand) 5%, transparent));
  box-shadow: inset 2px 0 0 var(--brand);
}

/* Sticky topbar floats over scrolling content (soft drop; keeps its hairline). */
.d-topbar { box-shadow: 0 6px 18px -14px rgba(16,24,40,.22); }

/* Floating cards: whisper-thin border so the layered shadow — not an outline — carries the lift. */
.r-card, .r-stat, .r-tablecard { border-color: color-mix(in srgb, var(--border) 60%, transparent); }
