/* ==========================================================================
   Valus Teal — design tokens for the Loyalty Admin portal
   --------------------------------------------------------------------------
   Replaces color-purple-gradient.css in _LayoutNew and the sign-in pages.

   1. New tokens (--color-*, --space-*, --radius-* …) used by valus-theme.css.
   2. The app's existing variables (--theme-primary, --background-light,
      --text-color-dark …) remapped to the same palette, so every existing
      rule in theme.css / workflows.css / views that uses them turns teal
      without touching those files.

   Mode: html[data-theme="dark"] (set before first paint) and body.dark-mode
   (kept for the existing CSS and smart-loyalty-charts.js) are always set
   together by the layout script.

   Brand teal #0F9D8A is only 3.4:1 on white, so text and white-on-teal
   buttons use the deeper #087C70 (5.1:1). Source: Valus company profile.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Non-colour tokens (shared by both modes)
   -------------------------------------------------------------------------- */
:root {
  /* Typography */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --text-xs: 0.75rem;     /* 12px — captions, table meta */
  --text-sm: 0.8125rem;   /* 13px — table cells, helper text */
  --text-base: 0.875rem;  /* 14px — body, inputs, buttons */
  --text-md: 1rem;        /* 16px — card titles */
  --text-lg: 1.125rem;    /* 18px — section titles */
  --text-xl: 1.375rem;    /* 22px — page titles */
  --text-2xl: 1.75rem;    /* 28px — KPI values */
  --text-3xl: 2.25rem;    /* 36px — login headline */

  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --tracking-tight: -0.011em;
  --tracking-caps: 0.06em;

  /* Spacing (4px base) */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4  */
  --space-2: 0.5rem;   /* 8  */
  --space-3: 0.75rem;  /* 12 */
  --space-4: 1rem;     /* 16 */
  --space-5: 1.25rem;  /* 20 */
  --space-6: 1.5rem;   /* 24 */
  --space-8: 2rem;     /* 32 */
  --space-10: 2.5rem;  /* 40 */
  --space-12: 3rem;    /* 48 */
  --space-16: 4rem;    /* 64 */

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* Sizing */
  --control-h-sm: 30px;
  --control-h: 38px;
  --control-h-lg: 44px;
  --sidebar-w: 256px;
  --sidebar-w-collapsed: 72px;
  --header-h: 64px;
  --content-max: 1440px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --duration-fast: 120ms;
  --duration: 180ms;
  --duration-slow: 260ms;

  /* Chart series colours used by js/colors.js (same in both modes) and the legends next to those charts */
  --color-series-1: #0F9D8A;
  --color-series-2: #8C54C4;
  --color-series-3: #5CC7B6;
  --color-series-4: #B48AE6;

  /* Layers */
  --z-sidebar: 1030;
  --z-header: 1020;
  --z-dropdown: 1040;
  --z-backdrop: 1050;
  --z-modal: 1060;
  --z-toast: 1080;

}

/* --------------------------------------------------------------------------
   2. Light
   Cool off-white surfaces, deep-ink sidebar (like the profile's dark slides),
   teal leads, purple is a sparing accent.
   -------------------------------------------------------------------------- */
:root,
:root[data-theme="light"] {
  color-scheme: light;

  /* Surfaces */
  --color-bg: #F2F6F5;
  --color-surface: #FFFFFF;
  --color-surface-raised: #FFFFFF;
  --color-surface-sunken: #EAF1EF;
  --color-surface-hover: #EFF5F3;
  --color-border: #DCE6E3;
  --color-border-strong: #C2D1CD;

  /* Text */
  --color-text: #12201E;
  --color-text-secondary: #42504D;
  --color-text-muted: #5A6865;
  --color-text-inverse: #FFFFFF;

  /* Primary (brand teal, deepened for text and white labels) */
  --color-primary: #087C70;
  --color-primary-hover: #066A5F;
  --color-primary-active: #05594F;
  --color-on-primary: #FFFFFF;
  --color-primary-soft: #E3F4F0;
  --color-primary-soft-text: #065F55;
  --color-brand: #0F9D8A;

  /* Accent (brand purple) */
  --color-accent: #7A45B5;
  --color-accent-hover: #683A9C;
  --color-on-accent: #FFFFFF;
  --color-accent-soft: #F1E9F9;
  --color-accent-soft-text: #5E3291;
  --color-link: #066C61;
  --color-focus-ring: #0F9D8A59;

  /* Semantic */
  --color-success: #3D7A4F;
  --color-success-soft: #E0EEE2;
  --color-success-text: #2F633F;
  --color-warning: #9A6A12;
  --color-warning-soft: #F6EBD2;
  --color-warning-text: #74500C;
  --color-danger: #A9473A;
  --color-danger-soft: #F5E0DB;
  --color-danger-text: #8C3628;
  --color-info: #3B6687;
  --color-info-soft: #DFE8F0;
  --color-info-text: #2E5370;
  --color-neutral-soft: #E8EFED;
  --color-neutral-text: #42504D;

  /* Sidebar — deep ink-teal */
  --color-nav-bg: #0D1F20;
  --color-nav-border: #0D1F20;
  --color-nav-text: #DCE8E6;
  --color-nav-text-muted: #A3B8B4;
  --color-nav-section: #8FA6A2;
  --color-nav-hover-bg: #FFFFFF12;
  --color-nav-active-bg: #34D0BC24;
  --color-nav-active-text: #FFFFFF;
  --color-nav-indicator: #34D0BC;
  --color-nav-brand: #FFFFFF;
  --color-nav-mark-bg: #34D0BC;
  --color-nav-mark-text: #062A26;

  /* Login hero panel */
  --color-hero-bg: #0B1A1C;
  --color-hero-text: #F2F6F5;
  --color-hero-muted: #A9BDB9;
  --color-hero-line: #FFFFFF12;

  /* Forms */
  --color-input-bg: #FFFFFF;
  --color-input-border: #CFDCD8;
  --color-input-placeholder: #82918E;
  --color-input-disabled: #EDF2F1;

  /* Overlays & misc */
  --color-backdrop: #0B161880;
  --color-skeleton: #E5EDEB;
  --color-skeleton-shine: #F4F8F7;
  --color-tooltip-bg: #12201E;
  --color-tooltip-text: #F2F6F5;
  --color-selection: #0F9D8A33;
  --color-scrollbar: #C2D1CD;

  /* Data visualisation — teal, purple, then the profile's blue/pink gradient stops */
  --color-chart-1: #0F9D8A;
  --color-chart-2: #8C54C4;
  --color-chart-3: #3B82C4;
  --color-chart-4: #5CC7B6;
  --color-chart-5: #C25FA8;
  --color-chart-6: #C9963E;
  --color-chart-grid: #E3EBE9;
  --color-chart-text: #5A6865;

  /* Elevation */
  --shadow-xs: 0 1px 1px #0B20200A;
  --shadow-sm: 0 1px 2px #0B20200F, 0 1px 3px #0B20200A;
  --shadow-md: 0 4px 16px -4px #0B20201F;
  --shadow-lg: 0 18px 44px -12px #0B202038;

  /* Glass (always on) */
  --color-glass-border: #FFFFFFA6;
  --color-glass-highlight: #FFFFFFCC;
  --glass-surface-mix: 68%;   /* how much of --color-surface stays opaque */
  --glass-nav-mix: 94%;       /* sidebar stays mostly opaque so small nav text keeps AA */
  --glass-blur: 18px;
  --glass-orb-strength: 20%;  /* tint of the background colour washes */
}

/* --------------------------------------------------------------------------
   3. Dark
   Near-black ink with teal and purple glows, as on the profile's dark slides.
   -------------------------------------------------------------------------- */
:root[data-theme="dark"],
:root body.dark-mode {
  color-scheme: dark;

  --color-bg: #0A1315;
  --color-surface: #111D20;
  --color-surface-raised: #172529;
  --color-surface-sunken: #0D181A;
  --color-surface-hover: #162327;
  --color-border: #203135;
  --color-border-strong: #2F4549;

  --color-text: #E6EFEE;
  --color-text-secondary: #B6C6C3;
  --color-text-muted: #8DA19E;
  --color-text-inverse: #0A1315;

  --color-primary: #34D0BC;
  --color-primary-hover: #52DBC9;
  --color-primary-active: #22B9A6;
  --color-on-primary: #04211D;
  --color-primary-soft: #34D0BC1F;
  --color-primary-soft-text: #7FE3D6;
  --color-brand: #34D0BC;

  --color-accent: #B48AE6;
  --color-accent-hover: #C29FEC;
  --color-on-accent: #1E1030;
  --color-accent-soft: #B48AE61F;
  --color-accent-soft-text: #CDB2F0;
  --color-link: #4FD8C6;
  --color-focus-ring: #34D0BC66;

  --color-success: #7CC08D;
  --color-success-soft: #7CC08D1F;
  --color-success-text: #9AD3A8;
  --color-warning: #E2B25F;
  --color-warning-soft: #E2B25F1F;
  --color-warning-text: #EBC57F;
  --color-danger: #E8907E;
  --color-danger-soft: #E8907E21;
  --color-danger-text: #F0AA9B;
  --color-info: #8DB4D6;
  --color-info-soft: #8DB4D61F;
  --color-info-text: #A9C7E2;
  --color-neutral-soft: #FFFFFF0F;
  --color-neutral-text: #B6C6C3;

  --color-nav-bg: #081012;
  --color-nav-border: #172529;
  --color-nav-text: #D2DFDD;
  --color-nav-text-muted: #8DA19E;
  --color-nav-section: #7E928F;
  --color-nav-hover-bg: #FFFFFF0D;
  --color-nav-active-bg: #34D0BC1F;
  --color-nav-active-text: #B5F0E7;
  --color-nav-indicator: #34D0BC;
  --color-nav-brand: #E6EFEE;
  --color-nav-mark-bg: #34D0BC;
  --color-nav-mark-text: #04211D;

  --color-hero-bg: #081012;
  --color-hero-text: #E6EFEE;
  --color-hero-muted: #9CB0AD;
  --color-hero-line: #FFFFFF0F;

  --color-input-bg: #0D181A;
  --color-input-border: #2B3F43;
  --color-input-placeholder: #748885;
  --color-input-disabled: #142023;

  --color-backdrop: #000000B3;
  --color-skeleton: #18272A;
  --color-skeleton-shine: #213337;
  --color-tooltip-bg: #E6EFEE;
  --color-tooltip-text: #111D20;
  --color-selection: #34D0BC40;
  --color-scrollbar: #2B3F43;

  --color-chart-1: #34D0BC;
  --color-chart-2: #B48AE6;
  --color-chart-3: #6AA8E8;
  --color-chart-4: #1F9C8B;
  --color-chart-5: #E08CC4;
  --color-chart-6: #E2B25F;
  --color-chart-grid: #1C2B2E;
  --color-chart-text: #8DA19E;

  --shadow-xs: 0 1px 1px #00000033;
  --shadow-sm: 0 1px 2px #0000004D;
  --shadow-md: 0 6px 20px -6px #00000080;
  --shadow-lg: 0 22px 52px -12px #0000008C;

  --color-glass-border: #FFFFFF14;
  --color-glass-highlight: #FFFFFF0F;
  --glass-surface-mix: 62%;
  --glass-nav-mix: 88%;
  --glass-orb-strength: 30%;
}

/* --------------------------------------------------------------------------
   4. Existing app variables → Valus Teal (light)
   -------------------------------------------------------------------------- */
:root {
    --theme-primary: #087C70;
    --theme-primary-opacity: #0F9D8A22;
    --theme-secondary: #066A5F;
    --theme-light: #CDEEE8;
    --theme-light-secondary: #E3F4F0;
    --background-primary: #EAF1EF;
    --background-secondary: #F2F6F5;
    --background-light: #FFFFFF;
    --background-darker: #C2D1CD;
    --text-color-light: #42504D;
    --text-color-dark: #12201E;
    --field-text-color: #12201E;
    --color-white: #FFFFFF;
    --color-black: #000000;
    --button-secondary: #EAF1EF;
    --button-secondary-hover: #DCE6E3;
    --input-text-color: #12201E;
    --input-border-color: #CFDCD8;
    --input-background: #FFFFFF;
    --input-radio-background: #E3EBE9;
    --grid-color: #E3EBE9;
    --color-green: #3D7A4F;
    --color-red: #A9473A;
    --color-success-light: #E0EEE2;
    --color-danger-light: #F5E0DB;
    --color-warning-light: #F6EBD2;
    --table-even: #FFFFFF;
    --table-odd: #F6F9F8;
    --table-hover: #EFF5F3;
    --workflow-green: #087C70;
    --workflow-yellow: #9A6A12;
    --workflow-red: #A9473A;
    --toast-success-background: #E0EEE2;
    --toast-success-color: #2F633F;
    --toast-danger-background: #F5E0DB;
    --toast-danger-color: #8C3628;
    --toast-warning-background: #F6EBD2;
    --toast-warning-color: #74500C;
    --table-header-left: none;
    --table-header-right: none;
    --background-style-01: none;
    --background-style-02: none;
    --background-style-03: none;
}

/* --------------------------------------------------------------------------
   5. Existing app variables → Valus Teal (dark)
   --color-white / --color-black stay inverted, as the app expects.
   -------------------------------------------------------------------------- */
:root[data-theme="dark"],
:root body.dark-mode {
    --theme-primary: #34D0BC;
    --theme-primary-opacity: #34D0BC22;
    --theme-secondary: #22B9A6;
    --theme-light: #163B37;
    --theme-light-secondary: #1A3431;
    --background-primary: #172529;
    --background-secondary: #0A1315;
    --background-light: #111D20;
    --background-darker: #2F4549;
    --text-color-light: #B6C6C3;
    --text-color-dark: #E6EFEE;
    --field-text-color: #E6EFEE;
    --color-white: #000000;
    --color-black: #FFFFFF;
    --button-secondary: #1C2D31;
    --button-secondary-hover: #23373C;
    --input-text-color: #E6EFEE;
    --input-border-color: #2B3F43;
    --input-background: #0D181A;
    --input-radio-background: #2B3F43;
    --grid-color: #1C2B2E;
    --color-green: #7CC08D;
    --color-red: #E8907E;
    --color-success-light: #1D3324;
    --color-danger-light: #3A2320;
    --color-warning-light: #3A2F1A;
    --table-even: #111D20;
    --table-odd: #142226;
    --table-hover: #182A2E;
    --workflow-green: #34D0BC;
    --workflow-yellow: #E2B25F;
    --workflow-red: #E8907E;
    --toast-success-background: #1D3324;
    --toast-success-color: #9AD3A8;
    --toast-danger-background: #3A2320;
    --toast-danger-color: #F0AA9B;
    --toast-warning-background: #3A2F1A;
    --toast-warning-color: #EBC57F;
}
