/*
 * ConcreteInfo core stylesheet bundle — GENERATED, do not edit.
 *
 * Source: 22 sheets in includes/css-core-manifest.php,
 * concatenated in that exact order (the cascade order is load-bearing).
 *
 * Regenerate: php assets/css/build-bundle.php
 * source-sha256: fa912a965bb72d5312cec87e1331b2ac14ab391e15e67e18c586b849c34bd8d1
 */

/* ===== design-tokens.css ===== */
/**
 * ConcreteInfo Design Tokens
 * Single source of truth for all design values
 * Based on HSL color system for semantic theming
 *
 * @author Amit Haridas, ConcreteInfo
 * @version 2.0.0
 */

html {
  /* CAMS2-parity root: Tailwind rem utilities (text-sm, p-4, gap-3…) render at the 15px scale */
  font-size: 15px;
}

:root {
  /* ============================================
     COLOR SYSTEM (HSL-based for semantic theming)
     ============================================ */

  /* Brand Colors - ConcreteInfo Palette */
  --color-brand-h: 14;
  --color-brand-s: 77%;
  --color-brand-l: 45%; /* WCAG AA: was 51% (#e24e21, 3.93:1); 45% gives #cb431a (4.82:1) */

  --color-brand: hsl(var(--color-brand-h), var(--color-brand-s), var(--color-brand-l));
  --color-brand-dark: hsl(var(--color-brand-h), var(--color-brand-s), 40%);
  --color-brand-light: hsl(var(--color-brand-h), var(--color-brand-s), 60%);
  --color-brand-50: hsl(var(--color-brand-h), var(--color-brand-s), 98%);
  --color-brand-100: hsl(var(--color-brand-h), var(--color-brand-s), 95%);
  --color-brand-200: hsl(var(--color-brand-h), var(--color-brand-s), 90%);

  /* Neutral Scale - matches concreteinfo.in warm gray palette */
  --color-gray-50: #fafbfc;
  --color-gray-100: #f5f5f5;
  --color-gray-200: #e3e3e3;
  --color-gray-300: #d1d1d1;
  --color-gray-400: #787374; /* WCAG AA: was #b0b0b0 → 4.66:1 on white */
  --color-gray-500: #6b6767; /* WCAG AA: was #9a9696 → 5.58:1 on white */
  --color-gray-600: #5f5b5b; /* WCAG AA: was #7a7878 → 6.70:1 on white */
  --color-gray-700: #5a5858;
  --color-gray-800: #4e4e4e;
  --color-gray-850: #4a4a4a;
  --color-gray-900: #464646;
  --color-gray-950: #0d0b09;

  /* Semantic Colors */
  --color-primary: var(--color-brand);
  --color-primary-hover: var(--color-brand-dark);
  --color-primary-light: var(--color-brand-100);

  --color-secondary: var(--color-gray-700);
  --color-secondary-hover: var(--color-gray-800);

  --color-success: #1a7a56;
  --color-success-light: hsl(159, 64%, 95%);

  --color-warning: hsl(45, 93%, 47%);
  --color-warning-light: hsl(45, 93%, 95%);

  --color-danger: hsl(0, 84%, 47%); /* WCAG AA: 60% read 3.76:1 as text on white; 47% (#d21f1f) ≈ 5.9:1 */
  --color-danger-light: hsl(0, 84%, 95%);

  --color-info: hsl(199, 89%, 36%); /* WCAG AA: 48% read 2.86:1 as text on white; 36% ≈ 4.8:1 */
  --color-info-light: hsl(199, 89%, 95%);

  /* Pure values — on-brand text and colour-mix bases. Declared as tokens so
     components never have to hard-code #fff / #000 (see the token-no-hex
     lint rule). */
  --color-white: #ffffff;
  --color-black: #000000;

  /* Text colours for the pale status surfaces (WCAG AA on the paired
     --color-*-light background). */
  --color-warning-text: #92400e;
  --color-success-text: #166534;

  /* ============================================
     NAV CATEGORY HUES
     One hue per navigation section — visual wayfinding through the menu
     maze. The section key IS the category, so .navcat-{key} sets --navc and
     .navcat applies it. Light mode uses the Tailwind-600 scale, dark mode
     the 300–400 scale, so neighbouring sections never read alike on either
     background. Managed in assets/css/components/sidebar-v2.css.
     ============================================ */
  --color-nav-dashboard: #db2777;       /* pink-600   */
  --color-nav-mix-design: #7c3aed;      /* violet-600 */
  --color-nav-materials: #0891b2;       /* cyan-600   */
  --color-nav-production: #2563eb;      /* blue-600   */
  --color-nav-quality: #059669;         /* emerald-600*/
  --color-nav-reports: #d97706;         /* amber-600  */
  --color-nav-analysis: #0d9488;         /* teal-600   */
  --color-nav-calibration: #65a30d;     /* lime-600   */
  --color-nav-setup: #64748b;           /* slate-500  */
  --color-nav-administration: #64748b;  /* slate-500  */
  --color-nav-account: #64748b;         /* slate-500  */

  /* Accent scales (Tailwind teal / purple) — action-card variants in
     components/cards.css. Naming mirrors --color-brand-N / --color-gray-N. */
  --color-teal-50: #ccfbf1;
  --color-teal-500: #14b8a6;
  --color-teal-600: #0d9488;
  --color-purple-50: #f3e8ff;
  --color-purple-500: #a855f7;
  --color-purple-600: #9333ea;

  /* ============================================
     LIGHT MODE TOKENS
     ============================================ */
  --bg-primary: var(--color-gray-50);
  --bg-secondary: #ffffff;
  --bg-tertiary: var(--color-gray-100);
  --bg-elevated: #ffffff;
  --bg-overlay: hsl(210, 10%, 10%, 0.5);

  --text-primary: var(--color-gray-900);
  /* Decoupled from --color-gray-600/500 so darkening body TEXT to WCAG AA
     (>=4.5:1 on white) does NOT also darken borders/dividers/icons that use
     the gray scale directly. gray-600 #7a7878 was ~4.1:1 (borderline) and
     gray-500 #9a9696 ~3:1 (fail) — secondary/tertiary/muted text was the
     root cause of the low-contrast-on-cards complaint. Dark mode overrides
     --text-secondary/tertiary separately (lighter, for dark bg). */
  --text-secondary: #4b5563;    /* slate-700, ~7:1 on white (AAA) */
  --text-tertiary:   #6b7280;   /* ~4.6:1 on white (AA) */
  --muted: var(--text-tertiary);/* canonical muted alias used across components */
  --text-inverse: #ffffff;
  --text-link: var(--color-brand);

  /* Semantic text-strength aliases (Phase 0/1) — same 4-stop ramp as
     text-primary/secondary/tertiary/inverse, named by role instead of order
     so component CSS reads intent. Both names stay live; migrate on touch. */
  --color-text-strong: var(--text-primary);
  --color-text-default: var(--text-secondary);
  --color-text-muted: var(--text-tertiary);
  --color-text-disabled: var(--color-gray-400);

  /* ── Hooks promoted to tokens (2026-10 hub/dashboard pass) ─────
     --border / --text / --text-strong / --surface-2 were UNDEFINED names
     relied on via fallbacks — var(--border,#e6e8ec), var(--text,#374151),
     var(--text-strong,#111827), var(--surface-2,#f1f3f6) — across hub.css,
     lifecycle-nav.css, dashboard.css, command-palette.css. Values below are
     exactly those fallback hexes, so light mode is unchanged by
     construction; dark values (see .dark block) come from the same rules'
     own .dark overrides. CAUTION: --text-strong (slate-900 #111827) is NOT
     the alias --color-text-strong above (= --text-primary #464646) — both
     names stay live until components migrate. */
  --border: #e6e8ec;
  --text: #374151;
  --text-strong: #111827;
  --surface-2: #f1f3f6;
  --surface-card: var(--bg-secondary); /* hub card surface — warm-dark override below */

  /* Info-note callout family (hub__note, hub__alert--info) */
  --info-note-bg: #f1f7ff;
  --info-note-border: #bcdcff;
  --info-note-text: #34528a;
  --info-note-text-strong: #1d3a66;

  /* Trend-direction arrows (stat pills) */
  --trend-up: var(--color-success);
  --trend-down: var(--color-danger);

  /* Tone-chip text (hub xl-chips): strong tone-on-tint text */
  --tone-text-success: #0f5c3f;
  --tone-text-warning: #7a5e00;
  --tone-text-alert: var(--color-brand-dark);

  --border-subtle: var(--color-gray-200);
  --border-default: var(--color-gray-300);
  --border-strong: var(--color-gray-400);

  --shadow-xs: 0 1px 2px rgba(13, 11, 9, 0.04);
  --shadow-sm: 0 1px 3px rgba(13, 11, 9, 0.06), 0 1px 2px rgba(13, 11, 9, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(13, 11, 9, 0.08), 0 2px 4px -2px rgba(13, 11, 9, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(13, 11, 9, 0.1), 0 4px 6px -4px rgba(13, 11, 9, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(13, 11, 9, 0.12), 0 8px 10px -6px rgba(13, 11, 9, 0.05);
  --shadow-2xl: 0 25px 50px -12px rgba(13, 11, 9, 0.25);
  --shadow-primary: 0 10px 25px -5px hsl(14, 77%, 51%, 0.3);
  /* Soft / blur shadows — large diffuse radius for floating, ambient depth */
  --shadow-soft: 0 8px 24px -6px rgba(13, 11, 9, 0.10), 0 2px 6px -2px rgba(13, 11, 9, 0.06);
  --shadow-glow: 0 10px 30px -8px hsl(var(--color-brand-h), 77%, 51%, 0.35);
  --shadow-float: 0 18px 40px -12px rgba(13, 11, 9, 0.18);

  /* Semantic 4-level shadow scale (Phase 0/1 refinement). Existing xs/sm/md/lg/
     xl/2xl/soft/float stay defined above as deprecated aliases — components
     migrate to shadow-1..4 on touch, nothing breaks if they don't yet. */
  --shadow-1: var(--shadow-sm);   /* cards at rest */
  --shadow-2: var(--shadow-md);   /* hover / active elevation */
  --shadow-3: var(--shadow-lg);   /* modals, popovers */
  --shadow-4: var(--shadow-float); /* dramatic — drawer overlays, rare */

  /* Card Header Theme Tokens (overridden by card-theme-engine) */
  --card-header-bg: transparent;
  --card-header-fg: var(--text-primary);
  --card-header-border: var(--border-subtle);
  --card-header-accent-color: transparent;
  --card-header-accent-height: 0px;
  /* Card header layout + effects (height, glass blur, depth highlight) */
  --card-header-py: 10px;        /* CAMS2 density (was 14px) */
  --card-header-px: var(--spacing-4);    /* 16px — aligned with card__body (was 24px) */
  --card-header-blur: 0px;      /* backdrop blur for glass themes */
  --card-header-saturate: 1;    /* backdrop saturation boost for glass */
  --card-header-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.06); /* top depth line */
  /* Card-level shadow (outer; not clipped by overflow:hidden) */
  --card-shadow: var(--shadow-sm);

  /* Focus ring */
  --focus-ring: 0 0 0 3px var(--color-brand-100);
  --focus-ring-dark: 0 0 0 3px hsl(var(--color-brand-h), 50%, 20%);

  /* ============================================
     TYPOGRAPHY SCALE (Reduced by one size for compact UI)
     ============================================ */
  --font-family-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'Helvetica Neue', Arial, sans-serif;
  --font-family-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'Helvetica Neue', Arial, sans-serif;
  --font-family-display: 'Barlow Condensed', 'IBM Plex Sans Condensed', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-family-mono: 'SF Mono', 'Fira Code', 'Consolas', 'Liberation Mono', monospace;

  /* Font sizes — frozen in px; the 15px html root (below) shrinks only
     Tailwind rem utilities to the CAMS2 scale, these stay at designed values. */
  --font-size-xs: 11px;
  --font-size-sm: 13px;
  --font-size-base: 15px;
  --font-size-lg: 17px;
  --font-size-xl: 19px;
  --font-size-2xl: 22px;
  --font-size-3xl: 26px;
  --font-size-4xl: 32px;
  --font-size-5xl: 40px;
  --font-size-2xs: 10px;        /* tabular numerics, dense table cells */

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  --line-height-dense: 1.4;     /* dense table rows */

  --letter-spacing-tight: -0.025em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.025em;
  --letter-spacing-wider: 0.05em;

  /* ============================================
     SPACING SCALE (4px base unit)
     ============================================ */
  --spacing-0: 0;
  --spacing-px: 1px;
  --spacing-0-5: 0.125rem;   /* 2px */
  --spacing-half: 0.125rem;  /* 2px — icon-in-button optical alignment, alias of spacing-0-5 */
  --spacing-1: 0.25rem;      /* 4px */
  --spacing-1-5: 0.375rem;   /* 6px */
  --spacing-2: 0.5rem;       /* 8px */
  --spacing-2-5: 0.625rem;   /* 10px */
  --spacing-3: 0.75rem;      /* 12px */
  --spacing-3-5: 0.875rem;   /* 14px */
  --spacing-4: 1rem;         /* 16px */
  --spacing-5: 1.25rem;      /* 20px */
  --spacing-6: 1.5rem;       /* 24px */
  --spacing-7: 1.75rem;      /* 28px */
  --spacing-8: 2rem;         /* 32px */
  --spacing-9: 2.25rem;      /* 36px */
  --spacing-10: 2.5rem;      /* 40px */
  --spacing-12: 3rem;        /* 48px */
  --spacing-16: 4rem;        /* 64px */
  --spacing-20: 5rem;        /* 80px */
  --spacing-24: 6rem;        /* 96px */

  /* ============================================
     BORDER RADIUS
     ============================================ */
  --radius-none: 0;
  --radius-sm: 0.25rem;      /* 4px */
  --radius-md: 0.5rem;       /* 8px */
  --radius-lg: 0.75rem;      /* 12px */
  --radius-xl: 1rem;         /* 16px */
  --radius-2xl: 1.5rem;      /* 24px */
  --radius-full: 9999px;

  /* Semantic radius (Phase 0/1). card/modal alias the existing scale exactly
     (lg=12px, xl=16px) so they already ride the sharp/round personality in
     theme-studio.css. control is a new value (6px, between sm/md) — extended
     into theme-studio.css's data-radius overrides in Step 5 below so it also
     responds to the sharp/round toggle instead of staying fixed. */
  --radius-control: 0.375rem;   /* 6px — buttons, inputs, badges */
  --radius-card: var(--radius-lg);   /* 12px — cards, panels */
  --radius-modal: var(--radius-xl);  /* 16px — modals, drawers */

  /* ============================================
     TRANSITIONS
     ============================================ */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ============================================
     ANIMATION KEYFRAMES
     ============================================ */
  --keyframes-fadeIn: fadeIn 200ms ease-out;
  --keyframes-slideUp: slideUp 250ms ease-out;
  --keyframes-slideDown: slideDown 250ms ease-out;
  --keyframes-scaleIn: scaleIn 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --keyframes-spin: spin 0.6s linear infinite;

  /* ============================================
     Z-INDEX SCALE
     ============================================ */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;

  /* ============================================
     LAYOUT
     ============================================ */
  --sidebar-width: 16.5rem;    /* 264px */
  --sidebar-collapsed-width: 4.5rem;
  --header-height: 4rem;       /* 64px */
  --container-max-width: 80rem; /* 1280px */
  --content-max-width: 72rem;   /* 1152px */
}

/* ============================================
   DARK MODE TOKENS
   ============================================ */
.dark {
  /* Nav category hues — the lighter Tailwind scale for dark backgrounds. */
  --color-nav-dashboard: #f472b6;       /* pink-400   */
  --color-nav-mix-design: #a78bfa;      /* violet-400 */
  --color-nav-materials: #22d3ee;       /* cyan-400   */
  --color-nav-production: #60a5fa;      /* blue-400   */
  --color-nav-quality: #34d399;         /* emerald-400*/
  --color-nav-reports: #fbbf24;         /* amber-400  */
  --color-nav-analysis: #2dd4bf;         /* teal-400   */
  --color-nav-calibration: #a3e635;     /* lime-400   */
  --color-nav-setup: #94a3b8;           /* slate-400  */
  --color-nav-administration: #94a3b8;  /* slate-400  */
  --color-nav-account: #94a3b8;         /* slate-400  */

  --bg-primary: var(--color-gray-950);
  --bg-secondary: var(--color-gray-900);
  --bg-tertiary: var(--color-gray-800);
  --bg-elevated: var(--color-gray-850, hsl(210, 8%, 14%));
  --bg-overlay: hsl(210, 10%, 5%, 0.7);

  --text-primary: var(--color-gray-50);
  /* Secondary/tertiary text bumped for WCAG-AA contrast on dark surfaces.
     Old values (gray-400 #b0b0b0 / gray-500 #9a9696) measured 4.35:1 and
     3.23:1 against the #464646 dark input/card surface — both below the 4.5
     AA threshold, so secondary/tertiary text, helper hints, and ghost-button
     labels read as dim gray-on-gray in dark mode. gray-200 (#e3e3e3) ≈ 7.5:1
     and gray-300 (#d1d1d1) ≈ 6.2:1 on #464646 — both AAA. There is no gray
     token between 400 and 300, so secondary jumps two stops; the 50→200→300
     hierarchy is preserved. */
  --text-secondary: var(--color-gray-200);
  --text-tertiary: var(--color-gray-300);
  --text-inverse: #ffffff;
  --text-link: hsl(var(--color-brand-h), 80%, 60%);
  --color-danger: hsl(0, 84%, 62%); /* brighter red for dark surfaces (light theme's 47% would sink to ~2.4:1) */
  --color-info: hsl(199, 89%, 62%); /* bright blue for dark surfaces (light theme's 38% would sink) */

  --color-text-strong: var(--text-primary);
  --color-text-default: var(--text-secondary);
  --color-text-muted: var(--text-tertiary);
  --color-text-disabled: var(--color-gray-600);

  --border-subtle: var(--color-gray-800);
  --border-default: var(--color-gray-700);
  --border-strong: var(--color-gray-600);

  /* ── Hub warm-dark surface family (2026-10) ───────────────────
     Values are the exact hexes previously hardcoded in hub.css /
     lifecycle-nav.css .dark rules (surface #1a1714, raised #26221e,
     border #2a2622, default text #cbd5e1) — dark rendering unchanged
     where a .dark override existed; light-mode fallbacks that leaked
     into dark now resolve to these family values instead. */
  --surface-card: #1a1714;
  --surface-2: #26221e;
  --border: #2a2622;
  --text: #cbd5e1;
  --text-strong: var(--text-primary);
  /* Secondary text on the warm-dark surfaces. Light counterparts differ
     per rule (--text-secondary on dw-* labels, --muted on hub tile-rich
     headline text), so this token is intentionally dark-scoped only. */
  --text-soft: #c7ccd6;
  --trend-up: #34d399;
  --trend-down: #f87171;
  --tone-text-success: #5fd3a4;
  --tone-text-warning: #ffd24a;
  --tone-text-alert: #ff9a7a;

  --shadow-xs: 0 1px 2px rgba(13, 11, 9, 0.2);
  --shadow-sm: 0 1px 3px rgba(13, 11, 9, 0.3), 0 1px 2px rgba(13, 11, 9, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(13, 11, 9, 0.4), 0 2px 4px -2px rgba(13, 11, 9, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(13, 11, 9, 0.5), 0 4px 6px -4px rgba(13, 11, 9, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(13, 11, 9, 0.6), 0 8px 10px -6px rgba(13, 11, 9, 0.5);
  --shadow-2xl: 0 25px 50px -12px rgba(13, 11, 9, 0.7);
  --shadow-primary: 0 10px 25px -5px hsl(14, 77%, 51%, 0.25);
  /* Soft / blur shadows — stronger in dark mode */
  --shadow-soft: 0 8px 24px -6px rgba(0, 0, 0, 0.45), 0 2px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 10px 30px -8px hsl(var(--color-brand-h), 77%, 51%, 0.3);
  --shadow-float: 0 18px 40px -12px rgba(0, 0, 0, 0.6);

  --shadow-1: var(--shadow-sm);
  --shadow-2: var(--shadow-md);
  --shadow-3: var(--shadow-lg);
  --shadow-4: var(--shadow-float);

  /* Card Header Theme — dark mode defaults (overridden by user theme) */
  --card-header-bg: transparent;
  --card-header-fg: var(--color-gray-100);
  --card-header-border: var(--color-gray-700);
  --card-header-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Theme transition - smooth color changes */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition: background-color 300ms ease,
              border-color 300ms ease,
              color 300ms ease,
              box-shadow 300ms ease,
              fill 300ms ease,
              stroke 300ms ease !important;
}

/* ============================================================================
   v6 UI-refresh utilities — additive, opt-in classes (approved 2026-07-12).
   Spec: docs/superpowers/specs/2026-07-12-ui-refresh-design.md
   Apply by adding the class to an element; no existing rules are changed.
   ============================================================================ */

/* Frosted-glass surface — translucent white + blur, over a tinted backdrop.
   Use on cards, panels, sticky header, modals, toasts. */
.frosted {
  background: rgba(255, 255, 255, 0.42);
  -webkit-backdrop-filter: saturate(1.5) blur(26px);
  backdrop-filter: saturate(1.5) blur(26px);
  border: 1px solid rgba(255, 255, 255, 0.6);
}
/* Dark variant — sidebar / dark drawers. */
.frosted--dark {
  background: rgba(13, 16, 26, 0.72);
  -webkit-backdrop-filter: saturate(1.3) blur(20px);
  backdrop-filter: saturate(1.3) blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Gentle lift on hover — the approved middle ground (NOT the rejected -8px pop).
   -3px translate + shadow-lg + a soft, restrained brand glow + brand-100 border. */
.lift {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.3s ease,
              border-color 0.3s ease;
  will-change: transform;
}
.lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg),
              0 12px 28px -10px hsla(var(--color-brand-h), var(--color-brand-s), var(--color-brand-l), 0.16);
  border-color: var(--color-brand-100);
}

/* Note: monochrome-icon enforcement (FA icons inherit color, brand on active/primary)
   is intentionally NOT global here — it lands in the surface-adoption task so each
   icon is reviewed (avoids shifting existing icon colors). */

/* cams2 display-face parity (04/09) — page headings render in the condensed
   display face like cams2's h2/h3 treatment; body and everything else
   unchanged. Users' saved font preferences still override sans/heading. */
.page-title {
  font-family: var(--font-family-display);
  font-weight: 800;
  letter-spacing: 0.2px;
}

/* ===== base.css ===== */
/**
 * ConcreteInfo Base Styles
 * Reset, typography, and global element defaults
 *
 * @author Amit Haridas, ConcreteInfo
 */

/* ============================================================================
   DESIGN TOKENS — ALIASES & DERIVED VALUES
   ============================================================================ */
:root {
  /* Legacy shadow aliases — mapped to design-tokens */
  --card-elevation-resting: var(--shadow-sm);
  --card-elevation-raised: var(--shadow-md);
  --card-elevation-hover: var(--shadow-lg);
  --card-elevation-floating: var(--shadow-xl);

  /* Gradient variables */
  --gradient-primary: linear-gradient(135deg, var(--color-brand) 0%, var(--color-brand-light) 100%);
  --gradient-brand: var(--gradient-primary);
  --gradient-secondary: linear-gradient(135deg, var(--color-gray-700) 0%, var(--color-gray-800) 100%);
}

/* ============================================================================
   RESET
   ============================================================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* Safe area insets for notched devices */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

body {
  margin: 0;
  font-family: var(--font-family-sans, 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif);
  font-size: var(--font-size-base, 15px);
  line-height: var(--line-height-normal, 1.6);
  color: var(--text-primary, #464646);
  background-color: var(--bg-primary, #fafbfc);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Touch target enforcement — 44px minimum */
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================================
   TOUCH TARGETS
   ============================================================================ */
/* Global interactive element touch targets */
button,
[role="button"],
/* 44px touch targets apply below the lg shell breakpoint only (CAMS2 pattern);
   desktop controls use their natural component heights (~33-40px). */
@media (max-width: 1023px) {
  a.btn,
  label.checkbox,
  label.radio,
  .input,
  .select,
  textarea {
    min-height: 44px;
  }
}
@media (min-width: 1024px) {
  a.btn {
    min-height: 36px;
  }
}

/* Smaller inputs can be smaller */
.input--sm,
.select--sm {
  min-height: 36px;
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--spacing-3, 0.75rem);
  font-weight: var(--font-weight-bold, 700);
  line-height: var(--line-height-tight, 1.25);
  color: var(--text-primary, #464646);
}

p {
  margin: 0 0 var(--spacing-3, 0.75rem);
}

a {
  color: var(--color-brand);
  text-decoration: none;
  transition: color var(--transition-fast, 150ms ease);
}

a:hover {
  color: var(--color-brand-dark);
}

/* ============================================================================
   ELEMENTS
   ============================================================================ */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  padding-left: var(--spacing-5, 1.25rem);
}

button {
  cursor: pointer;
  font-family: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

hr {
  border: none;
  border-top: 1px solid var(--border-subtle, #e3e3e3);
  margin: var(--spacing-4, 1rem) 0;
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */
:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== layouts/sidebar.css ===== */
/**
 * Sidebar Layout Component
 * Features: collapsible, nested navigation, user section
 * Theming: matches concreteinfo.in light sidebar style
 *
 * @author Amit Haridas, ConcreteInfo
 */

/* ============================================
   SIDEBAR BASE — light theme
   ============================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width, 264px);
  height: 100vh;
  background-color: var(--bg-primary, #ffffff);
  border-right: 1px solid var(--border-subtle, #e3e3e3);
  display: flex;
  flex-direction: column;
  z-index: var(--z-fixed, 1030);
  transition: transform var(--transition-normal, 250ms ease);
  overflow: hidden;
}

/* ============================================
   SIDEBAR HEADER
   ============================================ */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-4, 1rem) var(--spacing-5, 1.25rem);
  min-height: var(--header-height, 64px);
  border-bottom: 1px solid var(--border-subtle, #e3e3e3);
  background-color: var(--bg-primary, #ffffff);
}

.sidebar-logo {
  height: 2.5rem;
  width: auto;
}

.sidebar-close {
  display: none;
  padding: var(--spacing-2, 0.5rem);
  border-radius: var(--radius-md, 0.5rem);
  color: var(--color-gray-500, #6b7280);
  background: var(--bg-tertiary, #f3f4f6);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast, 150ms);
}

.sidebar-close:hover {
  background-color: var(--bg-secondary, #e5e7eb);
  color: var(--text-primary, #1f2937);
}

/* ============================================
   SIDEBAR USER
   ============================================ */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--spacing-3, 0.75rem);
  padding: var(--spacing-4, 1rem) var(--spacing-5, 1.25rem);
  border-bottom: 1px solid var(--border-subtle, #f0f0f0);
  background-color: var(--bg-secondary, #fafafa);
  color: var(--color-gray-500, #6b7280);
}

.sidebar-user i {
  color: var(--color-brand);
  font-size: 1.5rem;
}

.sidebar-user .fw-semibold {
  color: var(--text-primary, #1f2937);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm, 0.875rem);
}

.sidebar-user small {
  color: var(--text-tertiary, #9a9696);
  font-size: var(--font-size-xs, 0.75rem);
}

.sidebar-user .ms-2 {
  margin-left: 0.5rem;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-3, 0.75rem) 0;
  display: flex;
  flex-direction: column;
}

/* Custom scrollbar — orange thumb matching concreteinfo.in */
.sidebar-nav::-webkit-scrollbar {
  width: 0.25rem;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: var(--bg-tertiary, #f3f4f6);
  border-radius: 9999px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--color-brand);
  border-radius: 9999px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--color-brand-dark);
}

/* Firefox scrollbar */
.sidebar-nav {
  scrollbar-width: thin;
  scrollbar-color: var(--color-brand) var(--bg-tertiary, #f3f4f6);
}

/* Navigation Section */
.sidebar-section {
  margin-bottom: 0;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-2, 0.5rem);
  padding: var(--spacing-3, 0.75rem) var(--spacing-5, 1.25rem) var(--spacing-2, 0.5rem);
  font-size: 0.8125rem;
  font-weight: var(--font-weight-semibold);
  /* Sentence case per product direction (was 11px uppercase). Contrast
     note still applies at 13px: text-secondary (7:1) with a fallback that
     passes on its own. */
  color: var(--text-secondary, #4b5563);
  letter-spacing: 0.02em;
  border-top: 1px solid var(--border-subtle, #e3e3e3);
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast, 150ms);
}

.sidebar-section-title:hover {
  color: var(--color-brand);
}

.sidebar-section:first-of-type .sidebar-section-title {
  border-top: none;
  padding-top: var(--spacing-2, 0.5rem);
}

.sidebar-section-title > i:first-child {
  font-size: 0.75rem;
  color: var(--color-brand);
  flex-shrink: 0;
}

/* Lucide outline svg icons (menu direction 2026-11-16): same 20px column
   the FA glyphs occupied; explicit height because svg has no font glyph
   box. Stroke inherits currentColor, so navcat category tints ride along. */
.sidebar-section-title > svg.ci-lucide:first-child {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

/* Chevron indicator */
.sidebar-section-chevron {
  margin-left: auto;
  font-size: 0.65rem;
  color: var(--text-tertiary, #9a9696);
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1),
              color var(--transition-fast, 150ms);
  flex-shrink: 0;
}

.sidebar-section.open .sidebar-section-chevron {
  transform: rotate(180deg);
  color: var(--color-brand);
}

.sidebar-section-title:hover .sidebar-section-chevron {
  color: var(--color-brand);
}

/* Collapsible body */
.sidebar-section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Open body: NO cap. The server renders the active section with .open, so
   this rule IS the first-paint geometry — a finite cap (was 1200px) clipped
   taller sections (the v2 "more" stack is ~1600-1900px) and forced
   sidebar.js to overwrite an inline scrollHeight right after first paint,
   animating a visible jump of everything below on every page load. `none`
   also removes the JS dependency: the section renders fully even before
   sidebar.js runs, and the click open/close animation still works because
   it drives inline max-height (0 -> scrollHeight), not this rule. */
.sidebar-section.open .sidebar-section-body {
  max-height: none;
}

/* Navigation Link */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-3, 0.75rem);
  padding: 0.55rem var(--spacing-5, 1.25rem);
  margin: 0.125rem 0;
  border-left: 3px solid transparent;
  color: var(--color-gray-500, #6b7280);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-fast, 150ms);
  position: relative;
}

.sidebar-link:hover {
  background-color: var(--color-brand-50, #fef2f2);
  color: var(--color-brand);
  border-left-color: var(--color-brand-200, #fcd5cc);
}

.sidebar-link.active {
  background-color: var(--color-brand-50, #fef2f2);
  color: var(--color-brand);
  border-left-color: var(--color-brand);
  font-weight: var(--font-weight-semibold);
}

.sidebar-link i {
  width: 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.sidebar-link svg.ci-lucide {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.sidebar-link span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-link.text-danger {
  color: #dc2626 !important;
}

.sidebar-link.text-danger:hover {
  background-color: #fef2f2 !important;
  color: #b91c1c !important;
  border-left-color: #fca5a5 !important;
}

/* ============================================
   SIDEBAR OVERLAY (Mobile)
   ============================================ */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal, 250ms);
  pointer-events: none;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width, 264px);
  right: 0;
  height: var(--header-height, 64px);
  background-color: var(--bg-primary, #ffffff);
  border-bottom: 1px solid var(--border-subtle, #e3e3e3);
  display: flex;
  align-items: center;
  padding: 0 var(--spacing-6, 1.5rem);
  z-index: calc(var(--z-fixed, 1030) - 2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sidebar-toggle {
  display: none;
  padding: var(--spacing-2, 0.5rem);
  border-radius: var(--radius-md, 0.5rem);
  color: var(--color-gray-500, #6b7280);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast, 150ms);
  margin-right: var(--spacing-3, 0.75rem);
}

.sidebar-toggle:hover {
  background-color: var(--bg-tertiary, #f3f4f6);
  color: var(--text-primary, #1f2937);
}

.topbar-brand {
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary, #1f2937);
  font-family: var(--font-family-heading, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--spacing-3, 0.75rem);
}

.topbar-actions button[data-theme-toggle] {
  padding: var(--spacing-2, 0.5rem);
  border-radius: var(--radius-lg, 0.75rem);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast, 150ms);
}

.topbar-actions button[data-theme-toggle]:hover {
  background-color: var(--bg-tertiary, #f3f4f6);
}

/* ============================================
   CONTENT WRAPPER
   ============================================ */
.content-wrapper {
  margin-left: var(--sidebar-width, 264px);
  min-height: 100vh;
  background-color: var(--bg-primary, #f5f5f5);
}

.main-content {
  padding: var(--spacing-6, 1.5rem);
}

/* ============================================
   RESPONSIVE SIDEBAR
   ============================================ */
/* Icon-rail for DESKTOP-narrow only (1024-1279px): thin persistent sidebar, hide text labels.
   Scoped to >=1024px so it does NOT cascade into the mobile drawer (<1024px), which needs
   the full labels + search bar visible in its 280px width. Without this min-width floor the
   icon-rail's display:none rules (labels, .sidebar-search, user-card info) bled into mobile
   and the drawer opened with icons-only + no search. */
@media (min-width: 1024px) and (max-width: 1279.98px) {
  :root { --sidebar-width: var(--sidebar-collapsed-width, 4.5rem); }
  .sidebar-link span,
  .sidebar-section-title,
  .sidebar-manage-title,
  .sidebar-section-chevron { display: none; }
  .sidebar-search { display: none; }
  .sidebar-user-card__info { display: none; }
  .sidebar-link { justify-content: center; padding-left: 0; padding-right: 0; }
  .sidebar-section-title > i:first-child { margin: 0; }
  .sidebar-section-title > svg.ci-lucide:first-child { margin: 0; }
}

@media (max-width: 1023.98px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    z-index: var(--z-modal, 1050);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .topbar {
    left: 0;
  }

  .content-wrapper {
    margin-left: 0;
  }

  .main-content {
    padding-top: var(--spacing-4, 1rem);
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-muted {
  color: var(--text-secondary, #6b7280) !important;
}

.ms-2 {
  margin-left: 0.5rem !important;
}

.mr-1 {
  margin-right: 0.25rem !important;
}

.mr-2 {
  margin-right: 0.5rem !important;
}

.mt-auto {
  margin-top: auto !important;
}

.fw-semibold {
  font-weight: var(--font-weight-semibold) !important;
}

.hidden {
  display: none !important;
}

/* ============================================
   FOCUS RINGS (keyboard navigation)
   ============================================ */
.sidebar-link:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: -2px;
  border-radius: 2px;
}

.sidebar-section-title:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: -2px;
}

/* ============================================
   FOOTER SECTION (Profile / Logout)
   ============================================ */
.sidebar-section--footer {
  margin-top: auto;
  padding-top: var(--spacing-2, 0.5rem);
  border-top: 1px solid var(--border-subtle, #e3e3e3);
}

/* ============================================
   SIDEBAR SEARCH
   ============================================ */

/* Container — matches sidebar-user section rhythm */
.sidebar-search {
  padding: var(--spacing-2, 0.5rem) var(--spacing-5, 1.25rem) var(--spacing-3, 0.75rem);
  background-color: var(--bg-secondary, #ffffff);
  border-bottom: 1px solid var(--border-subtle, #e3e3e3);
  flex-shrink: 0;
}

.dark .sidebar-search {
  background-color: var(--bg-secondary);
  border-bottom-color: var(--border-subtle);
}

.sidebar-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

/* Search icon */
.sidebar-search-wrap .search-icon {
  position: absolute;
  left: 0.65rem;
  color: var(--text-tertiary, #9a9696);
  font-size: 0.675rem;
  pointer-events: none;
  z-index: 1;
  transition: color 150ms;
}

.sidebar-search-input:focus ~ .search-icon,
.sidebar-search-wrap:focus-within .search-icon {
  color: var(--color-brand, #16668b);
}

/* Input — pill shape, tertiary bg so it looks embedded */
.sidebar-search-input {
  width: 100%;
  padding: 0.4375rem 4rem 0.4375rem 2rem;
  border: 1px solid var(--border-subtle, #e3e3e3);
  border-radius: var(--radius-full, 9999px);
  background-color: var(--bg-tertiary, #f5f5f5);
  color: var(--text-primary, #1f2937);
  font-size: 0.8125rem;
  font-family: inherit;
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: border-color 150ms, box-shadow 150ms, background-color 150ms;
  -webkit-appearance: none;
  appearance: none;
}

.sidebar-search-input::-webkit-search-cancel-button {
  display: none;
}

.sidebar-search-input::placeholder {
  /* The pill's tinted bg (#f5f5f5) drops text-tertiary below AA —
     secondary reads clearly and still reads as a placeholder. */
  color: var(--text-secondary, #4b5563);
}

.sidebar-search-input:hover:not(:focus) {
  border-color: var(--border-default, #d1d1d1);
  background-color: var(--bg-secondary, #ffffff);
  box-shadow: var(--shadow-sm);
}

.sidebar-search-input:focus {
  border-color: var(--color-brand, #16668b);
  box-shadow: 0 0 0 3px var(--color-brand-100, hsl(199, 73%, 95%)), var(--shadow-sm);
  background-color: var(--bg-secondary, #ffffff);
}

/* ⌘K / Ctrl+K shortcut badge — visible when input is idle and empty */
.sidebar-search-kbd {
  position: absolute;
  right: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.125rem;
  pointer-events: none;
  transition: opacity 150ms;
}

.sidebar-search-kbd kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0.3rem;
  font-size: 0.625rem;
  font-family: inherit;
  font-weight: 600;
  line-height: 1;
  color: var(--text-tertiary, #9a9696);
  background: var(--bg-secondary, #ffffff);
  border: 1px solid var(--border-default, #d1d1d1);
  border-radius: var(--radius-sm, 0.25rem);
  box-shadow: 0 1px 0 var(--border-default, #d1d1d1);
  white-space: nowrap;
}

.sidebar-search-kbd.hidden {
  display: none;
}

/* Clear button — shown only when input has value */
.sidebar-search-clear {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  min-height: 0; /* override the global button{min-height:44px} touch-target rule — this is a small in-field clear (×), not a primary tap target; without this it renders 20×44 → ellipse under border-radius:50% */
  background: var(--bg-tertiary, #f5f5f5);
  border: 1px solid var(--border-subtle, #e3e3e3);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-tertiary, #9a9696);
  font-size: 0.6rem;
  line-height: 1;
  padding: 0;
  transition: background-color 150ms, color 150ms, border-color 150ms;
}

.sidebar-search-clear:hover {
  background: var(--border-subtle, #e3e3e3);
  border-color: var(--border-default, #d1d1d1);
  color: var(--text-primary, #1f2937);
}

/* ─── Results panel inside the nav ──────────────────────────────────────── */
.sidebar-search-results-panel {
  display: none;
  padding: 0.25rem 0 0.5rem;
}

.sidebar-nav.search-active .sidebar-search-results-panel {
  display: block;
}

.sidebar-nav.search-active > .sidebar-link,
.sidebar-nav.search-active > .sidebar-section {
  display: none;
}

/* Results count header — matches sidebar-section-title style */
.search-results-header {
  padding: var(--spacing-2, 0.5rem) var(--spacing-5, 1.25rem) var(--spacing-1, 0.25rem);
  font-size: 0.8125rem;
  font-weight: var(--font-weight-semibold, 600);
  color: var(--text-tertiary, #9a9696);
  letter-spacing: 0.02em;
}

/* ─── Individual result item — mirrors .sidebar-link exactly ───────────── */
.sidebar-search-result-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-3, 0.75rem);
  padding: 0.55rem var(--spacing-5, 1.25rem);
  margin: 0.125rem 0;
  font-size: 0.85rem;
  font-weight: var(--font-weight-medium, 500);
  color: var(--color-gray-500, #6b7280);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background-color 150ms, color 150ms, border-left-color 150ms;
  cursor: pointer;
}

.sidebar-search-result-item:hover {
  background-color: var(--color-brand-50);
  color: var(--color-brand, #16668b);
  border-left-color: var(--color-brand-200);
}

.sidebar-search-result-item.highlighted {
  background-color: var(--color-brand-50);
  color: var(--color-brand, #16668b);
  border-left-color: var(--color-brand, #16668b);
}

.sidebar-search-result-item i {
  width: 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  flex-shrink: 0;
  color: inherit;
}

.sidebar-search-result-item svg.ci-lucide {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  color: inherit;
}

.sidebar-search-result-item .result-text {
  flex: 1;
  min-width: 0;
}

.sidebar-search-result-item .result-label {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-search-result-item .result-section {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-tertiary, #9a9696);
  margin-top: 0.1rem;
}

.sidebar-search-result-item:hover .result-section,
.sidebar-search-result-item.highlighted .result-section {
  color: var(--color-brand-light, hsl(199, 73%, 60%));
}

/* Empty state */
.sidebar-search-empty {
  padding: 1.25rem var(--spacing-5, 1.25rem);
  font-size: 0.8125rem;
  color: var(--text-tertiary, #9a9696);
  text-align: center;
  line-height: 1.5;
}

.sidebar-search-empty .empty-icon {
  display: block;
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
  opacity: 0.35;
}

/* Highlighted match — brand teal, not orange */
mark.search-highlight {
  background: var(--color-brand-100, hsl(199, 73%, 95%));
  color: var(--color-brand, #16668b);
  border-radius: 2px;
  padding: 0 1px;
  font-style: normal;
  font-weight: 600;
}

/* ─── Dark mode ─────────────────────────────────────────────────────────── */
.dark .sidebar-search-wrap .search-icon {
  color: rgba(255, 255, 255, 0.3);
}

.dark .sidebar-search-wrap:focus-within .search-icon {
  color: var(--color-brand-light);
}

.dark .sidebar-search-input {
  background-color: var(--bg-tertiary);
  border-color: var(--border-subtle);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

.dark .sidebar-search-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.dark .sidebar-search-input:hover:not(:focus) {
  border-color: rgba(255, 255, 255, 0.18);
  background-color: rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-sm);
}

.dark .sidebar-search-input:focus {
  background-color: var(--bg-secondary);
  border-color: var(--color-brand-light);
  box-shadow: 0 0 0 3px rgba(22, 104, 139, 0.25), var(--shadow-sm);
}

.dark .sidebar-search-kbd kbd {
  background: var(--bg-tertiary);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.3);
}

.dark .sidebar-search-clear {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.4);
}

.dark .sidebar-search-clear:hover {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
}

.dark .sidebar-search-result-item {
  color: var(--text-tertiary);
}

.dark .sidebar-search-result-item:hover {
  background-color: rgba(22, 104, 139, 0.12);
  color: var(--color-brand-light);
  border-left-color: rgba(22, 104, 139, 0.35);
}

.dark .sidebar-search-result-item.highlighted {
  background-color: rgba(22, 104, 139, 0.18);
  color: var(--color-brand-light);
  border-left-color: var(--color-brand-light);
}

.dark .sidebar-search-result-item .result-section {
  color: rgba(255, 255, 255, 0.3);
}

.dark .sidebar-search-result-item:hover .result-section,
.dark .sidebar-search-result-item.highlighted .result-section {
  color: var(--color-brand-light);
  opacity: 0.65;
}

.dark mark.search-highlight {
  background: rgba(22, 104, 139, 0.22);
  color: var(--color-brand-light);
}

.dark .search-results-header {
  color: rgba(255, 255, 255, 0.3);
}

/* ============================================
   MOBILE FAB TOGGLE (topbar removed)
   ============================================ */
.sidebar-toggle-fab {
  display: none;
  position: fixed;
  top: var(--spacing-3, 0.75rem);
  left: var(--spacing-3, 0.75rem);
  z-index: calc(var(--z-modal, 1050) - 10);
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-lg, 0.75rem);
  background: var(--color-brand);
  color: #fff;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0,0,0,.15));
  transition: transform var(--transition-fast, 150ms);
}
.sidebar-toggle-fab:hover { transform: scale(1.05); }

@media (max-width: 1023.98px) {
  .sidebar-toggle-fab { display: flex; }
}

/* ============================================
   SIDEBAR USER CARD (footer identity)
   ============================================ */
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: var(--spacing-2, 0.5rem);
  padding: var(--spacing-2, 0.5rem) var(--spacing-3, 0.75rem);
  margin-bottom: var(--spacing-2, 0.5rem);
  border-radius: var(--radius-md, 0.5rem);
  background: var(--bg-secondary, #f3f4f6);
}
.sidebar-user-card__main {
  display: flex;
  align-items: center;
  gap: var(--spacing-2, 0.5rem);
  flex: 1;
  min-width: 0;
  text-decoration: none;
}
.sidebar-user-card__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: var(--color-brand);
  color: #fff;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.sidebar-user-card__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.sidebar-user-card__name {
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: var(--font-weight-semibold, 600);
  color: var(--text-primary, #1f2937);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-card__plan {
  font-size: var(--font-size-xs, 0.75rem);
  color: var(--color-gray-400, #9ca3af);
}
.sidebar-user-card__plan i,
.sidebar-user-card__plan svg.ci-lucide { color: var(--color-brand); }
.sidebar-user-card__plan svg.ci-lucide { width: 0.7rem; height: 0.7rem; vertical-align: -0.05em; }
.sidebar-user-card__theme {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius-md, 0.5rem);
  background: transparent;
  color: var(--color-gray-500, #6b7280);
  cursor: pointer;
  transition: background var(--transition-fast, 150ms);
}
.sidebar-user-card__theme:hover {
  background: var(--bg-tertiary, #e5e7eb);
}
.dark .sidebar-user-card { background: rgba(255,255,255,0.05); }
.dark .sidebar-user-card__theme:hover { background: rgba(255,255,255,0.1); }

/* ── Lucide outline chrome sizing (2026-11-16) ──────────────────────────
   Stroke icons need explicit boxes (no font glyph). Sizes mirror the FA
   glyphs they replace so spacing is unchanged. */
.sidebar-close svg.ci-lucide { width: 1rem; height: 1rem; }
.sidebar-search-wrap svg.search-icon { width: 0.875rem; height: 0.875rem; }
.sidebar-search-clear svg.ci-lucide { width: 0.75rem; height: 0.75rem; }
.sidebar-user-card__avatar svg.ci-lucide { width: 1rem; height: 1rem; }
.sidebar-user-card__theme svg.ci-lucide { width: 1rem; height: 1rem; }
.sidebar-collapse-toggle svg.ci-lucide { width: 1.1rem; height: 1.1rem; }
.sidebar-create__btn svg.ci-lucide,
.sidebar-create__item svg.ci-lucide { width: 0.9rem; height: 0.9rem; flex-shrink: 0; }
.sidebar-nav-mode-toggle svg.ci-lucide { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.sidebar-search-empty svg.empty-icon { width: 1.5rem; height: 1.5rem; }

/* ===== layouts/header.css ===== */
/**
 * Header Layout Component
 * Features: breadcrumbs, actions, theme toggle
 * NOTE: The .topbar base layout (position, size, colours) is defined in
 * layouts/sidebar.css — this file only extends it with sub-element styles.
 *
 * @author Amit Haridas, ConcreteInfo
 */

.topbar--scrolled {
  box-shadow: var(--shadow-sm);
}

/* ============================================
   TOPBAR START
   ============================================ */
.topbar__start {
  display: flex;
  align-items: center;
  gap: var(--spacing-4);
}

.topbar__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.topbar__toggle:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

.topbar__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

/* Breadcrumbs */
.topbar__breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  font-size: var(--font-size-sm);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  color: var(--text-tertiary);
}

.breadcrumb__item {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb__item:hover {
  color: var(--color-primary);
}

.breadcrumb__item--current {
  color: var(--text-tertiary);
  font-weight: var(--font-weight-medium);
}

.breadcrumb__separator {
  color: var(--text-tertiary);
}

/* ============================================
   TOPBAR END
   ============================================ */
.topbar__end {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
}

/* Theme Toggle */
.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-lg);
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.theme-toggle__icon {
  font-size: var(--font-size-lg);
  transition: transform var(--transition-normal);
}

.theme-toggle:hover .theme-toggle__icon {
  transform: rotate(15deg);
}

.theme-toggle .icon-sun {
  display: none;
  color: var(--color-warning);
}

.theme-toggle .icon-moon {
  display: block;
  color: var(--color-gray-500);
}

/* Topbar Actions */
.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

.topbar__action {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.topbar__action:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.topbar__action-badge {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 0.5rem;
  height: 0.5rem;
  background-color: var(--color-danger);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-elevated);
}

/* ============================================
   RESPONSIVE TOPBAR
   ============================================ */
@media (max-width: 1023.98px) {
  .topbar__toggle {
    display: flex;
  }

  .topbar__breadcrumbs {
    display: none;
  }
}

@media (max-width: 639.98px) {
  .topbar__title {
    font-size: var(--font-size-base);
  }
}

/* ============================================
   PUBLIC NAVBAR (for non-authenticated pages)
   ============================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background-color: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  /* Brand accent underline */
  border-top: 3px solid var(--color-brand);
}

.navbar__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-6);
  height: 4.5rem;
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  text-decoration: none;
}

.navbar__logo {
  height: 2.5rem;
  width: auto;
}

.navbar__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.navbar__nav {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
}

.navbar__link {
  padding: var(--spacing-2) var(--spacing-4);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.navbar__link:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.navbar__link--active {
  color: var(--color-primary);
  background-color: var(--color-brand-100);
}

@media (max-width: 767.98px) {
  .navbar__container {
    padding: 0 var(--spacing-4);
  }

  .navbar__title {
    display: none;
  }
}

/* ===== layouts/content.css ===== */
/**
 * Content Layout Component
 * Features: main content area, sections, page headers
 *
 * @author Amit Haridas, ConcreteInfo
 */

/* ============================================
   CONTENT WRAPPER
   ============================================ */
.content-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  transition: margin-left var(--transition-normal);
  min-width: 0;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  flex: 1;
  padding: var(--spacing-6);
  /* Extra bottom room: fixed-height grids + sticky bars previously pushed
     the app footer flush against (or past) the viewport edge. */
  padding-bottom: var(--spacing-8, 2rem);
  padding-top: calc(var(--header-height, 64px) + var(--spacing-6, 1.5rem));
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: hidden;
  min-width: 0;
}

.main-content--compact {
  padding: var(--spacing-4);
}

.main-content--spacious {
  padding: var(--spacing-8);
}

/* Alias used by admin and other pages that wrap content in a simple div */
.content-area {
  width: 100%;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
  margin-bottom: var(--spacing-8);
}

.page-header__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-4);
  flex-wrap: wrap;
}

.page-header__title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  letter-spacing: var(--letter-spacing-tight);
  margin: 0;
}

.page-header__subtitle {
  margin-top: var(--spacing-1);
  font-size: var(--font-size-base);
  color: var(--text-secondary);
}

.page-header__meta {
  margin-top: var(--spacing-2);
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
}

.page-header__actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  flex-shrink: 0;
}

/* ============================================
   SECTION
   ============================================ */
.section {
  margin-bottom: var(--spacing-8);
}

.section--last {
  margin-bottom: 0;
}

.section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-5);
}

.section__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin: 0;
}

.section__subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: var(--spacing-1);
}

.section__actions {
  display: flex;
  gap: var(--spacing-2);
}

.section__body {
  /* Content goes here */
}

/* ============================================
   GRID LAYOUTS
   ============================================ */
.grid {
  display: grid;
  gap: var(--spacing-6);
}

.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid--5 {
  grid-template-columns: repeat(5, 1fr);
}

.grid--6 {
  grid-template-columns: repeat(6, 1fr);
}

.grid--sidebar {
  grid-template-columns: 1fr 320px;
}

.grid--sidebar-reverse {
  grid-template-columns: 320px 1fr;
}

/* Responsive Grid */
@media (max-width: 1279.98px) {
  .grid--4,
  .grid--5,
  .grid--6 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid--sidebar,
  .grid--sidebar-reverse {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1023.98px) {
  .grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767.98px) {
  .grid--2,
  .grid--3,
  .grid--4,
  .grid--5,
  .grid--6 {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   TABLE SCROLL WRAPPER (mobile-friendly)
   ============================================ */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--warm-300, #d1d1d1) transparent;
}
.table-scroll::-webkit-scrollbar {
  height: 4px;
}
.table-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.table-scroll::-webkit-scrollbar-thumb {
  background: var(--warm-300, #d1d1d1);
  border-radius: 2px;
}

/* ============================================
   MOBILE FORM OPTIMIZATIONS
   ============================================ */
/* Prevent iOS auto-zoom on input focus — ensure min 16px font */
@media (max-width: 767.98px) {
  .form-control,
  .form-select {
    font-size: 16px !important; /* prevents iOS zoom on focus */
    min-height: 44px;
    padding: 0.5rem 0.75rem;
  }
  .form-label {
    font-size: 0.8125rem;
  }
  .form-group {
    margin-bottom: 0.875rem;
  }
  .table-scroll tbody tr td {
    padding: 3px 4px;
  }
  .table-scroll tbody tr td .form-control {
    font-size: 14px !important;
    min-height: 36px;
    padding: 0.25rem 0.5rem;
  }
}

/* ============================================
   FLEX UTILITIES
   ============================================ */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.gap-1 { gap: var(--spacing-1); }
.gap-2 { gap: var(--spacing-2); }
.gap-3 { gap: var(--spacing-3); }
.gap-4 { gap: var(--spacing-4); }
.gap-5 { gap: var(--spacing-5); }
.gap-6 { gap: var(--spacing-6); }
.gap-8 { gap: var(--spacing-8); }

/* ============================================
   SPACING UTILITIES
   ============================================ */
.m-0 { margin: 0; }
.m-auto { margin: auto; }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--spacing-2); }
.mb-3 { margin-bottom: var(--spacing-3); }
.mb-4 { margin-bottom: var(--spacing-4); }
.mb-5 { margin-bottom: var(--spacing-5); }
.mb-6 { margin-bottom: var(--spacing-6); }
.mb-8 { margin-bottom: var(--spacing-8); }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--spacing-2); }
.mt-3 { margin-top: var(--spacing-3); }
.mt-4 { margin-top: var(--spacing-4); }
.mt-6 { margin-top: var(--spacing-6); }
.mt-8 { margin-top: var(--spacing-8); }

.p-0 { padding: 0; }
.p-4 { padding: var(--spacing-4); }
.p-5 { padding: var(--spacing-5); }
.p-6 { padding: var(--spacing-6); }

/* ============================================
   RESPONSIVE CONTENT
   ============================================ */
@media (max-width: 1023.98px) {
  .content-wrapper {
    margin-left: 0;
  }
}

@media (max-width: 767.98px) {
  .main-content {
    padding: var(--spacing-4);
    /* The shorthand above resets padding-bottom to zero, and the fixed
       bottom nav would then sit on top of the page content. Same clearance
       expression as the house rule in assets/css/mobile.css. */
    padding-bottom: calc(64px + var(--spacing-6, 1.5rem) + env(safe-area-inset-bottom, 0px));
  }

  .page-header__title {
    font-size: var(--font-size-xl);
  }

  .page-header__actions {
    width: 100%;
    margin-top: var(--spacing-4);
  }
}

/* ===== components/buttons.css ===== */
/**
 * Button Component System
 * Variants: primary, secondary, ghost, outline, danger
 * Sizes: xs, sm, md, lg, xl
 * States: hover, active, disabled, loading
 *
 * @author Amit Haridas, ConcreteInfo
 */

/* ============================================
   BASE BUTTON
   ============================================ */
.btn,
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-outline-secondary,
.btn-ghost,
.btn-ghost-active,
.btn-danger,
.btn-success,
.btn-warning,
.btn-info,
.btn-outline-danger,
.btn-outline-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2);
  height: 36px;                /* uniform button height; -sm/-lg/-icon override */
  padding: 0 var(--spacing-4); /* vertical centering via flex, not padding */
  font-family: var(--font-family-sans);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  text-decoration: none;
  border: 1.5px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-outline:focus-visible,
.btn-ghost:focus-visible,
.btn-danger:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Icon in button */
.btn i,
.btn svg {
  flex-shrink: 0;
}

/* ============================================
   BUTTON SIZES
   ============================================ */
.btn-xs {
  height: 1.5rem; /* 24px */
  padding: 0 var(--spacing-2);
  font-size: var(--font-size-xs);
  border-radius: var(--radius-control);
}

.btn-sm {
  height: 1.75rem; /* 28px */
  padding: 0 var(--spacing-3);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-control);
}

.btn-md {
  height: 36px; /* uniform control height — matches 38px inputs minus border rhythm */
  padding: 0 var(--spacing-4);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-control);
}

.btn-lg {
  height: 2.75rem; /* 44px — touch-target compliant */
  padding: 0 var(--spacing-6);
  font-size: var(--font-size-base);
  border-radius: var(--radius-control);
}

.btn-xl {
  height: 3.25rem; /* 52px */
  padding: 0 var(--spacing-8);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-control);
}

/* ============================================
   BUTTON VARIANTS
   ============================================ */

/* Primary - Gradient */
.btn-primary {
  /* solid brand-dark: the old brand gradient bottomed out at #e5461f
     (4.02:1 with white text — sub-AA). Buttons sit on brand-dark. */
  background: var(--color-brand-dark);
  color: var(--text-inverse);
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  /* CAMS2 hover: flat darken, no lift/glow */
  background: color-mix(in srgb, var(--color-brand-dark) 88%, #000);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

/* Secondary - Solid */
.btn-secondary {
  background-color: var(--color-gray-800);
  color: var(--text-inverse);
  border-color: var(--color-gray-800);
}

.btn-secondary:hover {
  background-color: var(--color-gray-700);
  border-color: var(--color-gray-700);
}

/* Outline */
.btn-outline {
  background-color: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline:hover {
  /* brand-dark fill, not brand: white on #e5461f measures 4.02:1 — below
     WCAG AA 4.5:1 for 13px button text. #c93a18 measures 5.3:1. */
  background-color: var(--color-brand-dark);
  color: var(--text-inverse);
  border-color: var(--color-brand-dark);
}

/* Ghost */
.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-ghost-active {
  background-color: var(--color-brand-50, hsl(var(--color-brand-h) var(--color-brand-s) var(--color-brand-l) / 0.08));
  color: var(--color-brand);
  border-color: transparent;
}

/* Danger */
.btn-danger {
  background-color: var(--color-danger);
  color: var(--text-inverse);
  border-color: var(--color-danger);
}

.btn-danger:hover {
  background-color: hsl(0, 84%, 50%);
  border-color: hsl(0, 84%, 50%);
}

/* Success */
.btn-success {
  background-color: var(--color-success);
  color: var(--text-inverse);
  border-color: var(--color-success);
}

.btn-success:hover {
  background-color: hsl(142, 76%, 32%);
  box-shadow: 0 4px 12px hsl(142, 76%, 36%, 0.3);
}

/* Warning */
.btn-warning {
  background-color: var(--color-warning);
  color: var(--color-gray-900);
  border-color: var(--color-warning);
}

.btn-warning:hover {
  background-color: hsl(45, 93%, 40%);
  border-color: hsl(45, 93%, 40%);
  box-shadow: 0 4px 12px hsl(45, 93%, 47%, 0.3);
}

/* Info */
.btn-info {
  background-color: var(--color-info);
  color: var(--text-inverse);
  border-color: var(--color-info);
}

.btn-info:hover {
  background-color: hsl(199, 89%, 38%);
  border-color: hsl(199, 89%, 38%);
  box-shadow: 0 4px 12px hsl(199, 89%, 48%, 0.3);
}

/* Outline Danger */
.btn-outline-danger {
  background-color: transparent;
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.btn-outline-danger:hover {
  background-color: var(--color-danger);
  color: var(--text-inverse);
}

/* Outline Success */
.btn-outline-success {
  background-color: transparent;
  color: var(--color-success);
  border-color: var(--color-success);
}

.btn-outline-success:hover {
  background-color: var(--color-success);
  color: var(--text-inverse);
}

/* ============================================
   BUTTON STATES
   ============================================ */
.btn:disabled,
.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading state */
.btn-loading {
  color: transparent;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

.btn-primary.btn-loading::after {
  border-color: var(--text-inverse);
  border-top-color: transparent;
}

/* ============================================
   SPECIAL BUTTON TYPES
   ============================================ */

/* Icon only button */
.btn-icon {
  padding: var(--spacing-2-5);
  aspect-ratio: 1;
}

.btn-icon.btn-sm {
  padding: var(--spacing-2);
}

.btn-icon.btn-lg {
  padding: var(--spacing-3);
}

/* Full width button */
.btn-full,
.btn-block {
  width: 100%;
}

/* ============================================
   BUTTON GROUPS
   ============================================ */
.btn-group {
  display: inline-flex;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.btn-group .btn {
  border-radius: 0;
  border-right-width: 0;
}

.btn-group .btn:first-child {
  border-top-left-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
}

.btn-group .btn:last-child {
  border-top-right-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  border-right-width: 1.5px;
}

.btn-group .btn:hover {
  transform: none;
}

/* ============================================
   FAB (Floating Action Button)
   ============================================ */
.btn-fab {
  position: fixed;
  bottom: var(--spacing-6);
  right: var(--spacing-6);
  width: 3.5rem;
  height: 3.5rem;
  padding: 0;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-sticky);
}

.btn-fab:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-xl);
}

/* ===== components/cards.css ===== */
/**
 * Card Component System
 * Variants: default, elevated, bordered, interactive, gradient
 *
 * @author Amit Haridas, ConcreteInfo
 */

/* ============================================
   BASE CARD
   ============================================ */
.card {
  background-color: var(--bg-elevated);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow, var(--shadow-1));
  overflow: hidden;
  transition: all var(--transition-normal);
}

/* Card variants */
.card--elevated {
  box-shadow: var(--shadow-md);
}

.card--soft {
  /* soft, diffuse ambient shadow — large blur radius */
  box-shadow: var(--shadow-soft);
}

.card--float {
  /* strong floating depth — max blur */
  box-shadow: var(--shadow-float);
}

.card--glow {
  /* accent-tinted blurred glow that follows the theme accent */
  box-shadow: var(--shadow-glow);
}

.card--glass {
  /* frosted glass surface — translucent + backdrop blur */
  background-color: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: var(--shadow-soft);
}

.card--bordered {
  box-shadow: none;
  border: 1px solid var(--border-subtle);
}

.card--interactive {
  cursor: pointer;
}

.card--interactive:hover {
  box-shadow: var(--shadow-xl);
  border-color: var(--color-brand-200);
}

/* ============================================
   CARD SECTIONS
   ============================================ */
.card__header {
  padding: var(--card-header-py, var(--spacing-2-5)) var(--card-header-px, var(--spacing-4));
  background: var(--card-header-bg);
  -webkit-backdrop-filter: blur(var(--card-header-blur, 0px)) saturate(var(--card-header-saturate, 1));
  backdrop-filter: blur(var(--card-header-blur, 0px)) saturate(var(--card-header-saturate, 1));
  color: var(--card-header-fg);
  border-bottom: 1px solid var(--card-header-border);
  box-shadow: var(--card-header-highlight, none);
  position: relative;
}

.card__header--subtle {
  background: var(--card-header-bg);
  color: var(--card-header-fg);
  border-bottom: 1px solid var(--card-header-border);
}

.card__header--transparent {
  background-color: transparent;
  border-bottom: none;
  padding-bottom: 0;
  /* A transparent header sits on the card body surface (--bg-elevated), so it
     must use body text colour — NOT the card theme's --card-header-fg, which is
     white for dark themes (aurora/neon/brand-duotone) and would be invisible on
     a light card body. This overrides the inherited `color: var(--card-header-fg)`
     from .card__header. */
  color: var(--text-primary);
}

/* Semantic tone headers — for sub-cards that need a fixed identity colour
   (e.g. distinguishing fine vs. coarse aggregate sections) rather than the
   user's selected card theme. Token-driven so they stay on-brand and track
   palette changes, unlike raw Tailwind utility colours. */
.card__header--tone-info {
  /* On-brand: follows the user's selected accent (was a hardcoded blue
     hsl(199,89%,34%) that ignored theming). Uses the darkened brand token
     for ~5.3:1 WCAG AA contrast with inverse text — the same darkened-recipe
     the original comment intended, now actually applied. Affects the IS 10262
     mix-design section headers + blend calculator. */
  background: var(--color-brand-dark);
  color: var(--text-inverse);
  border-bottom-color: var(--color-brand);
}

.card__header--tone-success {
  background: var(--color-success);
  color: var(--text-inverse);
  border-bottom-color: var(--color-success);
}

.card__header--tone-warning {
  /* --color-warning-light + --color-warning text measured ~1.9:1 — fails
     WCAG AA (4.5:1). Solid --color-warning + dark text measures ~4.8:1. */
  background: var(--color-warning);
  color: var(--color-gray-900);
  border-bottom-color: var(--color-warning);
}

.card__header--tone-dark {
  background: var(--color-gray-800);
  color: var(--text-inverse);
  border-bottom-color: var(--color-gray-800);
}

.card__title {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: inherit;
}

/* Fallback for headings inside .card__header that were never given the
   .card__title class (a widespread pattern — 588+ instances app-wide).
   base.css's `h1..h6 { color: var(--text-primary) }` is an explicit rule
   on the element itself, which wins over simple inheritance from the
   parent's `color: var(--card-header-fg)` regardless of specificity —
   inheritance always loses to any matching rule. Without this, those
   headings render in --text-primary (dark) against a colored/gradient
   header background, which happened to look fine in dark mode (where
   --text-primary is light) but is unreadable in light mode. */
.card__header h1,
.card__header h2,
.card__header h3,
.card__header h4,
.card__header h5,
.card__header h6 {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: inherit;
}

.card__subtitle {
  margin: var(--spacing-1) 0 0;
  font-size: var(--font-size-sm);
  /* Theme-aware: inherit so a subtitle inside a themed .card__header follows
     the card SKIN's --card-header-fg (chosen per-skin for AA on its bg — a
     page-theme token here puts dark slate on a charcoal skin, ~1.1:1).
     No opacity: it blends toward an unknown surface (see header note below). */
  color: inherit;
}

/* Subtitles that sit on the card BODY (a page-theme surface) keep the
   muted page token — there the surface decides the token source. */
.card__body .card__subtitle {
  color: var(--text-secondary);
}

/* Themed card headers own their text colours. Muted text inside a header
   must follow the header's --card-header-fg, not page-theme text tokens or
   Tailwind gray utilities (gray-500 on a charcoal skin ≈ 1.6:1). Hierarchy
   comes from size/weight, not dimming. */
.card__header .card__subtitle,
.card__header small,
.card__header .text-muted,
.card__header .text-gray-500,
.card__header .text-gray-400,
.card__header .text-gray-600 {
  color: inherit;
}

.card__body {
  padding: var(--spacing-4); /* 16px — CAMS2 card density (was 24px) */
}

/* Legacy alias — some templates still emit the flat Bootstrap-style name.
   Keep in sync with .card__body above. */
.card-body {
  padding: var(--spacing-4);
}

.card__body--compact {
  padding: var(--spacing-4);
}

.card__body--spacious {
  padding: var(--spacing-8);
}

.card__footer {
  padding: var(--spacing-4) var(--spacing-6);
  background-color: var(--bg-tertiary);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

.card__image {
  width: 100%;
  height: auto;
  display: block;
}

.card__actions {
  display: flex;
  gap: var(--spacing-2);
  margin-top: var(--spacing-4);
}

/* ============================================
   STAT CARD
   ============================================ */
.stat-card {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-4);
  padding: var(--spacing-5);
  background-color: var(--bg-elevated);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(13, 11, 9, .06));
  border-color: var(--color-brand-100);
}

/* ============================================
   KPI CARD — unified with the hub-tile visual
   (no colored left strip; accent-aware hover).
   Use in place of per-page "border-l-4 border-{color}"
   stat-card / inline stacks. Theming merge: P4-4.
   ============================================ */
.kpi-card {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-4);
  padding: var(--spacing-5);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(13, 11, 9, .04), 0 4px 14px -4px rgba(13, 11, 9, .10);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  position: relative;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px -8px rgba(13, 11, 9, .18);
  border-color: var(--color-brand-100);
}

/* One neutral token chip (26px, bg-tertiary, brand icon) — the app-wide
   KPI idiom. The old 56px gradient chips with colored shadows + bounce
   hover read as oversized/animated noise ("abnormal icons in cards").
   Variants keep ONLY a semantic exception: --danger for genuine alerts. */
.stat-card__icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 13px;
  background: var(--bg-tertiary);
  color: var(--color-brand);
  transition: background 150ms ease;
}

.stat-card:hover .stat-card__icon {
  background: hsl(var(--color-brand-h, 14) var(--color-brand-s, 82%) var(--color-brand-l, 49%) / 0.12);
}

.stat-card__icon--primary,
.stat-card__icon--secondary,
.stat-card__icon--success,
.stat-card__icon--info,
.stat-card__icon--warning {
  background: var(--bg-tertiary);
  color: var(--color-brand);
  box-shadow: none;
}

.stat-card__icon--danger {
  background: color-mix(in srgb, var(--color-danger, hsl(0, 84%, 47%)) 12%, transparent);
  color: var(--color-danger, hsl(0, 84%, 47%));
  box-shadow: none;
}

.stat-card__content {
  flex: 1;
  min-width: 0;
}

.stat-card__value {
  font-size: 20px;
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
}

.stat-card__value--sm {
  font-size: var(--font-size-xl);
}

.stat-card__label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
  margin-top: var(--spacing-1);
}

.stat-card__trend {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  padding: var(--spacing-1) var(--spacing-2);
  border-radius: var(--radius-full);
  margin-top: var(--spacing-2);
}

.stat-card__trend--up {
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.stat-card__trend--down {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

/* ============================================
   ACTION CARD
   ============================================ */
.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-8) var(--spacing-5);
  background-color: var(--bg-elevated);
  border-radius: var(--radius-xl);
  border: 2px solid transparent;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  text-align: center;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.action-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--color-brand), var(--color-brand-light));
  opacity: 0;
  transition: opacity var(--transition-normal);
  z-index: 0;
}

.action-card > * {
  position: relative;
  z-index: 1;
}

.action-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-brand);
}

.action-card:hover::after {
  opacity: 0.05;
}

.action-card__icon {
  width: 4rem;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xl);
  font-size: var(--font-size-2xl);
  margin-bottom: var(--spacing-4);
  transition: all var(--transition-bounce);
  background-color: var(--color-brand-100);
  color: var(--color-brand);
}

.action-card:hover .action-card__icon {
  background: linear-gradient(135deg, var(--color-brand), var(--color-brand-light));
  color: white;
  transform: scale(1.15) rotate(-10deg);
  box-shadow: var(--shadow-primary);
}

.action-card__title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--spacing-2);
  transition: color var(--transition-fast);
}

.action-card:hover .action-card__title {
  color: var(--color-brand);
}

.action-card__description {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: var(--line-height-normal);
}

/* Action card color variants */
.action-card[data-variant="blue"] .action-card__icon {
  background-color: var(--color-info-light);
  color: var(--color-info);
}

.action-card[data-variant="blue"]:hover .action-card__icon {
  background: linear-gradient(135deg, var(--color-info), hsl(199, 89%, 55%));
  color: white;
}

.action-card[data-variant="green"] .action-card__icon {
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.action-card[data-variant="green"]:hover .action-card__icon {
  background: linear-gradient(135deg, var(--color-success), hsl(142, 76%, 45%));
  color: white;
}

.action-card[data-variant="yellow"] .action-card__icon {
  background-color: var(--color-warning-light);
  color: var(--color-warning);
}

.action-card[data-variant="yellow"]:hover .action-card__icon {
  background: linear-gradient(135deg, var(--color-warning), hsl(45, 93%, 55%));
  color: white;
}

.action-card[data-variant="teal"] .action-card__icon {
  background-color: var(--color-teal-50);
  color: var(--color-teal-600);
}

.action-card[data-variant="teal"]:hover .action-card__icon {
  background: linear-gradient(135deg, var(--color-teal-500), var(--color-teal-600));
  color: white;
}

.action-card[data-variant="purple"] .action-card__icon {
  background-color: var(--color-purple-50);
  color: var(--color-purple-600);
}

.action-card[data-variant="purple"]:hover .action-card__icon {
  background: linear-gradient(135deg, var(--color-purple-500), var(--color-purple-600));
  color: white;
}

.action-card[data-variant="gray"] .action-card__icon {
  background-color: var(--color-gray-100);
  color: var(--color-gray-600);
}

.action-card[data-variant="gray"]:hover .action-card__icon {
  background: linear-gradient(135deg, var(--color-gray-600), var(--color-gray-700));
  color: white;
}

/* ============================================
   CARD GRID
   ============================================ */
.card-grid {
  display: grid;
  gap: var(--spacing-6);
}

.card-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.card-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.card-grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
  .card-grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .card-grid--2,
  .card-grid--3,
  .card-grid--4 {
    grid-template-columns: 1fr;
  }
}

/* ===== components/forms.css ===== */
/**
 * Form Input Components
 * Types: text, email, password, number, textarea, select, checkbox, radio
 * Sizes: sm, md, lg
 * States: default, focus, error, success, disabled
 *
 * @author Amit Haridas, ConcreteInfo
 */

/* ============================================
   FORM GROUP
   ============================================ */
.form-group {
  margin-bottom: var(--spacing-5);
}

.form-row {
  display: flex;
  gap: var(--spacing-4);
  margin-bottom: var(--spacing-5);
}

.form-row > * {
  flex: 1;
}

/* ============================================
   LABELS
   ============================================ */
.form-label {
  display: block;
  margin-bottom: var(--spacing-2); /* 8px — CAMS2 uses ~6px; kept roomier */
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary); /* CAMS2 label gray-700, not near-black */
}

.form-label--required::after {
  content: ' *';
  color: var(--color-danger);
}

.form-hint {
  margin-top: var(--spacing-1-5);
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

.form-error {
  margin-top: var(--spacing-1-5);
  font-size: var(--font-size-xs);
  color: var(--color-danger);
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
}

.form-error::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  background-color: var(--color-danger);
  border-radius: var(--radius-full);
}

/* ============================================
   INPUT BASE
   ============================================ */
.input,
.form-control,
.form-input,
.form-text {
  width: 100%;
  box-sizing: border-box;
  height: 38px;               /* uniform control height (selects/textboxes) */
  padding: 0 var(--spacing-3); /* vertical centering via line-height, not padding */
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  line-height: 36px;           /* 38px - 2px borders: centers glyphs, no clipping */
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); /* CAMS2 rounded-lg (12px) inputs */
  transition: all var(--transition-fast);
}

.input::placeholder,
.form-control::placeholder,
.form-input::placeholder,
.form-text::placeholder {
  color: var(--text-tertiary);
  font-size: var(--font-size-sm); /* 13px placeholders — quieter than values */
}

.input:hover,
.form-control:hover,
.form-input:hover,
.form-text:hover {
  border-color: var(--border-strong);
}

.input:focus,
.form-control:focus,
.form-input:focus,
.form-text:focus {
  outline: none;
  border-color: var(--color-primary);
  /* CAMS2 focus language: 2px translucent brand ring, not an opaque wash */
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-brand) 30%, transparent);
}


/* ============================================
   INPUT STATES
   ============================================ */
.input--error,
.form-control--error,
.input.is-invalid,
.form-control.is-invalid {
  border-color: var(--color-danger);
  background-color: var(--color-danger-light);
}

.input--error:focus,
.form-control--error:focus,
.input.is-invalid:focus,
.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px hsl(0, 84%, 95%);
}

.input--success,
.form-control--success,
.input.is-valid,
.form-control.is-valid {
  border-color: var(--color-success);
  background-color: var(--color-success-light);
}

.input--success:focus,
.form-control--success:focus,
.input.is-valid:focus,
.form-control.is-valid:focus {
  box-shadow: 0 0 0 3px hsl(142, 76%, 95%);
}

.input:disabled,
.form-control:disabled,
.input--disabled,
.form-control--disabled {
  background-color: var(--bg-tertiary);
  color: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.7;
}

/* ============================================
   INPUT SIZES
   ============================================ */
.input--sm,
.input-sm {
  height: 1.875rem; /* 30px */
  padding: var(--spacing-1-5) var(--spacing-2-5);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
}

.input--lg,
.input-lg {
  height: 2.625rem; /* 42px */
  padding: var(--spacing-3) var(--spacing-4);
  font-size: var(--font-size-lg);
}

/* ============================================
   SELECT
   Full base styles included so .select is self-contained
   (no need to also apply .input on <select> elements)
   ============================================ */
.select,
.form-select {
  /* Base input styles */
  display: block;
  width: 100%;
  box-sizing: border-box;
  /* Fixed height matching inputs */
  height: 38px;
  padding: 0 var(--spacing-3);
  line-height: 36px;
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: 1.4;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); /* CAMS2 rounded-lg (12px) */
  transition: all var(--transition-fast);
  /* Dropdown arrow */
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%237a7878' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--spacing-2-5) center;
  background-size: 0.875rem 0.875rem;
  padding-right: var(--spacing-8);
  cursor: pointer;
  vertical-align: middle;
}

.select:hover,
.form-select:hover {
  border-color: var(--border-strong);
}

.select:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-brand) 30%, transparent);
}

.select:disabled,
.form-select:disabled {
  background-color: var(--bg-tertiary);
  color: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.7;
}

/* ── Select readability baseline — theme-aware, both modes ───────────
   Guarantees the selected value AND the native <option> popup are
   always legible. Plain <select> elements otherwise inherit a light
   text colour in dark mode (Tailwind's `color: inherit`) over a
   default light UA background → white-on-white. Element-level
   specificity, so .select / .form-select / Tailwind classes still win. */
select {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}
select option,
select optgroup {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}
/* Keep the native dropdown popup in the correct colour scheme per mode */
:root { color-scheme: light; }


/* Size variants */
.select--sm,
.select-sm {
  height: 1.875rem; /* 30px */
  padding: var(--spacing-1-5) var(--spacing-2-5);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
  padding-right: var(--spacing-7);
  background-size: 0.75rem 0.75rem;
}

.select--lg,
.select-lg {
  height: 2.625rem; /* 42px */
  padding: var(--spacing-3) var(--spacing-4);
  font-size: var(--font-size-lg);
  padding-right: var(--spacing-10);
}

/* Error state */
.select--error,
.select.is-invalid {
  border-color: var(--color-danger);
  background-color: var(--color-danger-light);
}

/* Success state */
.select--success,
.select.is-valid {
  border-color: var(--color-success);
  background-color: var(--color-success-light);
}

/* ============================================
   TEXTAREA
   ============================================ */
.textarea,
textarea.input {
  resize: vertical;
  min-height: 100px;
}

/* ============================================
   CHECKBOX & RADIO
   ============================================ */
.checkbox,
.radio {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--spacing-3);
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.checkbox__input,
.radio__input,
.form-check-input {
  appearance: none;
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  border: 1.5px solid var(--border-default);
  background-color: var(--bg-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 0.125rem;
}

.checkbox__input,
.form-check-input[type="checkbox"] {
  border-radius: var(--radius-sm);
}

.radio__input,
.form-check-input[type="radio"] {
  border-radius: var(--radius-full);
}

.checkbox__input:hover,
.radio__input:hover,
.form-check-input:hover {
  border-color: var(--color-primary);
}

.checkbox__input:checked,
.radio__input:checked,
.form-check-input:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.checkbox__input:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M2 6l3 3 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.radio__input:checked::after,
.form-check-input[type="radio"]:checked::after {
  content: '';
  display: block;
  width: 0.5rem;
  height: 0.5rem;
  background-color: white;
  border-radius: var(--radius-full);
  margin: 0.25rem;
}

.checkbox__input:focus,
.radio__input:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 3px var(--color-brand-100);
  outline: none;
}

/* ============================================
   INPUT GROUP
   ============================================ */
.input-group {
  display: flex;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.input-group:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-brand-100);
}

.input-group .input {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.input-group .input:focus {
  box-shadow: none;
}

.input-group__prepend,
.input-group__append {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--spacing-4);
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  white-space: nowrap;
}

.input-group__prepend {
  border-right: 1px solid var(--border-subtle);
}

.input-group__append {
  border-left: 1px solid var(--border-subtle);
}

/* ============================================ */
/*   FORM SWITCH (toggle)                       */
/* ============================================ */
.form-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.form-switch input[type="checkbox"] {
  appearance: none;
  width: 2.25rem;
  height: 1.25rem;
  background-color: var(--color-gray-300);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  flex-shrink: 0;
}

.form-switch input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: 1rem;
  background-color: white;
  border-radius: var(--radius-full);
  transition: transform var(--transition-fast);
}

.form-switch input[type="checkbox"]:checked {
  background-color: var(--color-primary);
}

.form-switch input[type="checkbox"]:checked::after {
  transform: translateX(1rem);
}

.form-switch input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--color-brand-100);
}

/* ============================================
   FORM SECTION
   ============================================ */
.form-section {
  padding: var(--spacing-6);
  background-color: var(--bg-elevated);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  margin-bottom: var(--spacing-6);
}

.form-section__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--spacing-4);
  padding-bottom: var(--spacing-3);
  border-bottom: 1px solid var(--border-subtle);
}

.form-section__description {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-4);
}

/* ============================================
   REQUIRED MARKER
   Use with required form fields:
     <label>Email <span class="required-mark">*</span></label>
   Replaces inline `text-red-500` / `text-danger`
   spans so every required asterisk uses the
   project danger token (works in light + dark).
   ============================================ */
.required-mark {
  color: var(--color-danger, #ef4444);
  margin-left: 0.125rem;
  font-weight: var(--font-weight-semibold, 600);
}

.dark .required-mark,
[data-theme="dark"] .required-mark {
  color: #fca5a5;  /* tailwind red-300 — readable on dark bg */
}

/* --- merged from forms.v2.css --- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-1-5);
  margin-bottom: var(--spacing-4);
}

.field__label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-default);
}

.field__label .required {
  color: var(--color-danger);
  margin-left: var(--spacing-half);
}

.field__input {
  height: 38px;
  line-height: 36px;
  padding: 0 var(--spacing-3);
  font-size: var(--font-size-base);
  font-family: var(--font-family-sans);
  color: var(--color-text-strong);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-control);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.field__input:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: var(--focus-ring);
}

.dark .field__input:focus {
  box-shadow: var(--focus-ring-dark);
}

.field__input--touch {
  height: 2.75rem; /* 44px — touch target */
}

.field__textarea {
  height: auto;
  min-height: 5rem; /* 80px, matches .tf-textarea's prior min-height */
  padding: var(--spacing-2) var(--spacing-3);
  font-size: var(--font-size-base);
  font-family: var(--font-family-sans);
  color: var(--color-text-strong);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-control);
  line-height: var(--line-height-normal);
  resize: vertical;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.field__textarea:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: var(--focus-ring);
}

.dark .field__textarea:focus {
  box-shadow: var(--focus-ring-dark);
}

.field__input--auto {
  background: var(--bg-tertiary);
  font-family: var(--font-family-mono);
  font-weight: var(--font-weight-semibold);
  color: var(--color-brand-dark); /* brand on gray bg read 4.4:1; darker shade ≈ 6:1 */
  cursor: default;
}

.dark .field__input--auto {
  color: hsl(var(--color-brand-h), 80%, 65%); /* bright variant for dark surfaces */
}

.field__help {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.field--error .field__input {
  border-color: var(--color-danger);
}

.field__error {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
  font-size: var(--font-size-xs);
  color: var(--color-danger);
}

.field__error i { font-size: 0.75em; }

.field__input:disabled {
  background: var(--bg-tertiary);
  color: var(--color-text-disabled);
  box-shadow: none;
  cursor: not-allowed;
}

/* ============================================
   BOTTOM ACTION BAR
   Sticky save-action bar for small screens. On
   desktop (>= 1024px) this div is intentionally
   unstyled — it is a plain flow container, so the
   wrapped save button renders exactly where and
   how it did before. Only below the 1024px
   breakpoint (where the fixed 60px bottom-nav
   appears, see mobile.css) does it become a
   thumb-reachable sticky bar.
   ============================================ */
@media (max-width: 1023.98px) {
  .bottom-action-bar {
    position: sticky;
    /* Rests on the bottom-nav's top edge: nav is 60px tall plus its own
       safe-area inset (mobile.css .bottom-nav). */
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    z-index: 100; /* above page content, below .bottom-nav (1000) */
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-subtle);
    padding: var(--spacing-3) var(--spacing-4);
    box-shadow: var(--shadow-2);
  }
}

/* Textareas size by rows, not the fixed control height */
textarea.input,
textarea.form-control,
textarea.form-input,
textarea.form-text {
  height: auto;
  min-height: 84px;
  padding: var(--spacing-2) var(--spacing-3);
  line-height: 1.45;
}

/* ===== components/tables.css ===== */
/**
 * Table Component System
 * Variants: default, compact, bordered, striped
 * Features: sortable, responsive, hover
 *
 * @author Amit Haridas, ConcreteInfo
 */

/* ============================================
   TABLE CONTAINER
   ============================================ */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

/* ============================================
   BASE TABLE
   ============================================ */
.table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--bg-elevated);
}

/* ============================================
   TABLE HEADER
   ============================================ */
.table thead {
  background-color: var(--bg-tertiary);
}

.table th {
  padding: var(--spacing-3-5) var(--spacing-4);
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wider);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color var(--transition-fast);
}

.table th.sortable:hover {
  background-color: var(--bg-primary);
}

.table th.sortable::after {
  content: '';
  display: inline-block;
  margin-left: var(--spacing-2);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--text-tertiary);
  opacity: 0.4;
  transition: opacity var(--transition-fast);
}

.table th.sortable:hover::after {
  opacity: 0.7;
}

.table th.sortable.asc::after,
.table th.sortable.desc::after {
  opacity: 1;
  border-top-color: var(--color-primary);
}

.table th.sortable.asc::after {
  transform: rotate(180deg);
}

/* ============================================
   TABLE BODY
   ============================================ */
.table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-fast);
}

.table tbody tr:last-child {
  border-bottom: none;
}

.table tbody tr:hover {
  background-color: var(--color-brand-50);
}

.table td {
  padding: var(--spacing-4);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  vertical-align: middle;
}

/* First and last cell padding */
.table td:first-child,
.table th:first-child {
  padding-left: var(--spacing-6);
}

.table td:last-child,
.table th:last-child {
  padding-right: var(--spacing-6);
}

/* ============================================
   TABLE VARIANTS
   ============================================ */

/* Compact */
.table--compact td,
.table--compact th {
  padding: var(--spacing-2-5) var(--spacing-4);
}

.table--compact td:first-child,
.table--compact th:first-child {
  padding-left: var(--spacing-4);
}

.table--compact td:last-child,
.table--compact th:last-child {
  padding-right: var(--spacing-4);
}

/* Bordered */
.table--bordered {
  border: 1px solid var(--border-default);
}

.table--bordered th,
.table--bordered td {
  border-right: 1px solid var(--border-subtle);
}

.table--bordered th:last-child,
.table--bordered td:last-child {
  border-right: none;
}

/* Striped */
.table--striped tbody tr:nth-child(even) {
  background-color: var(--bg-primary);
}

/* ============================================
   TABLE ACTIONS
   ============================================ */
.table__actions {
  display: flex;
  gap: var(--spacing-1);
  justify-content: flex-end;
}

.table__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
}

.table__action:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.table__action--primary:hover {
  background-color: var(--color-brand-100);
  color: var(--color-brand);
}

.table__action--danger:hover {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

/* ============================================
   TABLE STATUS BADGES
   ============================================ */
.table .badge {
  font-size: var(--font-size-xs);
  padding: var(--spacing-1) var(--spacing-2-5);
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-medium);
}

/* ============================================
   TABLE EMPTY STATE
   ============================================ */
.table__empty {
  padding: var(--spacing-12) var(--spacing-6);
  text-align: center;
}

.table__empty-icon {
  width: 5rem;
  height: 5rem;
  margin: 0 auto var(--spacing-4);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: var(--font-size-2xl);
  color: var(--text-tertiary);
}

.table__empty-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--spacing-2);
}

.table__empty-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-4);
}

/* ============================================
   TABLE PAGINATION
   ============================================ */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-4) var(--spacing-6);
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-elevated);
}

.table-pagination__info {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.table-pagination__nav {
  display: flex;
  gap: var(--spacing-2);
}

.table-pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 var(--spacing-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.table-pagination__btn:hover:not(:disabled) {
  background-color: var(--bg-tertiary);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.table-pagination__btn--active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--text-inverse);
}

.table-pagination__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   BOOTSTRAP-COMPATIBLE TABLE ALIASES
   Allow Bootstrap table-* class names to use
   the same styling as our custom table--* classes
   ============================================ */
.table-sm td,
.table-sm th {
  padding: var(--spacing-2-5) var(--spacing-4);
}
.table-sm td:first-child,
.table-sm th:first-child { padding-left: var(--spacing-4); }
.table-sm td:last-child,
.table-sm th:last-child { padding-right: var(--spacing-4); }

.table-bordered {
  border: 1px solid var(--border-default);
}
.table-bordered th,
.table-bordered td {
  border: 1px solid var(--border-subtle);
}

.table-striped tbody tr:nth-child(even) {
  background-color: var(--bg-primary);
}

.table-hover tbody tr:hover {
  background-color: var(--color-brand-50);
}

/* ===== components/badges.css ===== */
/**
 * Badge Component System
 * Variants: primary, secondary, success, info, warning, danger
 * Sizes: sm, md, lg
 *
 * @author Amit Haridas, ConcreteInfo
 */

/* ============================================
   BASE BADGE
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1-5);
  padding: var(--spacing-1) var(--spacing-2-5);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  border-radius: var(--radius-full);
  white-space: nowrap;
  transition: all var(--transition-fast);
  /* Chip casing — statuses read as designed chips, not raw text. */
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Density-aware sizing (Phase 1) — [data-density] is already toggled on
   <html> by theme-studio.js; badges follow the same rule cards/tables use.
   Comfortable (default) keeps the existing padding-driven ~24px height. */
html[data-density="compact"] .badge {
  padding: var(--spacing-0-5) var(--spacing-2);
  font-size: var(--font-size-2xs);
}

html[data-density="compact"] .badge--lg {
  padding: var(--spacing-1) var(--spacing-2-5);
  font-size: var(--font-size-xs);
}

.badge i {
  font-size: 0.75em;
}

/* ============================================
   BADGE VARIANTS
   ============================================ */
.badge--primary {
  background-color: var(--color-brand-100);
  color: var(--color-brand);
}

.dark .badge--primary {
  background-color: hsl(var(--color-brand-h), 50%, 20%);
}

.badge--secondary {
  background-color: var(--color-gray-100);
  color: var(--color-gray-700);
}

.dark .badge--secondary {
  background-color: var(--color-gray-800);
  color: var(--color-gray-300);
}

.badge--success {
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.dark .badge--success {
  background-color: hsl(142, 76%, 20%);
}

.badge--info {
  background-color: var(--color-info-light);
  color: var(--color-info);
}

.dark .badge--info {
  background-color: hsl(199, 89%, 20%);
}

.badge--warning {
  background-color: var(--color-warning-light);
  color: var(--color-warning);
}

.dark .badge--warning {
  background-color: hsl(45, 93%, 20%);
  color: hsl(45, 93%, 60%);
}

.badge--danger {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

.dark .badge--danger {
  background-color: hsl(0, 84%, 20%);
}

/* ============================================
   BADGE SIZES
   ============================================ */
.badge--sm {
  padding: var(--spacing-0-5) var(--spacing-2);
  font-size: 0.625rem;
}

.badge--lg {
  padding: var(--spacing-1-5) var(--spacing-3);
  font-size: var(--font-size-sm);
}

/* ============================================
   BADGE WITH DOT
   ============================================ */
.badge--dot::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: currentColor;
}

/* ============================================
   STATUS BADGE (with indicator dot)
   ============================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.status-badge__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.status-badge__dot--success {
  background-color: var(--color-success);
  box-shadow: 0 0 0 2px var(--color-success-light);
}

.status-badge__dot--warning {
  background-color: var(--color-warning);
  box-shadow: 0 0 0 2px var(--color-warning-light);
}

.status-badge__dot--danger {
  background-color: var(--color-danger);
  box-shadow: 0 0 0 2px var(--color-danger-light);
}

.status-badge__dot--info {
  background-color: var(--color-info);
  box-shadow: 0 0 0 2px var(--color-info-light);
}

.status-badge__dot--neutral {
  background-color: var(--color-gray-400);
  box-shadow: 0 0 0 2px var(--color-gray-200);
}

.dark .status-badge__dot--neutral {
  background-color: var(--color-gray-500);
  box-shadow: 0 0 0 2px var(--color-gray-700);
}

/* ============================================
   PILL BADGE (larger, more prominent)
   ============================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-2) var(--spacing-4);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.pill:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

.pill--primary {
  background-color: var(--color-brand-100);
  border-color: var(--color-brand-200);
  color: var(--color-brand);
}

.pill__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-tertiary);
  color: var(--text-tertiary);
  font-size: 0.625rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pill__remove:hover {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

/* ============================================
   BOOTSTRAP-COMPATIBLE BADGE ALIASES
   bg-* color variants for Bootstrap 5 badge syntax
   ============================================ */
.badge.bg-primary   { background-color: var(--color-brand); color: #fff; }
.badge.bg-secondary { background-color: #6b7280; color: #fff; }
.badge.bg-success   { background-color: #22c55e; color: #fff; }
.badge.bg-danger    { background-color: #ef4444; color: #fff; }
.badge.bg-warning   { background-color: #eab308; color: #111; }
.badge.bg-info      { background-color: #3b82f6; color: #fff; }
.badge.bg-dark      { background-color: #1f2937; color: #fff; }
.badge.bg-light     { background-color: #f3f4f6; color: #111; }

/* ===== components/alerts.css ===== */
/**
 * Alert Component System
 * Variants: info, success, warning, danger
 *
 * @author Amit Haridas, ConcreteInfo
 */

/* ============================================
   BASE ALERT
   ============================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-3);
  padding: var(--spacing-4) var(--spacing-5);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

.alert__icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
}

.alert__content {
  flex: 1;
  min-width: 0;
}

.alert__title {
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-1);
}

.alert__text {
  color: inherit;
  opacity: 0.9;
}

.alert__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-md);
  background-color: transparent;
  color: inherit;
  /* 0.6 failed non-text contrast (3:1) on tinted alert backgrounds;
     0.75 passes while still reading as secondary. */
  opacity: 0.75;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.alert__close:hover {
  background-color: rgba(0, 0, 0, 0.05);
  opacity: 1;
}

.dark .alert__close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* ============================================
   ALERT VARIANTS
   ============================================ */
.alert--info {
  background-color: var(--color-info-light);
  border-color: hsl(199, 89%, 85%);
  color: hsl(199, 89%, 25%);
}

.dark .alert--info {
  background-color: hsl(199, 89%, 15%);
  border-color: hsl(199, 89%, 25%);
  color: hsl(199, 89%, 75%);
}

.alert--success {
  background-color: var(--color-success-light);
  border-color: hsl(142, 76%, 85%);
  color: hsl(142, 76%, 25%);
}

.dark .alert--success {
  background-color: hsl(142, 76%, 15%);
  border-color: hsl(142, 76%, 25%);
  color: hsl(142, 76%, 75%);
}

.alert--warning {
  background-color: var(--color-warning-light);
  border-color: hsl(45, 93%, 85%);
  color: hsl(45, 93%, 25%);
}

.dark .alert--warning {
  background-color: hsl(45, 93%, 15%);
  border-color: hsl(45, 93%, 25%);
  color: hsl(45, 93%, 75%);
}

.alert--danger {
  background-color: var(--color-danger-light);
  border-color: hsl(0, 84%, 85%);
  color: hsl(0, 84%, 30%);
}

.dark .alert--danger {
  background-color: hsl(0, 84%, 15%);
  border-color: hsl(0, 84%, 25%);
  color: hsl(0, 84%, 75%);
}

/* ============================================
   ALERT SIZES
   ============================================ */
.alert--sm {
  padding: var(--spacing-3) var(--spacing-4);
  font-size: var(--font-size-xs);
}

.alert--lg {
  padding: var(--spacing-5) var(--spacing-6);
  font-size: var(--font-size-base);
}

/* ============================================
   CALLOUT (larger, more prominent alert)
   ============================================ */
.callout {
  display: flex;
  gap: var(--spacing-4);
  padding: var(--spacing-5) var(--spacing-6);
  border-radius: var(--radius-xl);
  border-left: 4px solid;
  background-color: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

.callout__icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-size: var(--font-size-lg);
}

.callout__content {
  flex: 1;
}

.callout__title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--spacing-1);
}

.callout__text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin: 0;
}

/* Callout variants */
.callout--info {
  border-left-color: var(--color-info);
}

.callout--info .callout__icon {
  background-color: var(--color-info-light);
  color: var(--color-info);
}

.callout--success {
  border-left-color: var(--color-success);
}

.callout--success .callout__icon {
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.callout--warning {
  border-left-color: var(--color-warning);
}

.callout--warning .callout__icon {
  background-color: var(--color-warning-light);
  color: var(--color-warning);
}

.callout--danger {
  border-left-color: var(--color-danger);
}

.callout--danger .callout__icon {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: var(--spacing-6);
  right: var(--spacing-6);
  z-index: var(--z-tooltip);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-3);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-3);
  min-width: 320px;
  max-width: 420px;
  padding: var(--spacing-4);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: slideInRight var(--transition-normal) ease-out;
}

.toast--exiting {
  animation: fadeOut var(--transition-fast) ease-out forwards;
}

.toast__icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
}

.toast__content {
  flex: 1;
  min-width: 0;
}

.toast__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.toast__message {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: var(--spacing-1);
}

.toast__close {
  flex-shrink: 0;
  padding: var(--spacing-1);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.toast__close:hover {
  color: var(--text-primary);
}

@media (max-width: 767.98px) {
  .toast { min-width: auto; max-width: calc(100vw - 2rem); }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateX(var(--spacing-4));
  }
}

/* ============================================
   BOOTSTRAP-COMPATIBLE ALERT ALIASES
   ============================================ */
.alert-success   { background-color: #dcfce7; color: #166534; border-color: #22c55e; }
.alert-danger    { background-color: #fee2e2; color: #991b1b; border-color: #ef4444; }
.alert-warning   { background-color: #fef9c3; color: #713f12; border-color: #eab308; }
.alert-info      { background-color: #dbeafe; color: #1e40af; border-color: #3b82f6; }
.alert-secondary { background-color: var(--bg-tertiary); color: var(--text-secondary); border-color: var(--border-default); }
.alert-primary   { background-color: #fff5f0; color: #c03c18; border-color: var(--color-brand); }

/* ===== components/modal.css ===== */
/**
 * Modal Component System
 * Tailwind-compatible modals without Bootstrap
 * Variants: default, centered, fullscreen
 *
 * @author Amit Haridas, ConcreteInfo
 */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 1055;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 200ms ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1065;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--spacing-6);
  overflow-x: hidden;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 200ms ease;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal--centered {
  align-items: center;
}

.modal-dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: min(calc(100vw - 2rem), 28rem);
  max-height: calc(100vh - 4rem);
  margin: var(--spacing-10) auto;
  transform: translateY(-16px) scale(0.97);
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.active .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal--centered .modal-dialog {
  margin: auto;
}

.modal-sm .modal-dialog { max-width: 380px; }
.modal-lg .modal-dialog { max-width: min(800px, calc(100vw - var(--sidebar-width, 264px) - 3rem)); }
.modal-xl .modal-dialog { max-width: min(1140px, calc(100vw - var(--sidebar-width, 264px) - 3rem)); }
.modal-fullscreen .modal-dialog {
  max-width: 100%;
  max-height: none;
  height: 100%;
  margin: 0;
}

.modal-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  background-color: var(--bg-elevated);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  border: 1px solid var(--border-default);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-3);
  flex-shrink: 0;
  padding: var(--spacing-5) var(--spacing-6);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

/* Theme-driven modal header — consumes the same card-theme vars as .card__header
   (background/fg/border/blur/saturate/highlight) so a modal respects the user's
   selected card theme (gradient / glass / solid) instead of a fixed brand strip.
   Apply alongside layout utilities (flex / padding); this rule sets chrome only.
   Uses `background:` shorthand (not -color) so gradient themes render. */
.modal-header-themed {
  background: var(--card-header-bg);
  -webkit-backdrop-filter: blur(var(--card-header-blur, 0px)) saturate(var(--card-header-saturate, 1));
  backdrop-filter: blur(var(--card-header-blur, 0px)) saturate(var(--card-header-saturate, 1));
  color: var(--card-header-fg);
  border-bottom: 1px solid var(--card-header-border);
  box-shadow: var(--card-header-highlight, none);
}

/* Headings inside a themed header inherit the theme's foreground color
   (--card-header-fg) rather than a global heading color, so titles stay
   legible on both gradient (light fg) and solid/light (dark fg) themes. */
.modal-header-themed .modal-title,
.modal-header-themed h1,
.modal-header-themed h2,
.modal-header-themed h3,
.modal-header-themed h4 {
  color: inherit;
}

.modal-title {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-family-heading);
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  min-height: auto; /* override base.css 44px touch target — 32px hit area per modal anatomy */
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--muted);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.modal-close:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* Themed headers keep light-on-theme chrome for the close control */
.modal-header-themed .modal-close {
  color: var(--card-header-fg);
}

.modal-header-themed .modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--card-header-fg);
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: var(--spacing-5);
  overflow-y: auto;
  font-family: var(--font-family-sans);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  color: var(--text-secondary);
}

/* Visible scrollbar on all modal bodies */
.modal-body::-webkit-scrollbar {
  width: 6px;
}
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: 3px;
}

/* Ensure form elements in modals use consistent styling */
.modal-body .form-control,
.modal-body .input,
.modal-body .select,
.modal-body .form-select,
.modal-body textarea,
.modal-body input[type="text"],
.modal-body input[type="email"],
.modal-body input[type="password"],
.modal-body input[type="number"],
.modal-body input[type="date"],
.modal-body input[type="search"],
.modal-body select {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  min-height: 2.25rem;
  padding: var(--spacing-2) var(--spacing-3);
}

.modal-body textarea {
  height: auto;
  min-height: 5rem;
}

.modal-body label {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.modal-body p,
.modal-body li,
.modal-body span,
.modal-body div {
  font-family: var(--font-family-sans);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--spacing-2);
  flex-shrink: 0;
  padding: var(--spacing-4) var(--spacing-6) var(--spacing-5);
  border-top: 1px solid var(--border-subtle);
}

.modal-scrollbar::-webkit-scrollbar {
  width: 0.375rem;
}

.modal-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.modal-scrollbar::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: var(--radius-full);
}

/* Inline Tailwind modals — visible scrollbar */
[ x-show][class*="overflow-y-auto"]::-webkit-scrollbar,
.fixed.inset-0 [class*="overflow-y-auto"]::-webkit-scrollbar,
.fixed.inset-0 [class*="max-h-"]::-webkit-scrollbar {
  width: 6px;
}
[ x-show][class*="overflow-y-auto"]::-webkit-scrollbar-track,
.fixed.inset-0 [class*="overflow-y-auto"]::-webkit-scrollbar-track,
.fixed.inset-0 [class*="max-h-"]::-webkit-scrollbar-track {
  background: transparent;
}
[ x-show][class*="overflow-y-auto"]::-webkit-scrollbar-thumb,
.fixed.inset-0 [class*="overflow-y-auto"]::-webkit-scrollbar-thumb,
.fixed.inset-0 [class*="max-h-"]::-webkit-scrollbar-thumb {
  background: #d1d1d1;
  border-radius: 3px;
}

@media (max-width: 767.98px) {
  .modal {
    padding: var(--spacing-3);
  }

  .modal-dialog {
    max-width: 100%;
    margin: var(--spacing-4) 0;
  }

  .modal-lg .modal-dialog,
  .modal-xl .modal-dialog {
    max-width: 100%;
  }

  .modal-body {
    padding: var(--spacing-4);
  }
}

/* ============================================================================
   Legacy overlay modals  —  .modal-overlay wrapper + .modal__* BEM structure
   ----------------------------------------------------------------------------
   Pages: admin/roles.php, admin/user-roles.php, admin/subscription-plans.php,
   account/cloud-storage.php. These predate the .modal-backdrop / .active system
   above: they wrap a .modal card in .modal-overlay and toggle a .hidden class
   on the wrapper. .modal defaults to visibility:hidden (normally cleared by the
   .active class, which these pages never add) and .modal-overlay / .modal__*
   previously had NO CSS at all — so opening the modal removed .hidden from the
   wrapper but the card stayed invisible, making every "Add / Edit / Assign"
   button look dead. This block makes that existing markup render correctly,
   reusing the same design tokens as the standard modal classes. New pages
   should use the .modal + .active convention, not this one.
   ============================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--spacing-6);
  overflow-x: hidden;
  overflow-y: auto;
  background-color: var(--bg-overlay);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* In the overlay pattern, visibility is driven by the wrapper's .hidden class. */
.modal-overlay.hidden {
  display: none;
}

/* The card. Override .modal's default (position:fixed + visibility:hidden) so
   it renders as a relative card inside the overlay. Any inline max-width /
   max-height / overflow on a page's .modal element still wins (per-modal
   sizing), which is intended. */
.modal-overlay .modal {
  position: relative;
  inset: auto;
  z-index: auto;
  display: flex;
  flex-direction: column;
  opacity: 1;
  visibility: visible;
  margin: var(--spacing-10) auto;
  width: 100%;
  max-width: 500px;
  max-height: calc(100vh - 4rem);
  padding: 0;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.modal-overlay .modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-3);
  flex-shrink: 0;
  padding: var(--spacing-5) var(--spacing-6);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.modal-overlay .modal__title {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-family-heading, inherit);
  color: inherit;
}

.modal-overlay .modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  min-height: auto;                 /* override base.css 44px touch target */
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--transition-fast, 150ms ease), color var(--transition-fast, 150ms ease);
}

.modal-overlay .modal__close:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

.modal-overlay .modal__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: var(--spacing-5);
  overflow-y: auto;
}

/* Pages that wrap .modal__body + .modal__footer inside a <form> (roles.php
   et al.) broke the card's flex column: a plain-block form taller than the
   card overflows and clips (the Role Name field rendered at top:-36,
   invisible). Making the form itself the flex column restores the pinned
   header / scrolling body / pinned footer mechanics. Same shape applies to
   the modern .modal-content. */
.modal-overlay .modal > form,
.modal-content > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  margin: 0;
}

.modal-overlay .modal__footer {
  flex-shrink: 0;
  padding: var(--spacing-4) var(--spacing-6) var(--spacing-5);
  border-top: 1px solid var(--border-subtle);
}

@media (max-width: 767.98px) {
  .modal-overlay {
    padding: var(--spacing-3);
  }

  .modal-overlay .modal {
    max-width: 100%;
    margin: var(--spacing-3) 0;
  }
}

/* ===== components/list-group.css ===== */
/**
 * List Group Component
 * Replaces Bootstrap list-group with design-system equivalent
 *
 * @author Amit Haridas, ConcreteInfo
 */

.ci-list-group {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.ci-list-group-item {
  padding: var(--spacing-3) var(--spacing-4);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  transition: background-color var(--transition-fast);
}

.ci-list-group-item:last-child {
  border-bottom: none;
}

.ci-list-group-item--action {
  cursor: pointer;
  text-decoration: none;
  display: block;
}

.ci-list-group-item--action:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.ci-list-group-item.active,
.ci-list-group-item--active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--text-inverse);
}

.ci-list-group-item--success  { border-left: 3px solid var(--color-success); }
.ci-list-group-item--danger   { border-left: 3px solid var(--color-danger); }
.ci-list-group-item--warning  { border-left: 3px solid var(--color-warning); }
.ci-list-group-item--info     { border-left: 3px solid var(--color-info); }

/* ===== components/progress.css ===== */
/**
 * Progress Bar Component
 * Bootstrap-compatible .progress / .progress-bar
 * @author Amit Haridas, ConcreteInfo
 */

.progress {
  display: flex;
  height: 1rem;
  overflow: hidden;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.progress-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: #fff;
  background-color: var(--color-brand);
  transition: width 0.4s ease;
  white-space: nowrap;
  overflow: hidden;
  padding: 0 var(--spacing-2);
  border-radius: var(--radius-full);
}

/* Color variants using Tailwind-like bg-* classes */
.progress-bar.bg-success   { background-color: var(--color-success); }
.progress-bar.bg-danger    { background-color: var(--color-danger); }
.progress-bar.bg-warning   { background-color: var(--color-warning); color: var(--color-gray-900); }
.progress-bar.bg-info      { background-color: var(--color-info); }
.progress-bar.bg-primary   { background-color: var(--color-brand); }
.progress-bar.bg-secondary { background-color: var(--color-gray-500); }
.progress-bar.bg-dark      { background-color: var(--color-gray-800); }

/* ===== components/loading.css ===== */
/**
 * Loading Component Styles
 * Loading overlays, spinners, and progress indicators
 *
 * @author Amit Haridas, ConcreteInfo
 */

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease, visibility 200ms ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-container {
    background-color: var(--bg-elevated, #ffffff);
    border-radius: var(--radius-xl, 0.75rem);
    box-shadow: var(--shadow-2xl, 0 25px 50px -12px rgba(0, 0, 0, 0.25));
    padding: var(--spacing-6, 1.5rem) var(--spacing-8, 2rem);
    min-width: 200px;
    text-align: center;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-4, 1rem);
}

/* ============================================
   SPINNER ANIMATIONS
   ============================================ */

/* Default spinner - rotating circle */
.loading-spinner {
    width: 40px;
    height: 40px;
    position: relative;
}

.loading-spinner::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid var(--color-gray-200, #e5e7eb);
    border-radius: 50%;
}

.loading-spinner::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid transparent;
    border-top-color: var(--color-brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Dots spinner */
.loading-spinner--dots {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
}

.loading-spinner--dots::before,
.loading-spinner--dots::after,
.loading-spinner--dots span {
    content: '';
    width: 8px;
    height: 8px;
    background-color: var(--color-brand);
    border-radius: 50%;
    animation: dots 1.4s infinite ease-in-out;
}

.loading-spinner--dots::before {
    animation-delay: -0.32s;
}

.loading-spinner--dots::after {
    animation-delay: -0.16s;
}

.loading-spinner--dots span {
    animation-delay: 0s;
}

/* Pulse spinner */
.loading-spinner--pulse {
    width: 40px;
    height: 40px;
    background-color: var(--color-brand);
    border-radius: 50%;
    animation: pulse 1.2s ease-in-out infinite;
}

/* ============================================
   LOADING MESSAGE
   ============================================ */
.loading-message {
    color: var(--text-secondary, #6b7280);
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: var(--font-weight-medium, 500);
}

/* ============================================
   INLINE LOADING STATES
   ============================================ */
.is-loading {
    position: relative;
    pointer-events: none;
}

.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark .is-loading::after {
    background-color: rgba(0, 0, 0, 0.5);
}

/* Button loading state */
.btn.is-loading {
    color: transparent !important;
    pointer-events: none;
}

.btn.is-loading::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes dots {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { transform: scale(0.5); opacity: 0.5; }
    50% { transform: scale(1); opacity: 1; }
}

/* ============================================
   SKELETON LOADERS (for content placeholders)
   ============================================ */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary, #f3f4f6) 0%,
        var(--bg-secondary, #e5e7eb) 50%,
        var(--bg-tertiary, #f3f4f6) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md, 0.5rem);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton--text {
    height: 1rem;
    margin-bottom: var(--spacing-2, 0.5rem);
}

.skeleton--title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: var(--spacing-3, 0.75rem);
}

.skeleton--avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton--button {
    height: 40px;
    width: 100px;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-bar {
    width: 100%;
    height: 4px;
    background-color: var(--bg-tertiary, #f3f4f6);
    border-radius: var(--radius-full, 9999px);
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-brand), var(--color-brand-light));
    border-radius: var(--radius-full, 9999px);
    transition: width 300ms ease;
}

/* Indeterminate progress */
.progress-bar--indeterminate .progress-bar__fill {
    width: 30%;
    animation: indeterminate 1.5s infinite ease-in-out;
}

@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* ===== components/skeleton.css ===== */
/* Skeleton pulse loader — shown while analytics data loads */
.skeleton {
    position: relative;
    overflow: hidden;
    background: #e3e3e3;
    border-radius: 4px;
}

.dark .skeleton {
    background: #464646;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 100%
    );
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.skeleton-card {
    height: 88px;
    border-radius: 8px;
}

.skeleton-chart {
    height: 300px;
    border-radius: 12px;
}

.skeleton-table-row {
    height: 48px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text {
    display: inline-block;
    height: 14px;
    border-radius: 3px;
}

.skeleton-text-sm {
    height: 10px;
    width: 60%;
}

.skeleton-text-md {
    height: 14px;
    width: 80%;
}

.skeleton-text-lg {
    height: 24px;
    width: 40%;
}

.skeleton-badge {
    display: inline-block;
    height: 20px;
    width: 48px;
    border-radius: 10px;
}

/* ===== components/_dark-mode.css ===== */
/**
 * Centralized Dark Mode Overrides
 * All .dark { ... } overrides in one place.
 * Component-specific dark styles migrated from:
 *   - buttons.css
 *   - cards.css
 *   - forms.css
 *   - modal.css
 *   - tables.css
 *   - sidebar.css
 *
 * @author Amit Haridas, ConcreteInfo
 */

/* ============================================
   SEMANTIC TOKENS OVERRIDE
   ============================================ */
.dark {
  /* Semantic background tokens (overrides of :root defaults) */
  --bg-elevated: var(--color-gray-900);
}

/* ============================================
   BUTTONS
   ============================================ */
.dark .btn-secondary {
  background-color: var(--color-gray-700);
  border-color: var(--color-gray-700);
}

.dark .btn-secondary:hover {
  background-color: var(--color-gray-600);
  border-color: var(--color-gray-600);
}

.dark .btn-ghost:hover {
  background-color: var(--color-gray-800);
}

/* ============================================
   CARDS
   ============================================ */
.dark .card--interactive:hover {
  border-color: hsl(var(--color-brand-h), 50%, 30%);
}

.dark .stat-card__trend--up {
  background-color: hsl(142, 76%, 20%);
}

.dark .stat-card__trend--down {
  background-color: hsl(0, 84%, 20%);
}

/* ============================================
   FORMS
   ============================================ */
.dark .input:focus {
  box-shadow: 0 0 0 3px hsl(var(--color-brand-h), 50%, 20%);
}

.dark .select:focus {
  box-shadow: 0 0 0 3px hsl(var(--color-brand-h), 50%, 20%);
}

.dark .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23b0b0b0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
}

/* ============================================
   MODALS
   ============================================ */
.dark .modal-body::-webkit-scrollbar-thumb {
  background: var(--color-gray-600);
}

.dark .modal-scrollbar::-webkit-scrollbar-thumb {
  background: var(--color-gray-600);
}

.dark [x-show][class*="overflow-y-auto"]::-webkit-scrollbar-thumb,
.dark .fixed.inset-0 [class*="overflow-y-auto"]::-webkit-scrollbar-thumb,
.dark .fixed.inset-0 [class*="max-h-"]::-webkit-scrollbar-thumb {
  background: var(--color-gray-700);
}

/* ============================================
   TABLES
   ============================================ */
.dark .table tbody tr:hover {
  background-color: var(--color-gray-800);
}

.dark .table-hover tbody tr:hover {
  background-color: var(--color-gray-800);
}

/* ============================================
   LAYOUT — SIDEBAR + HEADER
   ============================================ */
.dark .sidebar {
  background-color: var(--color-gray-900);
  border-color: var(--color-gray-800);
}

.dark .sidebar-header {
  background-color: var(--color-gray-900);
  border-bottom-color: var(--color-gray-700);
}

.dark .sidebar-close {
  color: var(--color-gray-400);
}

.dark .sidebar-close:hover {
  background-color: var(--color-gray-800);
  color: var(--color-gray-100);
}

.dark .sidebar-user {
  background-color: var(--color-gray-900);
}

.dark .sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.dark .sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--color-gray-700);
}

.dark .sidebar-nav {
  background-color: transparent;
}

.dark .sidebar-section-title {
  color: var(--color-gray-400);
}

.dark .sidebar-section-title:hover {
  background-color: var(--color-gray-800);
  color: var(--color-gray-200);
}

.dark .sidebar-link {
  color: var(--color-gray-300);
}

.dark .sidebar-link:hover {
  background-color: var(--color-gray-800);
  color: var(--color-gray-100);
}

.dark .sidebar-link.active {
  background-color: var(--color-brand-900);
  color: var(--color-brand-100);
}

.dark .sidebar-link.text-danger {
  color: hsl(0, 84%, 65%);
}

.dark .sidebar-link.text-danger:hover {
  background-color: hsl(0, 84%, 15%);
}

.dark .topbar {
  background-color: var(--color-gray-900);
  border-color: var(--color-gray-700);
}

.dark .sidebar-toggle:hover {
  background-color: var(--color-gray-800);
}

.dark .topbar-brand {
  color: var(--color-gray-100);
}

.dark .topbar-actions button[data-theme-toggle]:hover {
  background-color: var(--color-gray-800);
}

/* Theme toggle icon swap */
.dark .theme-toggle .icon-sun {
  display: none;
}

.dark .theme-toggle .icon-moon {
  display: block;
}

/* ============================================
   BUTTONS — additional variants
   ============================================ */
.dark .btn-outline {
  border-color: hsl(14, 77%, 55%);
  color: hsl(14, 77%, 60%);
}
.dark .btn-outline:hover {
  background: hsl(14, 77%, 40%);
  color: var(--text-inverse);
  border-color: hsl(14, 77%, 40%);
}
.dark .btn-outline-danger {
  border-color: hsl(0, 84%, 55%);
  color: hsl(0, 84%, 60%);
}
.dark .btn-outline-success {
  border-color: hsl(142, 76%, 40%);
  color: hsl(142, 76%, 50%);
}
.dark .btn-danger {
  background-color: hsl(0, 84%, 50%);
  border-color: hsl(0, 84%, 50%);
}
.dark .btn-success {
  background-color: hsl(142, 76%, 40%);
  border-color: hsl(142, 76%, 40%);
}
.dark .btn-warning {
  background-color: hsl(45, 93%, 42%);
  border-color: hsl(45, 93%, 42%);
  color: var(--color-gray-100);
}
.dark .btn-info {
  background-color: hsl(199, 89%, 40%);
  border-color: hsl(199, 89%, 40%);
}

/* ============================================
   CARDS — subtle header dark mode
   ============================================ */
/* Card header dark mode — handled by --card-header-* design tokens */

/* ============================================
   FORMS — comprehensive dark inputs
   ============================================ */
.dark .input,
.dark .select,
.dark textarea {
  background-color: var(--color-gray-900);
  border-color: var(--color-gray-700);
  color: var(--text-primary);
}
.dark .input::placeholder,
.dark textarea::placeholder {
  /* gray-500 (#9a9696) measured only 3.23:1 on the #464646 dark input
     surface — below WCAG-AA 4.5, so placeholders read as dim gray-on-gray.
     gray-300 (#d1d1d1) ≈ 6.2:1 (AAA). Mirrors the --text-tertiary bump. */
  color: var(--color-gray-300);
}
.dark .input:focus,
.dark .select:focus,
.dark textarea:focus {
  border-color: hsl(14, 77%, 55%);
  box-shadow: 0 0 0 3px hsl(14, 50%, 20%);
}
.dark .input:disabled,
.dark .select:disabled,
.dark textarea:disabled {
  background-color: var(--color-gray-800);
  color: var(--color-gray-500);
}

/* ============================================
   TABLES — comprehensive dark mode
   ============================================ */
.dark .table th {
  background-color: var(--color-gray-800);
  color: var(--color-gray-400);
  border-bottom-color: var(--color-gray-700);
}
.dark .table td {
  border-bottom-color: var(--color-gray-800);
}
.dark .table tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

/* ============================================
   TESTING FORMS — section headers
   ============================================ */
.dark .tf-section {
  border-color: var(--color-gray-800);
}
.dark .tf-section-header:hover {
  background: var(--color-gray-800);
}

/* ===== components/icons.css ===== */
/**
 * Font Awesome monochrome icon system (Phase 1). Icons render alone (inline,
 * inherit color) or inside a flat single-hue tint square for emphasis — used
 * by hub tiles (.hub__t-ic) and, later, stat cards. Never a gradient or bevel.
 */

/* ── Lucide outline svg base (2026-11-16) ────────────────────────────────
   Every LucideIcon::render() svg carries .ci-lucide. Default to 1em×1em —
   the same font-relative sizing the FA <i> glyphs had — so an icon can
   NEVER blow up to intrinsic size when a surface forgets an explicit rule
   (inline svg without width/height resolves to container width otherwise).
   Surfaces that need exact boxes (nav rows 20px, chips 14px…) override
   with explicit width/height AFTER this sheet. */
svg.ci-lucide {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.hub__t-ic i,
.hub__xl-ic i {
  font-size: 0.875em;
  color: var(--color-brand);
}

/* Neutral (default) tint square background: `--surface-2` is an undefined/legacy
   token referenced via fallback only; it always resolves to `--bg-tertiary` in
   this codebase. Semantic tone variants for stat/status contexts reuse the same
   4 semantic colors as badges. */
.icon-tint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-control);
  background: var(--surface-2);
}
.icon-tint i { color: var(--color-text-default); }

.icon-tint--brand { background: var(--color-brand-100); }
.icon-tint--brand i { color: var(--color-brand); }

.icon-tint--success { background: var(--color-success-light); }
.icon-tint--success i { color: var(--color-success); }

.icon-tint--warning { background: var(--color-warning-light); }
.icon-tint--warning i { color: var(--color-warning); }

.icon-tint--danger { background: var(--color-danger-light); }
.icon-tint--danger i { color: var(--color-danger); }

.icon-tint--info { background: var(--color-info-light); }
.icon-tint--info i { color: var(--color-info); }

.dark .icon-tint { background: var(--bg-tertiary); }

/* ===== components/grid-card.css ===== */
/**
 * Grid card shell (Phase 1, new). Wraps any AG Grid / CIGrid instance in a
 * consistent header-bar + grid + footer chrome. The grid engine itself
 * (AG Grid Community, CIGrid) is untouched — this is presentation chrome
 * only. Adopted per-surface as list pages are touched (Phase 2/4).
 */

.grid-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.grid-card__header {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--card-header-py) var(--card-header-px);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--card-header-bg);
}

.grid-card__title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-strong);
  margin: 0;
  flex: 1;
  min-width: 0;
}

.grid-card__search {
  flex: 0 1 240px;
  min-width: 140px;
}

.grid-card__actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  margin-left: auto;
}

.grid-card__body {
  /* AG Grid / CIGrid instance mounts here. No padding — the grid manages
     its own internal spacing and needs to run edge-to-edge. */
}

.grid-card__body .ag-root-wrapper,
.grid-card__body .ci-grid {
  border: none;
  border-radius: 0;
}

.grid-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-2-5) var(--card-header-px);
  border-top: 1px solid var(--border-subtle);
  background: var(--card-header-bg);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* Numeric columns: right-aligned, tabular-nums, monospace — applied by the
   grid engine's column def class, this just defines the shared utility. */
.grid-card .col-numeric {
  font-family: var(--font-family-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.grid-card .col-actions {
  width: 120px;
  display: flex;
  gap: var(--spacing-1);
  justify-content: flex-end;
}

@media (max-width: 1279.98px) {
  .grid-card__search { flex: 0 1 180px; min-width: 100px; }
}

@media (max-width: 1023.98px) {
  .grid-card__header { flex-wrap: wrap; }
  .grid-card__search { flex: 1 1 100%; order: 3; }
}

@media (max-width: 640px) {
  .grid-card__header { flex-wrap: wrap; }
  .grid-card__search { flex: 1 1 100%; order: 3; }
}

/* ===== components/fields.css ===== */
/* assets/css/components/fields.css — <x-field> family */
.x-field { display: grid; gap: var(--spacing-2); margin-bottom: var(--spacing-4); }
.x-field__label { font-weight: 600; color: var(--text-primary); font-size: 0.9rem; }
.x-field__required { color: var(--color-danger); }
.x-field__help { font-size: 0.85rem; color: var(--text-tertiary); }
.x-field__error { font-size: 0.85rem; color: var(--color-danger); }
.x-field__error[hidden] { display: none; }
.x-field__unit { font-size: 0.85rem; color: var(--text-secondary); }
.x-field--error .input,
.x-field--error .select { border-color: var(--color-danger); }
.x-field--inline { grid-template-columns: auto 1fr auto; align-items: center; }

/* ===== components/sections.css ===== */
/* assets/css/components/sections.css — <x-section> family.
   Card surfaces use the Direction C treatment: radius + resting/hover shadow,
   no border (internal hairlines keep var(--border-subtle)). */
.x-section {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    transition: box-shadow .15s;
    margin-bottom: var(--spacing-5);
    overflow: hidden;
}
.x-section:hover,
.x-section:focus-within { box-shadow: var(--shadow-2); }
.x-section__title {
    display: flex; align-items: center; gap: var(--spacing-2-5);
    font-family: var(--font-family-heading);
    font-weight: 700; font-size: 1.1rem;
    padding: var(--spacing-4) var(--spacing-5);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}
.x-section__summary {
    font-weight: 400; font-size: 0.85rem;
    color: var(--text-tertiary);
    min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.x-section__chevron {
    margin-left: auto; flex-shrink: 0;
    transition: transform .15s;
}
.x-section[aria-expanded="true"] .x-section__chevron { transform: rotate(180deg); }
.x-section--collapsible > .x-section__title { cursor: pointer; }
.x-section--collapsible:not([aria-expanded="true"]) > .x-section__body { display: none; }
.x-section__body { padding: var(--spacing-5); }

/* ===== components/dashboard-v2.css ===== */
/* assets/css/components/dashboard-v2.css — <x-dashboard-page>.
   Card surfaces (.kpi-tile, .chart-slot, .dashboard-list) use the Direction C
   treatment: radius + resting/hover shadow, no border. */
.x-dashboard { display: grid; gap: var(--spacing-5); padding: var(--spacing-5); }
.x-dashboard__title { font-family: var(--font-family-display); font-weight: 700; }
.kpi-grid {
    display: grid; gap: var(--spacing-4);
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 768px) { .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi-grid--scroll { display: flex; overflow-x: auto; gap: var(--spacing-2-5); }
.kpi-grid--scroll .kpi-tile { flex: 0 0 auto; min-width: 150px; }

.kpi-tile {
    display: grid; grid-template-columns: auto 1fr; gap: var(--spacing-3);
    padding: 10px 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    transition: box-shadow .15s;
    min-height: 72px; text-decoration: none; color: inherit;
}
.kpi-tile:hover,
.kpi-tile:focus-within { box-shadow: var(--shadow-2); background: hsl(var(--color-brand-h),77%,45%,.05); }
.kpi-tile__value {
    font-family: var(--font-family-display);
    font-size: 1.5rem; font-weight: 800;
    color: var(--color-brand); font-variant-numeric: tabular-nums;
}
/* Dark mode: the brand token drops to 1.84:1 on dark --bg-elevated; this
   lighter brand tint restores AA (~4.6:1). The token itself is left untouched so
   white-on-brand buttons keep their contrast. */
.dark .kpi-tile__value { color: hsl(14, 77%, 62%); }
.kpi-tile__delta { font-size: 0.85rem; }
.kpi-tile__delta--up   { color: var(--color-success); }
.kpi-tile__delta--down { color: var(--color-danger); }
.kpi-tile__delta--flat { color: var(--text-tertiary); }
.kpi-tile__extra { grid-column: 1 / -1; }
@media (max-width: 767.98px) {
    .kpi-tile { min-height: 64px; padding: 10px 12px; }
    .kpi-tile__value { font-size: 1.25rem; }
}

/* Sparkline (inline SVG, viewBox 0 0 100 24) sizing inside the extra slot. */
.spark { color: var(--color-brand); }
.kpi-tile__extra .spark { display: block; width: 100%; height: 24px; }

.chart-slot {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    transition: box-shadow .15s;
    padding: 10px 14px;
}
.chart-slot:hover,
.chart-slot:focus-within { box-shadow: var(--shadow-2); background: hsl(var(--color-brand-h),77%,45%,.05); }
.chart-slot__title { font-weight: 600; margin-bottom: var(--spacing-3); }
.chart-slot__body  { min-height: 240px; }

.dashboard-list {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1);
    transition: box-shadow .15s;
    padding: var(--spacing-5);
}
.dashboard-list:hover,
.dashboard-list:focus-within { box-shadow: var(--shadow-2); background: hsl(var(--color-brand-h),77%,45%,.05); }
.dashboard-list ul { list-style: none; padding: 0; margin: 0; }
.dashboard-list li { padding: var(--spacing-2) 0; border-bottom: 1px solid var(--border-subtle); }
.dashboard-list li:last-child { border-bottom: 0; }

.dashboard-actions {
    position: sticky; bottom: 0;
    display: flex; gap: var(--spacing-3); justify-content: flex-end;
    padding: var(--spacing-4) var(--spacing-5);
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-subtle);
}
