/* Управляющий — design tokens. Light is the default; dark via [data-theme="dark"];
   inside Telegram (.tg) the surface colours come from themeParams (--tg-theme-* set by telegram-web-app.js). */
:root {
  /* glacier palette */
  --frost: #edf3f5;        /* page, light */
  --rime: #ffffff;         /* raised surface, light */
  --slate-ink: #142630;    /* text, light */
  --polar: #12202a;        /* page, dark */
  --polar-2: #192c37;      /* raised surface, dark */
  --glacier: #2fa9c6;      /* accent: ice light */
  --glacier-soft: #8fe0f0; /* crystal glow */
  --thaw: #c9851c;         /* warning: stale, waiting */
  --cranberry: #cc3d52;    /* error, overdue, negative */
  --spruce: #2a9a77;       /* ok, approved */

  /* *-0: our own theme values; the working tokens below may be replaced by Telegram's */
  --bg-0: var(--frost); --surface-0: var(--rime); --ink-0: var(--slate-ink); --muted-0: #5b6f78; --accent-0: #1f8fab; --accent-ink-0: #fff;
  --bg: var(--bg-0);
  --surface: var(--surface-0);
  --surface-2: #e2ebee;
  --ink: var(--ink-0);
  --muted: var(--muted-0);
  --faint: #8a9ca4;
  --line: rgb(20 38 48 / .1);
  --accent: var(--accent-0);
  --accent-ink: var(--accent-ink-0);
  --ok: var(--spruce);
  --warn: var(--thaw);
  --neg: var(--cranberry);
  --neg-soft: rgb(204 61 82 / .1);
  --warn-soft: rgb(201 133 28 / .12);
  --ok-soft: rgb(42 154 119 / .12);

  /* type: system faces only, with Cyrillic and Serbian Latin (š đ č ć ž) */
  --font: system-ui, -apple-system, "Cantarell", "Ubuntu", "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --t-amount: 600 clamp(28px, 7vw, 36px)/1.05 var(--font); /* totals */
  --t-title: 650 20px/1.2 var(--font);
  --t-body: 400 15px/1.45 var(--font);
  --t-row: 500 15px/1.3 var(--font);
  --t-small: 400 13px/1.35 var(--font);
  --track-tight: -.015em;

  /* space and shape: 4 px grid; radius grows with the size of the thing */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r-chip: 999px; --r-row: 10px; --r-panel: 18px;
  --pad: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg-0: var(--polar); --surface-0: var(--polar-2); --ink-0: #e4eff3; --muted-0: #93aab4; --accent-0: #5cc8e0; --accent-ink-0: #0f2029;
  --surface-2: #213844;
  --faint: #6a8390;
  --line: rgb(200 232 240 / .1);
  --neg: #ff6b7d;
  --neg-soft: rgb(255 107 125 / .12);
  --warn: #f0b04a;
  --ok: #4cc79c;
  color-scheme: dark;
}
/* Telegram: surfaces and text follow the user's theme, our semantic colours stay */
.tg {
  --bg: var(--tg-theme-secondary-bg-color, var(--bg-0));
  --surface: var(--tg-theme-bg-color, var(--surface-0));
  --ink: var(--tg-theme-text-color, var(--ink-0));
  --muted: var(--tg-theme-hint-color, var(--muted-0));
  --accent: var(--tg-theme-button-color, var(--accent-0));
  --accent-ink: var(--tg-theme-button-text-color, var(--accent-ink-0));
}
@media (min-width: 900px) { :root { --pad: 24px; } }
