/* ==========================================================================
   Juicy Garden — design tokens (iOS look)
   --------------------------------------------------------------------------
   The ONE place colours, type, spacing and radii are decided. style.css only
   uses these names. Light values first; dark mode is the same names redefined
   under :root[data-theme="dark"], so nothing in style.css knows which is showing.

   The older names (--leaf, --paper, --ink, --line…) are kept on purpose:
   every rule in style.css already speaks them, so the switch to iOS colours
   is a change of values, not a rewrite of a thousand lines.
   ========================================================================== */

:root {
  color-scheme: light;

  /* ---- type: Apple's system font, iOS text styles ---------------------- */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --fs-large-title: 34px;   /* bold — the page heading before scrolling */
  --fs-title: 22px;         /* title 2 */
  --fs-title-1: 28px;       /* title 1 — big money figures */
  --fs-headline: 17px;      /* semibold body */
  --fs-body: 17px;
  --fs-callout: 16px;
  --fs-subhead: 15px;
  --fs-footnote: 13px;
  --fs-caption: 12px;
  --fs-tab: 10px;           /* tab-bar labels */

  /* ---- spacing: 8px grid (4 for hairline nudges) ---------------------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;

  /* ---- shape ---------------------------------------------------------- */
  --radius: 12px;           /* cards, grouped lists */
  --radius-lg: 14px;        /* sheets, hero card */
  --radius-btn: 8px;        /* buttons */
  --radius-field: 10px;     /* inputs */
  --tap: 44px;              /* minimum touch target (HIG) */
  --hairline: 0.5px;

  /* ---- motion --------------------------------------------------------- */
  --ease: cubic-bezier(.25, .1, .25, 1);
  --ease-sheet: cubic-bezier(.32, .72, 0, 1);   /* iOS sheet spring, approximated */
  --t-fast: 200ms;
  --t-slow: 300ms;

  /* ---- surfaces (iOS grouped backgrounds) ----------------------------- */
  --paper: #F2F2F7;                 /* systemGroupedBackground */
  --card: #FFFFFF;                  /* secondarySystemGroupedBackground */
  --sheet: #FFFFFF;                 /* sheets, action sheets */
  --bar: rgba(249, 249, 249, .82);  /* translucent nav / tab bar */
  --bar-solid: #F9F9F9;             /* same bar, no blur (footers, fallback) */
  --field: rgba(118, 118, 128, .12);/* tertiarySystemFill — inputs, search */
  --fill: rgba(120, 120, 128, .12); /* quiet chips, grey buttons */
  --pressed: #E5E5EA;               /* a row while the finger is down */
  --seg-bg: rgba(118, 118, 128, .12);
  --seg-on: #FFFFFF;
  --switch-off: rgba(120, 120, 128, .16);
  --switch-on: #34C759;
  --keypad-bg: #D1D4D9;
  --scrim: rgba(0, 0, 0, .40);

  /* ---- text ----------------------------------------------------------- */
  --ink: #000000;           /* label */
  --ink-soft: #6C6C70;      /* secondary label, darkened for outdoor reading */
  --ink-faint: #C4C4C7;     /* tertiary — placeholders, chevrons */
  --line: #C6C6C8;          /* opaque separator */

  /* ---- the one accent: Juicy Garden green ----------------------------
     The app was #14532d (forest). iOS tint needs to read as a tap target on
     both backgrounds, so the accent is Apple's accessible green — the same
     family, lifted. The brand forest stays on the balance hero. */
  --accent: #248A3D;        /* tint: links, active tab, icons */
  --accent-fill: #248A3D;   /* filled buttons (white text 4.6:1) */
  --accent-press: #1C6E30;
  --accent-ring: rgba(36, 138, 61, .28);
  --on-accent: #FFFFFF;
  --hero: #14532D;          /* balance card — the brand forest */
  --hero-2: #1E6B3C;

  /* ---- status colours (tint + text pairs) ----------------------------- */
  --danger: #D70015;   --danger-bg: #FDECEC; --danger-line: rgba(215, 0, 21, .22);
  --ok: #248A3D;       --ok-bg: #E6F4EA;     --ok-line: rgba(36, 138, 61, .22);
  --flag: #B25000;     --flag-bg: #FFF4E0;   --flag-line: rgba(178, 80, 0, .22);
  --amber-ink: #9A5B00;
  --berry: #5856D6;    --berry-bg: #EEEDFB;  /* indigo — bank / nakladnoy */
  --teal: #0B6A80;     --teal-bg: #E3F2F8;
  --brown: #8A4A26;    --brown-bg: #F6EDE4;
  --star: #FF9F0A;
  /* Belgilanganlar line colours: a stripe and a faint tint per line. */
  --c-red: #E5484D;    --c-red-bg: rgba(229, 72, 77, .09);
  --c-orange: #F76B15; --c-orange-bg: rgba(247, 107, 21, .09);
  --c-yellow: #D9A400; --c-yellow-bg: rgba(255, 204, 0, .14);
  --c-green: #30A46C;  --c-green-bg: rgba(48, 164, 108, .10);
  --c-blue: #0A84FF;   --c-blue-bg: rgba(10, 132, 255, .09);
  --c-purple: #8E4EC6; --c-purple-bg: rgba(142, 78, 198, .10);

  /* ---- elevation ------------------------------------------------------ */
  --shadow-sheet: 0 -8px 32px rgba(0, 0, 0, .14);
  --shadow-float: 0 8px 24px rgba(0, 0, 0, .16), 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-key: 0 1px 0 rgba(0, 0, 0, .30);

  /* legacy aliases */
  --leaf: var(--accent-fill);
  --leaf-deep: var(--accent-press);
  --brand: var(--accent);
  --muted: var(--ink-soft);
}

/* Dark. Applied by the mark on <html>, which the script in index.html's
   <head> sets before the first paint: from the person's choice (Hisob →
   Ko'rinish), or from the phone's own setting when the choice is Avto. */
:root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #000000;
    --card: #1C1C1E;
    --sheet: #1C1C1E;
    --bar: rgba(22, 22, 23, .80);
    --bar-solid: #161617;
    --field: rgba(118, 118, 128, .24);
    --fill: rgba(120, 120, 128, .24);
    --pressed: #2C2C2E;
    --seg-bg: rgba(118, 118, 128, .24);
    --seg-on: #636366;
    --switch-off: rgba(120, 120, 128, .32);
    --switch-on: #30D158;
    --keypad-bg: #2B2B2D;
    --scrim: rgba(0, 0, 0, .55);

    --ink: #FFFFFF;
    --ink-soft: #98989F;
    --ink-faint: #48484A;
    --line: #38383A;

    --accent: #30D158;
    --accent-fill: #248A3D;
    --accent-press: #1C6E30;
    --accent-ring: rgba(48, 209, 88, .32);
    --hero: #0F3F22;
    --hero-2: #17532E;

    --danger: #FF453A;   --danger-bg: rgba(255, 69, 58, .16);  --danger-line: rgba(255, 69, 58, .30);
    --ok: #30D158;       --ok-bg: rgba(48, 209, 88, .14);      --ok-line: rgba(48, 209, 88, .28);
    --flag: #FF9F0A;     --flag-bg: rgba(255, 159, 10, .15);   --flag-line: rgba(255, 159, 10, .30);
    --amber-ink: #FFB340;
    --berry: #8E8CFF;    --berry-bg: rgba(94, 92, 230, .22);
    --teal: #64D2FF;     --teal-bg: rgba(100, 210, 255, .15);
    --brown: #D9A37A;    --brown-bg: rgba(172, 142, 104, .20);

    --c-red: #FF6369;    --c-red-bg: rgba(255, 99, 105, .16);
    --c-orange: #FF8B3E; --c-orange-bg: rgba(255, 139, 62, .16);
    --c-yellow: #FFD60A; --c-yellow-bg: rgba(255, 214, 10, .14);
    --c-green: #3DD68C;  --c-green-bg: rgba(61, 214, 140, .14);
    --c-blue: #4CA8FF;   --c-blue-bg: rgba(76, 168, 255, .16);
    --c-purple: #BF7AF0; --c-purple-bg: rgba(191, 122, 240, .16);

    --shadow-sheet: 0 -8px 32px rgba(0, 0, 0, .5);
    --shadow-float: 0 8px 24px rgba(0, 0, 0, .5);
    --shadow-key: 0 1px 0 rgba(0, 0, 0, .6);
  }
