/* =====================================================================
   KYNSAYS THEME — "Convergence"
   ---------------------------------------------------------------------
   The single source of truth for how Kynsays looks: colours, type,
   spacing, radii, shadows, motion and chart colours.
   Spec: docs/BRAND.md (contrast ratios and colour-blind checks there).
   Midnight Navy (html.dark-mode) is the default for the app and the
   workspace pages; light is the switch and the public site's theme.
   Elements with class .kyn-navy (app sidebar and top bar, public header
   and footer) use the navy token set in either theme.

   Rules for editing
   - Pages and skins use the semantic tokens (--kyn-bg, --kyn-surface,
     --kyn-text, --kyn-primary, ...). The raw --brand-* colours are only
     read by this file and by the logo.
   - Primary actions are blue (--kyn-primary #2B63F0, white text 5.07:1).
     Violet and cyan are accents: icons, small highlights, the logo,
     the loader, data series. They never fill a button or carry meaning
     on their own.
   - The brand gradient (--kyn-gradient-brand) is for the logo, the
     loader sweep, one hero element and the module-card hover edge.
     Its line form (--kyn-gradient-line, violet -> blue -> cyan) is the
     accent rule under headings and active tabs. Never a fill for buttons,
     cards, charts, backgrounds or text.
   - Cards are flat with a 1px border. Shadows (--kyn-shadow-1..3) are
     for sticky bars, menus, popovers, toasts and modals.
   - Colours used with transparency have a "-rgb" twin written as three
     space-separated numbers (e.g. 43 99 240). Keep both in sync.
   - Tokens built from other tokens go in the "derived" block, which is
     declared again on every .kyn-navy subtree.
   - --accent must be a 6-digit hex value (the app derives shades from it).
   - Chart colours are read by the charts when the theme is applied.
     Slots 1-3 are the three brand accents (blue, cyan, violet); 4-8 are
     neutrals. Charts with more than three series label them directly
     or with a legend. Slots 9-12 repeat 1-4 (docs/BRAND.md 4).
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+Arabic:wght@400;500;600;700&display=swap');

:root,html:not(.dark-mode) .kyn-navy .kyn-pop{
  color-scheme:light;

  /* ---------- brand palette (raw) ---------- */
  --brand-navy:#080D1D;
  --brand-violet:#7A3CFF;
  --brand-blue:#2F6BFF;
  --brand-cyan:#00D1D1;
  --brand-cyan-strong:#009C9C;
  --brand-ice:#E9F2FF;
  --brand-ink:#111827;
  --brand-slate:#78839A;
  --brand-white:#FFFFFF;
  --brand-black:#000000;
  --brand-navy-rgb:8 13 29;  --brand-violet-rgb:122 60 255;  --brand-blue-rgb:47 107 255;  --brand-cyan-rgb:0 209 209;

  /* ---------- logo parts ---------- */
  --kyn-logo-stem:var(--brand-violet);
  --kyn-logo-upper:var(--brand-blue);
  --kyn-logo-lower:var(--brand-cyan-strong);
  --kyn-gradient-brand:linear-gradient(135deg,#7A3CFF 0%,#2F6BFF 55%,#009C9C 100%);
  --kyn-gradient-line:linear-gradient(90deg,#7A3CFF 0%,#2F6BFF 50%,#009C9C 100%);
  --kyn-gradient-line-rtl:linear-gradient(270deg,#7A3CFF 0%,#2F6BFF 50%,#009C9C 100%);

  /* ---------- surfaces ---------- */
  --kyn-bg:#F5F5F7;              --kyn-bg-rgb:245 245 247;
  --kyn-surface:#FFFFFF;         --kyn-surface-rgb:255 255 255;
  --kyn-surface-raised:#FFFFFF;
  --kyn-surface-sunken:#F0F2F6;
  --kyn-surface-brand:#E9F2FF;
  --kyn-overlay:rgb(8 13 29 / .5);
  --kyn-scrim:rgb(8 13 29 / .72);          /* behind labels drawn on photos and video stills */
  --kyn-on-scrim:#FFFFFF;           --kyn-on-scrim-rgb:255 255 255;

  /* ---------- text ---------- */
  --kyn-text:#111827;            --kyn-text-rgb:17 24 39;
  --kyn-text-2:#5B657A;
  --kyn-text-disabled:#8A94A8;
  --kyn-text-on-primary:#FFFFFF;

  /* ---------- borders ---------- */
  --kyn-border:#D9DEE8;          --kyn-border-rgb:217 222 232;
  --kyn-border-control:#78839A;
  --kyn-border-strong:#111827;

  /* ---------- interactive ---------- */
  --kyn-primary:#2B63F0;         --kyn-primary-rgb:43 99 240;
  --kyn-primary-hover:#2459E0;
  --kyn-primary-active:#1F4FD0;
  --kyn-link:#2459E0;            --kyn-link-rgb:36 89 224;
  --kyn-focus:#2F6BFF;
  --kyn-selected-bg:#E9F2FF;
  --kyn-selected-text:#2459E0;
  --kyn-selection:rgb(47 107 255 / .20);
  --kyn-accent-violet:#7A3CFF;
  --kyn-accent-cyan:#007A78;

  /* ---------- semantic ---------- */
  --kyn-success:#1A7F37;         --kyn-success-rgb:26 127 55;     --kyn-success-soft:#E8F5EC;
  --kyn-warning:#B54708;         --kyn-warning-rgb:181 71 8;      --kyn-warning-soft:#FDF0E6;
  --kyn-danger:#C0392B;          --kyn-danger-rgb:192 57 43;      --kyn-danger-soft:#FCEBEA;
  --kyn-info:#2459E0;            --kyn-info-rgb:36 89 224;        --kyn-info-soft:#E9F2FF;
  --kyn-danger-fill:#B42318;

  /* ---------- sentiment ---------- */
  --kyn-sent-neutral:#5B657A;
  --kyn-sent-neutral-mark:#78839A;

  /* ---------- tooltip (inverse) ---------- */
  --kyn-tooltip-bg:#111827;
  --kyn-tooltip-text:#FFFFFF;

  /* ---------- type ---------- */
  --kyn-font:'Inter',system-ui,-apple-system,'Segoe UI',Roboto,Arial,'Noto Sans Arabic',sans-serif;
  --kyn-font-ar:'Noto Sans Arabic','Inter',system-ui,sans-serif;
  --kyn-type-display:700 56px/64px var(--kyn-font);
  --kyn-type-h1:700 40px/48px var(--kyn-font);
  --kyn-type-h2:600 32px/40px var(--kyn-font);
  --kyn-type-h3:600 24px/32px var(--kyn-font);
  --kyn-type-h4:600 18px/26px var(--kyn-font);
  --kyn-type-body-lg:400 18px/28px var(--kyn-font);
  --kyn-type-body:400 16px/24px var(--kyn-font);
  --kyn-type-body-sm:400 14px/20px var(--kyn-font);
  --kyn-type-label:500 13px/18px var(--kyn-font);
  --kyn-type-nav:500 14px/20px var(--kyn-font);
  --kyn-type-button:600 14px/20px var(--kyn-font);
  --kyn-type-button-sm:600 13px/18px var(--kyn-font);
  --kyn-type-input:400 14px/20px var(--kyn-font);
  --kyn-type-helper:400 12px/16px var(--kyn-font);
  --kyn-type-caption:400 12px/16px var(--kyn-font);
  --kyn-type-th:600 12px/16px var(--kyn-font);
  --kyn-type-kpi:600 32px/40px var(--kyn-font);
  --kyn-type-page:700 30px/36px var(--kyn-font);     /* app page title (top bar) */
  --kyn-type-section:600 24px/30px var(--kyn-font);  /* app section heading */
  --kyn-type-chart:400 12px/16px var(--kyn-font);
  --kyn-type-tooltip:500 12px/16px var(--kyn-font);
  --kyn-type-error:500 13px/18px var(--kyn-font);
  --kyn-track-display:-0.035em;
  --kyn-track-h1:-0.03em;
  --kyn-track-h2:-0.022em;
  --kyn-track-h3:-0.015em;
  --kyn-track-body:-0.011em;
  --kyn-track-small:-0.006em;
  --kyn-track-caption:0;
  --kyn-track-wordmark:-0.025em;

  /* ---------- spacing (4px base) ---------- */
  --kyn-space-0:0;   --kyn-space-1:4px;  --kyn-space-2:8px;  --kyn-space-3:12px; --kyn-space-4:16px;
  --kyn-space-5:20px; --kyn-space-6:24px; --kyn-space-8:32px; --kyn-space-10:40px; --kyn-space-12:48px;
  --kyn-space-16:64px; --kyn-space-20:80px; --kyn-space-24:96px;
  --kyn-gutter:24px;
  --kyn-content-max:1200px;
  --kyn-reading-max:720px;
  --kyn-header-h:56px;
  --kyn-sidebar-w:248px;
  --kyn-sidebar-w-collapsed:64px;
  --kyn-control-h:40px;
  --kyn-control-h-sm:32px;

  /* ---------- shape ---------- */
  --kyn-radius-xs:4px;
  --kyn-radius-sm:6px;
  --kyn-radius-md:10px;
  --kyn-radius-lg:14px;
  --kyn-radius-xl:20px;
  --kyn-radius-pill:9999px;

  /* ---------- elevation ---------- */
  --kyn-shadow-0:none;
  --kyn-shadow-1:0 1px 2px rgb(8 13 29 / .06);
  --kyn-shadow-2:0 4px 12px rgb(8 13 29 / .08),0 0 0 1px rgb(8 13 29 / .04);
  --kyn-shadow-3:0 16px 40px rgb(8 13 29 / .16);
  --kyn-z-base:0; --kyn-z-sticky:100; --kyn-z-dropdown:1000; --kyn-z-overlay:1100;
  --kyn-z-modal:1200; --kyn-z-toast:1300; --kyn-z-tooltip:1400;

  /* ---------- motion ---------- */
  --kyn-dur-fast:120ms;
  --kyn-dur-base:200ms;
  --kyn-dur-slow:320ms;
  --kyn-ease:cubic-bezier(.2,0,0,1);
  --kyn-ease-in:cubic-bezier(.4,0,1,1);
  --kyn-ease-out:cubic-bezier(0,0,.2,1);
  --kyn-dur-converge:640ms;                     /* the three parts slide together */

  /* ---------- charts: 3 brand accents, then neutrals (9-12 repeat 1-4) ---------- */
  --kyn-chart-1:#2F6BFF;   /* Electric Blue */
  --kyn-chart-2:#009C9C;   /* Cyan Strong */
  --kyn-chart-3:#7A3CFF;   /* Violet */
  --kyn-chart-4:#1F2A44;   /* neutrals, darkest first; slot 8 is "Other" */
  --kyn-chart-5:#5B657A;
  --kyn-chart-6:#3B4660;
  --kyn-chart-7:#6E7891;
  --kyn-chart-8:#78839A;
  --kyn-chart-grid:#E3E8F0;
  --kyn-chart-band-1:#F0F2F6;      --kyn-chart-band-2:#E3E8F0;   /* alternating phase bands behind charts */

  /* ---------- client accent (a feature, not an alias) ----------
     The app lets a report carry a client's accent colour: it sets --accent on <html>
     (and derives --accent-soft / --accent-dark). Default: the brand primary.
     --accent must be a 6-digit hex value. */
  --accent:#2B63F0;
}

/* tokens built from other tokens. They are declared again on every .kyn-navy
   subtree (and on light pop-ups inside one) so they follow that subtree's theme
   instead of inheriting the page's resolved value. */
:root,.kyn-navy,html:not(.dark-mode) .kyn-navy .kyn-pop{
  --kyn-logo-word:var(--kyn-text);
  --kyn-sent-positive:var(--kyn-success);
  --kyn-sent-negative:var(--kyn-danger);
  --kyn-chart-9:var(--kyn-chart-1);
  --kyn-chart-10:var(--kyn-chart-2);
  --kyn-chart-11:var(--kyn-chart-3);
  --kyn-chart-12:var(--kyn-chart-4);
  --kyn-chart-text:var(--kyn-text-2);
  /* app sidebar */
  --kyn-sidebar-bg:var(--kyn-bg);
  --kyn-sidebar-text:var(--kyn-text);
  --kyn-sidebar-text-2:var(--kyn-text-2);
  --accent-dark:var(--kyn-link);
  --accent-soft:var(--kyn-surface-sunken);
}

/* Midnight Navy: the default theme of the app and workspace pages (html.dark-mode),
   and the app's navy chrome in either theme (.kyn-navy). Cards are #111833. */
html.dark-mode,.kyn-navy{
  color-scheme:dark;
  --kyn-logo-lower:var(--brand-cyan);
  --kyn-gradient-brand:linear-gradient(135deg,#7A3CFF 0%,#2F6BFF 55%,#00D1D1 100%);
  --kyn-gradient-line:linear-gradient(90deg,#8F5CFF 0%,#4F82FF 50%,#00D1D1 100%);
  --kyn-gradient-line-rtl:linear-gradient(270deg,#8F5CFF 0%,#4F82FF 50%,#00D1D1 100%);

  --kyn-bg:#080D1D;              --kyn-bg-rgb:8 13 29;
  --kyn-surface:#111833;         --kyn-surface-rgb:17 24 51;
  --kyn-surface-raised:#18214A;
  --kyn-surface-sunken:#060A17;
  --kyn-surface-brand:#162457;
  --kyn-overlay:rgb(0 0 0 / .6);

  --kyn-text:#FFFFFF;            --kyn-text-rgb:255 255 255;
  --kyn-text-2:#A3ADC2;
  --kyn-text-disabled:#56607A;

  --kyn-border:#27315A;          --kyn-border-rgb:39 49 90;
  --kyn-border-control:#78839A;
  --kyn-border-strong:#E9F2FF;

  --kyn-link:#6C9BFF;            --kyn-link-rgb:108 155 255;
  --kyn-focus:#6C9BFF;
  --kyn-selected-bg:#162457;
  --kyn-selected-text:#7FA8FF;
  --kyn-selection:rgb(108 155 255 / .35);
  --kyn-accent-violet:#A57BFF;
  --kyn-accent-cyan:#00D1D1;

  --kyn-success:#4CC38A;         --kyn-success-rgb:76 195 138;    --kyn-success-soft:#0F2A22;
  --kyn-warning:#F5A35C;         --kyn-warning-rgb:245 163 92;    --kyn-warning-soft:#2E1F12;
  --kyn-danger:#FF6961;          --kyn-danger-rgb:255 105 97;     --kyn-danger-soft:#2E1517;
  --kyn-info:#6C9BFF;            --kyn-info-rgb:108 155 255;      --kyn-info-soft:#162457;

  --kyn-sent-neutral:#A3ADC2;
  --kyn-sent-neutral-mark:#A3ADC2;

  --kyn-tooltip-bg:#E9F2FF;
  --kyn-tooltip-text:#080D1D;

  --kyn-shadow-1:0 0 0 1px #27315A;
  --kyn-shadow-2:0 8px 24px rgb(0 0 0 / .45),0 0 0 1px #27315A;
  --kyn-shadow-3:0 16px 48px rgb(0 0 0 / .6),0 0 0 1px #27315A;

  --kyn-chart-1:#6C9BFF;
  --kyn-chart-2:#00D1D1;
  --kyn-chart-3:#A57BFF;
  --kyn-chart-4:#E9F2FF;
  --kyn-chart-5:#A3ADC2;
  --kyn-chart-6:#C9D1E0;
  --kyn-chart-7:#8792A9;
  --kyn-chart-8:#78839A;
  --kyn-chart-grid:#27315A;
  --kyn-chart-band-1:#18214A;
  --kyn-chart-band-2:#27315A;

  --accent:#2B63F0;
}

/* a navy subtree sets its own text colour (it would otherwise inherit the page's) */
.kyn-navy{color:var(--kyn-text);}

/* ---------- base ---------- */
body{font-family:var(--kyn-font);letter-spacing:var(--kyn-track-small);font-variant-numeric:tabular-nums;-webkit-font-smoothing:antialiased;}
::selection{background:var(--kyn-selection);}
:focus-visible{outline:2px solid var(--kyn-focus);outline-offset:2px;}
/* Arabic: no negative tracking, Noto Sans Arabic first */
:lang(ar),[lang="ar"] *,[dir="rtl"],[dir="rtl"] *,.kyn-ar,.kyn-ar *{letter-spacing:0 !important;}
:lang(ar),[dir="rtl"]{font-family:var(--kyn-font-ar);}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important;}
}
