﻿/* ══════════════════════════════════════════════════════════════════════════
   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:   #0F6CBD;
  --brand-hover:     #115EA3;
  --brand-pressed:   #0F548C;
  --brand-selected:  #0F6CBD;
  --brand-fg:        #0F6CBD;
  --brand-fg-hover:  #115EA3;
  --brand-tint-60:   #EBF3FC;
  --brand-tint-40:   #CFE4FA;
  --brand-tint-20:   #96C6FA;
  --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:          #038387;
  --accent-hover:    #026D71;
  --accent-tint:     #E6F4F4;

  /* ── 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:       #F5F5F5;
  --neutral-layer:        #FFFFFF;
  --neutral-layer-alt:    #FAFAFA;
  --neutral-subtle:       #F5F5F5;
  --neutral-subtle-hover: #F0F0F0;
  --neutral-pressed:      #E0E0E0;
  --neutral-disabled-bg:  #F0F0F0;

  --stroke-1: #D1D1D1;   /* control borders */
  --stroke-2: #E0E0E0;   /* dividers between rows and sections */
  --stroke-3: #EBEBEB;   /* the faintest rule that still reads */

  --fg-1: #242424;       /* headings and primary values */
  --fg-2: #424242;       /* body and labels */
  --fg-3: #616161;       /* secondary and hints */
  --fg-4: #707070;       /* 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: #0E700E; --success-bg: #F1FAF1; --success-br: #9FD89F;
  --warning-fg: #8A5A00; --warning-bg: #FFF9F5; --warning-br: #F5C9A8;
  --error-fg:   #B10E1C; --error-bg:   #FDF3F4; --error-br:   #EEACB2;
  --info-fg:    #0F548C; --info-bg:    #EBF3FC; --info-br:    #B4D6FA;
  --purple-fg:  #5C2E91; --purple-bg:  #F6F2FB; --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 0 2px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.14);
  --shadow-4:  0 0 2px rgba(0,0,0,.12), 0 2px 4px rgba(0,0,0,.14);
  --shadow-8:  0 0 2px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.14);
  --shadow-16: 0 0 2px rgba(0,0,0,.12), 0 8px 16px rgba(0,0,0,.14);
  --shadow-28: 0 0 8px rgba(0,0,0,.12), 0 14px 28px rgba(0,0,0,.14);
  --shadow-64: 0 0 8px rgba(0,0,0,.20), 0 32px 64px rgba(0,0,0,.24);

  /* ── Shape ────────────────────────────────────────────────────────────
     Controls take small, surfaces take large, anything floating takes xl. */
  --r-none: 0; --r-sm: 2px; --r-md: 4px; --r-lg: 8px; --r-xl: 8px; --r-pill: 9999px;

  /* ── Type ramp — named for the role, never the pixel ──────────────────*/
  --fs-caption:  12px;
  --fs-body-sm:  13px;
  --fs-body:     14px;
  --fs-body-lg:  16px;
  --fs-subtitle: 18px;
  --fs-title-sm: 22px;
  --fs-title:    28px;
  --fs-display:  36px;

  --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:           260px;
  --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: #2886DE;
  --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:  #479EF5;
  --brand-hover:    #62ABF5;
  --brand-pressed:  #2886DE;
  --brand-selected: #479EF5;
  --brand-fg:       #6CB8F6;
  --brand-fg-hover: #96C6FA;
  --brand-tint-60:  #082338;
  --brand-tint-40:  #0C3B5E;
  --brand-tint-20:  #0F548C;
  --brand-on:       #0A1620;

  --accent:       #3BB7BB;
  --accent-hover: #5CCBCF;
  --accent-tint:  #0B2E30;

  --neutral-canvas:       #1F1F1F;
  --neutral-layer:        #292929;
  --neutral-layer-alt:    #2E2E2E;
  --neutral-subtle:       #333333;
  --neutral-subtle-hover: #3D3D3D;
  --neutral-pressed:      #242424;
  --neutral-disabled-bg:  #333333;

  --stroke-1: #666666;
  --stroke-2: #525252;
  --stroke-3: #3D3D3D;

  --fg-1: #FFFFFF;
  --fg-2: #D6D6D6;
  --fg-3: #ADADAD;
  --fg-4: #9E9E9E;

  --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 0 2px rgba(0,0,0,.36), 0 1px 2px rgba(0,0,0,.28);
  --shadow-4:  0 0 2px rgba(0,0,0,.36), 0 2px 4px rgba(0,0,0,.28);
  --shadow-8:  0 0 2px rgba(0,0,0,.36), 0 4px 8px rgba(0,0,0,.28);
  --shadow-16: 0 0 2px rgba(0,0,0,.36), 0 8px 16px rgba(0,0,0,.28);
  --shadow-28: 0 0 8px rgba(0,0,0,.36), 0 14px 28px rgba(0,0,0,.28);
  --shadow-64: 0 0 8px rgba(0,0,0,.30), 0 32px 64px rgba(0,0,0,.36);

  --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 ──────────────────────────────────────────────────────────────
   Drawn by the shared Fluent shell (branding/web/fluent-shell.css), the same
   pane the Reports and Accounting portals use. */

/* ── 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-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; }
}

/* ── Top bar on tablets and phones ────────────────────────────────────────
   The bar holds a menu button, the trail, a search field, the branch picker, the
   theme switch and the account menu. Together they need roughly 700px, so on a
   phone the bar overflowed sideways and pushed the account menu off screen.

   Order of surrender as the screen narrows: the search field gets narrower, then
   folds into a magnifier that opens a row of its own; the trail shrinks to the
   current screen's name; the branch picker drops its caption and the account
   menu its name. What stays is what an operator cannot do without: the menu, the
   branch they are looking at, and the way out. */
.sc-search-toggle, .sc-search-close { display: none; }

@media (max-width: 1100px) {
  .sc-search-wrap input { width: 190px; }
  .sc-search-wrap input:focus { width: 240px; }
  .sc-branch-btn { max-width: 210px; }
  .sc-branch-name { max-width: 120px; }
}

@media (max-width: 768px) {
  .sc-topbar { padding: 0 6px; gap: 2px; }
  .sc-topbar-actions { gap: 0; flex-shrink: 0; }

  /* The trail becomes a title: just the current screen, cut with an ellipsis. */
  .sc-breadcrumb { flex-wrap: nowrap; overflow: hidden; padding-left: 4px; }
  .sc-breadcrumb .sc-bc-link, .sc-breadcrumb .sc-bc-sep { display: none; }
  .sc-bc-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
                   font-size: var(--fs-body); padding: 3px 4px; }

  /* Search: a magnifier in the bar, a full-width row when opened. */
  .sc-search-toggle { display: inline-flex; }
  .sc-search-wrap { display: none; }
  .sc-search-wrap.open {
    display: flex; align-items: center; gap: 4px;
    position: absolute; inset: 0; z-index: 5; padding: 0 6px 0 10px;
    background: var(--topbar-bg);
  }
  .sc-search-wrap.open .sc-search-icon { left: 22px; }
  .sc-search-wrap.open input,
  .sc-search-wrap.open input:focus {
    flex: 1; width: 100%; min-width: 0; height: 38px; padding-left: 34px;
  }
  .sc-search-wrap.open .sc-search-close { display: inline-flex; flex-shrink: 0; }

  /* Branch picker: the name stays (which shop am I looking at?), the caption and
     caret go. */
  .sc-branch-btn { height: 40px; padding: 0 8px; gap: 6px; max-width: 132px; }
  .sc-branch-kicker { display: none; }
  .sc-branch-btn > svg:not(:first-child) { display: none; }
  .sc-branch-name { max-width: 84px; font-size: var(--fs-caption); }

  /* Its list opens as a panel across the screen instead of hanging off a button
     near the right edge, where a 280px menu ran off the left of a phone. */
  .sc-branch-menu {
    position: fixed; top: calc(var(--topbar-h) + 4px); left: 8px; right: 8px;
    min-width: 0; max-width: none;
    max-height: calc(100vh - var(--topbar-h) - 20px);
    max-height: calc(100dvh - var(--topbar-h) - 20px);
  }

  /* Account: the avatar alone; the menu stays inside the screen. */
  .sc-user-name, .sc-user-caret { display: none; }
  .sc-topbar .sc-dropdown > .sc-icon-btn { padding: 2px; gap: 0; }
  .sc-dropdown-menu { max-width: calc(100vw - 16px); }
}

@media (max-width: 400px) {
  /* The smallest phones: the title gives way so the branch name can be read. */
  .sc-breadcrumb { display: none; }
  .sc-topbar-actions { margin-left: auto; }
  .sc-branch-btn { max-width: 150px; }
  .sc-branch-name { max-width: 100px; }
}

/* ── Photos (products and menu) ───────────────────────────────────────────
   A grid of cards, each one a picture and the two ways to replace it. The camera
   and upload buttons are labels around a real file input, so the browser opens
   the camera or gallery itself. The input is hidden by position rather than
   display:none — some mobile browsers refuse to open a chooser from an input that
   has no box. */
.sc-photo-tip { margin: 0 0 12px; color: var(--fg-3); font-size: var(--fs-body-sm); }
.sc-photo-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }

.sc-photo-grid {
  display: grid; gap: 14px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.sc-photo-card {
  display: flex; flex-direction: column; gap: 10px; padding: 10px;
  background: var(--neutral-layer); border: 1px solid var(--stroke-2);
  border-radius: var(--r-lg); min-width: 0;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.sc-photo-card.is-done { border-color: var(--success-fg); }
.sc-photo-frame {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--r-md); background: var(--neutral-subtle);
}
.sc-photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-photo-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  color: var(--fg-4); font-size: var(--fs-caption);
}
.sc-photo-busy {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--neutral-layer) 80%, transparent);
}
.sc-photo-meta { min-width: 0; }
.sc-photo-name { font-weight: var(--fw-semibold); font-size: var(--fs-body);
                 white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-photo-sub { color: var(--fg-4); font-size: var(--fs-caption);
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sc-photo-actions { display: flex; gap: 8px; }
.sc-photo-btn { position: relative; flex: 1 1 0; justify-content: center; gap: 6px;
                cursor: pointer; overflow: hidden; }
.sc-photo-btn.is-disabled { opacity: .5; pointer-events: none; }
.sc-photo-input { position: absolute; inset: 0; width: 100%; height: 100%;
                  opacity: 0; cursor: pointer; font-size: 0; }
.sc-photo-remove { align-self: flex-start; color: var(--error-fg); }

@media (max-width: 768px) {
  /* Two to a row on a phone, and big buttons: this screen is used standing up. */
  .sc-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .sc-photo-card { padding: 8px; gap: 8px; }
  .sc-photo-actions { flex-direction: column; }
  .sc-photo-btn { min-height: 44px; }
  .sc-photo-toolbar > * { flex: 1 1 100%; }
}
@media (max-width: 380px) {
  .sc-photo-grid { grid-template-columns: 1fr; }
}

/* A photo that could not be saved: the reason, and the two ways forward. */
.sc-photo-fail {
  display: flex; flex-direction: column; gap: 8px; padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--error-fg) 40%, var(--stroke-2));
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--error-fg) 8%, var(--neutral-layer));
  color: var(--fg-2); font-size: var(--fs-caption); line-height: 1.4;
}
.sc-photo-fail-actions { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 768px) { .sc-photo-fail-actions .sc-btn { flex: 1 1 0; min-height: 40px; justify-content: center; } }

/* ── Theme ────────────────────────────────────────────────────────────────
   color-scheme tells the browser which palette its own parts should use: the
   scrollbars, date and colour pickers, select lists, autofill and the page
   behind an overscroll. Without it a dark portal keeps bright white native
   controls inside it. The attribute is set before first paint (_Layout) and kept
   in step by shopcore-admin.js. */
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* Moving between themes fades the surfaces instead of snapping — only while the
   change is happening, so ordinary hover and focus transitions are untouched. */
html.sc-theme-fade, html.sc-theme-fade *, html.sc-theme-fade *::before, html.sc-theme-fade *::after {
  transition: background-color var(--fl-normal, 200ms) ease, border-color var(--fl-normal, 200ms) ease,
              color var(--fl-normal, 200ms) ease, fill var(--fl-normal, 200ms) ease !important;
}

.sc-theme-menu { min-width: 176px; padding: 4px; }
.sc-theme-item { width: 100%; border: 0; background: transparent; color: var(--fg-2);
                 border-radius: var(--r-md); font: inherit; text-align: left; cursor: pointer; }
.sc-theme-item svg { flex-shrink: 0; color: var(--fg-3); }
.sc-theme-item span { flex: 1; }
.sc-theme-item.selected { background: var(--brand-tint-60); color: var(--brand-fg); font-weight: var(--fw-semibold); }
.sc-theme-item.selected svg { color: var(--brand-fg); }
.sc-theme-tick { margin-left: auto; }
