/**
 * FOTA-K colour tokens: the ONE place colours are defined.
 *
 * Loaded by includes/header.php before main.css on every dashboard page.
 * main.css aliases its short names (--teal, --em, --text, --border...) to
 * these, and the section stylesheets (assets/css/sections/*.css) and the
 * inline style="" colours in sections/*.php use them directly.
 *
 * Families (shades 50-950). Near-identical shades were merged into one
 * family each: gray/zinc/neutral -> slate, green -> emerald, cyan -> sky,
 * purple -> violet, pink -> rose, Bootstrap greys -> slate.
 * NOTE: the brand "teal" (--teal in main.css) is really sky-500; the
 * --teal-NNN family below is the true green-blue teal.
 *
 * To change a colour app-wide, change it here and bump SYSTEM_VERSION.
 * The app's one font is here too (--font-sans, first lines of :root).
 * Not used by: emails, PDF templates (mPDF has no var()), Chart.js colours.
 */
:root {
    /* ---- type: the one font of the app (4.9.79) ----
       Both families are loaded by includes/header.php (Google Fonts, not
       render-blocking). Manrope: Latin text and figures; it has tabular
       figures, so amounts line up where a rule asks for tabular-nums.
       IBM Plex Sans Arabic is only downloaded by a page that shows Arabic.
       Use var(--font-sans) in new CSS; do not name a font in a section. */
    --font-sans: 'Manrope', 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* slate: text, borders, surfaces */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --slate-950: #020617;

    /* sky: brand primary (#0ea5e9) */
    --sky-50: #f0f9ff;
    --sky-100: #e0f2fe;
    --sky-200: #bae6fd;
    --sky-300: #7dd3fc;
    --sky-400: #38bdf8;
    --sky-500: #0ea5e9;
    --sky-600: #0284c7;
    --sky-700: #0369a1;
    --sky-800: #075985;
    --sky-900: #0c4a6e;
    --sky-950: #082f49;

    /* emerald: positive / paid / income */
    --emerald-50: #ecfdf5;
    --emerald-100: #d1fae5;
    --emerald-200: #a7f3d0;
    --emerald-300: #6ee7b7;
    --emerald-400: #34d399;
    --emerald-500: #10b981;
    --emerald-600: #059669;
    --emerald-700: #047857;
    --emerald-800: #065f46;
    --emerald-900: #064e3b;
    --emerald-950: #022c22;

    /* amber: warning / pending */
    --amber-50: #fffbeb;
    --amber-100: #fef3c7;
    --amber-200: #fde68a;
    --amber-300: #fcd34d;
    --amber-400: #fbbf24;
    --amber-500: #f59e0b;
    --amber-600: #d97706;
    --amber-700: #b45309;
    --amber-800: #92400e;
    --amber-900: #78350f;
    --amber-950: #451a03;

    /* red: danger / overdue */
    --red-50: #fef2f2;
    --red-100: #fee2e2;
    --red-200: #fecaca;
    --red-300: #fca5a5;
    --red-400: #f87171;
    --red-500: #ef4444;
    --red-600: #dc2626;
    --red-700: #b91c1c;
    --red-800: #991b1b;
    --red-900: #7f1d1d;
    --red-950: #450a0a;

    /* blue: info, and "success" buttons (brand choice, see main.css) */
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-200: #bfdbfe;
    --blue-300: #93c5fd;
    --blue-400: #60a5fa;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --blue-800: #1e40af;
    --blue-900: #1e3a8a;
    --blue-950: #172554;

    /* indigo */
    --indigo-50: #eef2ff;
    --indigo-100: #e0e7ff;
    --indigo-200: #c7d2fe;
    --indigo-300: #a5b4fc;
    --indigo-400: #818cf8;
    --indigo-500: #6366f1;
    --indigo-600: #4f46e5;
    --indigo-700: #4338ca;
    --indigo-800: #3730a3;
    --indigo-900: #312e81;
    --indigo-950: #1e1b4b;

    /* violet */
    --violet-50: #f5f3ff;
    --violet-100: #ede9fe;
    --violet-200: #ddd6fe;
    --violet-300: #c4b5fd;
    --violet-400: #a78bfa;
    --violet-500: #8b5cf6;
    --violet-600: #7c3aed;
    --violet-700: #6d28d9;
    --violet-800: #5b21b6;
    --violet-900: #4c1d95;
    --violet-950: #2e1065;

    /* teal (true teal, not the brand colour) */
    --teal-50: #f0fdfa;
    --teal-100: #ccfbf1;
    --teal-200: #99f6e4;
    --teal-300: #5eead4;
    --teal-400: #2dd4bf;
    --teal-500: #14b8a6;
    --teal-600: #0d9488;
    --teal-700: #0f766e;
    --teal-800: #115e59;
    --teal-900: #134e4a;
    --teal-950: #042f2e;

    /* orange */
    --orange-50: #fff7ed;
    --orange-100: #ffedd5;
    --orange-200: #fed7aa;
    --orange-300: #fdba74;
    --orange-400: #fb923c;
    --orange-500: #f97316;
    --orange-600: #ea580c;
    --orange-700: #c2410c;
    --orange-800: #9a3412;
    --orange-900: #7c2d12;
    --orange-950: #431407;

    /* rose */
    --rose-50: #fff1f2;
    --rose-100: #ffe4e6;
    --rose-200: #fecdd3;
    --rose-300: #fda4af;
    --rose-400: #fb7185;
    --rose-500: #f43f5e;
    --rose-600: #e11d48;
    --rose-700: #be123c;
    --rose-800: #9f1239;
    --rose-900: #881337;
    --rose-950: #4c0519;

    /* ---- roles: use these in new code ---- */
    --c-primary: var(--sky-500);
    --c-primary-strong: var(--sky-600);
    --c-success: var(--emerald-500);
    --c-warning: var(--amber-500);
    --c-danger: var(--red-500);
    --c-info: var(--blue-500);
    --c-text: var(--slate-800);
    --c-muted: var(--slate-500);
    --c-border: var(--slate-200);
    --c-surface: #ffffff;
    --c-surface-alt: var(--slate-50);

    /* ---- data grid: every table (assets/css/datagrid.css) ---- */
    --dg-bg: #ffffff;
    --dg-head-bg: var(--slate-100);
    --dg-head-text: var(--slate-600);
    --dg-text: var(--slate-800);
    --dg-muted: var(--slate-500);
    --dg-frame: var(--slate-200);
    --dg-head-line: var(--slate-300);
    --dg-row-line: var(--slate-200);         /* between rows */
    --dg-col-line: var(--slate-200);         /* between columns; transparent = none */
    --dg-hover: rgba(14,165,233,.05);
    --dg-hover-strong: var(--slate-100);
    --dg-selected: rgba(14,165,233,.11);
    --dg-font: .84rem;
    --dg-head-font: .7rem;
    --dg-pad-x: 12px;
    --dg-pad-y: 10px;
    --dg-head-pad-y: 11px;
    --dg-radius: 12px;
    --dg-btn-size: 30px;
    --dg-btn-default: var(--slate-600);
    --dg-cb-edge: var(--slate-400);          /* row checkbox border (3:1 on white) */
    --dg-cb-on: var(--sky-600);              /* ticked / some ticked */
    --dg-bar-bg: var(--slate-900);           /* the floating bulk bar */
    --dg-bar-text: #ffffff;

    /* ---- motion (assets/js/fota-motion.js + main.css) ---- */
    --ease-out: cubic-bezier(.16, 1, .3, 1);      /* expo.out */
    --ease-in-out: cubic-bezier(.65, 0, .35, 1);  /* power2.inOut-ish */
    --dur-fast: .18s;
    --dur-ui: .28s;
    --dur-reveal: .55s;

    /* ---- UI kit: surfaces, radii, shadows (assets/css/ui.css) ----
       The look of the Invoices screen, as values every screen shares. */
    --ui-surface: #ffffff;
    --ui-surface-2: var(--slate-50);          /* popup footer, quiet bands */
    --ui-line: var(--slate-200);
    --ui-line-soft: var(--slate-100);
    --ui-title: var(--slate-900);
    --ui-text: var(--slate-800);
    --ui-muted: var(--slate-500);
    --ui-faint: var(--slate-500);             /* small labels: still readable on white */
    --ui-accent: var(--sky-500);              /* title icons, active marks */
    --ui-r-xl: 16px;                          /* page header, panels, popups */
    --ui-r-lg: 12px;                          /* stat cards, inner cards */
    --ui-r-md: 10px;                          /* buttons, fields */
    --ui-r-sm: 8px;                           /* tabs, small buttons */
    --ui-shadow-xs: 0 1px 2px rgba(15,23,42,.05);
    --ui-shadow-sm: 0 1px 3px rgba(15,23,42,.04), 0 4px 20px rgba(15,23,42,.05);
    --ui-shadow-md: 0 2px 6px rgba(15,23,42,.05), 0 14px 32px -10px rgba(15,23,42,.14);
    --ui-shadow-lg: 0 10px 24px -8px rgba(15,23,42,.16), 0 28px 70px -14px rgba(15,23,42,.32);
    --ui-strip: linear-gradient(90deg, var(--sky-500), var(--emerald-500), var(--blue-500));
    --ui-strip-h: 3px;
    --ui-head-pad: 22px 28px;                 /* page header */
    --ui-title-size: 1.3rem;
    --ui-sub-size: .8rem;

    /* ---- UI kit: buttons. One raised 3D recipe, a few tones ----
       Solid tones: top and bottom of the surface, its edge, the glow under it.
       White text must read on the middle of the surface (4.5:1 or more), so
       do not make a top colour lighter without checking that. */
    --tone-brand-1: #0e90d4;   --tone-brand-2: #075f96;   --tone-brand-edge: #064e7b;   --tone-brand-glow: rgba(3,105,161,.42);
    --tone-ink-1: #56657b;     --tone-ink-2: #1e293b;     --tone-ink-edge: #0f172a;     --tone-ink-glow: rgba(15,23,42,.34);
    --tone-danger-1: #f2545b;  --tone-danger-2: #b91c1c;  --tone-danger-edge: #991b1b;  --tone-danger-glow: rgba(220,38,38,.38);
    --tone-success-1: #12a274; --tone-success-2: #056245; --tone-success-edge: #064e3b; --tone-success-glow: rgba(4,120,87,.38);
    /* Pearl: the quiet white button. A tint only colours its text and icon. */
    --tone-pearl-1: #ffffff;   --tone-pearl-2: #edf1f6;   --tone-pearl-edge: var(--slate-300); --tone-pearl-edge-b: #b3bfce;
    --tone-pearl-ink: var(--slate-700);        --tone-pearl-glow: rgba(15,23,42,.12);
    --tone-pearl-rim: rgba(255,255,255,1);     --tone-pearl-press: #e3e9f0;
    /* A pearl button that is switched on (.active), an open menu button. */
    --tone-on-1: var(--sky-50);                --tone-on-2: var(--sky-100);
    --tone-on-ink: var(--sky-700);             --tone-on-edge: var(--sky-300);
    --tint-brand: var(--sky-700);
    --tint-danger: var(--red-600);
    --tint-amber: var(--amber-700);
    --tint-success: var(--emerald-700);
    --tint-violet: var(--violet-700);
    /* Sizes */
    --fb-h-md: 38px;  --fb-px-md: 16px;  --fb-fs-md: .84rem;  --fb-r-md: 10px;
    --fb-h-sm: 32px;  --fb-px-sm: 12px;  --fb-fs-sm: .78rem;  --fb-r-sm: 8px;
    --fb-h-lg: 46px;  --fb-px-lg: 24px;  --fb-fs-lg: .94rem;  --fb-r-lg: 12px;

    /* ---- UI kit: fields (inputs, selects, textareas) ---- */
    --ff-bg: #ffffff;
    --ff-line: var(--slate-300);
    --ff-line-hover: var(--slate-400);
    --ff-text: var(--slate-800);
    --ff-placeholder: var(--slate-400);
    --ff-focus: var(--sky-500);
    --ff-ring: rgba(14,165,233,.16);
    --ff-h-md: 38px;  --ff-h-sm: 32px;  --ff-h-lg: 46px;
    --ff-fs: .86rem;
    --ff-r: 10px;
}

/* Phones: finger sizes (same numbers mobile-app.css used). */
@media (max-width: 768px) {
    :root {
        --fb-h-md: 44px;  --fb-h-sm: 38px;  --fb-h-lg: 50px;
        --ff-h-md: 46px;  --ff-h-sm: 40px;  --ff-h-lg: 50px;
        --ui-head-pad: 16px 16px;
        --ui-title-size: 1.15rem;
    }
}

body.dark-mode {
    --c-text: var(--slate-200);
    --c-muted: var(--slate-400);
    --c-border: var(--slate-700);
    --c-surface: var(--slate-800);
    --c-surface-alt: var(--slate-900);
    --dg-bg: var(--slate-900);
    --dg-head-bg: var(--slate-800);
    --dg-head-text: var(--slate-300);
    --dg-text: var(--slate-200);
    --dg-muted: var(--slate-400);
    --dg-frame: rgba(148,163,184,.2);
    --dg-head-line: rgba(148,163,184,.4);
    --dg-row-line: rgba(148,163,184,.2);
    --dg-col-line: rgba(148,163,184,.2);
    --dg-hover: rgba(56,189,248,.07);
    --dg-hover-strong: rgba(148,163,184,.14);
    --dg-selected: rgba(56,189,248,.14);
    --dg-btn-default: var(--slate-300);
    --dg-cb-edge: var(--slate-500);
    --dg-cb-on: var(--sky-500);
    --dg-bar-bg: var(--slate-100);
    --dg-bar-text: var(--slate-900);

    --ui-surface: var(--slate-900);
    --ui-surface-2: #131c2e;
    --ui-line: rgba(148,163,184,.14);
    --ui-line-soft: rgba(148,163,184,.08);
    --ui-title: var(--slate-100);
    --ui-text: var(--slate-200);
    --ui-muted: var(--slate-400);
    --ui-faint: var(--slate-400);
    --ui-accent: var(--sky-400);
    --ui-shadow-xs: 0 1px 2px rgba(0,0,0,.3);
    --ui-shadow-sm: 0 1px 3px rgba(0,0,0,.3), 0 6px 22px rgba(0,0,0,.22);
    --ui-shadow-md: 0 2px 6px rgba(0,0,0,.3), 0 14px 32px -10px rgba(0,0,0,.5);
    --ui-shadow-lg: 0 10px 24px -8px rgba(0,0,0,.5), 0 28px 70px -14px rgba(0,0,0,.7);

    --tone-brand-glow: rgba(2,132,199,.5);
    --tone-ink-1: #64748b;     --tone-ink-2: #334155;     --tone-ink-edge: #1e293b;     --tone-ink-glow: rgba(0,0,0,.5);
    --tone-pearl-1: #34435a;   --tone-pearl-2: #1f2b3e;   --tone-pearl-edge: rgba(148,163,184,.3); --tone-pearl-edge-b: rgba(2,6,23,.6);
    --tone-pearl-ink: var(--slate-100);        --tone-pearl-glow: rgba(0,0,0,.45);
    --tone-pearl-rim: rgba(255,255,255,.1);    --tone-pearl-press: #18222f;
    --tone-on-1: #1c4a6b;                      --tone-on-2: #153a56;
    --tone-on-ink: var(--sky-200);             --tone-on-edge: rgba(56,189,248,.55);
    --tint-brand: var(--sky-300);
    --tint-danger: var(--red-300);
    --tint-amber: var(--amber-300);
    --tint-success: var(--emerald-300);
    --tint-violet: var(--violet-300);

    --ff-bg: #0d1626;
    --ff-line: rgba(148,163,184,.24);
    --ff-line-hover: rgba(148,163,184,.42);
    --ff-text: var(--slate-100);
    --ff-placeholder: var(--slate-500);
    --ff-focus: var(--sky-400);
    --ff-ring: rgba(56,189,248,.2);
}
