/* ============================================================================
 * Self-hosted Geist (variable). License: SIL Open Font License 1.1.
 * Source files at /wwwroot/fonts/geist/. License at /wwwroot/fonts/geist/OFL.txt.
 * ============================================================================ */

@font-face {
  font-family: 'Geist';
  src: url('/fonts/geist/Geist.woff2') format('woff2-variations'),
       url('/fonts/geist/Geist.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('/fonts/geist/GeistMono.woff2') format('woff2-variations'),
       url('/fonts/geist/GeistMono.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ============================================================================
 * Abacus Design Tokens — design reference language
 * Single source of truth: /DESIGN.md
 * Reference images: /.gstack-designs/reference/
 * ============================================================================ */

:root {
  /* ---------- Type ---------- */
  --font-sans: "Geist", "Geist Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --fs-display: 2.25rem;   /* 36px */
  --fs-h2: 1.375rem;       /* 22px */
  --fs-h3: 1rem;           /* 16px */
  --fs-body: 0.875rem;     /* 14px */
  --fs-small: 0.8125rem;   /* 13px */
  --fs-caption: 0.75rem;   /* 12px */
  --fs-label: 0.6875rem;   /* 11px */
  --fs-stat: 2rem;         /* 32px */

  --lh-tight: 1.1;
  --lh-snug: 1.25;
  --lh-normal: 1.5;

  --tracking-display: -0.02em;
  --tracking-h2: -0.015em;
  --tracking-h3: -0.005em;
  --tracking-body: -0.005em;
  --tracking-label: 0.06em;

  /* ---------- Color: warm-paper neutrals ---------- */
  --cr-canvas: oklch(95.5% 0.006 85);
  --cr-surface: oklch(97.5% 0.012 85);   /* sidebar — visibly cream */
  --cr-card: oklch(99.5% 0.003 85);      /* main + cards — almost-white, faint warm */
  --cr-border: oklch(92% 0.005 85);
  --cr-border-strong: oklch(88% 0.005 85);
  --cr-text: oklch(22% 0.01 85);
  --cr-text-muted: oklch(55% 0.01 85);
  --cr-text-soft: oklch(70% 0.008 85);

  /* ---------- Color: brand & status ---------- */
  --cr-accent: oklch(70% 0.20 145);
  --cr-accent-strong: oklch(60% 0.22 145);
  --cr-accent-bg: oklch(94% 0.05 145);
  --cr-accent-ring: oklch(70% 0.20 145 / 0.22);

  /* Tab active = deep olive (reference active tab color, not pure black) */
  --cr-tab-active: oklch(38% 0.06 130);

  --cr-warn: oklch(72% 0.16 60);
  --cr-warn-bg: oklch(95% 0.06 75);

  --cr-danger: oklch(60% 0.22 28);
  --cr-danger-bg: oklch(96% 0.04 28);

  --cr-info: oklch(70% 0.12 290);
  --cr-info-bg: oklch(95% 0.03 290);

  --cr-money-up: oklch(60% 0.18 145);
  --cr-money-warn: oklch(68% 0.18 55);

  /* ---------- Color: chart categories ---------- */
  --cat-1: oklch(70% 0.13 145);  /* sage */
  --cat-2: oklch(78% 0.14 90);   /* marigold */
  --cat-3: oklch(45% 0.07 130);  /* deep olive */
  --cat-4: oklch(72% 0.13 305);  /* lavender (purple) */
  --cat-5: oklch(75% 0.13 30);   /* peach / coral */
  --cat-6: oklch(88% 0.05 80);   /* cream tan */

  /* ---------- Spacing (4pt scale) ---------- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* ---------- Radii ---------- */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 9999px;

  /* ---------- Motion ---------- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-1: 120ms;
  --dur-2: 180ms;
  --dur-3: 240ms;
  --dur-4: 320ms;

  /* ---------- Shadows (used sparingly) ---------- */
  --shadow-modal: 0 24px 48px -12px oklch(20% 0.005 85 / 0.18);
  --shadow-toast: 0 8px 24px -8px oklch(20% 0.005 85 / 0.16);

  /* Subtle interactive hover background — slightly darker than surface in
     light mode, slightly lighter than card in dark mode. Used by sidebar nav
     items, ghost icon buttons, toolbar filter buttons, and idle tabs. */
  --cr-hover: oklch(94% 0.005 85);
}

/* ============================================================================
 * Bootstrap / Blazorise overrides — ABP-shipped admin pages
 * (Tenant Management, Identity, Setting Management) render with Blazorise +
 * Bootstrap, not MudBlazor. Override Bootstrap's brand variables so those
 * pages pick up our sage accent inside AbacusLayout.
 * ============================================================================ */

:root {
  /* Bootstrap 5 brand colors */
  --bs-primary: #5BA15E;
  --bs-primary-rgb: 91, 161, 94;
  --bs-link-color: #4E8B51;
  --bs-link-hover-color: #3D7140;
  --bs-border-color: #E7E3DC;
  --bs-body-bg: #FCFBF8;
  --bs-body-color: #1F1D19;
}

.btn-primary {
  --bs-btn-bg: #5BA15E;
  --bs-btn-border-color: #5BA15E;
  --bs-btn-hover-bg: #4E8B51;
  --bs-btn-hover-border-color: #4E8B51;
  --bs-btn-active-bg: #3D7140;
  --bs-btn-active-border-color: #3D7140;
}

.btn-outline-primary {
  --bs-btn-color: #4E8B51;
  --bs-btn-border-color: #5BA15E;
  --bs-btn-hover-bg: #5BA15E;
  --bs-btn-hover-border-color: #5BA15E;
}

/* Blazorise tweaks for inputs/tables inside ABP admin pages */
.form-control:focus,
.form-select:focus {
  border-color: #5BA15E;
  box-shadow: 0 0 0 0.2rem rgba(91, 161, 94, 0.18);
}

.table > thead {
  font-size: var(--fs-caption);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--cr-text-muted);
}

/* Dark theme for ABP admin pages (Users, Roles, Tenants, Settings). LeptonX Lite ships
   no dark style and hard-codes light component colors, so map them onto --cr-* tokens. */
[data-theme="dark"] {
  --bs-body-bg: var(--cr-card);
  --bs-body-color: var(--cr-text);
  --bs-emphasis-color: var(--cr-text);
  --bs-secondary-color: var(--cr-text-muted);
  --bs-secondary-bg: var(--cr-surface);
  --bs-tertiary-bg: var(--cr-canvas);
  --bs-heading-color: var(--cr-text);
  --bs-border-color: var(--cr-border);
  --bs-border-color-translucent: var(--cr-border);
}

[data-theme="dark"] .card {
  --bs-card-bg: var(--cr-card);
  --bs-card-color: var(--cr-text);
  --bs-card-border-color: var(--cr-border);
  --bs-card-cap-color: var(--cr-text);
  --bs-card-title-color: var(--cr-text);
  box-shadow: none;
}

[data-theme="dark"] .modal {
  --bs-modal-bg: var(--cr-card);
  --bs-modal-color: var(--cr-text);
}

[data-theme="dark"] .dropdown-menu {
  --bs-dropdown-bg: var(--cr-card);
  --bs-dropdown-color: var(--cr-text);
  --bs-dropdown-border-color: var(--cr-border);
  --bs-dropdown-divider-bg: var(--cr-border);
  --bs-dropdown-link-color: var(--cr-text);
  --bs-dropdown-link-hover-color: var(--cr-text);
  --bs-dropdown-link-hover-bg: var(--cr-hover);
}

[data-theme="dark"] .list-group {
  --bs-list-group-color: var(--cr-text);
  --bs-list-group-bg: var(--cr-card);
  --bs-list-group-border-color: var(--cr-border);
  --bs-list-group-action-color: var(--cr-text);
  --bs-list-group-action-hover-color: var(--cr-text);
  --bs-list-group-action-active-color: var(--cr-text);
  --bs-list-group-action-active-bg: var(--cr-hover);
  --bs-list-group-disabled-bg: var(--cr-card);
}

[data-theme="dark"] .nav-tabs {
  --bs-nav-tabs-border-color: var(--cr-border);
}

[data-theme="dark"] .pagination {
  --bs-pagination-color: var(--cr-text);
  --bs-pagination-bg: var(--cr-card);
  --bs-pagination-border-color: var(--cr-border);
  --bs-pagination-hover-color: var(--cr-text);
  --bs-pagination-hover-bg: var(--cr-hover);
  --bs-pagination-hover-border-color: var(--cr-border);
  --bs-pagination-disabled-color: var(--cr-text-soft);
  --bs-pagination-disabled-bg: var(--cr-card);
  --bs-pagination-disabled-border-color: var(--cr-border);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  color: var(--cr-text);
  background-color: var(--cr-surface);
  border-color: var(--cr-border);
}

[data-theme="dark"] .form-control::placeholder {
  color: var(--cr-text-muted);
}

[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-select:disabled {
  background-color: var(--cr-canvas);
}

/* ABP page titles; LeptonX hard-codes these near-black. */
[data-theme="dark"] .content-header-title {
  color: var(--cr-text);
}

/* ============================================================================
 * Transitional aliases — un-migrated pages reference the old DESIGN.md token
 * names. These map them onto the new Abacus token system so those pages
 * keep rendering during migration. Removed in the final cleanup commit.
 * ============================================================================ */

:root {
  /* Surface / typography */
  --cr-bg: var(--cr-canvas);
  --surface: var(--cr-card);
  --text: var(--cr-text);
  --text-muted: var(--cr-text-muted);
  --bg: var(--cr-canvas);
  --border: var(--cr-border);

  /* Accent (was ERP-blue, now sage) */
  --accent: var(--cr-accent);
  --accent-light: var(--cr-accent-bg);
  --cr-accent-light: var(--cr-accent-bg);

  /* Status tokens used by older request/queue/timeline UI */
  --cr-approved: var(--cr-accent-strong);
  --cr-approved-bg: var(--cr-accent-bg);
  --cr-rejected: var(--cr-danger);
  --cr-rejected-bg: var(--cr-danger-bg);
  --cr-pending: var(--cr-warn);
  --cr-pending-bg: var(--cr-warn-bg);
  --cr-info-request: var(--cr-info);
  --cr-info-request-bg: var(--cr-info-bg);
  --cr-delegation: var(--cr-text-soft);
  --cr-processed: var(--cr-text-muted);
  --cr-draft: var(--cr-text-soft);
  --cr-draft-bg: #F1F3F4;
}

/* ============================================================================
 * Theme-switch guard — abacus-theme.js adds .abacus-theme-switching to <html>
 * around a [data-theme] flip, then removes it on the next frame. While present,
 * every transition/animation is suppressed so the page repaints in unison
 * instead of staggering across each element's per-property duration.
 * ============================================================================ */
html.abacus-theme-switching,
html.abacus-theme-switching *,
html.abacus-theme-switching *::before,
html.abacus-theme-switching *::after {
  transition: none !important;
  animation: none !important;
}

/* Dark theme */
[data-theme="dark"] {
  --cr-canvas: oklch(18% 0.005 85);
  --cr-surface: oklch(22% 0.005 85);
  --cr-card: oklch(25% 0.005 85);
  --cr-border: oklch(32% 0.005 85);
  --cr-border-strong: oklch(38% 0.005 85);
  --cr-text: oklch(94% 0.005 85);
  --cr-text-muted: oklch(68% 0.008 85);
  --cr-text-soft: oklch(50% 0.008 85);
  --cr-accent: oklch(72% 0.14 138);
  --cr-accent-strong: oklch(78% 0.16 138);
  --cr-accent-bg: oklch(28% 0.05 138);
  --cr-accent-ring: oklch(72% 0.14 138 / 0.24);

  /* Subtle hover bg — slightly lifted vs card so hovers read without glowing. */
  --cr-hover: oklch(30% 0.005 85);

  /* Status chip backgrounds — light theme uses near-white tinted surfaces
     which glow against dark canvas. Drop saturation+lightness so chips read
     as muted tinted cards. Foregrounds (--cr-warn / --cr-danger / --cr-info)
     stay light enough for AA contrast against these darker beds. */
  --cr-warn:       oklch(78% 0.14 75);
  --cr-warn-bg:    oklch(32% 0.05 75);
  --cr-danger:     oklch(72% 0.18 28);
  --cr-danger-bg:  oklch(30% 0.07 28);
  --cr-info:       oklch(78% 0.10 290);
  --cr-info-bg:    oklch(30% 0.04 290);

  /* Money emphasis */
  --cr-money-up:   oklch(72% 0.14 145);
  --cr-money-warn: oklch(78% 0.14 55);

  /* Tab-active deep olive needs to lift in dark mode so the active pill
     stands out against the dark canvas instead of disappearing into it. */
  --cr-tab-active: oklch(72% 0.10 130);

  --cr-draft-bg: var(--cr-hover);
}

/* ============================================================================
 * Base resets — only where they help. Don't fight Blazorise/LeptonX globally.
 * Scope deeper styles under .abacus-app.
 * ============================================================================ */

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.abacus-app,
.abacus-app * {
  font-family: var(--font-sans);
  font-feature-settings: "tnum" on, "ss01" on;
}

.abacus-app {
  background: var(--cr-canvas);
  color: var(--cr-text);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  letter-spacing: var(--tracking-body);
  min-height: 100vh;
}

/* ============================================================================
 * App shell — sidebar + main content
 * ============================================================================ */

.abacus-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  gap: 0;
  padding: 0;
  min-height: 100vh;
  max-width: none;
  margin: 0;
}

.abacus-nav__item {
  white-space: nowrap;
}

.abacus-sidebar {
  background: var(--cr-surface);
  border: 0;
  border-right: 1px solid var(--cr-border);
  border-radius: 0;
  padding: var(--space-5) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
}

.abacus-main {
  background: var(--cr-card);
  border: 0;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---------- Sidebar internals ---------- */

.abacus-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3) var(--space-4);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--cr-text);
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: opacity var(--dur-1) var(--ease-out);
}

.abacus-brand:hover {
  text-decoration: none;
  color: var(--cr-text);
  opacity: 0.85;
}

.abacus-brand:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--cr-accent-ring);
}

.abacus-brand__mark {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--cr-text);
  color: var(--cr-canvas);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.875rem;
}

.abacus-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.abacus-nav__section {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--cr-text-soft);
  padding: var(--space-3) var(--space-3) var(--space-1);
}

.abacus-nav__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-3);
  border-radius: var(--r-sm);
  color: var(--cr-text-muted);
  font-size: var(--fs-body);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
  cursor: pointer;
  user-select: none;
}

.abacus-nav__item:hover {
  background: var(--cr-hover);
  color: var(--cr-text);
}

.abacus-nav__item--active {
  background: var(--cr-card);
  color: var(--cr-text);
  border: 1px solid var(--cr-border);
  box-shadow: 0 1px 2px oklch(20% 0.005 85 / 0.04);
}

.abacus-nav__item--active:hover {
  background: var(--cr-card);
}

.abacus-nav__item--active .abacus-nav__icon {
  color: var(--cr-accent-strong);
}

.abacus-nav__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.abacus-nav__label {
  flex: 1;
}

.abacus-nav__counter {
  background: var(--cr-card);
  border: 1px solid var(--cr-border);
  border-radius: var(--r-sm);
  padding: 2px var(--space-2);
  font-size: var(--fs-caption);
  font-weight: 500;
  color: var(--cr-text-muted);
  min-width: 24px;
  text-align: center;
}

.abacus-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border-top: 1px solid var(--cr-border);
}

.abacus-user__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cat-5);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.abacus-user__name {
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--cr-text);
  line-height: 1.2;
}

.abacus-user__role {
  font-size: var(--fs-caption);
  color: var(--cr-text-muted);
  line-height: 1.2;
}

/* ============================================================================
 * Top bar
 * ============================================================================ */

.abacus-topbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--cr-border);
}

.abacus-search {
  flex: 1;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--cr-border);
  border-radius: var(--r-sm);
  background: var(--cr-card);
  color: var(--cr-text-soft);
  font-size: var(--fs-body);
}

.abacus-search input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--cr-text);
  font: inherit;
}

.abacus-search input::placeholder {
  color: var(--cr-text-soft);
}

.abacus-search--button {
  cursor: pointer;
  text-align: left;
}

.abacus-search--button:hover {
  border-color: var(--cr-border-strong);
}

.abacus-search__placeholder {
  flex: 1;
  color: var(--cr-text-soft);
  font: inherit;
}

.abacus-kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--cr-canvas);
  border: 1px solid var(--cr-border);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: var(--fs-caption);
  color: var(--cr-text-muted);
  font-family: var(--font-mono);
}

.abacus-iconbtn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--cr-text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out);
}

.abacus-iconbtn:hover {
  background: var(--cr-hover);
  color: var(--cr-text);
}

/* ============================================================================
 * Page header
 * ============================================================================ */

.abacus-page {
  padding: var(--space-6) var(--space-8) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.abacus-pagehead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.abacus-pagetitle {
  font-size: var(--fs-display);
  font-weight: 600;
  letter-spacing: var(--tracking-display);
  line-height: var(--lh-tight);
  color: var(--cr-text);
  margin: 0;
}

.abacus-pagesub {
  font-size: var(--fs-body);
  color: var(--cr-text-muted);
  margin-top: var(--space-1);
}

.abacus-pagelink {
  font-size: var(--fs-small);
  color: var(--cr-accent-strong);
  text-decoration: none;
  font-weight: 500;
}

.abacus-pagelink:hover { text-decoration: underline; }

/* ============================================================================
 * Tabs (segmented)
 * ============================================================================ */

.abacus-tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: var(--space-2);
  background: transparent;
  padding: 0;
}

.abacus-tab {
  padding: var(--space-2) var(--space-4);
  height: 36px;
  border-radius: var(--r-pill);
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--cr-text-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}

.abacus-tab:hover { color: var(--cr-text); background: var(--cr-hover); }

.abacus-tab--active {
  background: var(--cr-tab-active);
  color: var(--cr-canvas);
  font-weight: 600;
}

.abacus-tab--active:hover {
  background: var(--cr-tab-active);
  color: var(--cr-canvas);
}

/* ============================================================================
 * KPI strip
 * ============================================================================ */

.abacus-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}

.abacus-kpi {
  background: var(--cr-card);
  border: 1px solid var(--cr-border);
  border-radius: var(--r-md);
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.abacus-kpi__head {
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--cr-text);
}

.abacus-kpi__info {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--cr-text-soft);
  cursor: help;
  border-radius: 50%;
  transition: color var(--dur-1) var(--ease-out);
}

.abacus-kpi__info:hover,
.abacus-kpi__info:focus-visible {
  color: var(--cr-text-muted);
  outline: none;
}

/* ============================================================================
 * Abacus tooltip — CSS-only branded tooltip. Add `.abacus-tip` to any element
 * and set `data-tip="..."` for the message. Default direction is above; add
 * `.abacus-tip--below` to flip it under the trigger (safer inside cards with
 * tight top edges, e.g. KPI tile info icons).
 * ============================================================================ */

.abacus-tip {
  position: relative;
}

.abacus-tip::after,
.abacus-tip::before {
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-1) var(--ease-out);
}

.abacus-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--cr-text);
  color: var(--cr-canvas);
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs-small);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 240px;
  text-align: left;
  box-shadow: var(--shadow-toast);
  z-index: 1000;
}

.abacus-tip::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--cr-text);
  z-index: 1000;
}

.abacus-tip--below::after {
  bottom: auto;
  top: calc(100% + 8px);
}

.abacus-tip--below::before {
  bottom: auto;
  top: calc(100% + 2px);
  border-top-color: transparent;
  border-bottom-color: var(--cr-text);
}

.abacus-tip:hover::after,
.abacus-tip:hover::before,
.abacus-tip:focus-visible::after,
.abacus-tip:focus-visible::before {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .abacus-tip::after,
  .abacus-tip::before {
    transition: none;
  }
}

.abacus-kpi__row {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.abacus-stat {
  font-size: var(--fs-stat);
  font-weight: 600;
  letter-spacing: var(--tracking-h2);
  color: var(--cr-text);
  font-variant-numeric: tabular-nums;
  line-height: var(--lh-tight);
}

.abacus-legend {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.abacus-legend__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-small);
}

.abacus-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.abacus-legend__label {
  color: var(--cr-text-muted);
  flex: 1;
}

.abacus-legend__value {
  color: var(--cr-text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Donut chart (CSS-only conic-gradient) */
.abacus-donut {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}

.abacus-donut::before {
  content: "";
  position: absolute;
  inset: 18px;
  background: var(--cr-card);
  border-radius: 50%;
}

.abacus-donut__center {
  position: relative;
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--cr-text);
}

/* Segmented horizontal bar (Pending Value: legend spread + per-seg pill caps in later block) */
.abacus-segbar__seg {
  height: 100%;
}

.abacus-seglegend {
  display: flex;
  flex-wrap: wrap;
  row-gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--fs-caption);
  color: var(--cr-text-muted);
}

.abacus-seglegend__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: var(--space-2);
  min-width: 6rem;
}

.abacus-seglegend__head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  min-width: 0;
}

/* Keep the dot centered on the first line when the name wraps. */
.abacus-seglegend__head .abacus-dot {
  margin-top: calc((1.3em - 8px) / 2);
}

/* Long facility names wrap instead of truncating so the full name stays readable. */
.abacus-seglegend__label {
  min-width: 0;
  overflow-wrap: break-word;
  line-height: 1.3;
}

.abacus-seglegend__pct {
  font-size: var(--fs-small);
  color: var(--cr-text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.abacus-segbar {
  display: flex;
  height: 8px;
  width: 100%;
  gap: 2px;
}

.abacus-segbar__seg:first-child { border-radius: var(--r-pill) 0 0 var(--r-pill); }
.abacus-segbar__seg:last-child { border-radius: 0 var(--r-pill) var(--r-pill) 0; }
.abacus-segbar__seg:only-child { border-radius: var(--r-pill); }

/* Radial "this session" ring */
.abacus-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.abacus-ring::before {
  content: "";
  position: absolute;
  inset: 14px;
  background: var(--cr-card);
  border-radius: 50%;
}

.abacus-ring__center {
  position: relative;
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--cr-text);
}

/* ============================================================================
 * Toolbar (search + filter + select-all)
 * ============================================================================ */

.abacus-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--cr-border);
}

.abacus-toolbar__filter {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-3);
  border-radius: var(--r-sm);
  background: transparent;
  border: 0;
  color: var(--cr-text);
  font-size: var(--fs-body);
  font-weight: 500;
  cursor: pointer;
}

.abacus-toolbar__filter:hover { background: var(--cr-hover); }

.abacus-toolbar__spacer { flex: 1; }

.abacus-toolbar__link {
  font-size: var(--fs-small);
  color: var(--cr-accent-strong);
  background: none;
  border: 0;
  cursor: pointer;
  font-weight: 500;
}

.abacus-toolbar__link:hover { text-decoration: underline; }

/* ============================================================================
 * Request card (the hero element)
 * ============================================================================ */

.abacus-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.abacus-card {
  background: var(--cr-card);
  border: 1px solid var(--cr-border);
  border-radius: var(--r-md);
  padding: var(--space-6);
  transition: border-color var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}

.abacus-card:hover {
  border-color: var(--cr-border-strong);
  transform: translateY(-1px);
}

.abacus-card--selected {
  border-color: var(--cr-accent);
  background: color-mix(in oklch, var(--cr-accent-bg) 35%, var(--cr-card));
}

.abacus-card--selected:hover {
  border-color: var(--cr-accent-strong);
}

.abacus-card--focused {
  box-shadow: 0 0 0 2px var(--cr-accent-ring);
}

/* ============================================================================
 * Search palette (⌘K overlay)
 * ============================================================================ */

.abacus-search-palette {
  background: var(--cr-card);
  border: 1px solid var(--cr-border);
  border-radius: var(--r-md);
  width: min(640px, calc(100vw - var(--space-8)));
  max-height: min(60vh, 560px);
  margin-top: 10vh;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: abacus-modal-in var(--dur-3) var(--ease-out);
}

.abacus-search-palette__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--cr-border);
  color: var(--cr-text-soft);
}

.abacus-search-palette__head input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--cr-text);
  font: inherit;
  font-size: var(--fs-h3);
}

.abacus-search-palette__head input::placeholder {
  color: var(--cr-text-soft);
  font-size: var(--fs-body);
}

.abacus-search-palette__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2);
}

.abacus-search-palette__hint {
  padding: var(--space-6);
  text-align: center;
  color: var(--cr-text-muted);
  font-size: var(--fs-small);
}

.abacus-search-palette__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  text-align: left;
  cursor: pointer;
  color: var(--cr-text);
  transition: background var(--dur-1) var(--ease-out);
}

.abacus-search-palette__row:hover,
.abacus-search-palette__row--focused {
  background: var(--cr-canvas);
}

/* Make the search backdrop align the palette near the top of viewport, not centered. */
.abacus-modal-backdrop:has(> .abacus-search-palette) {
  align-items: flex-start;
}

/* ============================================================================
 * Account popover + notification-bell badge
 * ============================================================================ */

.abacus-iconbtn--badge {
  position: relative;
}

.abacus-iconbtn__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--cr-danger);
  color: white;
  font-size: 10px;
  font-weight: 600;
  display: grid;
  place-items: center;
  pointer-events: none;
  border: 2px solid var(--cr-card);
  box-sizing: content-box;
  font-variant-numeric: tabular-nums;
}

.abacus-popover-backdrop {
  position: fixed; inset: 0;
  z-index: 19;
  background: transparent;
}

.abacus-popover {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 20;
  min-width: 240px;
  background: var(--cr-card);
  border: 1px solid var(--cr-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-toast);
  padding: var(--space-2);
  animation: abacus-modal-in var(--dur-2) var(--ease-out);
}

.abacus-popover__head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--cr-border);
  margin-bottom: var(--space-1);
}

.abacus-popover__section {
  padding: var(--space-2) var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--cr-border);
  margin-bottom: var(--space-1);
}

.abacus-popover__section-title {
  color: var(--cr-text-muted);
  font-size: var(--fs-caption);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.abacus-popover__radio {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  color: var(--cr-text);
  cursor: pointer;
  font-size: var(--fs-body);
}

.abacus-popover__radio input {
  accent-color: var(--cr-primary);
}

.abacus-popover__status {
  color: var(--cr-text-muted);
  font-size: var(--fs-caption);
  padding-top: var(--space-1);
}

.abacus-popover__status--error {
  color: var(--cr-danger);
}

.abacus-popover__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--r-sm);
  color: var(--cr-text);
  font-size: var(--fs-body);
  text-decoration: none;
  transition: background var(--dur-1) var(--ease-out);
}

.abacus-popover__item:hover {
  background: var(--cr-canvas);
  color: var(--cr-text);
  text-decoration: none;
}

.abacus-popover__item--danger {
  color: var(--cr-danger);
}

.abacus-popover__item--danger:hover {
  background: var(--cr-danger-bg);
  color: var(--cr-danger);
}

/* Custom checkbox used inside request cards */
.abacus-checkbox {
  position: relative;
  display: inline-grid;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
  margin-right: var(--space-1);
}

.abacus-checkbox input {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  inset: 0;
  margin: 0;
  cursor: pointer;
  opacity: 0;
}

.abacus-checkbox__box {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--cr-border-strong);
  border-radius: var(--r-sm);
  background: var(--cr-card);
  color: transparent;
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
}

.abacus-checkbox input:checked + .abacus-checkbox__box {
  background: var(--cr-accent);
  border-color: var(--cr-accent);
  color: white;
}

.abacus-checkbox input:focus-visible + .abacus-checkbox__box {
  box-shadow: 0 0 0 3px var(--cr-accent-ring);
}

.abacus-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.abacus-card__title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
}

.abacus-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cr-accent);
  display: grid;
  place-items: center;
  font-size: var(--fs-caption);
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.abacus-card__name {
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--cr-text);
  letter-spacing: var(--tracking-h3);
}

.abacus-card__money {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.abacus-card__amount {
  font-size: var(--fs-h2);
  font-weight: 600;
  letter-spacing: var(--tracking-h2);
  color: var(--cr-text);
  font-variant-numeric: tabular-nums;
}

.abacus-card__meta {
  font-size: var(--fs-caption);
  color: var(--cr-text-muted);
}

.abacus-card__sub {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--fs-small);
  color: var(--cr-text-muted);
}

.abacus-avatar-sm {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
}

.abacus-card__desc {
  font-size: var(--fs-body);
  color: var(--cr-text);
  max-width: 75ch;
  margin-top: var(--space-3);
  line-height: var(--lh-normal);
}

/* ---------- Priority chips ---------- */

.abacus-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--space-2);
  border-radius: var(--r-pill);
  font-size: var(--fs-caption);
  font-weight: 600;
  height: 22px;
  white-space: nowrap;
}

.abacus-chip--high {
  background: var(--cr-danger-bg);
  color: var(--cr-danger);
}

.abacus-chip--medium {
  background: var(--cr-warn-bg);
  color: var(--cr-warn);
}

.abacus-chip--low {
  background: var(--cr-canvas);
  color: var(--cr-text-muted);
}

/* Status tones (used by status pills on request-detail and elsewhere) */

.abacus-chip--approved {
  background: var(--cr-accent-bg);
  color: var(--cr-accent-strong);
}

.abacus-chip--pending {
  background: var(--cr-warn-bg);
  color: var(--cr-warn);
}

.abacus-chip--info {
  background: var(--cr-info-bg);
  color: var(--cr-info);
}

.abacus-chip--draft {
  background: var(--cr-draft-bg);
  color: var(--cr-draft);
}

.abacus-chip--withdrawn {
  background: var(--cr-canvas);
  color: var(--cr-text-soft);
  text-decoration: line-through;
  text-decoration-color: var(--cr-text-soft);
}

/* ---------- Approval chain ---------- */

.abacus-chain-wrap {
  margin-top: var(--space-5);
  background: var(--cr-canvas);
  border: 1px solid var(--cr-border);
  border-radius: var(--r-md);
  padding: var(--space-4) var(--space-5);
}

.abacus-chain {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: nowrap;
}

.abacus-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.abacus-step__indicator {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: white;
  font-size: 0.6875rem;
  font-weight: 600;
}

.abacus-step--done .abacus-step__indicator { background: var(--cr-accent); }
.abacus-step--current .abacus-step__indicator { background: var(--cat-5); }
.abacus-step--pending .abacus-step__indicator {
  background: oklch(82% 0.005 85);
  color: white;
}

.abacus-step__name {
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--cr-text);
  line-height: 1.2;
}

.abacus-step__role {
  font-size: var(--fs-caption);
  color: var(--cr-text-muted);
  line-height: 1.2;
}

.abacus-step__connector {
  flex: 1;
  min-width: 60px;
  height: 1px;
  position: relative;
  align-self: center;
  background: var(--cr-accent);
}

.abacus-step__connector--pending {
  background: var(--cr-border-strong);
}

.abacus-step__connector::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  border-left: 6px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  color: inherit;
}

.abacus-step__connector { color: var(--cr-accent); }
.abacus-step__connector--pending { color: var(--cr-border-strong); }

/* ---------- Budget impact inset ---------- */

.abacus-impact {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  margin-top: var(--space-3);
  background: var(--cr-canvas);
  border: 1px solid var(--cr-border);
  border-radius: var(--r-md);
}

.abacus-impact__nums-row {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--cr-card);
  border: 1px solid var(--cr-border);
  border-radius: var(--r-sm);
  padding: 6px var(--space-3);
  margin-top: var(--space-2);
}

.abacus-impact__title {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--cr-text);
}

.abacus-impact__sub {
  font-size: var(--fs-caption);
  color: var(--cr-text-muted);
  margin-top: 2px;
}

.abacus-impact__nums {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-2);
  font-size: var(--fs-small);
  color: var(--cr-text-muted);
  font-variant-numeric: tabular-nums;
}

.abacus-money-up { color: var(--cr-money-up); font-weight: 600; }
.abacus-money-warn { color: var(--cr-money-warn); font-weight: 600; }
.abacus-money-neutral { color: var(--cr-text); font-weight: 600; }

/* ---------- Action row ---------- */

.abacus-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.abacus-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-4);
  border-radius: var(--r-sm);
  font-size: var(--fs-body);
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), opacity var(--dur-1) var(--ease-out);
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}

.abacus-btn--primary {
  background: var(--cr-accent);
  color: white;
  border-color: var(--cr-accent);
}

.abacus-btn--primary:hover {
  background: var(--cr-accent-strong);
  border-color: var(--cr-accent-strong);
}

.abacus-btn--ghost {
  background: transparent;
  color: var(--cr-text);
  border-color: var(--cr-border);
}

.abacus-btn--ghost:hover {
  background: var(--cr-canvas);
  border-color: var(--cr-border-strong);
}

.abacus-btn--danger {
  background: transparent;
  color: var(--cr-danger);
  border-color: var(--cr-danger);
}

.abacus-btn--danger:hover {
  background: var(--cr-danger-bg);
}

.abacus-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--cr-accent-ring);
}

/* Disabled: clearly non-interactive — muted, not-allowed cursor, and no hover reaction.
   Used by the Submit button when required fields (incl. >=1 supporting document) aren't met. */
.abacus-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.abacus-btn--primary:disabled:hover {
  background: var(--cr-accent);
  border-color: var(--cr-accent);
}

.abacus-btn--ghost:disabled:hover {
  background: transparent;
  border-color: var(--cr-border);
}

.abacus-btn--danger:disabled:hover {
  background: transparent;
}

/* ============================================================================
 * Modal
 * ============================================================================ */

.abacus-modal-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(20% 0.005 85 / 0.45);
  display: grid;
  place-items: center;
  z-index: 1000;
  animation: abacus-fade-in var(--dur-3) var(--ease-out);
}

.abacus-modal {
  background: var(--cr-card);
  border-radius: var(--r-xl);
  max-width: 480px;
  width: calc(100% - var(--space-8));
  /* Cap to the viewport so the dialog never grows off-screen; the body scrolls
     and the footer stays pinned, keeping the action buttons always reachable. */
  max-height: calc(100dvh - var(--space-8));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-modal);
  animation: abacus-modal-in var(--dur-3) var(--ease-out);
}

.abacus-modal__header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-8) var(--space-4);
}

.abacus-modal__body {
  flex: 1 1 auto;
  min-height: 0;            /* required so the flex child can scroll, not overflow */
  overflow-y: auto;
  padding: 0 var(--space-8) var(--space-2);
}

/* When there's no footer, the body owns the bottom padding. */
.abacus-modal__body:last-child {
  padding: var(--space-2) var(--space-8) var(--space-8);
}

.abacus-modal__footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-8);
  border-top: 1px solid var(--cr-border);
  background: var(--cr-card);
}

/* CER lookup option rows — rendered inside the MudBlazor popover (portaled to the
   document root), so these must live in global (non-scoped) CSS to take effect. */
.ncrm-cer-opt { display: flex; flex-direction: column; gap: 1px; padding: 2px 0; min-width: 0; }
.ncrm-cer-opt-no {
  font-family: var(--font-mono, 'Geist Mono', monospace);
  font-size: 12.5px; font-weight: 600; color: var(--cr-accent); letter-spacing: 0.2px;
}
.ncrm-cer-opt-title {
  font-family: var(--font-sans, 'Geist', sans-serif);
  font-size: 13px; color: var(--cr-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ncrm-cer-opt-meta {
  font-family: var(--font-sans, 'Geist', sans-serif);
  font-size: 11.5px; color: var(--cr-text-muted); font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Location omni-select option (facility / department / intercompany) — rendered inside the
   MudBlazor popover at the document root, so these live in global (non-scoped) styles. */
.ncrm-loc-opt { display: flex; align-items: center; gap: 8px; padding: 2px 0; min-width: 0; }
.ncrm-loc-kind {
  flex: 0 0 auto;
  font-family: var(--font-sans, 'Geist', sans-serif);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase;
  padding: 1px 6px; border-radius: 999px; line-height: 1.5;
  border: 1px solid transparent;
}
.ncrm-loc-kind--facility { color: var(--cr-accent); background: color-mix(in srgb, var(--cr-accent) 12%, transparent); }
.ncrm-loc-kind--department { color: #7a5b19; background: color-mix(in srgb, #b8860b 14%, transparent); }
.ncrm-loc-kind--intercompany { color: #5a4a86; background: color-mix(in srgb, #6f5aae 14%, transparent); }
.ncrm-loc-name {
  font-family: var(--font-sans, 'Geist', sans-serif);
  font-size: 13px; color: var(--cr-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ncrm-loc-code {
  flex: 0 0 auto;
  font-family: var(--font-mono, 'Geist Mono', monospace);
  font-size: 11.5px; color: var(--cr-text-muted); font-variant-numeric: tabular-nums;
}

/* Vendor option (name + account number) — same popover-at-root reason as the location option. */
.ncrm-vopt { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 2px 0; min-width: 0; }
.ncrm-vopt-name {
  font-family: var(--font-sans, 'Geist', sans-serif);
  font-size: 13px; color: var(--cr-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ncrm-vopt-acct {
  flex: 0 0 auto;
  font-family: var(--font-mono, 'Geist Mono', monospace);
  font-size: 11.5px; color: var(--cr-text-muted); font-variant-numeric: tabular-nums;
}
.ncrm-vopt-acct--empty { font-style: italic; opacity: 0.7; }

@keyframes abacus-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes abacus-modal-in {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* ============================================================================
 * Inputs
 * ============================================================================ */

.abacus-input,
.abacus-textarea {
  width: 100%;
  height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--cr-border);
  border-radius: var(--r-sm);
  background: var(--cr-card);
  color: var(--cr-text);
  font: inherit;
  font-size: var(--fs-body);
  transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}

.abacus-textarea {
  height: auto;
  padding: var(--space-3);
  min-height: 96px;
  line-height: var(--lh-normal);
  resize: vertical;
}

.abacus-input:focus,
.abacus-textarea:focus {
  outline: none;
  border-color: var(--cr-accent);
  box-shadow: 0 0 0 3px var(--cr-accent-ring);
}

.abacus-input::placeholder,
.abacus-textarea::placeholder {
  color: var(--cr-text-soft);
}

/* ============================================================================
 * Reduced motion
 * ============================================================================ */

/* ============================================================================
 * Mobile/responsive — sidebar off-canvas drawer at narrow widths.
 * ============================================================================ */

.abacus-iconbtn--menu { display: none; }
.abacus-sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 40;
  background: oklch(20% 0.005 85 / 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-3) var(--ease-out);
}

@media (max-width: 900px) {
  .abacus-shell { grid-template-columns: 1fr; }
  .abacus-sidebar {
    position: fixed; top: 0; left: 0;
    width: 280px; height: 100vh; height: 100dvh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform var(--dur-3) var(--ease-out);
    border-right: 1px solid var(--cr-border);
    box-shadow: 0 0 0 transparent;
  }
  .abacus-sidebar--open {
    transform: translateX(0);
    box-shadow: 8px 0 32px -16px oklch(20% 0.005 85 / 0.25);
  }
  .abacus-sidebar-backdrop { display: block; }
  .abacus-sidebar-backdrop--visible {
    opacity: 1;
    pointer-events: auto;
  }
  .abacus-iconbtn--menu {
    display: grid;
    order: -1; /* render leftmost in the flex topbar */
    margin-right: var(--space-2);
  }
  .abacus-search { max-width: none; }
  .abacus-page {
    padding: var(--space-5) var(--space-5) var(--space-8);
  }
  .abacus-pagetitle {
    font-size: 1.875rem; /* slightly tighter on phones */
  }
  .abacus-kpis {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
 * Shortcuts overlay — keyboard reference, opened by `?` from anywhere.
 * Floats over the app like a modal but reads as a single calm card.
 * ============================================================================ */

.abacus-shortcuts-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(20% 0.005 85 / 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh var(--space-6) var(--space-6);
  z-index: 1100;
  outline: none;
  animation: abacus-modal-in var(--dur-3) var(--ease-out);
}

.abacus-shortcuts {
  background: var(--cr-card);
  border: 1px solid var(--cr-border);
  border-radius: var(--r-lg);
  width: min(640px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-modal);
}

.abacus-shortcuts__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--cr-border);
}

.abacus-shortcuts__title {
  font-size: var(--fs-h2);
  font-weight: 600;
  letter-spacing: var(--tracking-h2);
  color: var(--cr-text);
  margin: 0 0 var(--space-1);
}

.abacus-shortcuts__sub {
  font-size: var(--fs-small);
  color: var(--cr-text-muted);
  margin: 0;
}

.abacus-shortcuts__sub .abacus-kbd {
  vertical-align: 1px;
  margin: 0 2px;
}

.abacus-shortcuts__body {
  padding: var(--space-5) var(--space-6) var(--space-6);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.abacus-shortcuts__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.abacus-shortcuts__group-label {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--cr-text-muted);
  margin: 0;
}

.abacus-shortcuts__list {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
}

.abacus-shortcuts__list > div {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: var(--space-4);
  padding: 10px 0;
  border-bottom: 1px solid var(--cr-border);
}

.abacus-shortcuts__list > div:last-child { border-bottom: 0; }

.abacus-shortcuts__list dt {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0;
}

.abacus-shortcuts__list dd {
  font-size: var(--fs-body);
  color: var(--cr-text);
  margin: 0;
  letter-spacing: var(--tracking-body);
}

.abacus-shortcuts__then {
  font-size: var(--fs-caption);
  color: var(--cr-text-soft);
  font-style: italic;
  letter-spacing: 0;
  padding: 0 2px;
}

@media (max-width: 540px) {
  .abacus-shortcuts__list > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ============================================================================
 * Page hero — role-specific lead strip above KPI strip on triage pages.
 * Keeps each page visually distinct: urgent callout (Approvals), batch tray
 * (AP Queue), most-recent submission (My Requests).
 * ============================================================================ */

.abacus-pagehero {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-4) var(--space-5);
  margin-top: var(--space-3);
  background: var(--cr-card);
  border: 1px solid var(--cr-border);
  border-radius: var(--r-md);
}

.abacus-pagehero--urgent {
  background: color-mix(in oklch, var(--cr-warn-bg) 60%, var(--cr-card));
  border-color: color-mix(in oklch, var(--cr-warn) 30%, var(--cr-border));
}

.abacus-pagehero--success {
  background: color-mix(in oklch, var(--cr-accent-bg) 35%, var(--cr-card));
  border-color: color-mix(in oklch, var(--cr-accent) 25%, var(--cr-border));
}

.abacus-pagehero__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--cr-canvas);
  color: var(--cr-text);
}

.abacus-pagehero--urgent .abacus-pagehero__icon {
  background: color-mix(in oklch, var(--cr-warn) 20%, var(--cr-canvas));
  color: var(--cr-warn);
}

.abacus-pagehero--success .abacus-pagehero__icon {
  background: color-mix(in oklch, var(--cr-accent) 20%, var(--cr-canvas));
  color: var(--cr-accent-strong);
}

.abacus-pagehero__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.abacus-pagehero__lead {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--cr-text-muted);
  line-height: 1.2;
}

.abacus-pagehero__title {
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--cr-text);
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.abacus-pagehero__meta {
  font-size: var(--fs-small);
  color: var(--cr-text-muted);
  line-height: 1.4;
}

.abacus-pagehero__meta strong {
  color: var(--cr-text);
  font-weight: 600;
}

.abacus-pagehero__stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.abacus-pagehero__amount {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: var(--tracking-h2);
  color: var(--cr-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.abacus-pagehero__count {
  font-size: var(--fs-caption);
  color: var(--cr-text-muted);
}

.abacus-pagehero__actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .abacus-pagehero {
    flex-wrap: wrap;
  }
  .abacus-pagehero__actions,
  .abacus-pagehero__stat {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ============================================================================
 * Mini table — used by Reports (Top vendors)
 * ============================================================================ */

.abacus-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
}

.abacus-mini-table th {
  text-align: left;
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--cr-text-muted);
  border-bottom: 1px solid var(--cr-border);
  padding: var(--space-2) 0;
}

.abacus-mini-table td {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--cr-border);
  color: var(--cr-text);
}

.abacus-mini-table tr:last-child td {
  border-bottom: 0;
}

.abacus-mini-table__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

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

/* LeptonX brand logo override — Abacus 4-bead mark on warm-paper. Replaces the
   stock LeptonX flower so the login page reads as part of the Abacus app and
   not the demo theme. The .svg renders consistently at any size. */
:root .lpx-brand-logo {
  --lpx-logo: url('/images/abacus-mark.svg');
  --lpx-logo-icon: url('/images/abacus-mark.svg');
}

/* ============================================================================
 * ABP Account pages (Login, Register, Forgot Password) — restyle the
 * LeptonX MVC chrome to match the Abacus design system. The Account module
 * ships as Razor Pages with Bootstrap + LeptonX, not Blazor; the layout
 * wrapper is .abp-account-layout, NOT .account-module.
 * ============================================================================ */

/* Hide the tenant switcher card. Uses :has() to target the parent .card of
   the AbpTenantSwitchLink — multi-tenancy stays enabled for future use, only
   the UI is hidden. Supported in Safari 15.4+, Chrome 105+. */
.abp-account-layout .card:has(#AbpTenantSwitchLink) {
  display: none !important;
}

/* Account links (Register, Forgot password) — plain <a> tags inside the
   layout. LeptonX paints them with the default Bootstrap link blue. Sage. */
.abp-account-layout a:not(.btn) {
  color: var(--cr-accent-strong) !important;
  text-decoration: none;
}

.abp-account-layout a:not(.btn):hover {
  color: var(--cr-accent) !important;
  text-decoration: underline;
}

/* Password show/hide toggle (#PasswordVisibilityButton). LeptonX renders
   this as btn-secondary which, against the LeptonX palette, comes out
   purple. Force ghost-icon style so it reads as a control, not a CTA. */
#PasswordVisibilityButton {
  background: transparent !important;
  border-color: var(--cr-border) !important;
  color: var(--cr-text-muted) !important;
}

#PasswordVisibilityButton:hover,
#PasswordVisibilityButton:focus {
  background: var(--cr-canvas) !important;
  color: var(--cr-text) !important;
  border-color: var(--cr-border-strong) !important;
}

/* Validation error text — soften the hard cherry-red to the Abacus danger
   color so the page reads accountable, not alarming. */
.abp-account-layout .field-validation-error,
.abp-account-layout .text-danger,
.abp-account-layout .validation-summary-errors,
.abp-account-layout span[data-valmsg-for] {
  color: var(--cr-danger) !important;
  font-size: var(--fs-small);
}

/* Card softness — match the rest of the app's hairline-on-warm-paper
   surface treatment instead of the LeptonX heavier drop-shadow. */
.abp-account-layout .card {
  border: 1px solid var(--cr-border) !important;
  box-shadow: none !important;
  border-radius: var(--r-md) !important;
}

/* ============================================================================
 * Access pending — full-page state for new users with no roles/permissions
 * ============================================================================ */

.abacus-access-pending {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cr-canvas);
  padding: var(--space-6);
}

.abacus-access-pending__card {
  background: var(--cr-card);
  border: 1px solid var(--cr-border);
  border-radius: var(--r-lg);
  padding: var(--space-10) var(--space-8);
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.abacus-access-pending__mark {
  width: 40px;
  height: 40px;
}

.abacus-access-pending__title {
  font-size: var(--fs-h2);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--cr-text);
  margin: var(--space-5) 0 0;
}

.abacus-access-pending__body {
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--cr-text-muted);
  margin: var(--space-3) 0 0;
  max-width: 38ch;
}

.abacus-access-pending__meta {
  font-size: var(--fs-caption);
  color: var(--cr-text-soft);
  margin: var(--space-4) 0 0;
}

.abacus-access-pending__actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-8);
}

.abacus-access-pending__actions .abacus-btn {
  text-decoration: none;
}
