/* =====================================================================
   Miftah — Design tokens
   Green product surface: primary #0D9762, secondary #154618, black and
   white. White cards float on a pale canvas; colour marks the action,
   the state and the data, never the decoration.
   Light is the default; dark is a selected theme, not an inversion.
   ===================================================================== */

:root {
  color-scheme: light;

  /* --- Type ---------------------------------------------------------- */
  --font:    'Urbanist', 'IBM Plex Sans Arabic', 'Segoe UI', system-ui, sans-serif;
  --font-ar: 'IBM Plex Sans Arabic', 'Urbanist', 'Segoe UI', system-ui, sans-serif;
  --mono:    'Urbanist', 'IBM Plex Sans Arabic', 'Segoe UI', system-ui, sans-serif;

  /* --- Surfaces ------------------------------------------------------ */
  --canvas:        #F2F4F3;   /* app background behind cards             */
  --surface:       #FFFFFF;   /* cards, table body, inputs on canvas     */
  --surface-2:     #F5F7F6;   /* filled inputs, table headers, insets    */
  --surface-3:     #E9EEEB;   /* hover, pressed, selected rows           */

  /* --- Lines --------------------------------------------------------- */
  --border:        #E6EBE8;
  --border-strong: #CBD4CF;

  /* --- Ink ----------------------------------------------------------- */
  --ink:           #000000;
  --ink-2:         #5A6560;
  --ink-3:         #87938C;

  /* --- Brand / action ------------------------------------------------ */
  --accent:        #0D9762;   /* primary                                 */
  --accent-ink:    #FFFFFF;
  --accent-hover:  #0B8557;
  --accent-deep:   #154618;   /* secondary: deep green blocks            */
  --accent-deep-ink: #FFFFFF;
  --accent-text:   #154618;   /* green text on the soft tint: hovers, checked chips, avatars */
  --accent-soft:   #E3F4EB;   /* icon tiles, tints, selected chips       */
  --accent-soft-2: #C6E9D6;
  --focus:         #0D9762;

  /* --- Data hues ----------------------------------------------------- */
  --data-1:        #0D9762;
  --data-2:        #154618;
  --data-3:        #F2C14E;
  --data-4:        #000000;
  --grid:          #E9EDEB;
  --axis:          #CBD4CF;

  /* --- State: mark / ink / tint -------------------------------------- */
  --good-mark:     #0D9762;  --good-ink:  #0A7A4F;  --good-bg:  #E3F4EB;
  --warn-mark:     #F2C14E;  --warn-ink:  #8A5A00;  --warn-bg:  #FDF3DC;
  --crit-mark:     #E5484D;  --crit-ink:  #B3282D;  --crit-bg:  #FCE8E9;
  --info-mark:     #154618;  --info-ink:  #154618;  --info-bg:  #E8EFE9;
  --mute-bg:       #EEF1EF;  --mute-ink:  #5A6560;

  /* --- Geometry ------------------------------------------------------ */
  --r-sm:   8px;
  --r:      12px;
  --r-lg:   20px;
  --r-pill: 999px;

  --sidebar-w: 288px;
  --topbar-h:  68px;

  /* --- Elevation (sparingly) ----------------------------------------- */
  --shadow-card:  0 1px 2px rgba(21, 70, 24, .04);
  --shadow-pop:   0 12px 32px rgba(21, 70, 24, .12), 0 0 0 1px rgba(21, 70, 24, .05);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, .22);

  /* --- Motion -------------------------------------------------------- */
  --t-fast: 120ms;
  --t:      200ms;
  --ease:   cubic-bezier(.2, .7, .3, 1);

  /* --- Direction multiplier (flips every inline transform in RTL) ---- */
  --dir: 1;
}

/* Dark: OS preference, unless an explicit light stamp overrides it */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --canvas:        #0B0F0D;
    --surface:       #141A17;
    --surface-2:     #1A211D;
    --surface-3:     #222B26;

    --border:        #263029;
    --border-strong: #37443C;

    --ink:           #F3F6F4;
    --ink-2:         #A6B1AB;
    --ink-3:         #74807A;

    --accent:        #19B074;
    --accent-ink:    #04140C;
    --accent-hover:  #2BC184;
    --accent-deep:   #1B5A2A;
    --accent-deep-ink: #F3F6F4;
    --accent-text:   #8FD6AA;
    --accent-soft:   #163627;
    --accent-soft-2: #1E4A35;
    --focus:         #2BC184;

    --data-1:        #19B074;
    --data-2:        #8FD6AA;
    --data-3:        #F2C14E;
    --data-4:        #F3F6F4;
    --grid:          #202924;
    --axis:          #37443C;

    --good-mark:     #19B074;  --good-ink:  #5FD59C;  --good-bg:  #12301F;
    --warn-mark:     #F2C14E;  --warn-ink:  #F0C864;  --warn-bg:  #2E2612;
    --crit-mark:     #EE6B6F;  --crit-ink:  #F39396;  --crit-bg:  #33191B;
    --info-mark:     #8FD6AA;  --info-ink:  #8FD6AA;  --info-bg:  #16302A;
    --mute-bg:       #222B26;  --mute-ink:  #A6B1AB;

    --shadow-card:  0 1px 2px rgba(0, 0, 0, .3);
    --shadow-pop:   0 12px 32px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06);
    --shadow-modal: 0 24px 60px rgba(0, 0, 0, .65);
  }
}

/* Dark: explicit toggle — must win over a light OS setting */
:root[data-theme="dark"] {
  color-scheme: dark;

  --canvas:        #0B0F0D;
  --surface:       #141A17;
  --surface-2:     #1A211D;
  --surface-3:     #222B26;

  --border:        #263029;
  --border-strong: #37443C;

  --ink:           #F3F6F4;
  --ink-2:         #A6B1AB;
  --ink-3:         #74807A;

  --accent:        #19B074;
  --accent-ink:    #04140C;
  --accent-hover:  #2BC184;
  --accent-deep:   #1B5A2A;
  --accent-deep-ink: #F3F6F4;
  --accent-text:   #8FD6AA;
  --accent-soft:   #163627;
  --accent-soft-2: #1E4A35;
  --focus:         #2BC184;

  --data-1:        #19B074;
  --data-2:        #8FD6AA;
  --data-3:        #F2C14E;
  --data-4:        #F3F6F4;
  --grid:          #202924;
  --axis:          #37443C;

  --good-mark:     #19B074;  --good-ink:  #5FD59C;  --good-bg:  #12301F;
  --warn-mark:     #F2C14E;  --warn-ink:  #F0C864;  --warn-bg:  #2E2612;
  --crit-mark:     #EE6B6F;  --crit-ink:  #F39396;  --crit-bg:  #33191B;
  --info-mark:     #8FD6AA;  --info-ink:  #8FD6AA;  --info-bg:  #16302A;
  --mute-bg:       #222B26;  --mute-ink:  #A6B1AB;

  --shadow-card:  0 1px 2px rgba(0, 0, 0, .3);
  --shadow-pop:   0 12px 32px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, .65);
}

:root[dir="rtl"] { --dir: -1; }
