/* ClosingGrid — design tokens
 * Neutral admin palette (gray topbar, white content, blue accents).
 * Per-tenant brand colors override via base.html <style> from companies.branding_jsonb (M2.2).
 */

:root {
  /* Brand (overridable per tenant) */
  --cg-brand-primary: #2563eb;
  --cg-brand-primary-hover: #1d4ed8;
  --cg-brand-primary-active: #1e40af;
  --cg-brand-accent: #0ea5e9;

  /* Neutrals */
  --cg-gray-50:  #f9fafb;
  --cg-gray-100: #f3f4f6;
  --cg-gray-200: #e5e7eb;
  --cg-gray-300: #d1d5db;
  --cg-gray-400: #9ca3af;
  --cg-gray-500: #6b7280;
  --cg-gray-600: #4b5563;
  --cg-gray-700: #374151;
  --cg-gray-800: #1f2937;
  --cg-gray-900: #111827;
  --cg-gray-950: #030712;

  /* Surfaces */
  --cg-bg:           var(--cg-gray-50);
  --cg-surface:      #ffffff;
  --cg-surface-2:    var(--cg-gray-100);
  --cg-surface-hover:var(--cg-gray-100);
  --cg-topbar-bg:    #f4f5f7;
  --cg-sidebar-bg:   #ffffff;
  --cg-border:       var(--cg-gray-200);
  --cg-border-strong:var(--cg-gray-300);

  /* Text */
  --cg-text:         var(--cg-gray-900);
  --cg-text-muted:   var(--cg-gray-600);
  --cg-text-subtle:  var(--cg-gray-500);
  --cg-text-on-brand:#ffffff;

  /* Semantic */
  --cg-success:      #16a34a;
  --cg-success-bg:   #dcfce7;
  --cg-success-text: #166534;
  --cg-warning:      #d97706;
  --cg-warning-bg:   #fef3c7;
  --cg-warning-text: #92400e;
  --cg-danger:       #dc2626;
  --cg-danger-bg:    #fee2e2;
  --cg-danger-text:  #991b1b;
  --cg-info:         #0284c7;
  --cg-info-bg:      #e0f2fe;
  --cg-info-text:    #075985;

  /* Order status pills */
  --cg-status-new-bg:        #eff6ff;
  --cg-status-new-text:      #1d4ed8;
  --cg-status-scheduling-bg: #fef3c7;
  --cg-status-scheduling-text:#92400e;
  --cg-status-assigned-bg:   #ede9fe;
  --cg-status-assigned-text: #5b21b6;
  --cg-status-confirmed-bg:  #cffafe;
  --cg-status-confirmed-text:#155e75;
  --cg-status-completed-bg:  #dcfce7;
  --cg-status-completed-text:#166534;
  --cg-status-closed-bg:     #f3f4f6;
  --cg-status-closed-text:   #374151;
  --cg-status-canceled-bg:   #fee2e2;
  --cg-status-canceled-text: #991b1b;
  --cg-status-onhold-bg:     #fef3c7;
  --cg-status-onhold-text:   #78350f;

  /* Spacing scale (4px base) */
  --cg-s-0: 0;
  --cg-s-1: 4px;
  --cg-s-2: 8px;
  --cg-s-3: 12px;
  --cg-s-4: 16px;
  --cg-s-5: 20px;
  --cg-s-6: 24px;
  --cg-s-8: 32px;
  --cg-s-10:40px;
  --cg-s-12:48px;
  --cg-s-16:64px;

  /* Type scale */
  --cg-font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --cg-font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --cg-t-xs:   11px;
  --cg-t-sm:   13px;
  --cg-t-base: 14px;
  --cg-t-md:   15px;
  --cg-t-lg:   17px;
  --cg-t-xl:   20px;
  --cg-t-2xl:  24px;
  --cg-t-3xl:  30px;
  --cg-lh-tight:  1.25;
  --cg-lh-normal: 1.5;
  --cg-fw-regular:  400;
  --cg-fw-medium:   500;
  --cg-fw-semibold: 600;

  /* Radii */
  --cg-r-sm: 4px;
  --cg-r-md: 6px;
  --cg-r-lg: 8px;
  --cg-r-xl: 12px;
  --cg-r-pill: 9999px;

  /* Shadows */
  --cg-shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --cg-shadow-md: 0 2px 6px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --cg-shadow-lg: 0 10px 30px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.04);

  /* Layout */
  --cg-topbar-h:     56px;
  --cg-sidebar-w:    232px;
  --cg-sidebar-w-sm: 64px;
  --cg-z-sidebar:    20;
  --cg-z-topbar:     30;
  --cg-z-dropdown:   40;
  --cg-z-modal:      50;
  --cg-z-toast:      60;
  --cg-z-palette:    70;
}

@media (prefers-color-scheme: dark) {
  :root {
    --cg-bg:           var(--cg-gray-950);
    --cg-surface:      var(--cg-gray-900);
    --cg-surface-2:    var(--cg-gray-800);
    --cg-surface-hover:var(--cg-gray-800);
    --cg-topbar-bg:    var(--cg-gray-900);
    --cg-sidebar-bg:   var(--cg-gray-900);
    --cg-border:       var(--cg-gray-800);
    --cg-border-strong:var(--cg-gray-700);
    --cg-text:         var(--cg-gray-100);
    --cg-text-muted:   var(--cg-gray-400);
    --cg-text-subtle:  var(--cg-gray-500);
  }
}
