/* ==========================================================================
   ARIA palette: the ONE place the app's colours are chosen.
   - The seven theme colours are --sym-1 .. --sym-7.
   - The role tokens below map them onto the names the rest of the CSS uses
     (--primary, --success, ...). Change a role to re-skin a part of the app, or
     change a --sym-* value to re-skin everything that uses it.
   - The palette is chosen on My Profile (theme.js saves it as <html data-aria-palette="metronorth|vecs">).
     Everything below applies to Metro North only: each selector is guarded with
     :not([data-aria-palette="vecs"]), so VECS falls back to the original colours at the top of app.css
     (blue, green, amber, red). To add a palette, give it its own block here, guard Metro North's against it too,
     and keep contrast: text on --primary / --success must stay at 4.5:1 or better.
   Contrast (white text on the fill): sym-7 15:1, sym-6 10:1, sym-5 6.0:1, sym-1 4.8:1.
   sym-3 is 4.4:1 (large text and icons only); sym-2 and sym-4 are light and are
   used only as tints or with dark text.
   Loaded after app.css, so these win over the old defaults.
   ========================================================================== */
:root:not([data-aria-palette="vecs"]) {
    --sym-1: #007e8e;   /* deep teal */
    --sym-2: #85a1ca;   /* soft steel blue */
    --sym-3: #477bb3;   /* mid blue */
    --sym-4: #00adb6;   /* bright teal */
    --sym-5: #0168a5;   /* strong blue */
    --sym-6: #233d66;   /* navy */
    --sym-7: #00214d;   /* deep navy */

    /* identity / structure */
    --primary: var(--sym-5);
    --primary-dark: var(--sym-7);
    --primary-light: var(--sym-1);
    --primary-faded: color-mix(in srgb, var(--sym-7) 31%, transparent);
    --primary-pastel: var(--sym-2);
    --primary-pastel-faded: color-mix(in srgb, var(--sym-2) 31%, transparent);
    --primary-pastel-pale: color-mix(in srgb, var(--sym-2) 55%, #fff);
    --brand-bar: var(--sym-6);

    /* "complete / ok" statuses are teal */
    --success: var(--sym-1);
    --success-dark: color-mix(in srgb, var(--sym-1) 80%, #000);
    --success-light: var(--sym-4);
    --success-pastel: color-mix(in srgb, var(--sym-4) 30%, #fff);
    --success-faded: color-mix(in srgb, var(--sym-1) 68%, transparent);
    /* "in progress", "urgent" and "critical / incomplete" statuses use the palette too, so nothing looks like VESPA's amber and red.
       Statuses are always backed by words, dots, ticks and crosses, never colour alone. Validation errors (--error) stay red. */
    --secondary: var(--sym-3);
    --secondary-dark: var(--sym-3);
    --secondary-light: color-mix(in srgb, var(--sym-3) 45%, #fff);
    --secondary-pastel: color-mix(in srgb, var(--sym-3) 22%, #fff);
    --secondary-faded: color-mix(in srgb, var(--sym-3) 31%, transparent);
    --tertiary: var(--sym-4);
    --error-dark: var(--sym-6);
    --error-light: var(--sym-2);
    --error-pastel: color-mix(in srgb, var(--sym-6) 22%, #fff);
    --error-faded: color-mix(in srgb, var(--sym-6) 49%, transparent);
}

/* Night: the same roles, lifted so text, borders and tints stay readable on the dark surfaces (4.5:1 or better for text). */
:root:not([data-aria-palette="vecs"])[data-aria-mode="night"] {
    --primary: color-mix(in srgb, var(--sym-5) 55%, #fff);
    --primary-light: var(--sym-4);
    --success: var(--sym-4);
    --success-dark: var(--sym-4);
    --secondary: var(--sym-3);
    --secondary-dark: color-mix(in srgb, var(--sym-3) 70%, #fff);
    --tertiary: color-mix(in srgb, var(--sym-4) 55%, #fff);
    --error-dark: var(--sym-2);
    --error-faded: color-mix(in srgb, var(--sym-2) 49%, transparent);
}

/* Header and footer: a deep navy sweep with a thin teal-to-blue "signal" line, instead of a flat bar */
:root:not([data-aria-palette="vecs"]) .qvh-topbar.bg-brand-bar {
    background:
        linear-gradient(90deg, var(--sym-4), var(--sym-5) 55%, var(--sym-2)) bottom / 100% 3px no-repeat,
        linear-gradient(100deg, var(--sym-7) 0%, var(--sym-6) 62%, color-mix(in srgb, var(--sym-5) 80%, var(--sym-6)) 100%);
}
:root:not([data-aria-palette="vecs"]) footer.bg-brand-bar {
    background:
        linear-gradient(90deg, var(--sym-2), var(--sym-5) 45%, var(--sym-4)) top / 100% 3px no-repeat,
        linear-gradient(100deg, var(--sym-6) 0%, var(--sym-7) 100%);
}
:root:not([data-aria-palette="vecs"])[data-aria-mode="night"] .qvh-topbar.bg-brand-bar {
    background:
        linear-gradient(90deg, var(--sym-4), var(--sym-5) 55%, var(--sym-2)) bottom / 100% 3px no-repeat,
        linear-gradient(100deg, #00132f 0%, color-mix(in srgb, var(--sym-7) 70%, var(--sym-6)) 100%);
}
:root:not([data-aria-palette="vecs"])[data-aria-mode="night"] footer.bg-brand-bar {
    background:
        linear-gradient(90deg, var(--sym-2), var(--sym-5) 45%, var(--sym-4)) top / 100% 3px no-repeat,
        linear-gradient(100deg, #00132f 0%, #00183a 100%);
}

/* Night: Acute Outreach car tile. Clearer rows (a stronger tint per car, no dark button fill on top) and near-white text. */
:root:not([data-aria-palette="vecs"])[data-aria-mode="night"] #PersistentWidgets .tile-car {
    background: color-mix(in srgb, var(--accent) 24%, var(--surface-card)) !important;
}
:root:not([data-aria-palette="vecs"])[data-aria-mode="night"] #PersistentWidgets .tile-car + .tile-car {
    border-top: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
}
:root:not([data-aria-palette="vecs"])[data-aria-mode="night"] #PersistentWidgets .tile-car-row,
:root:not([data-aria-palette="vecs"])[data-aria-mode="night"] #PersistentWidgets .tile-car-row:hover {
    background: transparent !important; border-color: transparent !important; color: #eef3f7 !important;
}
:root:not([data-aria-palette="vecs"])[data-aria-mode="night"] #PersistentWidgets .tile-car-row:hover { background: rgba(255,255,255,.08) !important; }
:root:not([data-aria-palette="vecs"])[data-aria-mode="night"] #PersistentWidgets .tile-car-name,
:root:not([data-aria-palette="vecs"])[data-aria-mode="night"] #PersistentWidgets .tile-car-row .tile-status-label,
:root:not([data-aria-palette="vecs"])[data-aria-mode="night"] #PersistentWidgets .tile-car-row .tile-status-count { color: #eef3f7 !important; }

/* Acute Outreach cars: each car has its own tint, in the palette (AM plain, MID blue, PM teal), in Light and Dark */
:root:not([data-aria-palette="vecs"]) #PersistentWidgets .tile-car.car-am { background: #fff; }
:root:not([data-aria-palette="vecs"]) #PersistentWidgets .tile-car.car-mid { background: color-mix(in srgb, var(--sym-2) 24%, #fff); }
:root:not([data-aria-palette="vecs"]) #PersistentWidgets .tile-car.car-pm { background: color-mix(in srgb, var(--sym-4) 16%, #fff); }
:root:not([data-aria-palette="vecs"]) #PersistentWidgets .car-am .button-outline,
:root:not([data-aria-palette="vecs"]) #PersistentWidgets .car-am hr { border-color: color-mix(in srgb, var(--sym-6) 35%, #fff) !important; }
:root:not([data-aria-palette="vecs"]) #PersistentWidgets .car-mid .button-outline,
:root:not([data-aria-palette="vecs"]) #PersistentWidgets .car-mid hr { border-color: var(--sym-3) !important; }
:root:not([data-aria-palette="vecs"]) #PersistentWidgets .car-pm .button-outline,
:root:not([data-aria-palette="vecs"]) #PersistentWidgets .car-pm hr { border-color: var(--sym-1) !important; }
:root:not([data-aria-palette="vecs"])[data-aria-mode="night"] #PersistentWidgets .tile-car.car-am { background: color-mix(in srgb, #fff 7%, var(--surface-card)) !important; }
:root:not([data-aria-palette="vecs"])[data-aria-mode="night"] #PersistentWidgets .tile-car.car-mid { background: color-mix(in srgb, var(--sym-3) 30%, var(--surface-card)) !important; }
:root:not([data-aria-palette="vecs"])[data-aria-mode="night"] #PersistentWidgets .tile-car.car-pm { background: color-mix(in srgb, var(--sym-4) 26%, var(--surface-card)) !important; }
