/* ============================================================
   AdvisorCore design tokens (#207): the one place for colours, radii, shadows, spacing and font sizes.
   Loaded first by the CRM (index.html) and the approval page (approval.html). Every other stylesheet
   uses these through var(--…); `node scripts/check-css.mjs` (pre-push gate) refuses an undefined token,
   a fallback value, a hard-coded colour, a literal font size, radius, shadow or spacing step outside
   this file, and any breakpoint other than the two below.

   Breakpoints (media queries cannot read custom properties, so the gate enforces the numbers):
     phone   (max-width:600px)  / (min-width:601px)
     mobile  (max-width:860px)  / (min-width:861px)   the side menu becomes the bottom bar
   ============================================================ */

/* Cascade layers: base (tokens, reset), components (shared look: atelier, shell, sign-in, approval),
   pages (screen layout). A later layer wins regardless of selector weight. */
@layer base, components, pages;

@layer base{
  /* #443: Regain login identity, independent of the authenticated CRM's light/dark themes. */
  :root{
    --regain-font:'Regain Inter',Arial,sans-serif;
    --regain-paper:#f8fafc; --regain-ink:#0f172a; --regain-primary:#1e3a8a; --regain-accent:#3b82f6;
    --regain-soft:color-mix(in srgb,var(--regain-ink) 75%,var(--regain-paper));
    --regain-line:color-mix(in srgb,var(--regain-ink) 12%,var(--regain-paper));
    --regain-line-strong:color-mix(in srgb,var(--regain-ink) 35%,var(--regain-paper));
    --regain-primary-dark:color-mix(in srgb,var(--regain-primary) 80%,var(--regain-ink));
    --regain-tint:color-mix(in srgb,var(--regain-accent) 6%,var(--regain-paper));
    --fs-16:2.25rem; --fs-17:clamp(2rem,4vw,3rem);
  }
  .session-login{--r-sm:7px}
  :root{
    color-scheme:light dark;

    /* plochy a linky */
    --bg:#fbfbfc; --surface:#ffffff; --surface-2:#f6f7f9; --surface-3:#eef0f3;
    --line:#e6e8ec; --line-strong:#d4d8de;
    --text:#1c1d1f; --text-2:#4b5158; --muted:#6b7280; --faint:#9aa1ab;

    /* akcent */
    --acc:#1fa396; --acc-hover:#178c81; --acc-fg:#ffffff; --acc-soft:#e4f2f0; --acc-ink:#146b62;

    /* stavy; --on-status is text on a full ok/dng/info background */
    --ok:#177d63; --ok-bg:#e4f4ee;
    --warn:#8a6516; --warn-bg:#fbf1dc;
    --dng:#b4342c; --dng-bg:#fbe9e7; --dng-hover:#9a2c25;
    --info:#2b5f9e; --info-bg:#e8f0fa;
    --neutral:#5b626b; --neutral-bg:#eef0f3;
    --on-status:#ffffff;

    /* kategorie smluv */
    --c-mortgage:#2e6f9e; --c-loan:#7a5aa8; --c-life:#c0553f; --c-property:#3f8f6b;
    --c-vehicle:#b8802f; --c-investment:#1f8b98; --c-pension:#5c8b36; --c-savings:#4a6fa5;
    --c-liability:#8a6ba8; --c-other:#78808c; --c-docs:#93806c;

    /* sloupce To do listu (#269) */
    --task-processing:#2f6fde; --task-waiting:#c99700; --task-assistant:#2e9e5b; --task-ideas:#8a55d7;

    /* překryv pod oknem a pozadí živého obrazu prohlížeče */
    --scrim:rgba(16,20,24,.38);
    --frame-bg:#1d2420;

    /* tvar a stín */
    --r-xs:4px; --r-sm:6px; --r:8px; --r-lg:12px; --pill:999px;
    --sh:0 1px 2px rgba(20,24,30,.05);
    --sh-lift:0 1px 2px rgba(20,24,30,.06),0 8px 24px rgba(20,24,30,.08);
    --sh-pop:0 6px 20px rgba(20,24,30,.22);
    --focus:0 0 0 3px rgba(31,163,150,.28);

    /* písmo: one type scale, smallest to largest */
    --font:'Inter',system-ui,-apple-system,'Segoe UI',sans-serif;
    --font-mono:ui-monospace,SFMono-Regular,Consolas,monospace;
    --fs-1:10.5px; --fs-2:11px; --fs-3:11.5px; --fs-4:12px; --fs-5:12.5px; --fs-6:13px; --fs-7:13.5px;
    --fs-8:14px; --fs-9:15px; --fs-10:16px; --fs-11:17px; --fs-12:19px; --fs-13:21px; --fs-14:22px; --fs-15:30px;

    /* mezery: a 2 px grid; the number is the size in pixels */
    --sp-2:2px; --sp-4:4px; --sp-6:6px; --sp-8:8px; --sp-10:10px; --sp-12:12px; --sp-14:14px; --sp-16:16px;
    --sp-18:18px; --sp-20:20px; --sp-24:24px; --sp-28:28px; --sp-32:32px; --sp-40:40px; --sp-48:48px;

    /* rozměry rozvržení */
    --row:36px; --nav-w:212px; --tabbar:0px;
  }
  @media (max-width:860px){
    :root{--row:44px;--tabbar:calc(56px + env(safe-area-inset-bottom))}
  }
}

/* Dark: the system preference unless the user chose light, or the user's explicit choice. */
@layer base{
  @media (prefers-color-scheme:dark){
    :root:not([data-theme="light"]){
      --bg:#141618; --surface:#1a1d20; --surface-2:#212528; --surface-3:#282d31;
      --line:#2c3136; --line-strong:#3a4046;
      --text:#e9ebee; --text-2:#c3c8ce; --muted:#949ba3; --faint:#6e757d;
      --acc:#35bfb0; --acc-hover:#4fd0c1; --acc-fg:#0e1214; --acc-soft:#17332f; --acc-ink:#7fd9cd;
      --ok:#54c39b; --ok-bg:#152b25; --warn:#dcae5c; --warn-bg:#2e2718;
      --dng:#ef7f75; --dng-bg:#31201e; --dng-hover:#f29890; --info:#77a9e0; --info-bg:#18242f;
      --neutral:#a2a9b1; --neutral-bg:#242a2f;
      --on-status:#0e1214;
      --c-mortgage:#6ea8d8; --c-loan:#b195dd; --c-life:#e08b76; --c-property:#6fc39a;
      --c-vehicle:#dcae5c; --c-investment:#4fc2cf; --c-pension:#96c065; --c-savings:#7fa3d8;
      --c-liability:#b79ad6; --c-other:#a0a8b3; --c-docs:#c0ab92;
      --task-processing:#6f9ef2; --task-waiting:#f0c43c; --task-assistant:#5cc887; --task-ideas:#b391f2;
      --scrim:rgba(0,0,0,.55);
      --sh:0 1px 2px rgba(0,0,0,.4);
      --sh-lift:0 1px 2px rgba(0,0,0,.5),0 8px 24px rgba(0,0,0,.4);
      --sh-pop:0 6px 20px rgba(0,0,0,.5);
      --focus:0 0 0 3px rgba(53,191,176,.35);
    }
  }
  :root[data-theme="light"]{color-scheme:light}
  :root[data-theme="dark"]{
    color-scheme:dark;
    --bg:#141618; --surface:#1a1d20; --surface-2:#212528; --surface-3:#282d31;
    --line:#2c3136; --line-strong:#3a4046;
    --text:#e9ebee; --text-2:#c3c8ce; --muted:#949ba3; --faint:#6e757d;
    --acc:#35bfb0; --acc-hover:#4fd0c1; --acc-fg:#0e1214; --acc-soft:#17332f; --acc-ink:#7fd9cd;
    --ok:#54c39b; --ok-bg:#152b25; --warn:#dcae5c; --warn-bg:#2e2718;
    --dng:#ef7f75; --dng-bg:#31201e; --dng-hover:#f29890; --info:#77a9e0; --info-bg:#18242f;
    --neutral:#a2a9b1; --neutral-bg:#242a2f;
    --on-status:#0e1214;
    --c-mortgage:#6ea8d8; --c-loan:#b195dd; --c-life:#e08b76; --c-property:#6fc39a;
    --c-vehicle:#dcae5c; --c-investment:#4fc2cf; --c-pension:#96c065; --c-savings:#7fa3d8;
    --c-liability:#b79ad6; --c-other:#a0a8b3; --c-docs:#c0ab92;
    --task-processing:#6f9ef2; --task-waiting:#f0c43c; --task-assistant:#5cc887; --task-ideas:#b391f2;
    --scrim:rgba(0,0,0,.55);
    --sh:0 1px 2px rgba(0,0,0,.4);
    --sh-lift:0 1px 2px rgba(0,0,0,.5),0 8px 24px rgba(0,0,0,.4);
    --sh-pop:0 6px 20px rgba(0,0,0,.5);
    --focus:0 0 0 3px rgba(53,191,176,.35);
  }
}
