/* Maksab admin design tokens.
   Loaded after adminator.css (which defines the same variable names) and before site.css, so every colour the template reads
   comes from here. Source of the brand values: maksab-brand-kit (tokens.css, INTEGRATION_GUIDE.md section 2).

   Rules kept here:
   - Every text colour is at least 4.5:1 on the surfaces it is used on (light and dark). The pairs were measured, see
     .scratch/ui-overhaul/ and tools/UiAudit (node audit.mjs).
   - Maksab Green is the primary. Cobalt is the brand's reward signal: it is used for "info" and for the reward series only, and
     stays small. Error is the brand red.
   - The chart palette was run through the data-viz validator (lightness band, chroma, colour-blind separation, contrast on the
     chart surface) for both themes. Slots are in the validated order; do not reorder or add hues.
   - Dark theme is built from the brand's own dark surfaces (Deep Nile and its steps). The brand kit has no admin dark mode, so the
     light green (#34C48B) is used for the primary on dark: an extension of the kit, flagged here on purpose. */

:root {
  /* brand constants (not themed) */
  --mk-nile-900: #0A2E24;
  --mk-green-700: #0B5C3B;
  --mk-green-500: #0F7A4F;
  --mk-green-400: #34C48B;
  --mk-green-300: #6FC59A;
  --mk-green-100: #C9E8D6;
  --mk-green-50: #E7F4EC;
  --mk-cobalt-700: #1E47C8;
  --mk-cobalt-500: #2F6EFF;
  --mk-cobalt-light: #7FB2FF;
  --mk-cobalt-100: #E3ECFF;
  --mk-cream: #FBF7EE;
  --mk-line: #E4DCC8;

  /* shape: the brand uses big radii in the subscriber app; the admin keeps the same family but tighter */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* 4px spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* font families: Latin text, headings and big numbers in Inter, Arabic in Cairo (also the fallback for mixed text), all self-hosted */
  --font-ui: "Inter", "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Inter", "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* type scale (sizes in px) */
  --text-xs: 11.5px;
  --text-sm: 13px;
  --text-md: 14.5px;
  --text-lg: 17px;
  --text-xl: 22px;
  --text-2xl: 30px;
  --text-3xl: 40px;
  /* keyboard focus: a 2px gap in the card colour, then a solid 2px ring in the primary colour (works on filled and plain controls, in every theme) */
  --focus-ring: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--primary);
}

:root[data-theme=light] {
  color-scheme: light;

  --frame: #EFE8D6;
  --bg-body: #FBF7EE;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --bg-hover: #F6F1E4;
  --bg-muted: #F4EFE2;

  --t-base: #10231C;
  --t-muted: #4A5A52;
  --t-light: #5B6A62;   /* the template used this for real text at 2.6:1; it is now 5:1 or better on every surface */
  --t-inverse: #FFFFFF;

  --border: #E4DCC8;
  --border-soft: #EEE7D5;

  --primary: #0F7A4F;
  --primary-light: #1B9A66;
  --primary-dark: #0B5C3B;
  --primary-soft: #E7F4EC;
  --primary-ring: rgba(15, 122, 79, .22);

  /* status and accent colours: each is 4.5:1 or better as text on white, on the page and on its own soft background */
  --success: #0B8230;
  --success-soft: #EAF8EE;
  --warning: #AD4F06;
  --warning-soft: #FEF3D6;
  --danger: #CF2A1E;
  --danger-soft: #FEEEEC;
  --info: #1D4ED8;
  --info-soft: #E0EAFF;
  --purple: #7430EA;
  --purple-soft: #F0EAFE;
  --pink: #C9145A;
  --pink-soft: #FEEAF2;
  --teal: #0A7A6F;
  --teal-soft: #DDF6F1;
  --orange: #C23C07;
  --orange-soft: #FEEBDD;

  --shadow-sm: 0 1px 2px 0 rgba(10, 46, 36, .05);
  --shadow-card: 0 1px 3px 0 rgba(10, 46, 36, .07), 0 1px 2px -1px rgba(10, 46, 36, .05);
  --shadow-lg: 0 10px 15px -3px rgba(10, 46, 36, .10), 0 4px 6px -4px rgba(10, 46, 36, .06);
  --overlay: rgba(251, 247, 238, .72);

  /* text on a solid colour fill (buttons, avatars, counters) */
  --on-fill: #FFFFFF;

  /* chart palette, validated order (light, on white): green, cobalt, amber, violet, magenta, aqua, burnt orange, slate (the neutral "Other") */
  --chart-1: #0E9F5C;
  --chart-2: #2563EB;
  --chart-3: #E08400;
  --chart-4: #7C3AED;
  --chart-5: #E11D74;
  --chart-6: #0891B2;
  --chart-7: #EA580C;
  --chart-8: #64748B;
}

:root[data-theme=dark] {
  color-scheme: dark;

  --frame: #06231B;
  --bg-body: #0A2E24;
  --bg-card: #123D31;
  --bg-sidebar: #0A2E24;
  --bg-hover: #174A3B;
  --bg-muted: #1A4A3C;

  --t-base: #F2F7F4;
  --t-muted: #A9C7B8;
  --t-light: #9DBFAE;
  --t-inverse: #0A2E24;

  --border: #245546;
  --border-soft: #1A4638;

  --primary: #34C48B;
  --primary-light: #6FC59A;
  --primary-dark: #1FA570;
  --primary-soft: #174A3B;
  --primary-ring: rgba(52, 196, 139, .30);

  --success: #4ADE80;
  --success-soft: #16452F;
  --warning: #FBBF24;
  --warning-soft: #4A3A12;
  --danger: #FF8A80;
  --danger-soft: #4D2424;
  --info: #7AA7FF;
  --info-soft: #1D3466;
  --purple: #B79CFF;
  --purple-soft: #352A63;
  --pink: #FF8EC0;
  --pink-soft: #5A2644;
  --teal: #2DD4BF;
  --teal-soft: #124B47;
  --orange: #FF9A5C;
  --orange-soft: #52301A;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .35);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, .30), 0 1px 2px -1px rgba(0, 0, 0, .25);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .45), 0 4px 6px -4px rgba(0, 0, 0, .35);
  --overlay: rgba(10, 46, 36, .72);

  --on-fill: #0A2E24;

  /* chart palette (dark, on the card surface #123D31): the same eight hues stepped for the dark surface */
  --chart-1: #22C07A;
  --chart-2: #4F8BFF;
  --chart-3: #F5A524;
  --chart-4: #9B7BFF;
  --chart-5: #F2569A;
  --chart-6: #1FB6D6;
  --chart-7: #FF7A2E;
  --chart-8: #8AA0B5;
}

:root {
  /* semantic aliases used by site.css and the chart partials */
  --text-good: var(--success);
  --text-bad: var(--danger);
  --chart-success: var(--chart-1);
  --chart-warning: var(--chart-3);

  /* the classes s1 to s8 that the pages already use keep their hue family (s1 aqua, s2 violet, s3 amber, s4 cobalt, s5 green,
     s6 magenta, s7 orange, s8 slate), so nothing that means "good" or "warning" changes meaning */
  --series-s1: var(--chart-6);
  --series-s2: var(--chart-4);
  --series-s3: var(--chart-3);
  --series-s4: var(--chart-2);
  --series-s5: var(--chart-1);
  --series-s6: var(--chart-5);
  --series-s7: var(--chart-7);
  --series-s8: var(--chart-8);
}

/* the template writes white text on every solid fill; on the dark theme's light fills that is unreadable (2.5:1), so the text colour
   is a token: white on light, Deep Nile on dark */
::selection { background: var(--primary); color: var(--on-fill); }
.btn--primary, .btn--success, .btn--danger, .btn--warning,
.nav-badge.pro, .icon-btn .count.danger, .icon-btn .count.info,
.workspace-avatar, .avatar, .dd-avatar,
.range-tabs a.is-active { color: var(--on-fill); }

/* the template's avatar is a green-to-violet gradient; the brand uses one colour */
.workspace-avatar, .avatar { background: var(--primary); }
