/* ═══════════════════════════════════════════════════════════════════════════
   tokens.css — the portal's ONE design system (views_new, every page, desktop and phone).
   Linked first in every page's <head>. Every spacing, font size / weight / line height, corner radius, control height,
   shadow, transition and colour in views_new CSS, page <style> blocks and inline styles uses these variables.
   Change a value here and it changes everywhere. Raw values were snapped to the nearest step.

   Spacing   --sp-* scale + roles --page-* / --card-* / --tile-* / --gap-* / --btn-* / --input-* / --cell-*
   Type      --fs-* sizes, --fw-* weights, --lh-* line heights + roles --fs-page / --fs-card-title / --fs-label …
   Shape     --radius-xs / --radius-sm / --radius / --radius-lg / --radius-xl / --radius-pill (sm + base come from brand.css)
   Controls  --ctl-sm / --ctl-md / --ctl-lg: one height for buttons, inputs and selects of the same size
   Colour    the Brand roles (--text, --muted, --surface*, --border, --buy, --sell, --amber, --primary*) from brand.css,
             plus --on-fill (text on a coloured fill) and --info / --info-bg here. They switch with light / dark mode and
             follow the company's branding palette.
   Shadow / motion  --shadow, --shadow-lg, --t from brand.css. (z-index values are not tokenised: they stack against
             Bootstrap / DataTables / jconfirm / loader overlays, so they keep their numbers.)
   Breakpoints (CSS cannot use variables in @media): phone < 600px, tablet < 900px, wide ≥ 1200px — every
   @media in views_new uses only 599 / 600, 899 / 900, 1199 / 1200.
   Bootstrap spacing classes (p-3, mt-2 …) are mapped onto the scale in portal_app.css.
   (Not part of the shared Brand layer: brand.css stays identical across projects.)
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  /* type: sizes */
  --fs-xs: 11.5px;     /* table heads, badges, overlines */
  --fs-sm: 12.5px;     /* labels, captions, meta text */
  --fs-base: 14px;     /* body, buttons, inputs */
  --fs-md: 16px;       /* card titles */
  --fs-lg: 20px;       /* page titles */
  --fs-xl: 24px;       /* key figures */
  --fs-2xl: 32px;      /* hero figures */
  --fs-3xl: 40px;      /* display */
  /* type: weights, line heights */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --lh-none: 1;
  --lh-tight: 1.2;
  --lh-snug: 1.35;
  --lh-normal: 1.5;
  --lh-relaxed: 1.65;
  /* type: roles */
  --fs-page: var(--fs-lg);
  --fs-card-title: var(--fs-md);
  --fs-section: var(--fs-base);
  --fs-body: var(--fs-base);
  --fs-label: var(--fs-sm);
  --fs-meta: var(--fs-xs);
  --fs-badge: var(--fs-xs);
  --fs-table-head: var(--fs-xs);

  /* shape (--radius-sm 8px and --radius 10px come from brand.css) */
  --radius-xs: 4px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* control heights: buttons, inputs, selects of the same size line up */
  --ctl-sm: 32px;
  --ctl-md: 38px;
  --ctl-lg: 44px;

  /* buttons: one component in three sizes (portal_app.css "Components") */
  --btn-h: var(--ctl-md);
  --btn-sm-h: var(--ctl-sm);
  --btn-lg-h: var(--ctl-lg);
  --btn-fs: var(--fs-base);
  --btn-sm-fs: var(--fs-sm);
  --btn-fw: var(--fw-semibold);
  --btn-radius: var(--radius-sm);

  /* badges / status pills: one component for every status */
  --badge-pad-y: var(--sp-0-5);
  --badge-pad-x: var(--sp-2-5);
  --badge-fs: var(--fs-badge);
  --badge-fw: var(--fw-bold);
  --badge-radius: var(--radius-pill);

  /* colour roles not in brand.css */
  --on-fill: #ffffff;                                              /* text / icons on a coloured fill (buttons, avatars) */
  --info: var(--primary-2);
  --info-bg: color-mix(in srgb, var(--primary-2) 12%, transparent);

  /* 1) scale */
  --sp-px: 1px;
  --sp-0-5: 2px;
  --sp-1: 4px;
  --sp-1-5: 6px;
  --sp-2: 8px;
  --sp-2-5: 10px;
  --sp-3: 12px;
  --sp-3-5: 14px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;
  --sp-9: 36px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-14: 56px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;
  --sp-28: 112px;
  --sp-32: 128px;
  --sp-40: 160px;

  /* layout */
  --topbar-h: 64px;                 /* desktop top bar; the content starts below it */
  --sidebar-w: 250px;               /* desktop sidebar; the content starts after it */

  /* 2) roles */
  --page-pad-x: var(--sp-6);        /* content area, left / right */
  --page-pad-top: var(--sp-6);      /* content area, below the top bar */
  --page-pad-bottom: var(--sp-10);  /* content area, end of page */
  --title-gap: var(--sp-4);         /* page title → first card */
  --stack-gap: var(--sp-4);         /* between stacked cards / blocks */
  --section-gap: var(--sp-6);       /* between page sections (a section title starts a new one) */
  --grid-gap: var(--sp-4);          /* between cards / columns side by side */

  --card-pad-x: var(--sp-5);        /* card head, body and footer share it so their edges line up */
  --card-pad-y: var(--sp-5);        /* card body, top / bottom */
  --card-head-pad-y: var(--sp-3-5); /* card head, top / bottom */
  --card-foot-pad-y: var(--sp-3-5); /* card footer, top / bottom */

  --tile-pad-y: var(--sp-3);       /* compact tiles: account rows, overview stats, filter bars */
  --tile-pad-x: var(--sp-4);

  --gap-xs: var(--sp-1);            /* icon ↔ text */
  --gap-sm: var(--sp-2);            /* buttons / chips in a row */
  --gap-md: var(--sp-3);            /* items in a toolbar / list */
  --gap-lg: var(--sp-4);            /* form rows, field groups */

  --field-gap: var(--sp-1-5);       /* label → input */
  --btn-pad-y: var(--sp-2-5);
  --btn-pad-x: var(--sp-4);
  --btn-sm-pad-y: var(--sp-1-5);
  --btn-sm-pad-x: var(--sp-3);
  --input-pad-y: var(--sp-2-5);
  --input-pad-x: var(--sp-3);
  --cell-pad-y: var(--sp-2-5);      /* table cells */
  --cell-pad-x: var(--sp-3);
}

/* phones: tighter page and card edges; room for the bottom navigation */
@media (max-width: 899px) {
  :root {
    --page-pad-x: var(--sp-4);
    --page-pad-top: var(--sp-4);
    --page-pad-bottom: var(--sp-24);
    --section-gap: var(--sp-5);
    --grid-gap: var(--sp-3);
    --card-pad-x: var(--sp-4);
    --card-pad-y: var(--sp-4);
    --card-head-pad-y: var(--sp-3);
    --card-foot-pad-y: var(--sp-3);
  }
}
