/* Colours of the panel and the pages around it (sign-in, terms, privacy), light by default.
 * Every colour of the stylesheets is a token from this file: tools/check-colors.js fails the build on a colour written anywhere else.
 * The dark theme overrides the same names in the second block; it is switched by <html data-theme="dark"> (theme-boot.js, theme-toggle.js). */
:root {
  color-scheme: light;

  /* surfaces */
  --bg: #f5f7fa;            /* page behind the cards */
  --surface: #fff;          /* cards, panels, the page itself */
  --surface-2: #f7f9fb;     /* table header, totals row, quiet blocks inside a card */
  --field: #fff;            /* inputs, selects */
  --field-hover: #fafbfc;
  --btn-bg: #fff;
  --btn-hover: #f4f5f7;
  --pop: #fff;              /* menus, modals, toasts, tooltips */
  --hover: #f1f3f5;         /* hover of a menu item, the track of segmented controls */
  --seg-on: #fff;           /* the chosen segment */
  --row-hover: #f8fbff;
  --row-selected: #eef5fd;
  --track: #eceff1;         /* progress and switch tracks, skeletons */
  --track-strong: #cfd5db;
  --neutral: #b8c2cc;
  --knob: #fff;
  --avatar-bg: #c9d6e3;
  --bar-bg: rgba(255, 255, 255, .92);
  --tabbar-bg: rgba(255, 255, 255, .94);
  --overlay: rgba(0, 0, 0, .35);
  --overlay-sheet: rgba(15, 25, 40, .4);

  /* lines */
  --border: #dfe1e5;
  --border-soft: #eef0f2;
  --border-strong: #c3c9d0;

  /* text */
  --text: #222;
  --text-2: #4a4f55;
  --muted: #707579;
  --faint: #c3c8cd;

  /* accent (Telegram blue) */
  --blue: #3390ec;          /* strokes, borders, fills without text on them */
  --blue-dark: #2a7fd4;
  --blue-light: #e8f3fd;    /* soft accent fill */
  --accent-solid: #3390ec;  /* fill with white text on it */
  --accent-hover: #2a7fd4;
  --accent-text: #3390ec;   /* links and accent text */
  --accent-strong: #2a7fd4;
  --accent-ink: #1f6fbf;
  --accent-line: #c5d9ee;
  --accent-rgb: 51, 144, 236;
  --on-accent: #fff;
  --on-accent-fg: #2a7fd4;  /* text on a white chip that sits on the accent */
  --on-accent-muted: rgba(255, 255, 255, .8);
  --on-accent-line: rgba(255, 255, 255, .25);
  --on-accent-hover: rgba(255, 255, 255, .12);
  --kpi-1: #3390ec;
  --kpi-2: #2a7fd4;
  --hero-1: #4fb0f5;
  --hero-2: #3390ec;
  --hero-3: #2a7fd4;

  /* states */
  --red: #e53935;
  --danger-rgb: 229, 57, 53;
  --on-signal: #fff;        /* the glyph on a red / orange / green dot */
  --danger-text: #c62828;
  --danger-solid: #e53935;  /* fill with white text on it */
  --danger-strong: #c62828;
  --danger-soft: #fdeceb;
  --danger-line: #f2c4c3;
  --green: #31b545;
  --success-text: #1e8a2f;
  --success-soft: #e3f6e6;
  --orange: #f5a623;
  --amber: #e8890c;
  --amber-ink: #8a5a00;
  --warn-text: #8a5a00;
  --warn-soft: #fff4dc;
  --warn-line: #f2dba6;
  --warn-stripe: #f9c96a;
  --orange-text: #e07b00;
  --orange-soft: #fff1e0;
  --orange-line: #ffd7a8;
  --purple-text: #6a3fc0;
  --purple-soft: #efe8fd;

  /* status badges of the ads */
  --st-active-bg: #e3f6e6;            --st-active-fg: #1e8a2f;
  --st-on_hold-bg: #fff4dc;           --st-on_hold-fg: #a26b00;
  --st-in_review-bg: #e8f3fd;         --st-in_review-fg: #1f6fbf;
  --st-ready_for_review-bg: #efe8fd;  --st-ready_for_review-fg: #6a3fc0;
  --st-declined-bg: #fdeceb;          --st-declined-fg: #c62828;
  --st-stopped-bg: #eceff1;           --st-stopped-fg: #546e7a;
  --st-type-bg: #f1f3f5;              --st-type-fg: #444;

  /* charts and tooltips */
  --chart-grid: #eceff1;
  --chart-base: #cfd8dc;
  --chart-guide: #90a4ae;
  --chart-nodata: #f4f6f7;
  --chart-dim: rgba(255, 255, 255, .62);
  --chart-bar-soft: #8cc0f5;
  --chart-1: #3390ec;
  --chart-2: #e8890c;
  --tip-bg: #1f2933;
  --tip-fg: #fff;

  /* the ad preview imitates a Telegram post */
  --tg-bg-1: #a8c98f;
  --tg-bg-2: #7fae6e;
  --tg-msg: #effdde;
  --tg-tag: #d7f0c8;
  --tg-green: #4fae4e;
  --tg-line: #c8e5b7;
  --tg-bot: #fff;

  /* shadows: the colour of the shadow is a token, the strength stays where it is used */
  --shadow-rgb: 20, 40, 70;
  --shade-rgb: 0, 0, 0;
}

/* ---------- dark theme "Graphite": depth comes from lighter layers, not from shadows; text is never pure white, the page never pure black ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #121417;
  --surface: #1a1d21;
  --surface-2: #202328;
  --field: #15171a;
  --field-hover: #1b1e22;
  --btn-bg: #23272c;
  --btn-hover: #2b3037;
  --pop: #202328;
  --hover: #262a30;
  --seg-on: #353a42;
  --row-hover: #20252b;
  --row-selected: #1c2f47;
  --track: #2a2f36;
  --track-strong: #3a4048;
  --neutral: #5b636d;
  --knob: #e6e8eb;
  --avatar-bg: #3a4450;
  --bar-bg: rgba(18, 20, 23, .86);
  --tabbar-bg: rgba(26, 29, 33, .94);
  --overlay: rgba(0, 0, 0, .6);
  --overlay-sheet: rgba(0, 0, 0, .6);

  --border: #2b3036;
  --border-soft: #23272c;
  --border-strong: #3a4048;

  --text: #e6e8eb;
  --text-2: #c5cad0;
  --muted: #9aa1aa;
  --faint: #858c95;

  --blue: #4c9ffe;
  --blue-dark: #3b8eef;
  --blue-light: #1c2f47;
  --accent-solid: #2b74d4;
  --accent-hover: #2468c4;
  --accent-text: #6db1ff;
  --accent-strong: #6db1ff;
  --accent-ink: #7cb9ff;
  --accent-line: #2a4a73;
  --accent-rgb: 76, 159, 254;
  --on-accent: #fff;
  --on-accent-fg: #1d5fb4;
  --on-accent-muted: rgba(255, 255, 255, .92);
  --on-accent-line: rgba(255, 255, 255, .3);
  --on-accent-hover: rgba(255, 255, 255, .14);
  --kpi-1: #2468c4;
  --kpi-2: #1f5cb0;
  --hero-1: #2d6cc0;
  --hero-2: #1d4e94;
  --hero-3: #153a70;

  --red: #ff6b63;
  --danger-rgb: 255, 107, 99;
  --on-signal: #15171a;
  --danger-text: #ff8a80;
  --danger-solid: #cf3f38;
  --danger-strong: #b8352f;
  --danger-soft: #3a1d1c;
  --danger-line: #6b2e2b;
  --green: #4cc764;
  --success-text: #6fd987;
  --success-soft: #17301f;
  --orange: #f0a03c;
  --amber: #b35f00;
  --amber-ink: #8a5a00;
  --warn-text: #f3c06a;
  --warn-soft: #33270f;
  --warn-line: #5c4719;
  --warn-stripe: #8a6a24;
  --orange-text: #f5a95a;
  --orange-soft: #36230f;
  --orange-line: #6a4520;
  --purple-text: #b9a4fb;
  --purple-soft: #2a2140;

  --st-active-bg: #17301f;            --st-active-fg: #6fd987;
  --st-on_hold-bg: #33270f;           --st-on_hold-fg: #f3c06a;
  --st-in_review-bg: #172b45;         --st-in_review-fg: #6db1ff;
  --st-ready_for_review-bg: #2a2140;  --st-ready_for_review-fg: #b9a4fb;
  --st-declined-bg: #3a1d1c;          --st-declined-fg: #ff8a80;
  --st-stopped-bg: #26292e;           --st-stopped-fg: #a3aab3;
  --st-type-bg: #262a30;              --st-type-fg: #c5cad0;

  --chart-grid: #262a30;
  --chart-base: #3a4048;
  --chart-guide: #6f767f;
  --chart-nodata: #1f2226;
  --chart-dim: rgba(18, 20, 23, .6);
  --chart-bar-soft: #3a6ea8;
  --chart-1: #4c9ffe;
  --chart-2: #f0a03c;
  --tip-bg: #2f343b;
  --tip-fg: #f1f3f5;

  --tg-bg-1: #15191d;
  --tg-bg-2: #101316;
  --tg-msg: #24282e;
  --tg-tag: #31363d;
  --tg-green: #7bd88f;
  --tg-line: #3a4048;
  --tg-bot: #202328;

  --shadow-rgb: 0, 0, 0;
  --shade-rgb: 0, 0, 0;
}

/* ---------- the theme switch: a sun / moon lever ---------- */
.theme-switch {
  --h: 36px;
  position: relative; display: inline-flex; align-items: center; flex: none; padding: 0; cursor: pointer;
  width: calc(var(--h) * 2 + 2px); height: var(--h); border: 1px solid var(--border); border-radius: 999px; background: var(--hover);
  -webkit-tap-highlight-color: transparent;
}
.theme-switch-knob {
  position: absolute; top: 2px; left: 2px; width: calc(var(--h) - 6px); height: calc(var(--h) - 6px); border-radius: 50%;
  background: var(--seg-on); box-shadow: 0 1px 3px rgba(var(--shadow-rgb), .22); transition: transform .2s cubic-bezier(.3, .7, .4, 1);
}
.theme-switch[aria-checked="true"] .theme-switch-knob { transform: translateX(var(--h)); }
.theme-switch-ic { position: relative; z-index: 1; display: grid; place-items: center; width: var(--h); height: 100%; color: var(--muted); transition: color .2s; }
.theme-switch-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-switch[aria-checked="false"] .sun, .theme-switch[aria-checked="true"] .moon { color: var(--accent-strong); }
.theme-switch:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .45); }
@media (pointer: coarse) { .theme-switch { --h: 40px; } }
@media (prefers-reduced-motion: reduce) { .theme-switch-knob { transition: none; } }
.page-switch { position: fixed; top: 16px; right: 16px; z-index: 30; }
/* everything changes colour at once; only the lever itself glides */
.theme-switching *:not(.theme-switch-knob), .theme-switching *:not(.theme-switch-knob)::before, .theme-switching *:not(.theme-switch-knob)::after { transition: none !important; }
