/* ══════════════════════════════════════════════════════════════════════════
   ShopCore Books — the "Mate" look
   ══════════════════════════════════════════════════════════════════════════

   The same finish as the Admin portal (Admin's wwwroot/css/mate.css), spoken
   in fx- classes. Loaded after shopcore-books.css and the shared
   fluent-shell.css so it decides the finish without touching the other
   portals. If a token or the pane changes in mate.css, change it here too.

   What stays Books': the ledger's rules — figures right-aligned and tabular,
   brackets for negatives, debit and credit as two sides, three densities.
   Those are behaviour, not decoration, and the look does not touch them.

   Parts, in order:
     1. Tokens + base + sidebar   (same as Admin)
     2. Books tokens              (--layer, --canvas, --brand … resolved from the
                                   Mate tokens, so the dark theme follows)
     3. Shell, top bar, page header, buttons, fields
     4. Cards, figure tiles, toolbar, tabs
     5. The grid, status
     6. Alerts, modal, empty states
     7. Sign-in
   ────────────────────────────────────────────────────────────────────────── */

/* ═══ 1. TOKENS ═══════════════════════════════════════════════════════════ */

:root {
  /* Primary is ink, not a hue: buttons, selection and links are near-black. */
  --brand-primary:   #0E1620;
  --brand-hover:     #1C2733;
  --brand-pressed:   #000000;
  --brand-selected:  #0E1620;
  --brand-fg:        #0E1620;
  --brand-fg-hover:  #000000;
  --brand-tint-60:   #F2F3F5;
  --brand-tint-40:   #E6E8EB;
  --brand-tint-20:   #C9CED5;
  --brand-on:        #FFFFFF;

  /* The one colour the design uses: the green of a paid order and a full ring. */
  --accent:          #2F6F55;
  --accent-hover:    #265B46;
  --accent-tint:     #EAF3EE;

  --neutral-canvas:       #FFFFFF;
  --neutral-layer:        #FFFFFF;
  --neutral-layer-alt:    #FAFAFB;
  --neutral-subtle:       #F6F7F8;
  --neutral-subtle-hover: #F2F3F5;
  --neutral-pressed:      #E9EBEE;
  --neutral-disabled-bg:  #F2F3F5;

  --stroke-1: #E3E5E8;   /* control borders */
  --stroke-2: #ECEDEF;   /* dividers */
  --ctl-stroke-hover: #CBD0D6;  /* a field under the pointer */
  --ctl-stroke-strong: #C3C9D0; /* checkbox edge, dashed chip edge */
  --ctl-track: #D3D8DE;         /* an off switch */
  --stroke-3: #F2F3F4;

  --fg-1: #0E1620;
  --fg-2: #2B333D;
  --fg-3: #6B7480;
  --fg-4: #9097A1;

  --success-fg: #1E7A4F; --success-bg: #EAF6EF; --success-br: #BFE3CF;
  --warning-fg: #B26A00; --warning-bg: #FFF5E6; --warning-br: #F4D9A8;
  --error-fg:   #D93036; --error-bg:   #FDEEEE; --error-br:   #F4BEC0;
  --info-fg:    #2F5FD0; --info-bg:    #EEF3FD; --info-br:    #C3D4F7;
  --purple-fg:  #6B4BC8; --purple-bg:  #F3F0FC; --purple-br:  #D5CCF2;

  /* Soft, short shadows: surfaces are drawn by their hairline, not their lift. */
  --shadow-2:  0 1px 2px rgba(14,22,32,.04);
  --shadow-4:  0 1px 3px rgba(14,22,32,.06);
  --shadow-8:  0 4px 12px rgba(14,22,32,.08);
  --shadow-16: 0 8px 24px rgba(14,22,32,.12);
  --shadow-28: 0 16px 40px rgba(14,22,32,.16);
  --shadow-64: 0 24px 64px rgba(14,22,32,.24);

  --r-sm: 4px; --r-md: 6px; --r-lg: 10px; --r-xl: 14px;

  --font: 'Inter', 'Segoe UI Variable Text', 'Segoe UI', -apple-system, BlinkMacSystemFont,
          'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Inter', 'Segoe UI Variable Display', 'Segoe UI', sans-serif;

  --sidebar-w:           232px;
  --sidebar-w-collapsed: 64px;
  --topbar-h:            56px;
  --content-pad:         28px;

  /* The pane: a dark navy slab, lighter text as it comes forward. */
  --mt-side-bg:        #0B121A;
  --mt-side-raise:     #141C26;
  --mt-side-hover:     #111A24;
  --mt-side-stroke:    #1D2733;
  --mt-side-fg:        #8C97A4;
  --mt-side-fg-hover:  #D5DBE2;
  --mt-side-fg-active: #FFFFFF;
  --mt-side-faint:     #5B6673;

  --nav-bg:         var(--mt-side-bg);
  --nav-border:     var(--mt-side-stroke);
  --nav-fg:         var(--mt-side-fg);
  --nav-fg-hover:   var(--mt-side-fg-hover);
  --nav-fg-active:  var(--mt-side-fg-active);
  --nav-hover-bg:   var(--mt-side-hover);
  --nav-active-bg:  var(--mt-side-raise);
  --nav-section-fg: var(--mt-side-faint);
  --nav-rail:       transparent;

  --topbar-bg:     var(--neutral-layer);
  --topbar-border: var(--stroke-2);
  --focus-ring:    0 0 0 2px var(--neutral-layer), 0 0 0 4px var(--brand-primary);

  --sc-primary-light: #3A4756;
}

/* Dark theme: the page joins the pane. Ink flips to white for primary actions. */
:root[data-theme="dark"] {
  --brand-primary:  #F4F6F8;
  --brand-hover:    #FFFFFF;
  --brand-pressed:  #D9DEE4;
  --brand-selected: #F4F6F8;
  --brand-fg:       #F4F6F8;
  --brand-fg-hover: #FFFFFF;
  --brand-tint-60:  #1A232E;
  --brand-tint-40:  #243040;
  --brand-tint-20:  #33415A;
  --brand-on:       #0B121A;

  --accent:       #4DB68A;
  --accent-hover: #6BC9A0;
  --accent-tint:  #12261D;

  --neutral-canvas:       #0B121A;
  --neutral-layer:        #101821;
  --neutral-layer-alt:    #131C26;
  --neutral-subtle:       #151F2A;
  --neutral-subtle-hover: #1A2531;
  --neutral-pressed:      #0E1620;
  --neutral-disabled-bg:  #151F2A;

  --stroke-1: #2A3544;
  --stroke-2: #1F2A37;
  --ctl-stroke-hover: #3A4859;
  --ctl-stroke-strong: #3A4859;
  --ctl-track: #2E3B4B;
  --stroke-3: #19232E;

  --fg-1: #F4F6F8;
  --fg-2: #D3D9E0;
  --fg-3: #9AA4B0;
  --fg-4: #6F7A87;

  --success-fg: #5FD398; --success-bg: #11261B; --success-br: #1F4A33;
  --warning-fg: #F0B95B; --warning-bg: #2A2010; --warning-br: #54411D;
  --error-fg:   #FF7A80; --error-bg:   #2D1517; --error-br:   #5A2A2D;
  --info-fg:    #7DA2FF; --info-bg:    #131E36; --info-br:    #26396B;
  --purple-fg:  #B7A1F5; --purple-bg:  #1D1731; --purple-br:  #38305F;

  --shadow-2:  0 1px 2px rgba(0,0,0,.4);
  --shadow-4:  0 1px 3px rgba(0,0,0,.45);
  --shadow-8:  0 4px 12px rgba(0,0,0,.5);
  --shadow-16: 0 8px 24px rgba(0,0,0,.55);
  --shadow-28: 0 16px 40px rgba(0,0,0,.6);
  --shadow-64: 0 24px 64px rgba(0,0,0,.65);

  --mt-side-bg:     #070C12;
  --mt-side-raise:  #111923;
  --mt-side-hover:  #0D141C;
  --mt-side-stroke: #17202B;

  --sc-primary-light: #D3D9E0;
}

/* ═══ 2. BASE ═════════════════════════════════════════════════════════════ */

body { font-family: var(--font); color: var(--fg-1); background: var(--neutral-canvas);
       -webkit-font-smoothing: antialiased; }
.sc-shell { background: var(--neutral-canvas); }
.sc-main  { background: var(--neutral-canvas); }
.sc-content { background: var(--neutral-canvas); font-size: 13px; }
::selection { background: color-mix(in srgb, var(--brand-primary) 14%, transparent); color: var(--fg-1); }

/* ═══ 3. SIDEBAR ══════════════════════════════════════════════════════════
   A dark navy pane: mark and name with a fold button, a search field, the
   menu, and who is signed in. The selected item is a raised dark chip and
   white text — no rail, no tint. */

.fl-sidebar {
  background: var(--mt-side-bg); border-right: 0; color: var(--mt-side-fg);
  font-family: var(--font);
}
@media (min-width: 769px) {
  .fl-sidebar { width: var(--sidebar-w); }
  .fl-sidebar:not(.pinned) { width: var(--sidebar-w-collapsed); }
  .fl-sidebar:not(.pinned):not(:hover):not(:focus-within) :is(.fl-search, .fl-collapse, .fl-user-more, .fl-nav-none),
  .fl-sidebar.collapsed :is(.fl-search, .fl-collapse, .fl-user-more, .fl-nav-none) { display: none; }
  .fl-sidebar:not(.pinned):not(:hover):not(:focus-within) .fl-nav-section,
  .fl-sidebar.collapsed .fl-nav-section { background: var(--mt-side-stroke); }
  .fl-sidebar:not(.pinned):not(:hover):not(:focus-within) .fl-nav-item,
  .fl-sidebar.collapsed .fl-nav-item { border-radius: 8px; }
}

/* Header: mark, name, fold button */
.fl-logo { min-height: 60px; padding: 14px 14px 10px 16px; border-bottom: 0; gap: 10px; }
.fl-logo-mark { width: 24px; height: 24px; border-radius: 6px; }
.fl-logo-name { font-family: var(--font-display); font-size: 16px; font-weight: 600;
                letter-spacing: -.01em; color: #FFFFFF; }
.fl-logo-sub  { display: none; }
.fl-collapse {
  margin-left: auto; width: 28px; height: 28px; flex-shrink: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--mt-side-fg); cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.fl-collapse:hover { background: var(--mt-side-raise); color: #FFFFFF; }
.fl-collapse svg { width: 17px; height: 17px; }

/* Search */
.fl-search {
  position: relative; display: flex; align-items: center; gap: 8px;
  margin: 2px 14px 12px; padding: 0 8px 0 10px; height: 34px;
  border: 1px solid var(--mt-side-stroke); border-radius: 8px; background: #0F1822;
  color: var(--mt-side-fg); transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.fl-search:focus-within { border-color: #2C3A4A; background: #111C28; }
.fl-search svg { width: 15px; height: 15px; flex-shrink: 0; }
.fl-search input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent;
  font: 400 13px/1 var(--font); color: #FFFFFF; box-shadow: none;
}
.fl-search input::placeholder { color: var(--mt-side-fg); }
.fl-search input:focus { box-shadow: none; border: 0; }
.fl-search kbd {
  flex-shrink: 0; padding: 2px 6px; border-radius: 5px; background: var(--mt-side-raise);
  border: 1px solid var(--mt-side-stroke); color: var(--mt-side-fg);
  font: 500 10.5px/1.3 var(--font); letter-spacing: .02em;
}
.fl-search:focus-within kbd { display: none; }

/* The trade chip: a quiet line of text, not a coloured badge. */
.fl-badge { margin: 0 14px 8px; padding: 0; background: transparent; color: var(--mt-side-faint);
            font-size: 10.5px; letter-spacing: .06em; }
.fl-badge::before { background: #3FB67F; }

/* Menu */
.fl-nav { padding: 2px 10px 12px; }
.fl-nav-section { padding: 18px 10px 6px; font-size: 11px; font-weight: 500; letter-spacing: .04em;
                  text-transform: none; color: var(--mt-side-faint); }
.fl-nav-section:first-child { padding-top: 4px; }

.fl-nav-item {
  min-height: 34px; padding: 6px 10px; margin: 2px 0; gap: 10px; border-radius: 7px;
  color: var(--mt-side-fg); font: 500 13px/1.3 var(--font);
}
.fl-nav-item svg { width: 16px; height: 16px; stroke-width: 1.7; }
.fl-nav-item:hover { background: var(--mt-side-hover); color: var(--mt-side-fg-hover); }
.fl-nav-item:active { background: var(--mt-side-raise); }
.fl-nav-item::before { display: none; }
.fl-nav-item.active { background: var(--mt-side-raise); color: #FFFFFF; font-weight: 500; }
.fl-nav-item.expanded:not(.active) { color: var(--mt-side-fg-hover); }
.fl-nav-chevron { opacity: .5; width: 13px; height: 13px; }

.fl-nav-count { padding: 0 6px; min-width: 18px; height: 18px; display: inline-flex; align-items: center;
                justify-content: center; border-radius: 999px; background: #E5484D; color: #FFFFFF;
                font-size: 10.5px; font-weight: 600; }
.fl-nav-item.active .fl-nav-count { background: #E5484D; color: #FFFFFF; }

.fl-nav-sub::before { left: 19px; background: var(--mt-side-stroke); }
.fl-nav-sub-item {
  min-height: 30px; padding: 5px 10px 5px 38px; margin: 1px 0; border-radius: 7px;
  color: var(--mt-side-fg); font: 400 12.5px/1.3 var(--font);
}
.fl-nav-sub-item:hover { background: var(--mt-side-hover); color: var(--mt-side-fg-hover); }
.fl-nav-sub-item.active { background: var(--mt-side-raise); color: #FFFFFF; font-weight: 500; }
.fl-nav-sub-item.active::before { left: 18px; width: 3px; height: 12px; background: #FFFFFF; opacity: .9; }
.fl-nav-none { padding: 14px 10px; font-size: 12.5px; color: var(--mt-side-faint); }

/* Signed-in user */
.fl-user { padding: 12px 14px 14px; border-top: 0; gap: 10px; }
.fl-avatar { width: 30px; height: 30px; background: #2A3644; color: #FFFFFF; font-size: 11.5px; font-weight: 600; }
.fl-user-name { font-size: 13px; font-weight: 500; color: #FFFFFF; }
.fl-user-role { font-size: 11.5px; color: var(--mt-side-faint); }
.fl-user-more {
  width: 26px; height: 26px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; color: var(--mt-side-fg); text-decoration: none;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.fl-user-more:hover { background: var(--mt-side-raise); color: #FFFFFF; text-decoration: none; }
.fl-user-more svg { width: 16px; height: 16px; }

/* On a phone the drawer keeps the same pane. */
@media (max-width: 768px) {
  .fl-sidebar { width: min(var(--sidebar-w), 86vw); }
}


/* ═══ 2. BOOKS TOKENS ═════════════════════════════════════════════════════ */

:root {
  --row-h: 48px;            /* comfortable is the Mate row; compact and relaxed still override */
  --font-mono: var(--font); /* figures keep their tabular lining (below), in the page's own face */
}

:root:root {
  --brand:         var(--brand-primary);
  --brand-tint:    var(--brand-tint-60);
  --brand-tint-2:  var(--brand-tint-40);
  --accent-on:     #FFFFFF;

  --canvas:       var(--neutral-canvas);
  --layer:        var(--neutral-layer);
  --layer-alt:    var(--neutral-layer-alt);
  --subtle:       var(--neutral-subtle);
  --subtle-hover: var(--neutral-subtle-hover);
  --pressed:      var(--neutral-pressed);
  --disabled-bg:  var(--neutral-disabled-bg);
  --stroke-strong: var(--ctl-stroke-strong);

  --ok-fg:   var(--success-fg); --ok-bg:   var(--success-bg); --ok-br:   var(--success-br);
  --warn-fg: var(--warning-fg); --warn-bg: var(--warning-bg); --warn-br: var(--warning-br);
  --err-fg:  var(--error-fg);   --err-bg:  var(--error-bg);   --err-br:  var(--error-br);
  --plum-fg: var(--purple-fg);  --plum-bg: var(--purple-bg);  --plum-br: var(--purple-br);
  --slate-fg: var(--fg-3);      --slate-bg: var(--neutral-subtle); --slate-br: var(--stroke-1);

  --debit-fg:   var(--info-fg);
  --credit-fg:  var(--warning-fg);
  --money-neg:  var(--error-fg);
  --money-zero: var(--fg-4);
}

body { font-family: var(--font); color: var(--fg-1); background: var(--neutral-canvas); font-size: 13px; }
.fx-shell, .fx-main, .fx-content { background: var(--neutral-canvas); }
.fx-shell { font-variant-numeric: tabular-nums; }
.fx-content { padding: var(--content-pad) 32px; font-size: 13px; }

/* ═══ 3. SHELL, TOP BAR, PAGE HEADER, BUTTONS, FIELDS ═════════════════════ */

.fx-topbar { height: var(--topbar-h); padding: 0 20px; gap: 10px; background: var(--neutral-layer);
             border-bottom: 1px solid var(--stroke-2); }
.fx-topbar-crumb { font-size: 11.5px; letter-spacing: 0; text-transform: none; color: var(--fg-4); }
.fx-topbar-screen { font-size: 13px; font-weight: 500; color: var(--fg-1); }
.fx-icon-btn { width: 34px; height: 34px; border-radius: 8px; color: var(--fg-3); }
.fx-icon-btn:hover { background: var(--neutral-subtle-hover); color: var(--fg-1); }
.fx-omnibox { height: 34px; border-radius: 8px; background: var(--neutral-subtle); border: 1px solid transparent; }
.fx-omnibox:hover { background: var(--neutral-subtle-hover); }
.fx-scope, .fx-period-pill { border-radius: 8px; }

.fx-page-head { margin-bottom: 20px; align-items: center; }
.fx-page-title h1 { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -.02em;
                    line-height: 1.2; color: var(--fg-1); }
.fx-page-lede { font-size: 13px; color: var(--fg-3); }

/* Ink for the main action, a white outlined button for the rest. */
.fx-btn {
  height: auto; min-height: 32px; padding: 0 12px; gap: 6px; border-radius: 7px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--stroke-1); background: var(--neutral-layer); color: var(--fg-1); box-shadow: var(--shadow-2);
}
.fx-btn:hover:not(:disabled) { background: var(--neutral-subtle-hover); border-color: var(--stroke-1); }
.fx-btn:active:not(:disabled) { background: var(--neutral-pressed); }
.fx-btn svg { width: 14px; height: 14px; }
.fx-btn-primary, .fx-btn-post { background: var(--brand-primary); border-color: var(--brand-primary); color: var(--brand-on); box-shadow: none; }
.fx-btn-primary:hover:not(:disabled), .fx-btn-post:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-on); }
.fx-btn-primary:active:not(:disabled), .fx-btn-post:active:not(:disabled) { background: var(--brand-pressed); }
.fx-btn-danger { background: #D93036; border-color: #D93036; color: #FFFFFF; box-shadow: none; }
.fx-btn-danger:hover:not(:disabled) { background: #BF262C; border-color: #BF262C; color: #FFFFFF; }
.fx-btn-subtle, .fx-btn-ghost { background: transparent; border-color: transparent; color: var(--fg-2); box-shadow: none; }
.fx-btn-subtle:hover:not(:disabled), .fx-btn-ghost:hover:not(:disabled) { background: var(--neutral-subtle-hover); border-color: transparent; }
.fx-btn-sm { min-height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.fx-btn-lg { min-height: 38px; padding: 0 16px; font-size: 14px; }
.fx-btn:disabled { opacity: .45; }

.fx-input, .fx-select, .fx-textarea {
  min-height: 34px; border-radius: 7px; border: 1px solid var(--stroke-1);
  background: var(--neutral-layer); color: var(--fg-1); font-size: 13px;
}
.fx-input::placeholder, .fx-textarea::placeholder { color: var(--fg-4); }
.fx-input:hover, .fx-select:hover, .fx-textarea:hover { border-color: var(--ctl-stroke-hover); }
.fx-input:focus, .fx-select:focus, .fx-textarea:focus {
  border-color: var(--brand-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 9%, transparent); outline: none;
}
.fx-label { font-size: 12.5px; font-weight: 500; color: var(--fg-2); }
.fx-hint { color: var(--fg-4); }
.fx-input-addon { background: var(--neutral-subtle); border-color: var(--stroke-1); color: var(--fg-3); }

/* Checkboxes: a 16px square, ink when ticked. Switches keep their own track. */
.fx-shell input[type="checkbox"]:not(.fx-switch *),
.fx-login-shell input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex-shrink: 0; margin: 0; cursor: pointer;
  width: 16px; height: 16px; border: 1.5px solid var(--ctl-stroke-strong); border-radius: 4px; background-color: var(--neutral-layer);
  display: inline-block; vertical-align: middle;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.fx-shell input[type="checkbox"]:not(.fx-switch *):hover { border-color: var(--fg-3); }
.fx-shell input[type="checkbox"]:not(.fx-switch *):checked,
.fx-shell input[type="checkbox"]:not(.fx-switch *):indeterminate,
.fx-login-shell input[type="checkbox"]:checked {
  background-color: var(--brand-primary); border-color: var(--brand-primary);
  background-repeat: no-repeat; background-position: center; background-size: 11px;
}
.fx-shell input[type="checkbox"]:not(.fx-switch *):checked,
.fx-login-shell input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] .fx-shell input[type="checkbox"]:not(.fx-switch *):checked,
:root[data-theme="dark"] .fx-login-shell input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B121A' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.fx-shell input[type="checkbox"]:not(.fx-switch *):indeterminate {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
}
.fx-switch input:checked + .fx-switch-track { background: var(--brand-primary); }
.fx-switch-track { background: var(--ctl-track); }

/* ═══ 4. CARDS, FIGURE TILES, TOOLBAR, TABS ═══════════════════════════════ */

.fx-card { background: var(--neutral-layer); border: 1px solid var(--stroke-2); border-radius: 14px; box-shadow: none; }
.fx-card-head { padding: 16px 20px; background: transparent; border-bottom: 1px solid var(--stroke-2); }
.fx-card-title { font-size: 14px; font-weight: 600; letter-spacing: -.005em; color: var(--fg-1); }
.fx-card-sub { font-size: 12.5px; color: var(--fg-4); }
.fx-card-body { padding: 20px; }
.fx-card-body.flush { padding: 0; }
.fx-card-foot { background: transparent; border-top: 1px solid var(--stroke-2); }

/* A figure on a soft grey tile with generous corners. */
.fx-kpis { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 18px; }
.fx-kpi { background: var(--neutral-subtle); border: 0; border-radius: 20px; padding: 18px 20px; box-shadow: none; overflow: visible; }
.fx-kpi:hover, .fx-kpi.clickable:hover { background: var(--neutral-subtle-hover); box-shadow: none; transform: none; }
.fx-kpi::before { display: none; }
.fx-kpi-label { font-size: 13px; font-weight: 500; color: var(--fg-3); margin-bottom: 10px; }
.fx-kpi-label::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%;
                        background: var(--kpi-accent, var(--brand-primary)); vertical-align: 1px; }
.fx-kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -.02em; color: var(--fg-1); }
.fx-kpi-meta { color: var(--fg-4); }

/* Filter row: quiet, selects become dashed pills. */
.fx-toolbar { padding: 12px 0 14px; gap: 8px; background: transparent; border: 0; flex-wrap: wrap; }
.fx-toolbar .fx-select {
  -webkit-appearance: none; appearance: none; width: auto; min-width: 0; min-height: 28px; height: 28px;
  padding: 0 26px 0 12px; border: 1px dashed var(--ctl-stroke-strong); border-radius: 999px; background-color: transparent;
  font-size: 12.5px; font-weight: 500; color: var(--fg-2); 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='%236B7480' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 12px;
}
.fx-toolbar .fx-select:hover { border-color: var(--fg-3); background-color: var(--neutral-subtle); }
.fx-toolbar .fx-select:focus { border-style: solid; border-color: var(--brand-primary); box-shadow: none; }
.fx-toolbar .fx-input { min-height: 28px; height: 28px; border-radius: 999px; font-size: 12.5px; }
.fx-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
           background: var(--brand-primary); color: var(--brand-on); border: 1px solid var(--brand-primary); font-size: 12px; font-weight: 500; }

/* Tabs — plain text with an ink underline on the one in force. */
.fx-tabs { gap: 20px; border-bottom: 1px solid var(--stroke-2); }
.fx-tab { padding: 10px 0; font-size: 13px; font-weight: 500; color: var(--fg-3); background: transparent; border: 0; border-radius: 0; }
.fx-tab:hover { color: var(--fg-1); background: transparent; }
.fx-tab.active { color: var(--fg-1); font-weight: 600; border-bottom: 0; box-shadow: inset 0 -2px 0 0 var(--brand-primary); }

/* ═══ 5. THE GRID, STATUS ═════════════════════════════════════════════════
   No outer frame, a quiet header in the page's own words, rows divided by a
   hairline with a soft fill under the pointer. Figures stay right-aligned. */

.fx-grid-wrap { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.fx-card > .fx-grid-wrap, .fx-card-body.flush > .fx-grid-wrap { background: transparent; }
.fx-grid thead th {
  padding: 10px 14px; background: var(--neutral-layer); font-size: 12.5px; font-weight: 500; letter-spacing: 0;
  text-transform: none; color: var(--fg-4); border-top: 1px solid var(--stroke-2); border-bottom: 1px solid var(--stroke-2);
}
.fx-grid thead th.sortable:hover { background: var(--neutral-layer); }
.fx-grid thead th.sorted { color: var(--fg-1); }
.fx-grid tbody td { padding: 0 14px; border-bottom: 1px solid var(--stroke-2); color: var(--fg-1); }
.fx-grid tbody tr:hover, .fx-grid tbody tr:hover td { background: var(--neutral-subtle); }
.fx-grid tbody tr.sel, .fx-grid tbody tr.sel td { background: var(--neutral-subtle); }
.fx-grid tfoot td { padding: 0 14px; height: var(--row-h); font-weight: 600; background: transparent; border-top: 0; border-bottom: 1px solid var(--stroke-2); }
.fx-pager { color: var(--fg-3); font-size: 12.5px; }

/* Status: text with a glyph, not a filled pill. */
.fx-badge { display: inline-flex; align-items: center; gap: 5px; padding: 0; background: transparent !important;
            border: 0 !important; border-radius: 0; font-size: 13px; font-weight: 400; letter-spacing: 0; white-space: nowrap; }
.fx-badge .fx-badge-dot { display: none; }
.fx-badge::before { content: "•"; font-size: 14px; line-height: 1; font-weight: 700; }
.fx-badge-ok    { color: var(--success-fg); }  .fx-badge-ok::before   { content: "✓"; font-size: 12px; }
.fx-badge-err   { color: var(--error-fg); }    .fx-badge-err::before  { content: "✕"; font-size: 11px; }
.fx-badge-warn  { color: var(--warning-fg); }  .fx-badge-warn::before { content: "◔"; font-size: 13px; font-weight: 400; }
.fx-badge-info  { color: var(--info-fg); }     .fx-badge-info::before { content: "↗"; font-size: 12px; }
.fx-badge-slate { color: var(--fg-3); }        .fx-badge-slate::before { content: "↩"; font-size: 12px; }
.fx-badge-brand { color: var(--accent); }
.fx-badge-plum  { color: var(--purple-fg); }

/* ═══ 6. ALERTS, MODAL, EMPTY STATES ══════════════════════════════════════ */

.fx-alert { border-radius: 10px; }
.fx-modal { border-radius: 14px; border: 1px solid var(--stroke-2); box-shadow: var(--shadow-28); }
.fx-modal-foot { background: transparent; }
.fx-palette { border-radius: 14px; }
.fx-toast { border-radius: 10px; }
.fx-empty-title, .fx-void-code { font-weight: 600; }
.fx-spinner { border-top-color: var(--brand-primary); }

/* ═══ 7. SIGN-IN ══════════════════════════════════════════════════════════ */

.fx-login-shell { background: var(--neutral-subtle); }
.fx-login-card { border-radius: 20px; border: 0; box-shadow: var(--shadow-28); }
.fx-login-brand { background: var(--mt-side-bg); }
.fx-login-brand-title { font-weight: 600; letter-spacing: -.02em; }
.fx-login-head { font-weight: 600; }

/* Print: keep the page white whatever the theme. */
@media print {
  body, .fx-shell, .fx-main, .fx-content { background: #FFFFFF !important; color: #111111; }
}

/* The spinner on a primary button takes the button's own text colour, so it shows
   on the ink button in light theme and on the pale one in dark. */
.fx-btn-primary .fx-spinner, .fx-btn-post .fx-spinner {
  border-color: color-mix(in srgb, var(--brand-on) 35%, transparent) !important;
  border-top-color: var(--brand-on) !important;
}
