/* =============================================================================
   ServiceResQ Design Tokens — "First-Responder"
   =============================================================================
   Rescue crimson + graphite. Decisive, tactical, on-time. Loads AFTER the shared
   Solvyr tokens so these canonical names override app-wide (shared components that
   read var(--color-primary) etc. inherit the ServiceResQ identity).

   Brand DNA:
     Rescue Crimson #C8102E — decisive, "we show up and fix it"
     Graphite       #141821 — structural, professional dark chrome
     Signal Amber   #F5A524 — warm energy, used sparingly
     Rectangular 3–4px corners (pills included), tight/dense spacing
     Archivo (display + numerals) + Inter (body/UI)

   Rule: reference var(--token) everywhere. Never hardcode colors/sizes/shadows.
   ============================================================================= */

:root {
  /* ===========================================================================
     BRAND SCALES
     =========================================================================== */
  --srq-crimson-50:  #FFF1F2;
  --srq-crimson-100: #FFE0E2;
  --srq-crimson-200: #FCC5C9;
  --srq-crimson-300: #F79AA1;
  --srq-crimson-400: #EE5C68;
  --srq-crimson-500: #DD2435;
  --srq-crimson-600: #C8102E;   /* PRIMARY — the brand red */
  --srq-crimson-700: #A60D26;
  --srq-crimson-800: #850B1F;
  --srq-crimson-900: #5F0815;

  --srq-graphite-50:  #F5F7FA;
  --srq-graphite-100: #ECEFF3;
  --srq-graphite-200: #DCE1E8;
  --srq-graphite-300: #BCC4D0;
  --srq-graphite-400: #8C95A4;
  --srq-graphite-500: #626B7B;
  --srq-graphite-600: #464E5C;
  --srq-graphite-700: #2F3641;
  --srq-graphite-800: #1E232C;
  --srq-graphite-900: #141821;  /* dark nav / sidebar */
  --srq-graphite-950: #0B0E14;

  --srq-amber:        #F5A524;  /* Signal Amber accent — sparingly */
  --srq-amber-hover:  #DB8E10;
  --srq-amber-soft:   #FEF6E7;

  /* ===========================================================================
     SEMANTIC COLORS  (canonical names — shared components inherit these)
     =========================================================================== */
  --color-primary:        var(--srq-crimson-600);
  --color-primary-hover:  var(--srq-crimson-700);
  --color-primary-active: var(--srq-crimson-800);
  --color-primary-light:  rgba(200, 16, 46, 0.10);
  --color-primary-focus:  rgba(200, 16, 46, 0.28);

  --color-secondary:      var(--srq-graphite-800);
  --color-accent:         var(--srq-amber);
  --color-accent-hover:   var(--srq-amber-hover);

  --color-success:        #15924B;
  --color-success-hover:  #0F7C3F;
  --color-success-light:  rgba(21, 146, 75, 0.10);
  --color-success-bg:     #ECFDF3;
  --color-success-border: #ABEFC6;
  --color-success-text:   #067647;

  --color-warning:        #D9870B;
  --color-warning-hover:  #B45309;
  --color-warning-light:  rgba(217, 135, 11, 0.10);
  --color-warning-bg:     #FFFAEB;
  --color-warning-border: #FEDF89;
  --color-warning-text:   #93370D;

  /* Danger is a DISTINCT alert red — deliberately not the brand crimson, so the
     brand never reads as "error". */
  --color-danger:         #DC2626;
  --color-danger-hover:   #B42318;
  --color-danger-light:   rgba(220, 38, 38, 0.10);
  --color-danger-bg:      #FEF3F2;
  --color-danger-border:  #FECDCA;
  --color-danger-text:    #B42318;

  --color-info:           #2E78C7;
  --color-info-light:     rgba(46, 120, 199, 0.10);
  --color-info-bg:        #EFF6FF;
  --color-info-border:    #B2D4F5;
  --color-info-text:      #1A5DA8;

  /* ===========================================================================
     NEUTRALS  (graphite ramp mapped onto the canonical gray names)
     =========================================================================== */
  --color-white:    #ffffff;
  --color-gray-50:  var(--srq-graphite-50);
  --color-gray-100: var(--srq-graphite-100);
  --color-gray-200: var(--srq-graphite-200);
  --color-gray-300: var(--srq-graphite-300);
  --color-gray-400: var(--srq-graphite-400);
  --color-gray-500: var(--srq-graphite-500);
  --color-gray-600: var(--srq-graphite-600);
  --color-gray-700: var(--srq-graphite-700);
  --color-gray-800: var(--srq-graphite-800);
  --color-gray-900: var(--srq-graphite-900);
  --color-black:    #000000;

  /* ===========================================================================
     SURFACE / TEXT / BORDER
     =========================================================================== */
  --color-bg:             var(--srq-graphite-50);
  --color-bg-alt:         #EFF2F6;
  --color-surface:        #ffffff;
  --color-surface-raised: #ffffff;
  --color-surface-sunken: var(--srq-graphite-100);
  --color-surface-muted:  var(--srq-graphite-100);
  --color-surface-hover:  var(--srq-graphite-50);

  /* Text ramp — AA on white: secondary 8.2:1, muted 5.3:1. Subtle = decorative. */
  --color-text:           var(--srq-graphite-900);
  --color-text-primary:   var(--srq-graphite-900);
  --color-text-secondary: var(--srq-graphite-600);
  --color-text-muted:     var(--srq-graphite-500);
  --color-text-subtle:    var(--srq-graphite-400);
  --color-text-inverse:   #ffffff;
  --color-on-primary:     #ffffff;
  --color-text-on-dark:   #D7DCE4;
  --color-text-on-dark-muted: rgba(215, 220, 228, 0.74);
  --color-text-link:      var(--color-primary);
  --color-text-link-hover: var(--color-primary-hover);

  --color-dark-border:    rgba(148, 163, 184, 0.14);
  --color-dark-hover:     rgba(255, 255, 255, 0.07);
  --color-dark-divider:   rgba(255, 255, 255, 0.10);
  --color-backdrop:       rgba(11, 14, 20, 0.62);

  --color-border:         var(--srq-graphite-200);
  --color-border-light:   var(--srq-graphite-100);
  --color-border-subtle:  var(--srq-graphite-100);
  --color-border-strong:  var(--srq-graphite-300);

  /* ===========================================================================
     STATUS PILLS — work-order / estimate lifecycle (rectangular)
     =========================================================================== */
  --badge-open-bg:       var(--color-info-bg);       --badge-open-text:      var(--color-info-text);      --badge-open-bd:      var(--color-info-border);
  --badge-scheduled-bg:  var(--srq-amber-soft);      --badge-scheduled-text: var(--color-warning-text);   --badge-scheduled-bd: var(--color-warning-border);
  --badge-progress-bg:   var(--srq-crimson-50);      --badge-progress-text:  var(--color-primary);        --badge-progress-bd:  var(--srq-crimson-200);
  --badge-complete-bg:   var(--color-success-bg);    --badge-complete-text:  var(--color-success-text);   --badge-complete-bd:  var(--color-success-border);
  --badge-invoiced-bg:   var(--srq-graphite-100);    --badge-invoiced-text:  var(--srq-graphite-700);     --badge-invoiced-bd:  var(--srq-graphite-300);
  --badge-cancelled-bg:  var(--color-danger-bg);     --badge-cancelled-text: var(--color-danger-text);    --badge-cancelled-bd: var(--color-danger-border);
  --badge-draft-bg:      var(--srq-graphite-100);    --badge-draft-text:     var(--srq-graphite-600);     --badge-draft-bd:     var(--srq-graphite-300);

  /* ===========================================================================
     TYPOGRAPHY
     =========================================================================== */
  --font-family-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-display: 'Archivo', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-family-mono:    ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;

  --font-size-2xs:  0.625rem;   /* 10px */
  --font-size-xs:   0.75rem;    /* 12px */
  --font-size-sm:   0.8125rem;  /* 13px */
  --font-size-base: 0.875rem;   /* 14px — data-dense */
  --font-size-md:   1rem;       /* 16px */
  --font-size-lg:   1.125rem;   /* 18px */
  --font-size-xl:   1.25rem;    /* 20px */
  --font-size-2xl:  1.5rem;     /* 24px */
  --font-size-3xl:  2rem;       /* 32px */
  --font-size-4xl:  2.5rem;     /* 40px */

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

  --line-height-tight:   1.2;
  --line-height-normal:  1.5;
  --line-height-relaxed: 1.7;

  --letter-spacing-tight: -0.015em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide:  0.04em;
  --letter-spacing-caps:  0.08em;

  /* ===========================================================================
     SPACING — 4px grid
     =========================================================================== */
  --space-0:   0;
  --space-px:  1px;
  --space-0_5: 0.125rem;  /* 2px */
  --space-1:   0.25rem;   /* 4px */
  --space-2:   0.5rem;    /* 8px */
  --space-3:   0.75rem;   /* 12px */
  --space-4:   1rem;      /* 16px */
  --space-5:   1.25rem;   /* 20px */
  --space-6:   1.5rem;    /* 24px */
  --space-8:   2rem;      /* 32px */
  --space-10:  2.5rem;    /* 40px */
  --space-12:  3rem;      /* 48px */
  --space-16:  4rem;      /* 64px */

  /* ===========================================================================
     RADIUS — rectangular 3–4px (pills included). Circle reserved for spinners.
     =========================================================================== */
  --radius-none:   0;
  --radius-sm:     3px;
  --radius:        3px;   /* default — buttons, inputs, pills, badges */
  --radius-md:     4px;
  --radius-lg:     4px;   /* cards, panels */
  --radius-xl:     4px;   /* modals */
  --radius-pill:   3px;   /* rectangular pills (NOT oval) */
  --radius-circle: 999px; /* spinners / true circles only */

  --border-width:      1px;
  --stroke-width-base: 2px;
  --stroke-width-accent: 3px;

  /* ===========================================================================
     SHADOWS / ELEVATION
     =========================================================================== */
  --shadow-xs: 0 1px 2px rgba(11, 14, 20, 0.05);
  --shadow-sm: 0 1px 2px rgba(11, 14, 20, 0.06);
  --shadow:    0 1px 3px rgba(11, 14, 20, 0.08), 0 1px 2px rgba(11, 14, 20, 0.05);
  --shadow-md: 0 4px 10px rgba(11, 14, 20, 0.08), 0 2px 4px rgba(11, 14, 20, 0.04);
  --shadow-lg: 0 16px 32px rgba(11, 14, 20, 0.12), 0 6px 12px rgba(11, 14, 20, 0.06);
  --shadow-xl: 0 24px 48px rgba(11, 14, 20, 0.16), 0 10px 20px rgba(11, 14, 20, 0.08);

  --elevation-0: none;
  --elevation-1: var(--shadow);
  --elevation-2: var(--shadow-md);
  --elevation-3: var(--shadow-lg);

  --focus-ring-default: 0 0 0 3px var(--color-primary-focus);
  --focus-ring-error:   0 0 0 3px rgba(220, 38, 38, 0.30);
  --focus-ring-success: 0 0 0 3px rgba(21, 146, 75, 0.28);
  --focus-ring-on-dark: 0 0 0 3px rgba(255, 255, 255, 0.40);
  --shadow-focus: var(--focus-ring-default);

  /* ===========================================================================
     GRADIENTS — tasteful, sparing
     =========================================================================== */
  --grad-crimson:  linear-gradient(135deg, #DD2435 0%, #C8102E 55%, #A60D26 100%);
  --grad-graphite: linear-gradient(170deg, #222834 0%, #141821 70%, #0E1118 100%);
  --grad-surface:  linear-gradient(180deg, #FFFFFF 0%, #FBFCFE 100%);
  --grad-amber:    linear-gradient(135deg, #F8B845, #F5A524);

  /* ===========================================================================
     MOTION
     =========================================================================== */
  --ease:        cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out:    cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 100ms;
  --duration-base: 180ms;
  --duration-slow: 280ms;
  --transition-fast: var(--duration-fast) var(--ease);
  --transition-base: var(--duration-base) var(--ease);
  --motion-fade-in:  var(--duration-base) var(--ease-out);
  --motion-slide-up: var(--duration-slow) var(--ease);

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

  /* ===========================================================================
     COMPONENT SIZES — tight
     =========================================================================== */
  --navbar-height:   54px;
  --btn-height-sm:   28px;
  --btn-height:      34px;
  --btn-height-lg:   40px;
  --input-height-sm: 30px;
  --input-height:    34px;
  --input-height-lg: 40px;
  --icon-btn-size:   32px;
  --touch-target:    44px;
  --sidebar-width:   232px;

  /* Component padding (tight) */
  --space-component-x: var(--space-3);   /* 12px */
  --space-component-y: var(--space-2);   /* 8px */
  --card-padding-y:    var(--space-3);   /* 12px */
  --card-padding-x:    var(--space-3);   /* 12px */
  --section-padding-y: var(--space-5);
  --section-padding-x: var(--space-5);

  /* ===========================================================================
     GRID / LAYOUT
     =========================================================================== */
  --grid-gap:    var(--space-3);
  --grid-gap-sm: var(--space-2);
  --grid-gap-lg: var(--space-5);
  --page-padding:        var(--space-5);
  --page-padding-mobile: var(--space-4);
  --content-max-width:   1320px;
  --page-content-max:    1280px;
  --page-content-max-narrow: 860px;

  /* ===========================================================================
     INTENT TRIPLETS / MONEY / DISABLED
     =========================================================================== */
  --intent-success-bg: var(--color-success-bg); --intent-success-text: var(--color-success-text); --intent-success-border: var(--color-success-border);
  --intent-warning-bg: var(--color-warning-bg); --intent-warning-text: var(--color-warning-text); --intent-warning-border: var(--color-warning-border);
  --intent-danger-bg:  var(--color-danger-bg);  --intent-danger-text:  var(--color-danger-text);  --intent-danger-border:  var(--color-danger-border);
  --intent-info-bg:    var(--color-info-bg);    --intent-info-text:    var(--color-info-text);    --intent-info-border:    var(--color-info-border);
  --intent-neutral-bg: var(--srq-graphite-100); --intent-neutral-text: var(--srq-graphite-700);   --intent-neutral-border: var(--srq-graphite-300);

  --money-positive: var(--color-success-text);
  --money-negative: var(--color-danger-text);
  --money-zero:     var(--color-text-muted);

  --color-disabled:    var(--srq-graphite-400);
  --color-disabled-bg: var(--srq-graphite-100);
  --opacity-disabled:  0.55;

  /* ===========================================================================
     BREAKPOINTS (reference values for media queries)
     =========================================================================== */
  --bp-sm:  640px;
  --bp-md:  768px;
  --bp-lg:  1024px;
  --bp-xl:  1280px;
  --bp-2xl: 1536px;
}

/* =============================================================================
   COMPACT DENSITY — opt-in via <html data-density="compact">
   Every component that references the sizing tokens auto-tightens.
   ============================================================================= */
[data-density="compact"] {
  --btn-height-sm:   24px;
  --btn-height:      28px;
  --btn-height-lg:   34px;
  --input-height-sm: 26px;
  --input-height:    28px;
  --input-height-lg: 34px;
  --icon-btn-size:   28px;
  --font-size-base:  0.8125rem; /* 13px */
  --card-padding-y:  var(--space-2);
  --card-padding-x:  var(--space-2);
  --section-padding-y: var(--space-3);
  --section-padding-x: var(--space-4);
  --grid-gap:        var(--space-2);
  --page-padding:    var(--space-4);
}
