/* ============================================================================
   Ontech Design System — v1.0.0   (the standard for all Ontech applications)
   Brand: slate + emerald, Inter. Light + dark. WCAG-AA contrast guaranteed.

   USAGE — link this one file (after Bootstrap, before your app CSS):
     <link rel="stylesheet" href="/static/ontech-design/ontech-design.css">
   For dashboards/BI, also link the optional modules:
     color-coding.css · bi-tools.css · modern-components.css

   Single source of truth: /opt/ontech-design-system/v1/  (vendored per app).
   Do not fork — propose changes upstream and bump the version.
   ========================================================================== */

/* ---- TOKENS (light) ------------------------------------------------------- */
:root {
  /* Brand */
  --primary: #0f172a; --primary-light: #1e293b; --primary-dark: #020617;
  --accent: #10b981; --accent-dark: #059669; --accent-light: #d1fae5;
  --accent-strong: #047857;            /* emerald-700 — AA text/fill */
  --secondary: #3b82f6; --purple: #8b5cf6;
  --link: #2563eb;                     /* blue-600 — links (AA on white) */
  /* A11y CTA: white on --accent (#10b981) fails 4.5:1; buttons use --btn-bg */
  --btn-bg: #047857; --btn-on: #ffffff;          /* white on emerald-700 = 5.48 AA */
  --focus-ring: 0 0 0 3px rgba(15,23,42,.35);
  /* Status */
  --success: #16a34a; --warning: #f59e0b; --danger: #ef4444; --info: #3b82f6;
  /* Text (+ alias) */
  --text: #1e293b; --text-secondary: #475569; --text-light: #475569; --muted: #64748b;
  /* Surfaces (+ alias) */
  --bg: #ffffff; --panel: #ffffff; --bg-tertiary: #f4f6f8; --bg-alt: #f4f6f8;
  --border: #e2e8f0; --active-bg: #ecfdf5;
  --hair: rgba(15,23,42,.14); --hair-soft: rgba(15,23,42,.10);
  /* ICTM-module aliases (so optional modules resolve on-brand) */
  --primary-color: #0f172a; --accent-color: #10b981; --bi-primary: #10b981; --bi-secondary: #047857;
  --bi-gradient: linear-gradient(135deg,#10b981 0%,#047857 100%);
  --primary-gradient: linear-gradient(135deg,#10b981 0%,#047857 100%);
  --bg-primary: #ffffff; --bg-secondary: #f9fafb; --text-primary: #1f2937; --border-light: #e5e7eb;
  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05); --shadow-md: 0 4px 6px rgba(0,0,0,.07);
  --card-shadow: 0 10px 30px rgba(0,0,0,.08); --card-hover-shadow: 0 15px 40px rgba(0,0,0,.12);
  /* Radius / spacing / motion */
  --r-sm: 6px; --r-md: 9px; --r-lg: 12px; --r-xl: 16px; --r-pill: 999px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;
  --t-fast: .2s; --t-base: .3s; --ease: cubic-bezier(.4,0,.2,1);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
/* ---- TOKENS (dark) -------------------------------------------------------- */
:root[data-theme="dark"] {
  --primary: #e2e8f0; --primary-light: #cbd5e1; --primary-dark: #f8fafc;
  --accent: #34d399; --accent-dark: #10b981; --accent-light: #064e3b; --accent-strong: #34d399;
  --link: #60a5fa;
  --btn-bg: #34d399; --btn-on: #06281c;
  --focus-ring: 0 0 0 3px rgba(255,255,255,.35);
  --text: #e5e7eb; --text-secondary: #aeb9c7; --text-light: #aeb9c7; --muted: #94a3b8;
  --bg: #0f172a; --panel: #1e293b; --bg-tertiary: #334155; --bg-alt: #334155;
  --border: #334155; --active-bg: #064e3b;
  --hair: rgba(255,255,255,.18); --hair-soft: rgba(255,255,255,.12);
  --primary-color: #e2e8f0; --bi-primary: #34d399; --bi-secondary: #10b981;
  --bg-primary: #1e293b; --bg-secondary: #0f172a; --text-primary: #e5e7eb; --border-light: #334155;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 4px 6px rgba(0,0,0,.5);
}

/* ---- BASE ----------------------------------------------------------------- */
body { font-family: var(--font-sans); color: var(--text); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }
.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; }

/* ---- BRAND PRIMITIVES ----------------------------------------------------- */
.bi-title, .page-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; color: var(--text-primary); margin: 0; }
.bi-header { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; justify-content: space-between; margin-bottom: 1.5rem; }
.metric-card, .chart-card, .card { background: var(--panel); border: 1px solid var(--border-light); border-radius: var(--r-lg); }
.chart-card, .card { box-shadow: var(--card-shadow); }
.card:hover { box-shadow: var(--card-hover-shadow); }

/* ---- BUTTONS (AA-safe brand) --------------------------------------------- */
.btn-primary, .btn-modern-primary { background-color: var(--btn-bg) !important; border-color: var(--btn-bg) !important; color: var(--btn-on) !important; }
.btn-primary:hover, .btn-modern-primary:hover { filter: brightness(.93); }
:root { --bs-primary: #047857; --bs-primary-rgb: 4,120,87; }
.text-primary { color: var(--accent-strong) !important; } .bg-primary { background-color: var(--accent-strong) !important; }

/* ---- COMPAT: legacy class names auto-adopt the standard ------------------- */
.page-header { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-light); }
.page-description { color: var(--text-muted, var(--muted)); font-size: .875rem; margin: .25rem 0 0; }
.table > thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; }
/* Neutralise NAPSA purple the optional modules ship on .bi-dashboard */
.bi-dashboard { background: transparent !important; min-height: auto !important; padding: 0 !important; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
