/* =====================================================================
   HK-ERP — theme.css  ·  Sumber tunggal TOKEN WARNA (design token layer)
   ---------------------------------------------------------------------
   Basis palet: docs/Theme_Color_Base_App/"AdobeColor kleur combinatie 5 luke.ase"
      #FFFFFF  putih            #111528  charcoal (ink)
      #3C57BD  biru (brand)     #F76372  coral (danger)
      #8C61D4  ungu (accent)    #719BEB  biru muda (brand terang)
      #5BC7D4  teal (info)      #171D37  navy (brand gelap)
      #ECEFFF  lavender         #FDAF58  oranye (warning)
   Pengecualian: `success` tetap memakai EMERALD (hijau) — warna fungsional.

   DEFAULT TEMA = LIGHT (`:root`), `[data-theme="dark"]` sebagai override.

   Cara pakai:
     - Muat stylesheet ini TERAKHIR (sebelum </head>) agar menimpa token lama.
     - Token hex  : var(--brand), var(--bg-page), ...
     - Token RGB  : --c-brand (dipakai Tailwind: rgb(var(--c-brand)/<alpha>))
   ===================================================================== */

:root {
    /* ---------- Primitif palet ---------- */
    --p-white:     #FFFFFF;
    --p-ink:       #111528;
    --p-blue:      #3C57BD;
    --p-red:       #F76372;
    --p-purple:    #8C61D4;
    --p-bluelight: #719BEB;
    --p-teal:      #5BC7D4;
    --p-navy:      #171D37;
    --p-lavender:  #ECEFFF;
    --p-orange:    #FDAF58;
    --p-emerald:   #10B981;   /* success (dipertahankan) */
    --p-emerald-d: #34D399;

    /* ---------- Fill SOLID (aman-AA dgn teks putih, tema-independen) ---------- */
    --c-brand-solid:   60 87 189;   /* #3C57BD — putih 6.38 */
    --c-accent-solid:  109 63 191;  /* #6D3FBF — putih 6.74 */
    --c-info-solid:    12 107 120;  /* #0C6B78 — putih 6.19 */
    --c-success-solid: 4 120 87;    /* #047857 — putih 5.48 */
    --c-warning-solid: 180 83 9;    /* #B45309 — putih 5.02 */
    --c-danger-solid:  192 38 58;   /* #C0263A — putih 5.87 */
    --c-on-solid:      255 255 255;
}

/* =====================================================================
   TEMA TERANG (DEFAULT)
   ===================================================================== */
:root,
[data-theme="light"] {
    color-scheme: light;

    /* --- RGB triples (untuk Tailwind / alpha) --- */
    --c-brand:        60 87 189;    /* #3C57BD */
    --c-brand-strong: 23 29 55;     /* #171D37 */
    --c-brand-light:  113 155 235;  /* #719BEB */
    --c-accent:       109 63 191;   /* #6D3FBF — teks di putih 6.74 */
    --c-info:         12 107 120;   /* #0C6B78 — teks di putih 6.19 */
    --c-success:      4 120 87;     /* #047857 — teks di putih 5.48 */
    --c-warning:      146 64 14;    /* #92400E — teks di putih 7.09 */
    --c-danger:       192 38 58;    /* #C0263A — teks di putih 5.87 */
    --c-page:         242 243 255;  /* #F2F3FF — tint lavender (BUKAN putih) */
    --c-card:         255 255 255;  /* #FFFFFF */
    --c-card-soft:    236 239 255;  /* #ECEFFF (lavender) */
    --c-sub:          236 239 255;  /* #ECEFFF (lavender) */
    --c-ink:          17 21 40;     /* #111528 (ink) */
    --c-muted:        17 21 40;     /* #111528 (dipakai dgn alpha) */
    --c-border:       17 21 40;     /* #111528 (ink) */
    --c-fg2:          107 111 122;  /* teks sekunder (~ink/62% di putih) */

    /* --- Token semantik (hex) --- */
    --brand:        rgb(var(--c-brand));
    --brand-strong: rgb(var(--c-brand-strong));
    --brand-light:  rgb(var(--c-brand-light));
    --brand-soft:   rgb(var(--c-brand) / .12);
    --brand-contrast: #FFFFFF;
    --accent:       rgb(var(--c-accent));
    --accent-soft:  rgb(236 239 255);
    --info:         rgb(var(--c-info));
    --success:      rgb(var(--c-success));
    --warning:      rgb(var(--c-warning));
    --danger:       rgb(var(--c-danger));

    /* --- Fill solid (bg-<sem>-solid) + warna teks di atasnya --- */
    --brand-solid:   rgb(var(--c-brand-solid));
    --accent-solid:  rgb(var(--c-accent-solid));
    --info-solid:    rgb(var(--c-info-solid));
    --success-solid: rgb(var(--c-success-solid));
    --warning-solid: rgb(var(--c-warning-solid));
    --danger-solid:  rgb(var(--c-danger-solid));
    --on-solid:      rgb(var(--c-on-solid));

    /* --- Permukaan & teks --- */
    --bg-page:       rgb(var(--c-page));
    --bg-card:       rgb(var(--c-card));
    --bg-card-soft:  rgb(var(--c-card-soft));
    --bg-sub:        rgb(var(--c-sub));
    --bg-hover:      rgb(var(--c-ink) / .05);
    --border:        rgb(var(--c-ink) / .12);
    --border-strong: rgb(var(--c-ink) / .50);  /* untuk kontrol form (≥3:1) */
    --text-primary:  rgb(var(--c-ink));
    /* Fase 50r — audit kontras AA: alpha dinaikkan .62 -> .70 agar teks sekunder
       tetap >= 4.5:1 bukan hanya di kartu putih (5.9:1) tetapi juga di latar
       halaman lavender #F2F3FF (~5.3:1) dan pada tick/legend chart.          */
    --text-secondary: rgb(var(--c-ink) / .70);
    --input-bg:      #FFFFFF;
    --bg-overlay:    rgb(var(--c-ink) / .45);

    /* --- Chart / aset --- */
    /* Palet chart eksplisit (Fase 50s): 8 warna HARMONIS & berbeda nyata,
       dipakai semua chart (donut/bar/line) via --color-chart-1..8. */
    --c-chart-1:  60 87 189;    /* brand  #3C57BD */
    --c-chart-2:  109 63 191;   /* accent #6D3FBF */
    --c-chart-3:  12 107 120;   /* teal   #0C6B78 */
    --c-chart-4:  4 120 87;     /* emerald #047857 */
    --c-chart-5:  180 83 9;     /* amber  #B45309 */
    --c-chart-6:  192 38 58;    /* red    #C0263A */
    --c-chart-7:  29 78 216;    /* indigo #1D4ED8 */
    --c-chart-8:  14 116 144;   /* cyan   #0E7490 */
    --color-chart-1: rgb(var(--c-chart-1));
    --color-chart-2: rgb(var(--c-chart-2));
    --color-chart-3: rgb(var(--c-chart-3));
    --color-chart-4: rgb(var(--c-chart-4));
    --color-chart-5: rgb(var(--c-chart-5));
    --color-chart-6: rgb(var(--c-chart-6));
    --color-chart-7: rgb(var(--c-chart-7));
    --color-chart-8: rgb(var(--c-chart-8));

    /* --- Alias kompatibilitas (dipakai halaman lama) --- */
    --bg-panel: rgb(var(--c-card-soft) / .78);
    --text: var(--text-primary);
    --sub: var(--text-secondary);
    --c-glass: var(--c-card);
    --c-txt: var(--c-ink);
    --c-panel: var(--c-card-soft);
    --c-em: var(--c-brand); --c-eml: var(--c-brand-light);
    --c-cyn: var(--c-info); --c-rd: var(--c-danger); --c-amber: var(--c-warning);
    --c-line: var(--border);
    --c-solid: #FFFFFF;
    /* Alias nama lama (legacy halaman: em/eml/cyn/amber/rd) */
    --c-bg: var(--c-page);
    --rd: var(--danger); --amber: var(--warning); --cyn: var(--info);
    --em: var(--brand); --eml: var(--brand);
    --chart-grid: rgb(var(--c-ink) / .08);
    --chart-tick: var(--text-secondary);
    --g1: #3C57BD; --g2: #6D3FBF; --g3: #92400E;
    --glow-1: rgb(var(--c-brand) / .16);
    --glow-2: rgb(var(--c-info) / .15);
    --sb-track: #ECEFFF; --sb-thumb: #719BEB;

    /* --- Token mobile (--m-*) --- */
    --m-accent: var(--brand);
    --m-accent-2: var(--info);
    --m-success: var(--success);
    --m-danger: var(--danger);
    --m-warning: var(--warning);
    --m-info: var(--info);
    --m-purple: var(--accent);
    --m-accent-solid: var(--brand-solid);
    --m-accent-2-solid: var(--info-solid);
    --m-success-solid: var(--success-solid);
    --m-danger-solid: var(--danger-solid);
    --m-warning-solid: var(--warning-solid);
    --m-bg: var(--bg-page);
    --m-bg-soft: var(--bg-card);
    --m-card: var(--bg-card);
    --m-card-2: var(--bg-card-soft);
    --m-border: var(--border);
    --m-text: var(--text-primary);
    --m-muted: var(--text-secondary);
}


/* =====================================================================
   TEMA GELAP (override)
   ===================================================================== */
[data-theme="dark"] {
    color-scheme: dark;

    --c-brand:        113 155 235;  /* #719BEB — teks di navy 5.99 */
    --c-brand-strong: 60 87 189;
    --c-brand-light:  154 179 244;
    --c-accent:       167 139 234;  /* #A78BEA — teks di navy 5.94 */
    --c-info:         91 199 212;
    --c-success:      52 211 153;   /* emerald terang */
    --c-warning:      253 175 88;
    --c-danger:       247 99 114;
    --c-page:         17 21 40;     /* #111528 */
    --c-card:         23 29 55;     /* #171D37 */
    --c-card-soft:    23 29 55;     /* #171D37 (navy) */
    --c-sub:          23 29 55;     /* #171D37 (navy) */
    --c-ink:          236 239 255;  /* #ECEFFF (lavender) */
    --c-muted:        236 239 255;  /* #ECEFFF (lavender) */
    --c-border:       236 239 255;  /* #ECEFFF (lavender) */
    --c-fg2:          154 158 178;  /* teks sekunder (~lavender/62% di navy) */

    /* Palet chart mode gelap (Fase 50s) — versi lebih terang agar nyaman di navy. */
    --c-chart-1:  113 155 235;  /* #719BEB */
    --c-chart-2:  167 139 234;  /* #A78BEA */
    --c-chart-3:  91 199 212;   /* #5BC7D4 */
    --c-chart-4:  52 211 153;   /* #34D399 */
    --c-chart-5:  253 175 88;   /* #FDAF58 */
    --c-chart-6:  247 99 114;   /* #F76372 */
    --c-chart-7:  147 178 245;  /* #93B2F5 */
    --c-chart-8:  103 208 222;  /* #67D0DE */

    --brand-soft:   rgb(var(--c-brand) / .18);
    --accent-soft:  rgb(var(--c-accent) / .22);

    --bg-hover:      rgb(var(--c-ink) / .07);
    --border:        rgb(var(--c-ink) / .16);
    --border-strong: rgb(var(--c-ink) / .38);  /* untuk kontrol form (≥3:1) */
    --input-bg:      rgb(var(--c-page));
    --bg-overlay:    rgb(var(--c-page) / .65);

    --c-glass: var(--c-card);
    --c-txt: var(--c-ink);
    --c-panel: var(--c-card-soft);
    --c-em: var(--c-brand); --c-eml: var(--c-brand-light);
    --c-cyn: var(--c-info); --c-rd: var(--c-danger); --c-amber: var(--c-warning);
    --c-solid: #111528;
    --chart-grid: rgb(var(--c-ink) / .08);
    --chart-tick: var(--text-secondary);
    --g1: #719BEB; --g2: #5BC7D4; --g3: #FDAF58;
    --glow-1: rgb(var(--c-brand) / .22);
    --glow-2: rgb(var(--c-info) / .18);
    --sb-track: rgb(var(--c-page)); --sb-thumb: rgb(var(--c-brand-strong));
}

/* =====================================================================
   Utilitas token (fallback non-Tailwind; dipakai mobile & halaman statis)
   ===================================================================== */
.bg-brand    { background-color: var(--brand) !important; }
.bg-accent   { background-color: var(--accent) !important; }
.bg-info     { background-color: var(--info) !important; }
.bg-success  { background-color: var(--success) !important; }
.bg-warning  { background-color: var(--warning) !important; }
.bg-danger   { background-color: var(--danger) !important; }
/* Fill solid (aman-AA dgn teks putih) */
.bg-brand-solid  { background-color: var(--brand-solid) !important; }
.bg-accent-solid { background-color: var(--accent-solid) !important; }
.bg-info-solid   { background-color: var(--info-solid) !important; }
.bg-success-solid{ background-color: var(--success-solid) !important; }
.bg-warning-solid,
.bg-warn-solid   { background-color: var(--warning-solid) !important; }
.bg-danger-solid { background-color: var(--danger-solid) !important; }
.text-on-solid   { color: var(--on-solid) !important; }
.bg-surface  { background-color: var(--bg-card) !important; }
.bg-surface-2{ background-color: var(--bg-sub) !important; }
.text-brand  { color: var(--brand) !important; }
.text-accent { color: var(--accent) !important; }
.text-info   { color: var(--info) !important; }
.text-success{ color: var(--success) !important; }
.text-warning{ color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-ink    { color: var(--text-primary) !important; }
.text-muted  { color: var(--text-secondary) !important; }
.border-brand  { border-color: var(--brand) !important; }
.border-surface{ border-color: var(--border) !important; }

/* Tema terang: transisi halus saat ganti tema */
html { background: var(--bg-page); }
body { background: var(--bg-page); color: var(--text-primary); }

/* =====================================================================
   BENTUK UI GLOBAL — radius kecil (0.25rem), border kartu tipis,
   shadow lebih tipis.  Diatur di sini (dimuat terakhir) agar berlaku
   ke seluruh halaman & komponen.
   ===================================================================== */
:root {
    --u-shadow: 0 1px 2px rgb(0 0 0 / .05);   /* shadow tipis standar */
}

/* (1) Radius = nilai default Tailwind DIKURANGI 0.25rem (bukan disamakan).
   Lingkaran `.rounded-full` dan `.rounded-none` tidak disentuh. */
.rounded    { border-radius: 0 !important; }          /* 0.25  - 0.25 -> 0    */
.rounded-sm { border-radius: 0 !important; }          /* 0.125 - 0.25 -> 0    */
[class*="rounded-md"]  { border-radius: .125rem !important; } /* 0.375 -> 0.125 */
[class*="rounded-lg"]  { border-radius: .25rem  !important; } /* 0.5   -> 0.25  */
[class*="rounded-xl"]  { border-radius: .5rem   !important; } /* 0.75  -> 0.5   */
[class*="rounded-2xl"] { border-radius: .75rem  !important; } /* 1     -> 0.75  */
[class*="rounded-3xl"] { border-radius: 1.25rem !important; } /* 1.5   -> 1.25  */

/* Variasi per-sisi (rounded-t/r/b/l & -tl/-tr/-br/-bl) */
[class*="rounded-tl-md"] { border-top-left-radius: .125rem !important; }
[class*="rounded-tr-md"] { border-top-right-radius: .125rem !important; }
[class*="rounded-br-md"] { border-bottom-right-radius: .125rem !important; }
[class*="rounded-bl-md"] { border-bottom-left-radius: .125rem !important; }
[class*="rounded-t-md"]  { border-top-left-radius: .125rem !important; border-top-right-radius: .125rem !important; }
[class*="rounded-r-md"]  { border-top-right-radius: .125rem !important; border-bottom-right-radius: .125rem !important; }
[class*="rounded-b-md"]  { border-bottom-right-radius: .125rem !important; border-bottom-left-radius: .125rem !important; }
[class*="rounded-l-md"]  { border-top-left-radius: .125rem !important; border-bottom-left-radius: .125rem !important; }

[class*="rounded-tl-lg"] { border-top-left-radius: .25rem !important; }
[class*="rounded-tr-lg"] { border-top-right-radius: .25rem !important; }
[class*="rounded-br-lg"] { border-bottom-right-radius: .25rem !important; }
[class*="rounded-bl-lg"] { border-bottom-left-radius: .25rem !important; }
[class*="rounded-t-lg"]  { border-top-left-radius: .25rem !important; border-top-right-radius: .25rem !important; }
[class*="rounded-r-lg"]  { border-top-right-radius: .25rem !important; border-bottom-right-radius: .25rem !important; }
[class*="rounded-b-lg"]  { border-bottom-right-radius: .25rem !important; border-bottom-left-radius: .25rem !important; }
[class*="rounded-l-lg"]  { border-top-left-radius: .25rem !important; border-bottom-left-radius: .25rem !important; }

[class*="rounded-tl-xl"] { border-top-left-radius: .5rem !important; }
[class*="rounded-tr-xl"] { border-top-right-radius: .5rem !important; }
[class*="rounded-br-xl"] { border-bottom-right-radius: .5rem !important; }
[class*="rounded-bl-xl"] { border-bottom-left-radius: .5rem !important; }
[class*="rounded-t-xl"]  { border-top-left-radius: .5rem !important; border-top-right-radius: .5rem !important; }
[class*="rounded-r-xl"]  { border-top-right-radius: .5rem !important; border-bottom-right-radius: .5rem !important; }
[class*="rounded-b-xl"]  { border-bottom-right-radius: .5rem !important; border-bottom-left-radius: .5rem !important; }
[class*="rounded-l-xl"]  { border-top-left-radius: .5rem !important; border-bottom-left-radius: .5rem !important; }

[class*="rounded-tl-2xl"] { border-top-left-radius: .75rem !important; }
[class*="rounded-tr-2xl"] { border-top-right-radius: .75rem !important; }
[class*="rounded-br-2xl"] { border-bottom-right-radius: .75rem !important; }
[class*="rounded-bl-2xl"] { border-bottom-left-radius: .75rem !important; }
[class*="rounded-t-2xl"]  { border-top-left-radius: .75rem !important; border-top-right-radius: .75rem !important; }
[class*="rounded-r-2xl"]  { border-top-right-radius: .75rem !important; border-bottom-right-radius: .75rem !important; }
[class*="rounded-b-2xl"]  { border-bottom-right-radius: .75rem !important; border-bottom-left-radius: .75rem !important; }
[class*="rounded-l-2xl"]  { border-top-left-radius: .75rem !important; border-bottom-left-radius: .75rem !important; }

[class*="rounded-tl-3xl"] { border-top-left-radius: 1.25rem !important; }
[class*="rounded-tr-3xl"] { border-top-right-radius: 1.25rem !important; }
[class*="rounded-br-3xl"] { border-bottom-right-radius: 1.25rem !important; }
[class*="rounded-bl-3xl"] { border-bottom-left-radius: 1.25rem !important; }
[class*="rounded-t-3xl"]  { border-top-left-radius: 1.25rem !important; border-top-right-radius: 1.25rem !important; }
[class*="rounded-r-3xl"]  { border-top-right-radius: 1.25rem !important; border-bottom-right-radius: 1.25rem !important; }
[class*="rounded-b-3xl"]  { border-bottom-right-radius: 1.25rem !important; border-bottom-left-radius: 1.25rem !important; }
[class*="rounded-l-3xl"]  { border-top-left-radius: 1.25rem !important; border-bottom-left-radius: 1.25rem !important; }

/* (2) Kartu — border tipis konsisten (kartu mobile diatur di mobile.css) */
.bg-card, .bg-card-soft, .bg-surface, .bg-surface-2,
.op-card, .kanban-col, .card-todo, .glass, .glass-solid {
    border: 1px solid var(--border) !important;
}

/* (3) Shadow — dibuat lebih tipis untuk semua utility shadow */
.shadow-sm, .shadow, .shadow-md, .shadow-lg, .shadow-xl, .shadow-2xl,
.shadow-inner {
    box-shadow: var(--u-shadow) !important;
}

