/* FuFlow360 design tokens: Ink and Gold (slice D2, decision D-017).
   One file for Operations and the Client Portal. Edit this copy
   (src/Operations.Web/wwwroot/css/theme.css) and copy it to
   src/ClientPortal.Web/wwwroot/css/theme.css; contrast.py fails if they differ.

   This file only declares custom properties: on :root, and on elements
   marked data-surface="ink". It styles nothing, so linking it changes no page. Components (D3) and the shell (D4) read these.

   Light is the default. Dark applies when the device asks for it, unless the
   page says data-theme="light"; data-theme="dark" forces dark. The two dark
   blocks below must stay identical: docs/design/tokens/contrast.py checks it.

   Table, contrast ratios and logo rules: docs/design/tokens.md. */

:root {
  /* Type. System fonts only; nothing is downloaded. Each stack names a
     Chinese face after the Latin one, so mixed text never falls to a serif.
     --font-display is the body stack today; it is its own name so a brand
     face can replace it later. */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font-body);
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", "PingFang SC", "Microsoft YaHei", monospace;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 36px;
  --leading-body: 1.5;
  --leading-tight: 1.2;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-bold: 700;
  --weight-display: 700;
  --display-tracking: 0.005em;
  --wordmark-tracking: 0.12em;

  /* Figures (money, counts, logins, dates): the body font with aligned
     digits, so a row never mixes two fonts and every platform looks alike. */
  --figure-variant: tabular-nums lining-nums;
  --figure-weight: 700;

  /* Spacing: a 4px scale. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 48px;

  /* Sizes that are rules. */
  --touch-target: 44px;
  --field-height: 48px;

  /* Radius. */
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-pill: 999px;

  /* Motion. */
  --motion-fast: 120ms;
  --motion-base: 200ms;
  --motion-slow: 360ms;
  --ease-standard: cubic-bezier(.2, 0, 0, 1);
  --ease-emphasized: cubic-bezier(.2, .8, .2, 1);

  /* MT5 working surfaces (docs/design/mt5-parity.md).
     --row-height-1line: a touch row with one line (settings, pickers).
     --row-height-2line: a touch row with two lines (Trade and History rows).
     --row-height-grid: a desktop grid row, for mouse and keyboard only. */
  --row-height-1line: 48px;
  --row-height-2line: 54px;
  --row-height-grid: 30px;
  --grid-header-height: 28px;
  --summary-row-height: 30px;
  --hairline: 1px solid var(--color-border);
  --tabbar-height: 56px;
  --tabbar-icon-size: 24px;
  --tabbar-label-size: 11px;
  --segment-height: 36px;
  --segment-radius: var(--radius-md);
  --navigator-width: 248px;
  --navigator-rail-width: 48px;
  --toolbox-height: 220px;
  --toolbox-tab-height: 30px;
  --statusbar-height: 26px;

  /* Layers. */
  --z-sticky: 10;
  --z-tabbar: 20;
  --z-dropdown: 30;
  --z-scrim: 40;
  --z-sheet: 50;
  --z-toast: 60;

  /* Focus ring: outline: var(--focus-ring); outline-offset: var(--focus-ring-offset).
     One rule works everywhere: inside data-surface="ink" the colour is re-pointed below. */
  --focus-ring-width: 2px;
  --focus-ring-offset: 2px;
  --focus-ring: var(--focus-ring-width) solid var(--color-focus);

  /* Status aliases. The five families are wait, progress, done, held and
     neutral. A status colour always sits beside an icon and a word. */
  --status-success-bg: var(--status-done-bg);
  --status-success-fg: var(--status-done-fg);
  --status-warning-bg: var(--status-wait-bg);
  --status-warning-fg: var(--status-wait-fg);
  --status-danger-bg: var(--status-held-bg);
  --status-danger-fg: var(--status-held-fg);
  --status-info-bg: var(--status-progress-bg);
  --status-info-fg: var(--status-progress-fg);

  /* Colour, light theme. */
  --theme-color-scheme: light;
  --color-bg: #F5F3EC;
  --color-surface: #FFFFFF;
  --color-surface-sunken: #EEEBE1;
  --color-row-hover: #FBF7EA;
  --color-row-zebra: #FAF8F3;
  --color-row-selected: #FBF0D0;
  --color-fill-disabled: #E6E3D9;
  --color-border: #DEDACD;
  --color-border-strong: #BDB7A6;
  --color-border-control: #7F7866;
  --color-text: #111827;
  --color-text-muted: #414B5C;
  --color-text-subtle: #566072;
  --color-text-disabled: #6F7480;
  --color-link: #7A4E00;
  --color-scrim: rgba(15, 23, 38, .55);
  --color-focus: #7A4E00;
  --color-focus-on-ink: #F7D27A;
  --color-brand-ink: #131C2E;
  --color-brand-gold: #F2C14E;
  --color-brand-gold-deep: #7A4E00;
  --color-brand-gold-edge: #8F6508;
  --color-primary: #131C2E;
  --color-primary-hover: #24304A;
  --color-on-primary: #FBE7B0;
  --color-primary-text: #7A4E00;
  --color-primary-soft: #FBF0D0;
  --color-on-primary-soft: #5F3D00;
  --color-danger: #B3261E;
  --color-danger-hover: #931D17;
  --color-on-danger: #FFFFFF;
  --color-topbar-bg: #FFFFFF;
  --color-tabbar-bg: #FFFFFF;
  --color-nav-bg: #0F1726;
  --color-nav-text: #B9C1CF;
  --color-nav-text-strong: #F6F1E2;
  --color-nav-text-subtle: #98A2B3;
  --color-nav-border: #243047;
  --color-nav-hover-bg: #1A2437;
  --color-nav-active-bg: #F2C14E;
  --color-nav-active-text: #1A1203;
  --gradient-brand: linear-gradient(135deg, #F6CF68 0%, #F0B747 50%, #E6973A 100%);
  --gradient-ink: linear-gradient(160deg, #1B2740 0%, #131C2E 55%, #0B111D 100%);
  --color-on-gradient: #17110A;
  --color-on-gradient-ink: #F6F1E2;
  --color-accent-on-gradient-ink: #F6CF68;
  --color-on-gradient-line: rgba(23, 17, 10, .5);
  --color-on-gradient-wash: rgba(23, 17, 10, .08);
  /* Numbers the MT5 way: blue for money in or a positive figure, red for
     money out or a negative one. Always with a sign or a word beside it. */
  --num-positive: #1458C8;
  --num-negative: #C8281E;
  --num-positive-on-ink: #6AA8FF;
  --num-negative-on-ink: #FF7B70;
  --status-wait-bg: #FBECC0;
  --status-wait-fg: #5F3D00;
  --status-progress-bg: #E2E9F5;
  --status-progress-fg: #1E3A6B;
  --status-done-bg: #DDEFE3;
  --status-done-fg: #12512F;
  --status-held-bg: #FBE1DC;
  --status-held-fg: #8B1D14;
  --status-neutral-bg: #EAE7DC;
  --status-neutral-fg: #3D4553;
  --shadow-1: 0 1px 0 rgba(17, 24, 39, .05);
  --shadow-2: 0 6px 16px rgba(17, 24, 39, .10);
  --shadow-3: 0 14px 34px rgba(17, 24, 39, .22);
  --shadow-hero: 0 12px 28px rgba(230, 151, 58, .30);
}

/* Dark, when the device asks for it and the page did not choose light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --theme-color-scheme: dark;
    --color-bg: #0A0F18;
    --color-surface: #121A28;
    --color-surface-sunken: #1A2435;
    --color-row-hover: #172132;
    --color-row-zebra: #151E2E;
    --color-row-selected: #3A2C08;
    --color-fill-disabled: #1F2A3C;
    --color-border: #2A364A;
    --color-border-strong: #435068;
    --color-border-control: #6F7D96;
    --color-text: #F3EFE4;
    --color-text-muted: #BCC3CE;
    --color-text-subtle: #9CA5B4;
    --color-text-disabled: #8A93A3;
    --color-link: #F2C14E;
    --color-scrim: rgba(0, 0, 0, .7);
    --color-focus: #F7D27A;
    --color-brand-gold-deep: #F2C14E;
    --color-brand-gold-edge: #F2C14E;
    --color-primary: #F2C14E;
    --color-primary-hover: #F7D27A;
    --color-on-primary: #1A1203;
    --color-primary-text: #F2C14E;
    --color-primary-soft: #3A2C08;
    --color-on-primary-soft: #F9DE9A;
    --color-danger: #FF7B70;
    --color-danger-hover: #FF9A91;
    --color-on-danger: #2A0A07;
    --color-topbar-bg: #0E1522;
    --color-tabbar-bg: #0E1522;
    --color-nav-bg: #070B12;
    --color-nav-border: #1E293B;
    --color-nav-hover-bg: #141D2C;
    --gradient-brand: linear-gradient(135deg, #F0C559 0%, #E7AC3F 50%, #D98A30 100%);
    --gradient-ink: linear-gradient(160deg, #1E2A44 0%, #162036 55%, #0E1522 100%);
    --color-accent-on-gradient-ink: #F0C559;
    --num-positive: #6AA8FF;
    --num-negative: #FF7B70;
    --status-wait-bg: #3A2C08;
    --status-wait-fg: #F9DE9A;
    --status-progress-bg: #1A2B4A;
    --status-progress-fg: #BFD3F5;
    --status-done-bg: #10321F;
    --status-done-fg: #9FE0B8;
    --status-held-bg: #45170F;
    --status-held-fg: #FFB8AE;
    --status-neutral-bg: #212C3E;
    --status-neutral-fg: #C6CDD8;
    --shadow-1: 0 1px 0 rgba(0, 0, 0, .4);
    --shadow-2: 0 6px 16px rgba(0, 0, 0, .5);
    --shadow-3: 0 14px 34px rgba(0, 0, 0, .65);
    --shadow-hero: 0 12px 28px rgba(0, 0, 0, .5);
  }
}

/* Dark, chosen on the page. Same values as the block above. */
:root[data-theme="dark"] {
  --theme-color-scheme: dark;
  --color-bg: #0A0F18;
  --color-surface: #121A28;
  --color-surface-sunken: #1A2435;
  --color-row-hover: #172132;
  --color-row-zebra: #151E2E;
  --color-row-selected: #3A2C08;
  --color-fill-disabled: #1F2A3C;
  --color-border: #2A364A;
  --color-border-strong: #435068;
  --color-border-control: #6F7D96;
  --color-text: #F3EFE4;
  --color-text-muted: #BCC3CE;
  --color-text-subtle: #9CA5B4;
  --color-text-disabled: #8A93A3;
  --color-link: #F2C14E;
  --color-scrim: rgba(0, 0, 0, .7);
  --color-focus: #F7D27A;
  --color-brand-gold-deep: #F2C14E;
  --color-brand-gold-edge: #F2C14E;
  --color-primary: #F2C14E;
  --color-primary-hover: #F7D27A;
  --color-on-primary: #1A1203;
  --color-primary-text: #F2C14E;
  --color-primary-soft: #3A2C08;
  --color-on-primary-soft: #F9DE9A;
  --color-danger: #FF7B70;
  --color-danger-hover: #FF9A91;
  --color-on-danger: #2A0A07;
  --color-topbar-bg: #0E1522;
  --color-tabbar-bg: #0E1522;
  --color-nav-bg: #070B12;
  --color-nav-border: #1E293B;
  --color-nav-hover-bg: #141D2C;
  --gradient-brand: linear-gradient(135deg, #F0C559 0%, #E7AC3F 50%, #D98A30 100%);
  --gradient-ink: linear-gradient(160deg, #1E2A44 0%, #162036 55%, #0E1522 100%);
  --color-accent-on-gradient-ink: #F0C559;
  --num-positive: #6AA8FF;
  --num-negative: #FF7B70;
  --status-wait-bg: #3A2C08;
  --status-wait-fg: #F9DE9A;
  --status-progress-bg: #1A2B4A;
  --status-progress-fg: #BFD3F5;
  --status-done-bg: #10321F;
  --status-done-fg: #9FE0B8;
  --status-held-bg: #45170F;
  --status-held-fg: #FFB8AE;
  --status-neutral-bg: #212C3E;
  --status-neutral-fg: #C6CDD8;
  --shadow-1: 0 1px 0 rgba(0, 0, 0, .4);
  --shadow-2: 0 6px 16px rgba(0, 0, 0, .5);
  --shadow-3: 0 14px 34px rgba(0, 0, 0, .65);
  --shadow-hero: 0 12px 28px rgba(0, 0, 0, .5);
}

/* Ink surfaces (header, sidebar, status bar) are ink in both themes. Mark
   them data-surface="ink": the focus ring and the MT5 number colours are
   re-pointed, so the same component rules work on them. */
[data-surface="ink"] {
  --color-focus: var(--color-focus-on-ink);
  --num-positive: var(--num-positive-on-ink);
  --num-negative: var(--num-negative-on-ink);
}

/* Reduced motion: every duration becomes zero. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 0ms;
    --motion-base: 0ms;
    --motion-slow: 0ms;
  }
}
