﻿/* ══════════════════════════════════════════════════════════════════════════
   ShopCore Admin Portal — Fluent design system
   ══════════════════════════════════════════════════════════════════════════

   Fluent, not "a blue theme": the tokens below are the whole vocabulary, and
   every rule under them spends only tokens. That is what makes a dark theme a
   second :root block rather than a second stylesheet, and what stops the next
   screen inventing its own greys.

   Read in four parts:
     1. Tokens     — colour, type ramp, elevation, radius, motion
     2. Shell      — sidebar, top bar, content
     3. Controls   — button, input, table, card, badge, modal, tabs
     4. Utilities  — grid spans and the helpers pages lean on

   Section 3 keeps every class name the portal already ships, so a page written
   against the old sheet renders correctly against this one. New work should
   reach for the components in Components/ rather than these classes directly.
   ────────────────────────────────────────────────────────────────────────── */

/* ═══ 1. TOKENS ═══════════════════════════════════════════════════════════ */

:root {
  /* ── Brand ramp ───────────────────────────────────────────────────────
     ShopCore's navy expressed as a Fluent ramp. A control names the role it
     wants — rest, hover, pressed, selected — and never a hex. */
  --brand-primary:   #1B4F72;
  --brand-hover:     #16415E;
  --brand-pressed:   #10314A;
  --brand-selected:  #1B4F72;
  --brand-fg:        #1B4F72;
  --brand-fg-hover:  #16415E;
  --brand-tint-60:   #E9F1F8;
  --brand-tint-40:   #D2E3F1;
  --brand-tint-20:   #A9C7E0;
  --brand-on:        #FFFFFF;

  /* The accent carries emphasis the brand cannot: a selection rail, a live
     dot, the one number on a dashboard that is the point of the dashboard. */
  --accent:          #E67E22;
  --accent-hover:    #CF6F17;
  --accent-tint:     #FDF1E6;

  /* ── Neutral ramp ─────────────────────────────────────────────────────
     Fluent's layered surfaces: canvas sits behind, layer floats on it, and
     subtle is what a header or footer inside a layer is painted with. */
  --neutral-canvas:       #F3F4F6;
  --neutral-layer:        #FFFFFF;
  --neutral-layer-alt:    #FAFBFC;
  --neutral-subtle:       #F5F6F8;
  --neutral-subtle-hover: #EDEFF2;
  --neutral-pressed:      #E4E7EB;
  --neutral-disabled-bg:  #F0F1F3;

  --stroke-1: #D6DAE0;   /* control borders */
  --stroke-2: #E4E7EB;   /* dividers between rows and sections */
  --stroke-3: #EFF1F4;   /* the faintest rule that still reads */

  --fg-1: #16202C;       /* headings and primary values */
  --fg-2: #48566A;       /* body and labels */
  --fg-3: #6B7A8F;       /* secondary and hints */
  --fg-4: #93A1B3;       /* muted, placeholders, disabled text */

  /* ── Status ───────────────────────────────────────────────────────────
     Three tokens each — a foreground that passes contrast on its own tint,
     the tint, and a border — so a badge, an alert and a chart legend can be
     the same green without agreeing by hand. */
  --success-fg: #0E6B33; --success-bg: #E8F7EE; --success-br: #B7E3C7;
  --warning-fg: #8A5A00; --warning-bg: #FFF6E5; --warning-br: #F3D9A4;
  --error-fg:   #B3261E; --error-bg:   #FDECEA; --error-br:   #F5C2BD;
  --info-fg:    #12609E; --info-bg:    #EAF3FB; --info-br:    #BBD8EF;
  --purple-fg:  #5B37B7; --purple-bg:  #F1ECFC; --purple-br:  #D6C6F2;

  /* ── Elevation ────────────────────────────────────────────────────────
     Fluent's depth scale: an ambient shadow that grounds the surface and a
     key shadow that lifts it. */
  --shadow-2:  0 1px 2px rgba(16,24,40,.10), 0 0 2px rgba(16,24,40,.06);
  --shadow-4:  0 2px 4px rgba(16,24,40,.10), 0 0 2px rgba(16,24,40,.06);
  --shadow-8:  0 4px 8px rgba(16,24,40,.11), 0 0 2px rgba(16,24,40,.06);
  --shadow-16: 0 8px 16px rgba(16,24,40,.12), 0 0 2px rgba(16,24,40,.06);
  --shadow-28: 0 14px 28px rgba(16,24,40,.16), 0 0 8px rgba(16,24,40,.08);
  --shadow-64: 0 32px 64px rgba(16,24,40,.22), 0 0 8px rgba(16,24,40,.10);

  /* ── Shape ────────────────────────────────────────────────────────────
     Controls take small, surfaces take large, anything floating takes xl. */
  --r-none: 0; --r-sm: 4px; --r-md: 6px; --r-lg: 8px; --r-xl: 12px; --r-pill: 9999px;

  /* ── Type ramp — named for the role, never the pixel ──────────────────*/
  --fs-caption:  11.5px;
  --fs-body-sm:  12.5px;
  --fs-body:     13.5px;
  --fs-body-lg:  15px;
  --fs-subtitle: 17px;
  --fs-title-sm: 20px;
  --fs-title:    24px;
  --fs-display:  32px;

  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700;

  --font: 'Segoe UI Variable Text', 'Segoe UI', 'Inter', -apple-system,
          BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Segoe UI Variable Display', 'Segoe UI', 'Inter', sans-serif;
  --font-mono: 'Cascadia Mono', 'Consolas', 'SF Mono', ui-monospace, monospace;

  /* ── Motion — Fluent's curves ─────────────────────────────────────────*/
  --dur-faster: 100ms; --dur-fast: 150ms; --dur-normal: 200ms; --dur-slow: 300ms;
  --ease:       cubic-bezier(.33, 0, .67, 1);
  --ease-decel: cubic-bezier(0, 0, .2, 1);
  --ease-accel: cubic-bezier(.8, 0, 1, 1);

  /* ── Shell metrics ────────────────────────────────────────────────────*/
  --sidebar-w:           268px;
  --sidebar-w-collapsed: 56px;
  --topbar-h:            52px;
  --content-pad:         24px;

  /* ── Compatibility aliases ────────────────────────────────────────────
     Every token the portal's existing pages already spend, re-pointed at the
     ramps above. Kept because eighty pages carry inline styles naming them;
     deleting them would repaint those pages at random rather than
     deliberately. New rules should use the tokens above. */
  --sc-primary:       var(--brand-primary);
  --sc-primary-dark:  var(--brand-pressed);
  --sc-primary-light: #2E86C1;
  --sc-accent:        var(--accent);
  --sc-accent-hover:  var(--accent-hover);
  --sc-success:       var(--success-fg);
  --sc-success-bg:    var(--success-bg);
  --sc-warning:       var(--warning-fg);
  --sc-warning-bg:    var(--warning-bg);
  --sc-error:         var(--error-fg);
  --sc-error-bg:      var(--error-bg);
  --sc-info:          var(--info-fg);
  --sc-info-bg:       var(--info-bg);

  --content-bg:        var(--neutral-canvas);
  --card-bg:           var(--neutral-layer);
  --card-border:       var(--stroke-2);
  --card-shadow:       var(--shadow-2);
  --card-shadow-hover: var(--shadow-8);
  --card-radius:       var(--r-lg);
  --focus-ring:        0 0 0 2px var(--neutral-layer), 0 0 0 4px var(--brand-primary);

  --text-primary:   var(--fg-1);
  --text-secondary: var(--fg-2);
  --text-muted:     var(--fg-4);
  --border-color:   var(--stroke-2);

  --topbar-bg:     var(--neutral-layer);
  --topbar-border: var(--stroke-2);

  --t-fast: var(--dur-fast) var(--ease);
  --t-base: var(--dur-normal) var(--ease);
  --t-slow: var(--dur-slow) var(--ease);

  /* ── Navigation surface ───────────────────────────────────────────────
     Fluent's nav drawer is a neutral surface, not a dark slab: it recedes so
     the content is the loudest thing on screen. The selected item is marked
     by a brand rail and a tint, which survives a dark theme without a second
     set of hand-picked greys. */
  --nav-bg:         var(--neutral-layer);
  --nav-border:     var(--stroke-2);
  --nav-fg:         var(--fg-2);
  --nav-fg-hover:   var(--fg-1);
  --nav-fg-active:  var(--brand-fg);
  --nav-hover-bg:   var(--neutral-subtle-hover);
  --nav-active-bg:  var(--brand-tint-60);
  --nav-section-fg: var(--fg-4);
  --nav-rail:       var(--brand-primary);
}

/* ── Dark theme ───────────────────────────────────────────────────────────
   Only tokens are restated. Nothing below section 2 knows a theme exists,
   which is the whole return on having tokens in the first place. */
:root[data-theme="dark"] {
  --brand-primary:  #4C9FD8;
  --brand-hover:    #63AFE2;
  --brand-pressed:  #3B87BC;
  --brand-selected: #4C9FD8;
  --brand-fg:       #7FBEE8;
  --brand-fg-hover: #9BCFF0;
  --brand-tint-60:  #17293A;
  --brand-tint-40:  #1E3A52;
  --brand-tint-20:  #2A5170;
  --brand-on:       #0A1620;

  --accent:       #F0913C;
  --accent-hover: #F5A55C;
  --accent-tint:  #33240F;

  --neutral-canvas:       #14181D;
  --neutral-layer:        #1B2027;
  --neutral-layer-alt:    #1F252D;
  --neutral-subtle:       #232A33;
  --neutral-subtle-hover: #2A323C;
  --neutral-pressed:      #323B47;
  --neutral-disabled-bg:  #232A33;

  --stroke-1: #3A434F;
  --stroke-2: #2C343E;
  --stroke-3: #242B34;

  --fg-1: #F2F4F7;
  --fg-2: #C3CBD6;
  --fg-3: #9AA5B4;
  --fg-4: #74808F;

  --success-fg: #6FD79B; --success-bg: #16301F; --success-br: #2C5A3C;
  --warning-fg: #F2C061; --warning-bg: #332812; --warning-br: #5C4820;
  --error-fg:   #F2938C; --error-bg:   #331C1A; --error-br:   #5C3330;
  --info-fg:    #7FBEE8; --info-bg:    #14283A; --info-br:    #2A4E6E;
  --purple-fg:  #B99BEF; --purple-bg:  #241C3A; --purple-br:  #3E3163;

  --shadow-2:  0 1px 2px rgba(0,0,0,.40), 0 0 2px rgba(0,0,0,.30);
  --shadow-4:  0 2px 4px rgba(0,0,0,.42), 0 0 2px rgba(0,0,0,.30);
  --shadow-8:  0 4px 8px rgba(0,0,0,.45), 0 0 2px rgba(0,0,0,.30);
  --shadow-16: 0 8px 16px rgba(0,0,0,.48), 0 0 2px rgba(0,0,0,.30);
  --shadow-28: 0 14px 28px rgba(0,0,0,.55), 0 0 8px rgba(0,0,0,.35);
  --shadow-64: 0 32px 64px rgba(0,0,0,.65), 0 0 8px rgba(0,0,0,.40);

  --sc-primary-light: #7FBEE8;
}

/* ═══ RESET ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font); font-size: var(--fs-body); line-height: 1.45;
  color: var(--fg-1); background: var(--neutral-canvas); height: 100%;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display); font-weight: var(--fw-semibold);
  color: var(--fg-1); letter-spacing: -.01em;
}

a { color: var(--brand-fg); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--brand-fg-hover); text-decoration: underline; }

/* Fluent's focus indicator: a ring that clears the control rather than
   thickening its border, so nothing shifts by a pixel when you tab onto it. */
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }

::selection { background: var(--brand-tint-40); color: var(--fg-1); }

/* Scrollbars, themed. A default light scrollbar on a dark surface is the one
   thing that always gives away a retro-fitted dark mode. */
* { scrollbar-width: thin; scrollbar-color: var(--stroke-1) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--stroke-1); border-radius: var(--r-pill);
                            border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-4); background-clip: content-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ═══ 2. SHELL ════════════════════════════════════════════════════════════ */

.sc-shell { display: flex; height: 100vh; overflow: hidden; background: var(--neutral-canvas); }

/* ── Sidebar ──────────────────────────────────────────────────────────────*/
.sc-sidebar {
  width: var(--sidebar-w); background: var(--nav-bg);
  border-right: 1px solid var(--nav-border);
  display: flex; flex-direction: column; flex-shrink: 0;
  height: 100vh; overflow: hidden; position: relative; z-index: 100;
  transition: width var(--dur-normal) var(--ease-decel);
}
.sc-sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sc-sidebar.collapsed .sc-logo-text,
.sc-sidebar.collapsed .sc-nav-label,
.sc-sidebar.collapsed .sc-nav-section,
.sc-sidebar.collapsed .sc-nav-chevron,
.sc-sidebar.collapsed .sc-nav-sub,
.sc-sidebar.collapsed .sc-biz-badge,
.sc-sidebar.collapsed .sc-user-info { display: none; }
.sc-sidebar.collapsed .sc-nav-item { justify-content: center; padding: 8px 0; }
.sc-sidebar.collapsed .sc-logo { justify-content: center; padding: 12px 0; }

/* Logo */
.sc-logo {
  padding: 14px 16px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--nav-border); flex-shrink: 0; min-height: var(--topbar-h);
}
.sc-logo-mark {
  width: 32px; height: 32px; border-radius: var(--r-md); flex-shrink: 0;
  display: block; object-fit: contain;
}
.sc-logo-text { min-width: 0; }
.sc-logo-name { font-family: var(--font-display); font-size: var(--fs-body-lg);
                font-weight: var(--fw-semibold); color: var(--fg-1);
                letter-spacing: -.02em; display: block; line-height: 1.1; }
.sc-logo-sub  { font-size: 10px; color: var(--fg-4); font-weight: var(--fw-semibold);
                text-transform: uppercase; letter-spacing: .08em; display: block; margin-top: 1px; }

/* The trade badge. Says which business type is in force, because every noun
   on every screen below it comes from that answer. */
.sc-biz-badge {
  margin: 10px 12px 4px; padding: 5px 10px;
  background: var(--brand-tint-60); border: 1px solid var(--brand-tint-40);
  border-radius: var(--r-md); font-size: 10.5px; font-weight: var(--fw-semibold);
  color: var(--brand-fg); letter-spacing: .05em; text-transform: uppercase;
  display: flex; align-items: center; gap: 7px;
}
.sc-biz-badge::before {
  content: ''; width: 6px; height: 6px; background: var(--success-fg);
  border-radius: 50%; flex-shrink: 0;
}

/* Nav scroll */
.sc-nav-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 8px 12px; }

/* Section label */
.sc-nav-section {
  padding: 14px 12px 5px; font-size: 10.5px; font-weight: var(--fw-semibold);
  text-transform: uppercase; letter-spacing: .07em; color: var(--nav-section-fg);
}

/* Nav item — Fluent's nav pill: a rounded fill on hover, a brand rail and a
   tint when selected. The rail is inside the pill so a collapsed rail still
   lines up with the icon. */
.sc-nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 11px; margin-bottom: 1px;
  color: var(--nav-fg); text-decoration: none;
  font-family: var(--font); font-size: var(--fs-body); font-weight: var(--fw-regular);
  cursor: pointer; transition: background var(--t-fast), color var(--t-fast);
  position: relative; white-space: nowrap; user-select: none;
  border: none; background: none; width: 100%; border-radius: var(--r-md);
  text-align: left;
}
.sc-nav-item:hover { background: var(--nav-hover-bg); color: var(--nav-fg-hover); text-decoration: none; }
.sc-nav-item:active { background: var(--neutral-pressed); }
.sc-nav-item.active {
  background: var(--nav-active-bg); color: var(--nav-fg-active); font-weight: var(--fw-semibold);
}
.sc-nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; background: var(--nav-rail); border-radius: 0 3px 3px 0;
}
.sc-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85;
                   transition: opacity var(--t-fast); }
.sc-nav-item.active svg, .sc-nav-item:hover svg { opacity: 1; }
.sc-nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sc-nav-chevron {
  margin-left: auto; width: 14px; height: 14px; opacity: .55; flex-shrink: 0;
  transition: transform var(--dur-normal) var(--ease), opacity var(--t-fast);
}
.sc-nav-item.expanded .sc-nav-chevron { transform: rotate(180deg); opacity: .85; }

/* A count or state chip riding on a nav item — an approval queue's depth. */
.sc-nav-pill {
  margin-left: auto; font-size: 10.5px; font-weight: var(--fw-semibold);
  background: var(--brand-tint-40); color: var(--brand-fg);
  border-radius: var(--r-pill); padding: 1px 7px; flex-shrink: 0;
}

/* Sub nav */
.sc-nav-sub { overflow: hidden; max-height: 0; transition: max-height var(--dur-slow) var(--ease); }
.sc-nav-sub.open { max-height: 900px; }
.sc-nav-sub-item {
  display: flex; align-items: center; padding: 6px 11px 6px 40px;
  color: var(--nav-fg); text-decoration: none; font-size: var(--fs-body-sm);
  font-weight: var(--fw-regular); cursor: pointer; position: relative;
  border: none; background: none; width: 100%; font-family: var(--font);
  text-align: left; border-radius: var(--r-md); margin-bottom: 1px;
  transition: background var(--t-fast), color var(--t-fast);
}
/* The tree rail. One line down the group rather than a dot per row — it reads
   as one list instead of eight unrelated bullets. */
.sc-nav-sub::before {
  content: ''; position: absolute; left: 20px; top: 0; bottom: 0;
  width: 1px; background: var(--stroke-2);
}
.sc-nav-sub { position: relative; }
.sc-nav-sub-item:hover { background: var(--nav-hover-bg); color: var(--nav-fg-hover); text-decoration: none; }
.sc-nav-sub-item.active { color: var(--nav-fg-active); font-weight: var(--fw-semibold);
                          background: var(--nav-active-bg); }
.sc-nav-sub-item.active::before {
  content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 14px; background: var(--nav-rail); border-radius: 3px;
}

/* User card */
.sc-sidebar-user {
  padding: 10px 12px; border-top: 1px solid var(--nav-border);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.sc-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-primary); color: var(--brand-on);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-body-sm); font-weight: var(--fw-semibold); flex-shrink: 0;
}
.sc-user-info { flex: 1; min-width: 0; }
.sc-user-name { font-size: var(--fs-body-sm); font-weight: var(--fw-semibold); color: var(--fg-1);
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.sc-user-role { font-size: var(--fs-caption); color: var(--fg-4); display: block;
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Top bar ──────────────────────────────────────────────────────────────*/
.sc-topbar {
  height: var(--topbar-h); background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex; align-items: center; padding: 0 16px; gap: 12px;
  flex-shrink: 0; position: sticky; top: 0; z-index: 50;
}
.sc-breadcrumb { flex: 1; display: flex; align-items: center; flex-wrap: wrap;
                 font-size: var(--fs-body-sm); gap: 1px; min-width: 0; }
.sc-bc-link { color: var(--fg-3); text-decoration: none; padding: 3px 6px;
              border-radius: var(--r-sm); transition: all var(--t-fast); }
.sc-bc-link:hover { color: var(--brand-fg); background: var(--neutral-subtle-hover); text-decoration: none; }
.sc-bc-sep { color: var(--fg-4); }
.sc-bc-current { color: var(--fg-1); font-weight: var(--fw-semibold); padding: 3px 6px; }

.sc-search-wrap { position: relative; }
.sc-search-wrap input {
  background: var(--neutral-subtle); border: 1px solid var(--stroke-1);
  border-radius: var(--r-md); padding: 6px 12px 6px 32px;
  font-size: var(--fs-body-sm); width: 240px; outline: none;
  transition: width var(--t-base), border-color var(--t-fast), background var(--t-fast);
  font-family: var(--font); color: var(--fg-1); height: 32px;
}
.sc-search-wrap input::placeholder { color: var(--fg-4); }
.sc-search-wrap input:focus {
  border-color: var(--brand-primary); width: 300px; background: var(--neutral-layer);
  box-shadow: inset 0 -2px 0 -1px var(--brand-primary);
}
.sc-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
                  width: 15px; height: 15px; color: var(--fg-4); pointer-events: none; }

.sc-topbar-actions { display: flex; align-items: center; gap: 4px; }
.sc-icon-btn {
  width: 32px; height: 32px; border-radius: var(--r-md); display: inline-flex;
  align-items: center; justify-content: center; background: none; border: none;
  cursor: pointer; color: var(--fg-2); transition: all var(--t-fast); position: relative;
}
.sc-icon-btn:hover { background: var(--neutral-subtle-hover); color: var(--fg-1); }
.sc-icon-btn:active { background: var(--neutral-pressed); }
.sc-icon-btn.on { background: var(--brand-tint-60); color: var(--brand-fg); }
.sc-notif-dot {
  position: absolute; top: 5px; right: 6px; width: 7px; height: 7px;
  background: var(--accent); border-radius: 50%; border: 2px solid var(--neutral-layer);
}

/* ── Branch picker ────────────────────────────────────────────────────────
   Sits in the top bar reading as a statement about what the figures on screen
   are, and opens into the list only when touched. It is deliberately louder
   than a select: a head office looking at one shop's numbers under a heading
   that says otherwise is the failure this control exists to prevent. */
.sc-branch { position: relative; }
.sc-branch-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px;
  padding: 0 10px; border-radius: var(--r-md);
  border: 1px solid var(--stroke-1); background: var(--neutral-layer);
  color: var(--fg-1); font-family: var(--font); font-size: var(--fs-body-sm);
  cursor: pointer; transition: all var(--t-fast); max-width: 260px;
}
.sc-branch-btn:hover { background: var(--neutral-subtle-hover); border-color: var(--stroke-1); }
.sc-branch-btn[disabled] { cursor: default; background: transparent; border-color: transparent; }
.sc-branch-btn svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--fg-3); }
.sc-branch-label { display: flex; flex-direction: column; align-items: flex-start;
                   min-width: 0; line-height: 1.15; }
.sc-branch-kicker { font-size: 9.5px; text-transform: uppercase; letter-spacing: .07em;
                    color: var(--fg-4); font-weight: var(--fw-semibold); }
.sc-branch-name { font-size: var(--fs-body-sm); font-weight: var(--fw-semibold); color: var(--fg-1);
                  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.sc-branch-all .sc-branch-name { color: var(--accent); }

.sc-branch-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 280px; max-width: 340px;
  background: var(--neutral-layer); border: 1px solid var(--stroke-2);
  border-radius: var(--r-lg); box-shadow: var(--shadow-16);
  padding: 6px; z-index: 400; max-height: 420px; overflow-y: auto;
  animation: sc-flyout var(--dur-fast) var(--ease-decel);
}
.sc-branch-menu-hdr {
  padding: 8px 10px 6px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--fg-4); font-weight: var(--fw-semibold);
}
.sc-branch-opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: none; background: none; cursor: pointer;
  border-radius: var(--r-md); font-family: var(--font); font-size: var(--fs-body);
  color: var(--fg-1); text-align: left; transition: background var(--t-fast);
}
.sc-branch-opt:hover { background: var(--neutral-subtle-hover); }
.sc-branch-opt.active { background: var(--brand-tint-60); color: var(--brand-fg);
                        font-weight: var(--fw-semibold); }
.sc-branch-opt-body { flex: 1; min-width: 0; }
.sc-branch-opt-sub { font-size: var(--fs-caption); color: var(--fg-4); font-weight: var(--fw-regular); }
.sc-branch-opt-check { width: 16px; height: 16px; flex-shrink: 0; color: var(--brand-fg); }

@keyframes sc-flyout {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Main + content ───────────────────────────────────────────────────────*/
.sc-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.sc-content { flex: 1; overflow-y: auto; padding: var(--content-pad); }

/* ── Page header ──────────────────────────────────────────────────────────*/
.sc-page-header { display: flex; align-items: flex-start; justify-content: space-between;
                  margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.sc-page-title { font-family: var(--font-display); font-size: var(--fs-title);
                 font-weight: var(--fw-semibold); color: var(--fg-1);
                 letter-spacing: -.02em; margin: 0; line-height: 1.2; }
.sc-page-subtitle { font-size: var(--fs-body); color: var(--fg-3); margin: 3px 0 0; max-width: 78ch; }
.sc-page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ═══ 3. CONTROLS ═════════════════════════════════════════════════════════ */

/* ── Cards ────────────────────────────────────────────────────────────────*/
.sc-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--card-radius); box-shadow: var(--shadow-2);
  overflow: hidden; transition: box-shadow var(--t-base), border-color var(--t-base);
}
.sc-card-header { padding: 14px 18px; border-bottom: 1px solid var(--stroke-2);
                  display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sc-card-title { font-family: var(--font-display); font-size: var(--fs-body-lg);
                 font-weight: var(--fw-semibold); color: var(--fg-1); }
.sc-card-subtitle { font-size: var(--fs-body-sm); color: var(--fg-4); margin-top: 2px; }
.sc-card-body { padding: 18px; }
.sc-card-footer { padding: 12px 18px; border-top: 1px solid var(--stroke-2);
                  background: var(--neutral-layer-alt); }

/* Two cards stacked as one surface — a toolbar card above a table card. */
.sc-card-stack-top { border-radius: var(--card-radius) var(--card-radius) 0 0; border-bottom: 0; }
.sc-card-stack-btm { border-radius: 0 0 var(--card-radius) var(--card-radius); border-top: 0; }

/* ── KPI tiles ────────────────────────────────────────────────────────────*/
.sc-kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
               gap: 14px; margin-bottom: 20px; }
.sc-kpi {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--card-radius); padding: 16px 18px 14px;
  box-shadow: var(--shadow-2); transition: box-shadow var(--t-base), transform var(--t-base);
  position: relative; overflow: hidden;
}
.sc-kpi:hover { box-shadow: var(--shadow-8); }
.sc-kpi::after { content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 3px;
                 background: var(--kpi-c, var(--brand-primary)); }
.sc-kpi-header { display: flex; align-items: flex-start; justify-content: space-between;
                 margin-bottom: 10px; gap: 8px; }
.sc-kpi-label { font-size: var(--fs-caption); font-weight: var(--fw-semibold); color: var(--fg-4);
                text-transform: uppercase; letter-spacing: .06em; }
.sc-kpi-icon { width: 32px; height: 32px; border-radius: var(--r-md); display: flex;
               align-items: center; justify-content: center; flex-shrink: 0;
               background: color-mix(in srgb, var(--kpi-c, var(--brand-primary)) 12%, transparent);
               color: var(--kpi-c, var(--brand-primary)); }
.sc-kpi-icon svg { width: 17px; height: 17px; }
.sc-kpi-value { font-family: var(--font-display); font-size: 26px; font-weight: var(--fw-semibold);
                color: var(--fg-1); letter-spacing: -.03em; line-height: 1.05; margin-bottom: 5px;
                font-variant-numeric: tabular-nums; }
.sc-kpi-trend { display: flex; align-items: center; gap: 4px; font-size: var(--fs-caption);
                font-weight: var(--fw-medium); }
.sc-kpi-trend.up   { color: var(--success-fg); }
.sc-kpi-trend.down { color: var(--error-fg); }
.sc-kpi-trend.flat { color: var(--fg-4); }
.sc-kpi-trend svg  { width: 13px; height: 13px; }

.kpi-primary { --kpi-c: var(--brand-primary); }
.kpi-success { --kpi-c: var(--success-fg); }
.kpi-warning { --kpi-c: var(--warning-fg); }
.kpi-error   { --kpi-c: var(--error-fg); }
.kpi-info    { --kpi-c: var(--info-fg); }
.kpi-accent  { --kpi-c: var(--accent); }
.kpi-purple  { --kpi-c: var(--purple-fg); }

/* ── Buttons ──────────────────────────────────────────────────────────────
   Fluent's button: 32px tall, 4px corners, semibold label, and a border on
   every variant so the outline and the filled forms line up in a toolbar. */
.sc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 32px; padding: 0 14px; border-radius: var(--r-sm);
  font-family: var(--font); font-size: var(--fs-body); font-weight: var(--fw-semibold);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  text-decoration: none; line-height: 1;
}
.sc-btn:hover { text-decoration: none; }
.sc-btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.sc-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.sc-btn-primary { background: var(--brand-primary); color: var(--brand-on); border-color: var(--brand-primary); }
.sc-btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-on); }
.sc-btn-primary:active:not(:disabled) { background: var(--brand-pressed); border-color: var(--brand-pressed); }

.sc-btn-accent { background: var(--accent); color: #FFF; border-color: var(--accent); }
.sc-btn-accent:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: #FFF; }

.sc-btn-success { background: var(--success-fg); color: #FFF; border-color: var(--success-fg); }
.sc-btn-success:hover:not(:disabled) { filter: brightness(1.1); color: #FFF; }

.sc-btn-warning { background: var(--warning-fg); color: #FFF; border-color: var(--warning-fg); }
.sc-btn-warning:hover:not(:disabled) { filter: brightness(1.1); color: #FFF; }

.sc-btn-danger { background: var(--error-fg); color: #FFF; border-color: var(--error-fg); }
.sc-btn-danger:hover:not(:disabled) { filter: brightness(1.1); color: #FFF; }

/* The confirmation panel on the forgot-password and reset-password pages.
   It had no rule at all, so the one message those pages exist to deliver —
   "check your email" — rendered as bare text under the heading, on the only
   screens a customer meets before signing in. */
.sc-info-box {
  padding: 14px 16px;
  border: 1px solid var(--stroke-1);
  border-left-width: 3px;
  border-radius: var(--r-md);
  background: var(--neutral-subtle);
  color: var(--fg-2);
  font-size: 13px;
  line-height: 1.55;
}

.sc-info-box.info-success {
  border-color: var(--success-br);
  border-left-color: var(--success-fg);
  background: var(--success-bg);
  color: var(--success-fg);
}

.sc-info-box.info-warning {
  border-color: var(--warning-br);
  border-left-color: var(--warning-fg);
  background: var(--warning-bg);
  color: var(--warning-fg);
}

.sc-btn-outline { background: var(--neutral-layer); color: var(--fg-1); border-color: var(--stroke-1); }
.sc-btn-outline:hover:not(:disabled) { background: var(--neutral-subtle-hover); color: var(--fg-1); }
.sc-btn-outline:active:not(:disabled) { background: var(--neutral-pressed); }

.sc-btn-subtle { background: var(--neutral-subtle); color: var(--fg-1); border-color: transparent; }
.sc-btn-subtle:hover:not(:disabled) { background: var(--neutral-subtle-hover); color: var(--fg-1); }

.sc-btn-ghost { background: transparent; color: var(--fg-2); border-color: transparent; }
.sc-btn-ghost:hover:not(:disabled) { background: var(--neutral-subtle-hover); color: var(--fg-1); }

/* The one-word link that lives in a table row's action column. */
.sc-btn-link { background: transparent; border-color: transparent; color: var(--brand-fg);
               height: auto; padding: 2px 4px; font-weight: var(--fw-semibold); }
.sc-btn-link:hover:not(:disabled) { text-decoration: underline; color: var(--brand-fg-hover); }

.sc-btn-sm { height: 26px; padding: 0 10px; font-size: var(--fs-body-sm); }
.sc-btn-sm svg { width: 13px; height: 13px; }
.sc-btn-lg { height: 40px; padding: 0 20px; font-size: var(--fs-body-lg); }
.sc-btn-icon { width: 32px; padding: 0; }
.sc-btn-icon-sm { width: 26px; height: 26px; padding: 0; }
.sc-btn-block { width: 100%; }

/* A row of buttons that reads as one control. */
.sc-btn-group { display: inline-flex; }
.sc-btn-group .sc-btn { border-radius: 0; margin-left: -1px; }
.sc-btn-group .sc-btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); margin-left: 0; }
.sc-btn-group .sc-btn:last-child  { border-radius: 0 var(--r-sm) var(--r-sm) 0; }

/* ── Inputs ───────────────────────────────────────────────────────────────
   Fluent's field: a quiet 1px box that grows a brand underline on focus. The
   underline is drawn with an inset shadow rather than a border so the control
   does not change size and the row does not jump. */
.sc-input, .sc-select, .sc-textarea {
  width: 100%; font-family: var(--font); font-size: var(--fs-body); color: var(--fg-1);
  background: var(--neutral-layer); border: 1px solid var(--stroke-1);
  border-radius: var(--r-sm); padding: 0 10px; height: 32px; outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.sc-input::placeholder, .sc-textarea::placeholder { color: var(--fg-4); }
.sc-input:hover:not(:disabled), .sc-select:hover:not(:disabled),
.sc-textarea:hover:not(:disabled) { border-color: var(--fg-4); }
.sc-input:focus, .sc-select:focus, .sc-textarea:focus {
  border-color: var(--stroke-1); box-shadow: inset 0 -2px 0 -1px var(--brand-primary);
}
.sc-input:disabled, .sc-select:disabled, .sc-textarea:disabled {
  background: var(--neutral-disabled-bg); color: var(--fg-4); cursor: not-allowed;
}
.sc-input[readonly] { background: var(--neutral-subtle); color: var(--fg-2); }
.sc-input.invalid, .sc-select.invalid, .sc-textarea.invalid { border-color: var(--error-fg); }
.sc-input.invalid:focus { box-shadow: inset 0 -2px 0 -1px var(--error-fg); }
.sc-input.mono { font-family: var(--font-mono); font-size: var(--fs-body-sm); }
.sc-input.num, .sc-input[type="number"] { text-align: right; font-variant-numeric: tabular-nums; }

.sc-select {
  appearance: none; padding-right: 30px; 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='%236B7A8F' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 15px;
}
:root[data-theme="dark"] .sc-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239AA5B4' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.sc-textarea { resize: vertical; min-height: 76px; height: auto; padding: 8px 10px; line-height: 1.5; }

.sc-input-sm, .sc-select-sm { height: 26px; font-size: var(--fs-body-sm); }

/* ── Form layout ──────────────────────────────────────────────────────────
   A create form is the screen most likely to end up jumbled, because every
   field is added by a different person on a different day. The grid below is
   the answer: fields declare a span, the grid decides the rest, and nothing
   needs an inline width. */
.sc-form-group { margin-bottom: 0; display: flex; flex-direction: column; }
.sc-label { display: block; font-size: var(--fs-body-sm); font-weight: var(--fw-semibold);
            color: var(--fg-2); margin-bottom: 5px; }
.sc-label.required::after { content: ' *'; color: var(--error-fg); }
.sc-field-error { font-size: var(--fs-caption); color: var(--error-fg); margin-top: 4px; }
.sc-field-hint  { font-size: var(--fs-caption); color: var(--fg-4); margin-top: 4px; line-height: 1.4; }

.sc-input-group { display: flex; align-items: stretch; }
.sc-input-group .sc-input { flex: 1; }
.sc-input-addon { display: flex; align-items: center; padding: 0 10px;
                  background: var(--neutral-subtle); border: 1px solid var(--stroke-1);
                  color: var(--fg-3); font-size: var(--fs-body-sm); white-space: nowrap; }
.sc-input-addon-l { border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); }
.sc-input-addon-r { border-left: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.sc-input-group .sc-input:not(:first-child) { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.sc-input-group .sc-input:not(:last-child)  { border-radius: var(--r-sm) 0 0 var(--r-sm); }

.sc-form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px 16px; }
.g-12 { grid-column: span 12; } .g-11 { grid-column: span 11; }
.g-10 { grid-column: span 10; } .g-9  { grid-column: span 9; }
.g-8  { grid-column: span 8; }  .g-7  { grid-column: span 7; }
.g-6  { grid-column: span 6; }  .g-5  { grid-column: span 5; }
.g-4  { grid-column: span 4; }  .g-3  { grid-column: span 3; }
.g-2  { grid-column: span 2; }  .g-1  { grid-column: span 1; }

/* A labelled divider inside a form grid: "Pricing", "Regulated goods". */
.sc-form-divider {
  grid-column: span 12; display: flex; align-items: center; gap: 10px;
  margin: 6px 0 0; font-size: var(--fs-caption); font-weight: var(--fw-semibold);
  text-transform: uppercase; letter-spacing: .07em; color: var(--fg-4);
}
.sc-form-divider::after { content: ''; flex: 1; height: 1px; background: var(--stroke-2); }

/* ── Checkbox and switch ──────────────────────────────────────────────────*/
.sc-check-group { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer;
                  user-select: none; }
.sc-check-input { appearance: auto; width: 16px; height: 16px; margin: 0; flex-shrink: 0;
                  accent-color: var(--brand-primary); cursor: pointer; margin-top: 1px; }
.sc-check-label { font-size: var(--fs-body); color: var(--fg-1); line-height: 1.35; }

/* Fluent's switch. For a setting that takes effect rather than a value that
   is saved with a form — the distinction the trade switches depend on. */
.sc-switch { display: inline-flex; align-items: flex-start; gap: 11px; cursor: pointer;
             user-select: none; }
.sc-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.sc-switch-track {
  width: 40px; height: 20px; border-radius: var(--r-pill); flex-shrink: 0;
  background: transparent; border: 1px solid var(--fg-3); position: relative;
  transition: background var(--t-fast), border-color var(--t-fast); margin-top: 1px;
}
.sc-switch-thumb {
  position: absolute; top: 50%; left: 4px; transform: translateY(-50%);
  width: 10px; height: 10px; border-radius: 50%; background: var(--fg-2);
  transition: left var(--dur-normal) var(--ease-decel), background var(--t-fast),
              width var(--dur-fast) var(--ease), height var(--dur-fast) var(--ease);
}
.sc-switch input:checked + .sc-switch-track { background: var(--brand-primary); border-color: var(--brand-primary); }
.sc-switch input:checked + .sc-switch-track .sc-switch-thumb { left: 23px; background: var(--brand-on);
                                                               width: 12px; height: 12px; }
.sc-switch input:disabled + .sc-switch-track { opacity: .45; cursor: not-allowed; }
.sc-switch input:focus-visible + .sc-switch-track { box-shadow: var(--focus-ring); }
.sc-switch-body { min-width: 0; }
.sc-switch-label { font-size: var(--fs-body); color: var(--fg-1); font-weight: var(--fw-medium);
                   line-height: 1.35; display: block; }
.sc-switch-hint { font-size: var(--fs-caption); color: var(--fg-4); margin-top: 3px;
                  line-height: 1.45; display: block; }

/* Cards that hold a form grid directly still need their padding. */
.sc-card:has(> .sc-form-grid) { padding: 18px; }
.sc-card:has(> .sc-form-grid) > .sc-card-title { margin-bottom: 14px; display: block; }

/* ── Toolbar ──────────────────────────────────────────────────────────────*/
.sc-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px;
              flex-wrap: wrap; border-bottom: 1px solid var(--stroke-2);
              background: var(--neutral-layer); }
.sc-toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sc-toolbar-sep { width: 1px; align-self: stretch; background: var(--stroke-2); margin: 2px 2px; }
.sc-toolbar-count { font-size: var(--fs-body-sm); color: var(--fg-4); white-space: nowrap; }

/* A removable filter chip, so what is narrowing a list is visible and
   reversible rather than hidden behind a drop-down somebody set last week. */
.sc-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px;
           padding: 0 6px 0 10px; border-radius: var(--r-pill);
           background: var(--brand-tint-60); color: var(--brand-fg);
           font-size: var(--fs-body-sm); font-weight: var(--fw-medium); }
.sc-chip button { border: none; background: none; cursor: pointer; color: inherit;
                  display: flex; padding: 2px; border-radius: 50%; opacity: .7; }
.sc-chip button:hover { opacity: 1; background: var(--brand-tint-40); }

/* Chips wrap rather than scroll: a promotion covering a dozen products should
   grow the field, not hide half the answer off the right edge. */
.sc-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* Results of a type-ahead search. Capped and scrollable so a loose search term
   cannot push the rest of the form off the screen. */
.sc-picker-list { list-style: none; margin: 4px 0 0; padding: 4px;
                  max-height: 176px; overflow-y: auto;
                  border: 1px solid var(--stroke-2); border-radius: var(--r-md);
                  background: var(--neutral-layer); }
.sc-picker-list li { margin: 0; }
.sc-picker-list button { width: 100%; text-align: left; border: none;
                         background: none; cursor: pointer; padding: 6px 8px;
                         border-radius: var(--r-sm); color: var(--fg-2);
                         font-size: var(--fs-body-sm); }
.sc-picker-list button:hover { background: var(--brand-tint-60); }
.sc-picker-list strong { font-weight: var(--fw-medium); color: var(--fg-3);
                         margin-right: 6px; }

/* ── Tables ───────────────────────────────────────────────────────────────*/
.sc-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sc-table { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
.sc-table thead th {
  padding: 9px 14px; text-align: left; font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold); color: var(--fg-3); background: var(--neutral-layer-alt);
  border-bottom: 1px solid var(--stroke-2); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.sc-table thead th.sorted { color: var(--brand-fg); }
.sc-table thead th .sort-arrows { display: inline-flex; flex-direction: column;
                                  margin-left: 4px; vertical-align: middle; opacity: .5; }
.sc-table tbody tr { border-bottom: 1px solid var(--stroke-3); transition: background var(--t-fast); }
.sc-table tbody tr:hover { background: var(--neutral-subtle); }
.sc-table tbody tr.selected { background: var(--brand-tint-60); }
.sc-table tbody tr:last-child { border-bottom: none; }
.sc-table tbody td { padding: 10px 14px; color: var(--fg-1); vertical-align: middle; }
.sc-table tbody td.muted { color: var(--fg-3); }
.sc-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums;
                         font-weight: var(--fw-medium); }
.sc-table tbody td.mono { font-family: var(--font-mono); font-size: var(--fs-body-sm); }
.sc-table th.col-check, .sc-table td.col-check { width: 40px; padding-right: 8px; }
.sc-table td.col-actions { width: 1%; text-align: right; white-space: nowrap; }
.sc-table th.num { text-align: right; }
.sc-table-clickable tbody tr { cursor: pointer; }

/* The two-line cell every list uses: a name over a code. */
.sc-cell-primary { font-weight: var(--fw-medium); color: var(--fg-1); }
.sc-cell-sub { font-size: var(--fs-caption); color: var(--fg-4); margin-top: 1px; }
.sc-cell-mono { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--fg-4); }

/* ── Badges ───────────────────────────────────────────────────────────────*/
.sc-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  border-radius: var(--r-pill); font-size: var(--fs-caption); font-weight: var(--fw-semibold);
  white-space: nowrap; border: 1px solid transparent; line-height: 1.5;
}
.sc-badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-success { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-br); }
.badge-success .sc-badge-dot { background: var(--success-fg); }
.badge-warning { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-br); }
.badge-warning .sc-badge-dot { background: var(--warning-fg); }
.badge-error   { background: var(--error-bg);   color: var(--error-fg);   border-color: var(--error-br); }
.badge-error   .sc-badge-dot { background: var(--error-fg); }
.badge-info    { background: var(--info-bg);    color: var(--info-fg);    border-color: var(--info-br); }
.badge-info    .sc-badge-dot { background: var(--info-fg); }
.badge-neutral { background: var(--neutral-subtle); color: var(--fg-3); border-color: var(--stroke-2); }
.badge-neutral .sc-badge-dot { background: var(--fg-4); }
.badge-primary { background: var(--brand-tint-60); color: var(--brand-fg); border-color: var(--brand-tint-40); }
.badge-primary .sc-badge-dot { background: var(--brand-primary); }
.badge-accent  { background: var(--accent-tint); color: var(--accent-hover); border-color: var(--accent); }
.badge-accent  .sc-badge-dot { background: var(--accent); }
.badge-purple  { background: var(--purple-bg);  color: var(--purple-fg);  border-color: var(--purple-br); }
.badge-purple  .sc-badge-dot { background: var(--purple-fg); }

/* ── Pagination ───────────────────────────────────────────────────────────*/
.sc-pagination { display: flex; align-items: center; justify-content: space-between;
                 padding: 10px 14px; border-top: 1px solid var(--stroke-2); gap: 12px;
                 flex-wrap: wrap; }
.sc-pagination-info { font-size: var(--fs-body-sm); color: var(--fg-4); }
.sc-pagination-pages { display: flex; align-items: center; gap: 2px; }
.sc-page-btn { min-width: 28px; height: 28px; border-radius: var(--r-sm);
               border: 1px solid transparent; background: none; cursor: pointer;
               font-family: var(--font); font-size: var(--fs-body-sm); color: var(--fg-2);
               display: inline-flex; align-items: center; justify-content: center;
               transition: all var(--t-fast); padding: 0 6px; }
.sc-page-btn:hover:not(:disabled) { background: var(--neutral-subtle-hover); color: var(--fg-1); }
.sc-page-btn.active { background: var(--brand-primary); border-color: var(--brand-primary);
                      color: var(--brand-on); font-weight: var(--fw-semibold); }
.sc-page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Tabs ─────────────────────────────────────────────────────────────────
   Fluent's tab list: the selected tab is marked by a short rail under its
   label rather than a full-width border, so a row of tabs reads as a row of
   words and not a filing cabinet. */
.sc-tabs { display: flex; border-bottom: 1px solid var(--stroke-2); gap: 2px;
           overflow-x: auto; }
.sc-tab { padding: 9px 12px 10px; font-family: var(--font); font-size: var(--fs-body);
          font-weight: var(--fw-medium); color: var(--fg-2); background: none;
          border: none; cursor: pointer; position: relative; white-space: nowrap;
          transition: color var(--t-fast), background var(--t-fast); border-radius: var(--r-sm) var(--r-sm) 0 0; }
.sc-tab:hover { color: var(--fg-1); background: var(--neutral-subtle-hover); }
.sc-tab.active { color: var(--brand-fg); font-weight: var(--fw-semibold); }
.sc-tab.active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 0;
                        height: 2px; background: var(--brand-primary); border-radius: 2px 2px 0 0; }
.sc-tab .tab-cnt { display: inline-flex; align-items: center; justify-content: center;
                   min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px;
                   border-radius: var(--r-pill); background: var(--neutral-subtle);
                   font-size: 10.5px; font-weight: var(--fw-semibold); color: var(--fg-3); }
.sc-tab.active .tab-cnt { background: var(--brand-primary); color: var(--brand-on); }

/* ── Modals ───────────────────────────────────────────────────────────────*/
.sc-overlay {
  position: fixed; inset: 0; background: rgba(11,17,24,.45);
  display: flex; align-items: center; justify-content: center; z-index: 500;
  padding: 24px; animation: sc-fade var(--dur-fast) var(--ease);
  backdrop-filter: blur(2px);
}
.sc-modal {
  background: var(--neutral-layer); border-radius: var(--r-xl);
  box-shadow: var(--shadow-64); width: 100%; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--stroke-2);
  animation: sc-modal-in var(--dur-normal) var(--ease-decel);
}
.sc-modal-sm { max-width: 440px; } .sc-modal-md { max-width: 640px; }
.sc-modal-lg { max-width: 860px; } .sc-modal-xl { max-width: 1140px; }
.sc-modal-hdr { padding: 18px 22px 14px; display: flex; align-items: flex-start;
                justify-content: space-between; gap: 16px; flex-shrink: 0; }
.sc-modal-title { font-family: var(--font-display); font-size: var(--fs-subtitle);
                  font-weight: var(--fw-semibold); color: var(--fg-1); }
.sc-modal-sub { font-size: var(--fs-body-sm); color: var(--fg-4); margin-top: 3px; }
.sc-modal-close { width: 30px; height: 30px; border-radius: var(--r-sm); border: none;
                  background: none; cursor: pointer; color: var(--fg-3); flex-shrink: 0;
                  display: flex; align-items: center; justify-content: center;
                  font-size: 15px; transition: all var(--t-fast); }
.sc-modal-close:hover { background: var(--neutral-subtle-hover); color: var(--fg-1); }
.sc-modal-body { padding: 4px 22px 22px; overflow-y: auto; flex: 1; }
.sc-modal-ftr { padding: 14px 22px; border-top: 1px solid var(--stroke-2);
                display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0;
                background: var(--neutral-layer-alt); }

@keyframes sc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sc-modal-in {
  from { opacity: 0; transform: scale(.97) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Drawer — a side panel for detail without leaving the list ────────────*/
.sc-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw);
  background: var(--neutral-layer); border-left: 1px solid var(--stroke-2);
  box-shadow: var(--shadow-64); z-index: 500; display: flex; flex-direction: column;
  animation: sc-drawer-in var(--dur-normal) var(--ease-decel);
}
.sc-drawer-wide { width: min(880px, 100vw); }
@keyframes sc-drawer-in { from { transform: translateX(24px); opacity: 0; }
                          to   { transform: translateX(0); opacity: 1; } }

/* ── Alerts ───────────────────────────────────────────────────────────────*/
.sc-alert { display: flex; align-items: flex-start; gap: 11px; padding: 11px 14px;
            border-radius: var(--r-md); border: 1px solid transparent;
            font-size: var(--fs-body); margin-bottom: 16px; line-height: 1.45; }
.sc-alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.sc-alert-title { font-weight: var(--fw-semibold); margin-bottom: 2px; }
.sc-alert-info    { background: var(--info-bg);    border-color: var(--info-br);    color: var(--info-fg); }
.sc-alert-success { background: var(--success-bg); border-color: var(--success-br); color: var(--success-fg); }
.sc-alert-warning { background: var(--warning-bg); border-color: var(--warning-br); color: var(--warning-fg); }
.sc-alert-error   { background: var(--error-bg);   border-color: var(--error-br);   color: var(--error-fg); }
.sc-alert-close { margin-left: auto; background: none; border: none; cursor: pointer;
                  color: inherit; opacity: .6; padding: 2px; border-radius: var(--r-sm); }
.sc-alert-close:hover { opacity: 1; }

/* ── Loading ──────────────────────────────────────────────────────────────*/
.sc-loading { display: flex; align-items: center; justify-content: center;
              gap: 11px; padding: 48px 20px; color: var(--fg-4); }
.sc-spinner { width: 28px; height: 28px; border: 2.5px solid var(--stroke-2);
              border-top-color: var(--brand-primary); border-radius: 50%;
              animation: sc-spin 900ms linear infinite; flex-shrink: 0; }
.sc-spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.sc-loading-text { font-size: var(--fs-body); }
@keyframes sc-spin { to { transform: rotate(360deg); } }

/* A skeleton row, so a slow list settles rather than flashing. */
.sc-skeleton { background: linear-gradient(90deg, var(--neutral-subtle) 25%,
               var(--neutral-subtle-hover) 37%, var(--neutral-subtle) 63%);
               background-size: 400% 100%; animation: sc-shimmer 1.4s ease infinite;
               border-radius: var(--r-sm); height: 12px; }
@keyframes sc-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ── Empty state ──────────────────────────────────────────────────────────*/
.sc-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
            padding: 56px 24px; text-align: center; }
.sc-empty-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--neutral-subtle);
                 display: flex; align-items: center; justify-content: center;
                 color: var(--fg-4); margin-bottom: 16px; }
.sc-empty-icon svg { width: 24px; height: 24px; }
.sc-empty-title { font-family: var(--font-display); font-size: var(--fs-body-lg);
                  font-weight: var(--fw-semibold); color: var(--fg-1); margin-bottom: 6px; }
.sc-empty-text { font-size: var(--fs-body); color: var(--fg-4); max-width: 46ch; margin-bottom: 18px; }

/* ── Progress ─────────────────────────────────────────────────────────────*/
.sc-progress { width: 100%; height: 4px; background: var(--stroke-2);
               border-radius: var(--r-pill); overflow: hidden; }
.sc-progress-bar { height: 100%; border-radius: var(--r-pill); background: var(--brand-primary);
                   transition: width var(--dur-slow) var(--ease-decel); }
.sc-progress-bar.pb-success { background: var(--success-fg); }
.sc-progress-bar.pb-warning { background: var(--warning-fg); }
.sc-progress-bar.pb-error   { background: var(--error-fg); }
.sc-progress-bar.pb-accent  { background: var(--accent); }

/* ── Divider ──────────────────────────────────────────────────────────────*/
.sc-divider { height: 1px; background: var(--stroke-2); margin: 16px 0; border: 0; }

/* ── Activity feed ────────────────────────────────────────────────────────*/
.sc-activity { display: flex; flex-direction: column; }
.sc-activity-item { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0;
                    border-bottom: 1px solid var(--stroke-3); }
.sc-activity-item:last-child { border-bottom: none; }
.sc-activity-dot { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
                   display: flex; align-items: center; justify-content: center;
                   background: var(--neutral-subtle); color: var(--fg-3); }
.sc-activity-dot svg { width: 15px; height: 15px; }
.sc-activity-body { flex: 1; min-width: 0; }
.sc-activity-text { font-size: var(--fs-body); color: var(--fg-1); line-height: 1.4; }
.sc-activity-text strong { font-weight: var(--fw-semibold); }
.sc-activity-time { font-size: var(--fs-caption); color: var(--fg-4); margin-top: 2px; }

/* ── Stat rows ────────────────────────────────────────────────────────────*/
.sc-stat-row { display: flex; align-items: center; justify-content: space-between;
               padding: 9px 0; border-bottom: 1px solid var(--stroke-3); gap: 12px; }
.sc-stat-row:last-child { border-bottom: none; }
.sc-stat-label { font-size: var(--fs-body); color: var(--fg-2); }
.sc-stat-value { font-size: var(--fs-body); font-weight: var(--fw-semibold); color: var(--fg-1);
                 font-variant-numeric: tabular-nums; }

.sc-bar-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px;
              padding: 9px 0; border-bottom: 1px solid var(--stroke-3); }
.sc-bar-row:last-child { border-bottom: none; }
.sc-bar-label { font-size: var(--fs-body); color: var(--fg-2); }
.sc-bar-val { font-size: var(--fs-body-sm); font-weight: var(--fw-semibold); color: var(--fg-1);
              white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ── Detail view ──────────────────────────────────────────────────────────*/
.sc-detail-section { margin-bottom: 22px; }
.sc-detail-section-title { font-size: var(--fs-caption); font-weight: var(--fw-semibold);
                           text-transform: uppercase; letter-spacing: .07em; color: var(--fg-4);
                           margin-bottom: 12px; padding-bottom: 7px;
                           border-bottom: 1px solid var(--stroke-2); }
.sc-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.sc-detail-label { font-size: var(--fs-caption); font-weight: var(--fw-semibold); color: var(--fg-4);
                   text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.sc-detail-value { font-size: var(--fs-body); color: var(--fg-1); font-weight: var(--fw-medium); }
.sc-detail-value.muted { color: var(--fg-3); font-weight: var(--fw-regular); }

/* ── Summary strip ────────────────────────────────────────────────────────*/
.sc-summary-strip { display: flex; gap: 24px; background: var(--neutral-layer);
                    border: 1px solid var(--card-border); border-radius: var(--card-radius);
                    padding: 14px 18px; margin-bottom: 16px; flex-wrap: wrap;
                    box-shadow: var(--shadow-2); }
.sc-summary-item { display: flex; flex-direction: column; gap: 2px; }
.sc-summary-label { font-size: var(--fs-caption); font-weight: var(--fw-semibold);
                    text-transform: uppercase; letter-spacing: .06em; color: var(--fg-4); }
.sc-summary-value { font-family: var(--font-display); font-size: var(--fs-title-sm);
                    font-weight: var(--fw-semibold); color: var(--fg-1);
                    font-variant-numeric: tabular-nums; }
.sc-summary-sep { width: 1px; background: var(--stroke-2); align-self: stretch; }

/* ── Dropdown / flyout ────────────────────────────────────────────────────*/
.sc-dropdown { position: relative; display: inline-block; }
.sc-dropdown-menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 200px;
                    background: var(--neutral-layer); border: 1px solid var(--stroke-2);
                    border-radius: var(--r-lg); box-shadow: var(--shadow-16);
                    padding: 5px; z-index: 400; overflow: hidden;
                    animation: sc-flyout var(--dur-fast) var(--ease-decel); }
.sc-dropdown-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px;
                    font-family: var(--font); font-size: var(--fs-body); color: var(--fg-1);
                    background: none; border: none; width: 100%; text-align: left;
                    cursor: pointer; border-radius: var(--r-sm); transition: background var(--t-fast); }
.sc-dropdown-item:hover { background: var(--neutral-subtle-hover); }
.sc-dropdown-item.danger { color: var(--error-fg); }
.sc-dropdown-item.danger:hover { background: var(--error-bg); }
.sc-dropdown-item svg { width: 15px; height: 15px; opacity: .7; flex-shrink: 0; }
.sc-dropdown-sep { height: 1px; background: var(--stroke-2); margin: 4px 0; }

/* ── Tooltip ──────────────────────────────────────────────────────────────*/
.sc-tip { position: relative; }
.sc-tip::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); background: var(--fg-1); color: var(--neutral-layer);
  font-size: var(--fs-caption); padding: 4px 8px; border-radius: var(--r-sm);
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity var(--t-fast);
  z-index: 600; box-shadow: var(--shadow-8);
}
.sc-tip:hover::after { opacity: 1; }

/* ── Sign-in ──────────────────────────────────────────────────────────────*/
.sc-login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--neutral-canvas); position: relative; overflow: hidden;
}
.sc-login-shell::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(1200px 600px at 15% 10%, var(--brand-tint-60), transparent 60%),
              radial-gradient(900px 500px at 85% 90%, var(--accent-tint), transparent 60%);
  pointer-events: none;
}
.sc-login-card {
  position: relative; background: var(--neutral-layer); border-radius: var(--r-xl);
  box-shadow: var(--shadow-64); border: 1px solid var(--stroke-2);
  display: grid; grid-template-columns: 1fr 1fr; max-width: 920px; width: 100%; overflow: hidden;
}
.sc-login-brand { background: var(--brand-primary); color: #FFF; padding: 48px 40px;
                  display: flex; flex-direction: column; justify-content: center; }
.sc-login-brand-title { font-family: var(--font-display); font-size: 30px;
                        font-weight: var(--fw-semibold); color: #FFF; letter-spacing: -.02em; }
.sc-login-brand-sub { font-size: var(--fs-body-lg); color: rgba(255,255,255,.82); }
.sc-login-brand-rule { width: 44px; height: 2px; background: var(--accent); margin: 18px 0;
                       border-radius: 1px; }
.sc-login-brand-copy { font-size: var(--fs-body); color: rgba(255,255,255,.78); line-height: 1.6; }
.sc-login-form { padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.sc-login-logo-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.sc-login-logo-mark { width: 56px; height: 56px; border-radius: var(--r-lg); display: block; }
.sc-login-head { font-family: var(--font-display); font-size: 26px; font-weight: var(--fw-semibold);
                 color: var(--fg-1); letter-spacing: -.02em; margin-bottom: 4px; }
.sc-login-sub { font-size: var(--fs-body); color: var(--fg-4); margin-bottom: 24px; }

/* The row of secondary controls under the password: remember-me on one side,
   the forgotten-password link on the other. Wraps rather than overflowing,
   because a longer translation of either would otherwise push the link out of
   the card. */
.sc-login-row { display: flex; flex-wrap: wrap; gap: 8px 16px;
                align-items: center; justify-content: space-between;
                margin-bottom: 20px; }
.sc-login-row .sc-check-label { font-size: var(--fs-body-sm); }

.sc-login-link { font-size: var(--fs-body-sm); color: var(--brand-primary);
                 text-decoration: none; }
.sc-login-link:hover { text-decoration: underline; }

/* Full width, and its own gap, so the spinner and the label do not need a
   margin hung off the spinner itself. */
.sc-login-submit { width: 100%; justify-content: center; gap: 8px; }

.sc-login-foot { margin-top: 20px; padding-top: 16px; text-align: center;
                 border-top: 1px solid var(--stroke-2); }
.sc-login-foot span { font-size: var(--fs-body-sm); color: var(--fg-4); }

/* The reveal control is a button sitting in the field's trailing slot; it needs
   the field's own border so the two read as one control. */
.sc-pw-toggle { cursor: pointer; border: 1.5px solid var(--stroke-1); }
@media (max-width: 860px) {
  .sc-login-card { grid-template-columns: 1fr; max-width: 460px; }
  .sc-login-brand { display: none; }
}

/* ═══ 4. UTILITIES ════════════════════════════════════════════════════════ */

.sc-grid-2   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sc-grid-3   { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sc-grid-4   { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.sc-grid-3-1 { display: grid; grid-template-columns: 3fr 1fr; gap: 16px; }
.sc-grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.sc-stack    { display: flex; flex-direction: column; gap: 16px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.align-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.fw-500 { font-weight: var(--fw-medium); }
.fw-600 { font-weight: var(--fw-semibold); }
.fw-700 { font-weight: var(--fw-bold); }
.fw-800 { font-weight: var(--fw-bold); }
.fs-xs { font-size: var(--fs-caption); }
.fs-sm { font-size: var(--fs-body-sm); }
.mono  { font-family: var(--font-mono); }
.nums  { font-variant-numeric: tabular-nums; }
.text-muted-c { color: var(--fg-4); }
.text-secondary-c { color: var(--fg-2); }
.text-primary-c { color: var(--brand-fg); }
.text-accent-c { color: var(--accent); }
.text-success-c { color: var(--success-fg); }
.text-warning-c { color: var(--warning-fg); }
.text-error-c { color: var(--error-fg); }
.mb-0 { margin-bottom: 0; }  .mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.mt-0 { margin-top: 0; }     .mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.w-100 { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Blazor's own error bar, themed ───────────────────────────────────────*/
#blazor-error-ui { background: var(--warning-bg); color: var(--warning-fg);
                   bottom: 0; box-shadow: var(--shadow-16); display: none;
                   left: 0; padding: 10px 16px; position: fixed; width: 100%; z-index: 1000;
                   font-size: var(--fs-body); }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 12px; top: 8px; }

/* ── Responsive ───────────────────────────────────────────────────────────*/
@media (max-width: 1024px) {
  .sc-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sc-sidebar { position: fixed; left: calc(-1 * var(--sidebar-w));
                transition: left var(--dur-slow) var(--ease-decel); box-shadow: var(--shadow-28); }
  .sc-sidebar.open { left: 0; }
  .sc-content { padding: 14px; }
  .sc-kpi-grid { grid-template-columns: 1fr 1fr; }
  .sc-grid-2, .sc-grid-3, .sc-grid-4, .sc-grid-3-1, .sc-grid-2-1 { grid-template-columns: 1fr; }
  .sc-form-grid > [class*="g-"] { grid-column: span 12; }
  .sc-summary-strip { gap: 16px; }
  .sc-search-wrap input { width: 150px; }
  .sc-search-wrap input:focus { width: 180px; }
  .sc-breadcrumb { display: none; }
}
