/* =====================================================================
   Miftah — Two luxury versions of Emerald: "Onyx" and "Stone"
   Asked for in Akram's notes (version 17): a high-end look, corners
   close to square, and luxury colours, with a switch to compare them.
   Both are Emerald underneath. app.js stamps data-style="emerald" and
   data-lux="onyx" | "stone", so every Emerald shape, the 8px corners and
   the fixed buttons carry over; this file changes colour and a few
   details only. Selectors carry one more attribute than Emerald's, so
   they win in light and in both dark stamps.

   Onyx: Akram's own palette from the Figma file. Emerald #1EA970,
   near-black #0B0C0B, graphite #6E706F, white. The bar is black, the
   action is the bright emerald with black type, the data is charcoal.

   Stone: light and quiet. Stone-grey surfaces, a deep forest green for
   the action, and brass for small details only (the key in the mark,
   the current page, hot counts, the recommendation stripe).

   Contrast checked: text pairs 4.5:1 or more on their grounds, marks
   3:1 or more, in light and dark.
   ===================================================================== */

/* ============================================================== Onyx */
:root[data-style="emerald"][data-lux="onyx"] {
  --canvas:        #F4F4F3;
  --surface:       #FFFFFF;
  --surface-2:     #F8F8F7;
  --surface-3:     #EDEDEC;
  --border:        #E4E4E2;
  --border-strong: #CACBC9;
  --ink:           #0B0C0B;
  --ink-2:         #535654;
  --ink-3:         #666867;
  --accent:        #1EA970;
  --accent-ink:    #0B0C0B;
  --accent-hover:  #2BBE82;
  --accent-deep:   #0B0C0B;
  --accent-deep-ink: #F2F3F2;
  --accent-text:   #0A6441;
  --accent-soft:   #E3F3EA;
  --accent-soft-2: #BFE6D2;
  --focus:         #1EA970;
  --data-1:        #2B2E2C;
  --data-2:        #1EA970;
  --data-3:        #B98A2A;
  --data-4:        #9A9C9B;
  --grid:          #ECECEB;
  --axis:          #CACBC9;
  --mute-bg:       #EDEDEC;  --mute-ink:  #535654;
  --shadow-card:  0 1px 2px rgba(11, 12, 11, .05), 0 1px 3px rgba(11, 12, 11, .04);
  --shadow-pop:   0 0 0 1px rgba(11, 12, 11, .07), 0 4px 8px -2px rgba(11, 12, 11, .08), 0 12px 28px -6px rgba(11, 12, 11, .16);
  --shadow-modal: 0 0 0 1px rgba(11, 12, 11, .07), 0 12px 24px -8px rgba(11, 12, 11, .20), 0 32px 64px -12px rgba(11, 12, 11, .30);
}

@media (prefers-color-scheme: dark) {
  :root[data-style="emerald"][data-lux="onyx"]:not([data-theme="light"]) {
    --canvas:        #0B0C0B;
    --surface:       #141615;
    --surface-2:     #1A1C1B;
    --surface-3:     #232625;
    --border:        #2A2D2B;
    --border-strong: #3B3F3D;
    --ink:           #F2F3F2;
    --ink-2:         #A9ACAA;
    --ink-3:         #8A8D8B;
    --accent:        #1EA970;
    --accent-ink:    #0B0C0B;
    --accent-hover:  #2BBE82;
    --accent-deep:   #0F2A1F;
    --accent-deep-ink: #D9F0E4;
    --accent-text:   #72D7A9;
    --accent-soft:   #12291F;
    --accent-soft-2: #1A3A2C;
    --focus:         #2BBE82;
    --data-1:        #C9CBCA;
    --data-2:        #1EA970;
    --data-3:        #EDC15F;
    --data-4:        #6F7270;
    --grid:          #202322;
    --axis:          #3B3F3D;
    --mute-bg:       #232625;  --mute-ink:  #A9ACAA;
  }
}
:root[data-style="emerald"][data-lux="onyx"][data-theme="dark"] {
  --canvas:        #0B0C0B;
  --surface:       #141615;
  --surface-2:     #1A1C1B;
  --surface-3:     #232625;
  --border:        #2A2D2B;
  --border-strong: #3B3F3D;
  --ink:           #F2F3F2;
  --ink-2:         #A9ACAA;
  --ink-3:         #8A8D8B;
  --accent:        #1EA970;
  --accent-ink:    #0B0C0B;
  --accent-hover:  #2BBE82;
  --accent-deep:   #0F2A1F;
  --accent-deep-ink: #D9F0E4;
  --accent-text:   #72D7A9;
  --accent-soft:   #12291F;
  --accent-soft-2: #1A3A2C;
  --focus:         #2BBE82;
  --data-1:        #C9CBCA;
  --data-2:        #1EA970;
  --data-3:        #EDC15F;
  --data-4:        #6F7270;
  --grid:          #202322;
  --axis:          #3B3F3D;
  --mute-bg:       #232625;  --mute-ink:  #A9ACAA;
}

/* The bar and the side panel are black in both themes. Their own tokens
   are redefined, so every control and popover inside follows. */
:root[data-style="emerald"][data-lux="onyx"] .topbar,
:root[data-style="emerald"][data-lux="onyx"] .sidebar {
  --surface:       #0B0C0B;
  --surface-2:     #171918;
  --surface-3:     #222423;
  --border:        #2A2C2B;
  --border-strong: #3A3D3B;
  --ink:           #F2F3F2;
  --ink-2:         #B3B6B4;
  --ink-3:         #8C8F8D;
  --accent-deep:   #1EA970;
  --accent-deep-ink: #0B0C0B;
  --accent-soft:   #14281E;
  --accent-text:   #72D7A9;
  --mute-bg:       #222423;  --mute-ink:  #B3B6B4;
  color: var(--ink);
}
:root[data-style="emerald"][data-lux="onyx"] .topbar { border-bottom-color: #1E201F; }

/* A wordmark, not a label */
:root[data-style="emerald"][data-lux] .brand-name { font-size: 14px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
:root[data-style="emerald"][data-lux] .page-head h1 { font-weight: 500; letter-spacing: -.03em; }
:root[data-style="emerald"][data-lux][dir="rtl"] .page-head h1 { letter-spacing: 0; }
:root[data-style="emerald"][data-lux] table.data th { letter-spacing: .08em; }
:root[data-style="emerald"][data-lux][dir="rtl"] table.data th { letter-spacing: 0; }

/* Onyx: black type on the bright emerald, black on the hover too */
:root[data-style="emerald"][data-lux="onyx"] .btn-primary,
:root[data-style="emerald"][data-lux="onyx"] .btn-primary:hover { color: var(--accent-ink); }
:root[data-style="emerald"][data-lux="onyx"] .kpi-grid > .kpi:nth-child(1) { --tile: var(--ink); --tile-ink: var(--ink); }
:root[data-style="emerald"][data-lux="onyx"] .next { border-inline-start-color: var(--ink); }
:root[data-style="emerald"][data-lux="onyx"] .chart .bar { fill: var(--data-1); }
:root[data-style="emerald"][data-lux="onyx"] .auth-aside { background: linear-gradient(160deg, #0B0C0B 0%, #0B0C0B 55%, #10261C 100%); color: #F2F3F2; }
:root[data-style="emerald"][data-lux="onyx"] .auth-aside .brand-mark { background: #1EA970; color: #0B0C0B; }
:root[data-style="emerald"][data-lux="onyx"] .auth-aside .lang-switch button[aria-pressed="true"] { background: #1EA970; color: #0B0C0B; }
:root[data-style="emerald"][data-lux="onyx"] .auth-art .art-key { color: #1EA970; }

/* ============================================================= Stone */
:root[data-style="emerald"][data-lux="stone"] {
  --canvas:        #EFEEEB;
  --surface:       #FBFBFA;
  --surface-2:     #F5F4F1;
  --surface-3:     #E9E7E2;
  --border:        #E1DFD9;
  --border-strong: #CAC7BF;
  --ink:           #1B1F1C;
  --ink-2:         #565A55;
  --ink-3:         #686B66;
  --accent:        #1F4D3A;
  --accent-ink:    #FFFFFF;
  --accent-hover:  #173D2E;
  --accent-deep:   #173D2E;
  --accent-deep-ink: #EFEBE2;
  --accent-text:   #1F4D3A;
  --accent-soft:   #E3EBE5;
  --accent-soft-2: #C7D6CB;
  --focus:         #1F4D3A;
  --brass:         #9C7A45;
  --brass-light:   #C9A56B;
  --data-1:        #2F5E4A;
  --data-2:        #9C7A45;
  --data-3:        #6A7F98;
  --data-4:        #8A8C86;
  --grid:          #E6E4DF;
  --axis:          #CAC7BF;
  --mute-bg:       #E9E7E2;  --mute-ink:  #565A55;
  /* a quieter green for 'good', so score bars and ticks sit with the forest */
  --good-mark:     #3F7F5C;  --good-ink:  #2C6446;  --good-bg:  #E4EEE7;
  --shadow-card:  0 1px 2px rgba(27, 31, 28, .05), 0 1px 3px rgba(27, 31, 28, .04);
  --shadow-pop:   0 0 0 1px rgba(27, 31, 28, .06), 0 4px 8px -2px rgba(27, 31, 28, .07), 0 12px 28px -6px rgba(27, 31, 28, .13);
  --shadow-modal: 0 0 0 1px rgba(27, 31, 28, .06), 0 12px 24px -8px rgba(27, 31, 28, .16), 0 32px 64px -12px rgba(27, 31, 28, .26);
}

@media (prefers-color-scheme: dark) {
  :root[data-style="emerald"][data-lux="stone"]:not([data-theme="light"]) {
    --canvas:        #121412;
    --surface:       #1A1D1A;
    --surface-2:     #202420;
    --surface-3:     #282C28;
    --border:        #2E332E;
    --border-strong: #3E443E;
    --ink:           #EEEDE8;
    --ink-2:         #ABAEA7;
    --ink-3:         #8C8F88;
    --accent:        #7DB89A;
    --accent-ink:    #0F1A14;
    --accent-hover:  #93C8AC;
    --accent-deep:   #173D2E;
    --accent-deep-ink: #EFEBE2;
    --accent-text:   #9CCBB2;
    --accent-soft:   #1C2B23;
    --accent-soft-2: #24392D;
    --focus:         #7DB89A;
    --brass:         #C9A56B;
    --brass-light:   #C9A56B;
    --data-1:        #6FA58A;
    --data-2:        #C9A56B;
    --data-3:        #93A8C4;
    --data-4:        #7F827B;
    --grid:          #262A26;
    --axis:          #3E443E;
    --mute-bg:       #282C28;  --mute-ink:  #ABAEA7;
  }
}
:root[data-style="emerald"][data-lux="stone"][data-theme="dark"] {
  --canvas:        #121412;
  --surface:       #1A1D1A;
  --surface-2:     #202420;
  --surface-3:     #282C28;
  --border:        #2E332E;
  --border-strong: #3E443E;
  --ink:           #EEEDE8;
  --ink-2:         #ABAEA7;
  --ink-3:         #8C8F88;
  --accent:        #7DB89A;
  --accent-ink:    #0F1A14;
  --accent-hover:  #93C8AC;
  --accent-deep:   #173D2E;
  --accent-deep-ink: #EFEBE2;
  --accent-text:   #9CCBB2;
  --accent-soft:   #1C2B23;
  --accent-soft-2: #24392D;
  --focus:         #7DB89A;
  --brass:         #C9A56B;
  --brass-light:   #C9A56B;
  --data-1:        #6FA58A;
  --data-2:        #C9A56B;
  --data-3:        #93A8C4;
  --data-4:        #7F827B;
  --grid:          #262A26;
  --axis:          #3E443E;
  --mute-bg:       #282C28;  --mute-ink:  #ABAEA7;
}

/* Brass, in small doses: the key in the mark, the current page, the counts that matter, the recommendation */
:root[data-style="emerald"][data-lux="stone"] .brand-mark,
:root[data-style="emerald"][data-lux="stone"] .user-btn .avatar { background: var(--accent-deep); color: var(--brass-light); }
:root[data-style="emerald"][data-lux="stone"] .topnav-item[aria-current="page"],
:root[data-style="emerald"][data-lux="stone"] .nav-item[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--brass-light); }
:root[data-style="emerald"][data-lux="stone"] .count-pill-hot { background: var(--brass-light); color: #1B1F1C; }
:root[data-style="emerald"][data-lux="stone"] .next { border-inline-start-color: var(--brass); }
:root[data-style="emerald"][data-lux="stone"] .auth-aside { background: linear-gradient(160deg, #173D2E 0%, #1F4D3A 100%); color: #EFEBE2; }
:root[data-style="emerald"][data-lux="stone"] .auth-aside .brand-mark { background: #EFEBE2; color: #173D2E; }
:root[data-style="emerald"][data-lux="stone"] .auth-art .art-key { color: #C9A56B; }
