/*
 * KordexPay design tokens (B34, style F: the look of ISPmanager 6).
 * Theme: data-theme="light" | "dark" on <html>; without it the system preference applies.
 * Every color used in the mockups and the UI kit comes from here.
 */

/* IBM Plex, local files (CSP 'self'), SIL Open Font License 1.1. Latin subset; other scripts fall back to system-ui. */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/ibm-plex-sans-latin-400-normal.3b646991d300.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/ibm-plex-sans-latin-500-normal.0717336fb31f.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/ibm-plex-sans-latin-600-normal.8960851d691c.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/ibm-plex-mono-latin-400-normal.08949f728dc5.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/ibm-plex-mono-latin-500-normal.01d285447409.woff2') format('woff2');
}

:root {
  /* ---- type: 400 0.875rem/1.125rem IBM Plex Sans ---- */
  --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 26px;
  --fs-3xl: 32px;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 600;
  --lh-tight: 1.25;
  --lh-normal: 1.2857;

  /* ---- spacing (4 px grid) ---- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* ---- radii ---- */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 16px;
  --r-full: 999px;

  /* ---- sizes ---- */
  --control-h: 36px;
  --control-h-sm: 28px;
  --row-h: 42px;
  --side-w: 202px;
  --side-w-collapsed: 56px;
  --content-max: 1440px;
  --auth-w: 400px;
  --pay-w: 440px;

  /* ---- motion ---- */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur: 0.15s;

  /* ---- light theme ---- */
  color-scheme: light;
  --bg: #edf2fc;
  --surface: #ffffff;
  --surface-2: #f5f8fe;
  --tool: #edf2fc;
  --chip: #edf2fc;
  --hover: #f5f8fe;
  --border: #dde3f0;
  --border-soft: #e8ecf6;
  --border-strong: #c3cce0;
  --text: #1f2433;
  --text-2: #464d66;
  --muted: #646c8c;
  --label: #646c8c;
  --acc: #2f66e8;
  --acc-fill: #2f66e8;
  --on-acc: #ffffff;
  --acc-hover: #2756c9;
  --acc-text: #2a5bd0;
  --acc-soft: #e4ecfd;
  --focus: #2f66e8;
  --overlay: rgba(20, 26, 44, 0.45);

  --ok-fg: #17703f;
  --ok-bg: #e2f2e8;
  --info-fg: #1f55b8;
  --info-bg: #e4ecfb;
  --warn-fg: #8a5300;
  --warn-bg: #fbefd8;
  --bad-fg: #c0291f;
  --bad-bg: #fbe6e3;
  --bad-row: #fff7f6;
  --vio-fg: #6a3db8;
  --vio-bg: #efe8fa;
  --teal-fg: #0b5a4b;
  --teal-bg: #e2f2ee;
  --neu-fg: #464d66;
  --neu-bg: #edf2fc;
  --badge: #d93a32;

  /* networks */
  --n-tron: #d8372e;
  --n-eth: #5b6bd8;
  --n-bsc: #c99a06;

  /* code / QR */
  --code-bg: #edf2fc;
  --qr-fg: #141820;
  --qr-bg: #ffffff;

  --shadow-md: 0 4px 16px rgba(31, 36, 51, 0.08);
  --shadow-lg: 0 16px 48px rgba(31, 36, 51, 0.18);
}

/*
 * Dark theme. Values are pre-compensated: the owner's Chrome shows KordexPay pages through an extra
 * gamma step (sRGB -> 2.2) that ISPmanager does not get, so CSS #1a2232 / #222d42 / #344463 / #2a3651
 * appear as ISPmanager's #202735 / #273144 / #374663 / #2e3952 on that screen. Do not "fix" them back
 * without checking on the owner's screen. ponytail: calibrated to one machine; drop once the cause is found.
 */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #1a2232;
  --surface: #222d42;
  --surface-2: #2d3950;
  --tool: #344463;
  --chip: #2a3651;
  --hover: #2d3950;
  --border: #374360;
  --border-soft: #2f3a53;
  --border-strong: #4a5775;
  --text: #e8ebf2;
  --text-2: #bdc4d7;
  --muted: #a0a8bf;
  --label: #aab2c8;
  --acc: #6b96ff;
  --acc-fill: #6b96ff;
  --on-acc: #050c2c;
  --acc-hover: #86a9ff;
  --acc-text: #90b1ff;
  --acc-soft: #2b3f71;
  --focus: #90b1ff;
  --overlay: rgba(0, 0, 0, 0.6);
  --ok-fg: #6bd79b;
  --ok-bg: #103725;
  --info-fg: #8bb5ff;
  --info-bg: #1c315c;
  --warn-fg: #f0b456;
  --warn-bg: #3a2c1a;
  --bad-fg: #ff8b81;
  --bad-bg: #412125;
  --bad-row: #2b2433;
  --vio-fg: #c4a5ff;
  --vio-bg: #30245a;
  --teal-fg: #6cd3be;
  --teal-bg: #12312b;
  --neu-fg: #bdc4d7;
  --neu-bg: #2a3651;
  --badge: #d03a31;
  --n-tron: #f05a4f;
  --n-eth: #8b94f0;
  --n-bsc: #d5a315;
  --code-bg: #2a3651;
  --qr-fg: #141820;
  --qr-bg: #ffffff;
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #1a2232;
    --surface: #222d42;
    --surface-2: #2d3950;
    --tool: #344463;
    --chip: #2a3651;
    --hover: #2d3950;
    --border: #374360;
    --border-soft: #2f3a53;
    --border-strong: #4a5775;
    --text: #e8ebf2;
    --text-2: #bdc4d7;
    --muted: #a0a8bf;
    --label: #aab2c8;
    --acc: #6b96ff;
    --acc-fill: #6b96ff;
    --on-acc: #050c2c;
    --acc-hover: #86a9ff;
    --acc-text: #90b1ff;
    --acc-soft: #2b3f71;
    --focus: #90b1ff;
    --overlay: rgba(0, 0, 0, 0.6);
    --ok-fg: #6bd79b;
    --ok-bg: #103725;
    --info-fg: #8bb5ff;
    --info-bg: #1c315c;
    --warn-fg: #f0b456;
    --warn-bg: #3a2c1a;
    --bad-fg: #ff8b81;
    --bad-bg: #412125;
    --bad-row: #2b2433;
    --vio-fg: #c4a5ff;
    --vio-bg: #30245a;
    --teal-fg: #6cd3be;
    --teal-bg: #12312b;
    --neu-fg: #bdc4d7;
    --neu-bg: #2a3651;
    --badge: #d03a31;
    --n-tron: #f05a4f;
    --n-eth: #8b94f0;
    --n-bsc: #d5a315;
    --code-bg: #2a3651;
    --qr-fg: #141820;
    --qr-bg: #ffffff;
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
  }
}
