/* ===== Karl Monitor tema v2 (25/11/2026), ikut rujukan admin ("After" dashboard analitik) =====
   Sebab setiap pilihan (antislop R-31):
   - Latar kelabu sejuk + kad putih bergaris nipis: data jadi fokus, bukan hiasan kaca.
   - Satu aksen hijau jenama (#1FA35C) untuk tindakan & trend naik; merah/kuning untuk keadaan sahaja.
   - Cip ikon 4 warna pada KPI: beza jenis angka dengan sekali pandang (jualan/mesej/media/giliran).
   - Trek graf berjalur: tunjuk skala penuh di belakang setiap bar supaya bar rendah tetap boleh dibaca.
   - Desktop: menu jadi rail ikon di kiri (macam rujukan); phone: tab bawah kekal (ibu jari).
   - Ikon kaca 3D (ChatGPT, 25/11) pada menu & KPI; animasi masuk sekali sahaja, semua tamat < 2 s.
   Dial: ENERGY 2 / RHYTHM 2 / MOTION 2. Dimuat selepas style.css & theme.css. */
:root {
  --bg: #EEF0F3; --card: #FFFFFF; --sunk: #F4F5F7; --ink: #111816; --muted: #56615C; --faint: #5F6A65; --line: #E3E6EA;
  --accent: #1FA35C; --accent-ink: #0E7A43; --accent-soft: #E6F6EC;
  --t-green: #1FA35C; --t-blue: #3B6FF5; --t-orange: #E8620F; --t-purple: #7A5AF8; --t-slate: #475569;
  --glass: var(--card); --glass-line: var(--line); --glass-shadow: 0 1px 2px rgba(17, 24, 22, .04);
  --lift: 0 1px 2px rgba(17, 24, 22, .05), 0 6px 18px -10px rgba(17, 24, 22, .18);
  --trk-bg: #F3F5F4; --trk-ln: #E2E7E4;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0D1110; --card: #151A18; --sunk: #1B2120; --ink: #E6ECE9; --muted: #A3AEA9; --faint: #85908B; --line: #27302C;
  --accent: #3CC17C; --accent-ink: #6BD69C; --accent-soft: #15301F;
  --t-green: #2FB56B; --t-blue: #5B87F7; --t-orange: #F07A30; --t-purple: #8F74F9; --t-slate: #8A97A8;
  --glass-shadow: none; --lift: 0 1px 2px rgba(0, 0, 0, .4); --trk-bg: #1A201E; --trk-ln: #242C29;
} }

/* latar rata: buang blob kaca lama */
html, body { background: var(--bg); }
body::before, body::after, #app::before { display: none; }
.card, .stat, .login-card, .rbox, .top, .tabs, #ptr {
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: none; backdrop-filter: none; }
.card { border-radius: 16px; }
.stat { border-radius: 16px; }
.top { border-width: 0 0 1px; }
a[href], button:not(:disabled), select, summary, label[for], [role="radio"] { cursor: pointer; }
button:disabled { cursor: not-allowed; }

/* tajuk bahagian: huruf biasa, bukan HURUF BESAR bertabur (R-06) */
.sec h2, .rhead { font-size: 15px; font-weight: 700; letter-spacing: -.01em; text-transform: none; color: var(--ink); }
.sec { margin: 8px 2px -2px; }

/* bar atas: jenama + laluan semasa */
.brand { gap: 10px; }
.brand .crumb { font-size: 14px; font-weight: 600; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line); }
.brand .crumb:empty { display: none; }

/* KPI utama (4 kad) */
.today-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 2px 2px -2px; }
.today-h h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.today-h p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.today-h .hero-bots { display: flex; gap: 6px; flex-wrap: wrap; }
.today-h .hero-bots span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); padding: 5px 10px; border-radius: 999px; }
.today-h .hero-bots i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.today-h .hero-bots i.off { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat.kpi { padding: 14px 16px 12px; display: flex; flex-direction: column; }
.kpi-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-h > span { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 !important; }
/* ikon kaca 3D (dijana ChatGPT, latar dibuang): warna sudah dalam gambar, tak perlu cip berwarna */
.chip-ic { flex: none; width: 36px; height: 36px; display: block; filter: drop-shadow(0 3px 6px rgba(17, 24, 22, .16)); transition: transform .25s cubic-bezier(.3, 1.5, .5, 1); }
.stat.kpi:hover .chip-ic { transform: translateY(-2px) rotate(-4deg); }
.stat.kpi strong { font-size: clamp(24px, 6.6vw, 32px); line-height: 1.15; margin-top: 8px; white-space: nowrap; }
.stat.kpi .trend { margin-top: 6px; padding-top: 0; }
.stat.kpi .spark { position: static; display: block; width: 100%; height: 26px; margin-top: 8px; }

/* kad lain: angka besar ikut gaya sama */
.stat { background: var(--card); }
.kpis .stat { box-shadow: var(--glass-shadow); }
.delta.up::before, .delta.down::before { content: ""; }
.delta.up { color: var(--accent-ink); }

/* kad nombor bot: jalur atas nipis, kad putih */
.bot::before { height: 3px; }

/* graf: trek berjalur di belakang bar */
.chart .trk-bg { fill: var(--trk-bg); }
.chart .trk-ln { stroke: var(--trk-ln); stroke-width: 2; }
svg .trk-bg { fill: var(--trk-bg); } svg .trk-ln { stroke: var(--trk-ln); stroke-width: 2; }
.chart { padding: 16px 16px 12px; }
.chart h3 { font-size: 15px; font-weight: 700; }

/* kad hero lama (halaman Jualan): jadi kad putih, bukan blok hijau penuh */
.hero { background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--glass-shadow); }
.hero::after { display: none; }
.hero-top { color: var(--muted); }
.hero-sub, .hero-total span, .hero-total small, .hero-row span { color: var(--muted); opacity: 1; }
.hero-big { color: var(--ink); }
.hero-row div { background: var(--sunk); border: 1px solid var(--line); }
.hero-row b { color: var(--ink); }
.hero-pill { background: var(--accent-soft); color: var(--accent-ink); }
.hero-bots span { background: var(--sunk); color: var(--muted); }
.hero-total { border-top-color: var(--line); }

/* cip tapisan & butang */
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary { background: #13874A; border-color: #13874A; }

/* tab bawah (phone): ikon kaca 3D; tab lain pudar sedikit supaya tab aktif menonjol */
.tabs { background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px -10px rgba(17, 24, 22, .2); }
.tabs a { color: var(--faint); font-weight: 600; }
.tabs a.on { color: var(--ink); }
.tabs .tab-ic { width: 30px; height: 30px; display: block; opacity: .55; filter: saturate(.55);
  transition: opacity .2s, filter .2s, transform .25s cubic-bezier(.3, 1.5, .5, 1); }
.tabs a:hover .tab-ic { opacity: .85; transform: translateY(-2px); }
.tabs a.on .tab-ic { opacity: 1; filter: saturate(1) drop-shadow(0 4px 8px rgba(17, 24, 22, .2)); animation: tabPop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes tabPop { 0% { transform: scale(.72) rotate(-10deg); } 60% { transform: scale(1.12) rotate(3deg); } 100% { transform: none; } }

/* animasi masuk halaman: berlaku sekali selepas data siap (kelas .anim dibuang selepas 1.8 s) */
.view.anim .kpis .stat { animation: kpiIn .5s cubic-bezier(.2, .8, .3, 1) both; }
.view.anim .kpis .stat:nth-child(2) { animation-delay: .06s; } .view.anim .kpis .stat:nth-child(3) { animation-delay: .12s; }
.view.anim .kpis .stat:nth-child(4) { animation-delay: .18s; }
@keyframes kpiIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.view.anim .chip-ic { animation: icPop .6s cubic-bezier(.3, 1.6, .5, 1) .15s both; }
@keyframes icPop { 0% { opacity: 0; transform: scale(.5) rotate(-14deg); } 70% { opacity: 1; transform: scale(1.1) rotate(4deg); } 100% { transform: none; } }
.view.anim .chart rect.bv { transform-box: fill-box; transform-origin: 50% 100%; animation: barUp .55s cubic-bezier(.2, .8, .3, 1) both; animation-delay: calc(var(--i, 0) * 22ms); }
@keyframes barUp { from { transform: scaleY(0); } to { transform: none; } }
.view.anim .spark path { stroke-dasharray: 400; animation: sparkDraw 1s ease-out both; }
.view.anim .spark .area { animation: rise .8s ease-out .3s both; }
@keyframes sparkDraw { from { stroke-dashoffset: 400; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .tabs .tab-ic, .chip-ic { transition: none; }
  .tabs a.on .tab-ic, .view.anim .kpis .stat, .view.anim .chip-ic, .view.anim .chart rect.bv, .view.anim .spark path, .view.anim .spark .area { animation: none; }
}

/* desktop: rail ikon di kiri, kandungan lebih lebar */
@media (min-width: 1024px) {
  #app { max-width: none; padding: 0 24px 32px 104px; }
  .top { margin: 0 -24px 0 -104px; padding-left: 104px; padding-right: 24px; }
  .view { max-width: 1180px; margin: 0 auto; padding: 20px 0; }
  .grid2 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tabs { left: 16px; right: auto; top: 16px; bottom: 16px; width: 72px; transform: none; max-width: none;
    grid-template-columns: 1fr; grid-auto-rows: min-content; align-content: start; gap: 12px;
    padding: 14px 8px; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--lift); }
  .tabs a { gap: 4px; padding: 4px 0; font-size: 11px; }
  .tabs .tab-ic { width: 44px; height: 44px; }
  .tabs b { left: calc(50% + 10px); top: 0; }
}
