/* CuanLog: tampilan kaca (glass). Dimuat paling akhir, menimpa variabel dan gaya dasar.
   Terang: kartu putih lembut di atas latar hijau pucat, sidebar hijau tua. Malam: kaca gelap. Aksen bawaan hijau zamrud (bisa diganti di Pengaturan). */
:root {
  --bg: #e8f0ed; --surface: rgb(255 255 255 / .88); --panel: rgb(14 80 58 / .06); --panel-2: rgb(14 80 58 / .1); --line: rgb(10 50 38 / .09);
  --ink: #0b1914; --ink-2: #2c423a; --muted: #5f736b;
  --accent: #0e9f6e; --accent-2: #2cc99d; --accent-ink: #fff; --accent-soft: rgb(14 159 110 / .12);
  --pos: #0e9f6e; --pos-soft: rgb(14 159 110 / .12); --neg: #e5484d; --neg-soft: rgb(229 72 77 / .1); --warn: #c27c00; --warn-soft: rgb(240 170 20 / .14);
  --shadow: 0 1px 1px rgb(8 40 30 / .04), 0 14px 34px -12px rgb(8 60 44 / .2);
  --glass-edge: rgb(255 255 255 / .85); --rail-a: #0f3b30; --rail-b: #091f19; --card-r: 22px; --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #06100d; --surface: rgb(255 255 255 / .05); --panel: rgb(255 255 255 / .06); --panel-2: rgb(255 255 255 / .1); --line: rgb(255 255 255 / .09);
    --ink: #ecf6f2; --ink-2: #c3d6ce; --muted: #8aa196;
    --accent: #2bd49a; --accent-2: #5fe6bb; --accent-ink: #052018; --accent-soft: rgb(43 212 154 / .14);
    --pos: #3fe0aa; --pos-soft: rgb(63 224 170 / .12); --neg: #ff6b7d; --neg-soft: rgb(255 107 125 / .12); --warn: #f2b84b; --warn-soft: rgb(242 184 75 / .12);
    --shadow: 0 18px 40px -18px rgb(0 0 0 / .7); --glass-edge: rgb(255 255 255 / .08); --rail-a: #0b2a22; --rail-b: #06140f;
  }
}
:root[data-theme="dark"] {
  --bg: #06100d; --surface: rgb(255 255 255 / .05); --panel: rgb(255 255 255 / .06); --panel-2: rgb(255 255 255 / .1); --line: rgb(255 255 255 / .09);
  --ink: #ecf6f2; --ink-2: #c3d6ce; --muted: #8aa196;
  --accent: #2bd49a; --accent-2: #5fe6bb; --accent-ink: #052018; --accent-soft: rgb(43 212 154 / .14);
  --pos: #3fe0aa; --pos-soft: rgb(63 224 170 / .12); --neg: #ff6b7d; --neg-soft: rgb(255 107 125 / .12); --warn: #f2b84b; --warn-soft: rgb(242 184 75 / .12);
  --shadow: 0 18px 40px -18px rgb(0 0 0 / .7); --glass-edge: rgb(255 255 255 / .08); --rail-a: #0b2a22; --rail-b: #06140f;
}

body { background: radial-gradient(900px 520px at 6% -8%, rgb(44 201 157 / .26), transparent 62%), radial-gradient(800px 560px at 100% 0, rgb(90 140 255 / .1), transparent 60%), var(--bg); background-attachment: fixed; }
:root[data-theme="dark"] body { background: radial-gradient(900px 520px at 6% -8%, rgb(43 212 154 / .16), transparent 62%), radial-gradient(800px 560px at 100% 0, rgb(90 120 255 / .08), transparent 60%), var(--bg); background-attachment: fixed; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body { background: radial-gradient(900px 520px at 6% -8%, rgb(43 212 154 / .16), transparent 62%), radial-gradient(800px 560px at 100% 0, rgb(90 120 255 / .08), transparent 60%), var(--bg); background-attachment: fixed; } }

/* ---------- Tombol, input, kontrol ---------- */
.btn { border-radius: 12px; transition: transform .2s var(--ease), box-shadow .25s, background .2s, border-color .2s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary, .btn.accent { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: transparent; box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.primary:hover, .btn.accent:hover { filter: none; box-shadow: 0 14px 26px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.icon-btn { border-radius: 12px; background: var(--surface); border-color: var(--glass-edge); transition: transform .2s var(--ease), background .2s; backdrop-filter: blur(10px); }
.icon-btn:hover { transform: translateY(-1px); background: var(--panel); }
input, select, textarea { border-radius: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); transition: border-color .2s, box-shadow .2s; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.seg { border-radius: 14px; background: var(--panel); border-color: transparent; }
.seg button { border-radius: 10px; transition: background .2s, color .2s, box-shadow .2s; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 4px 12px -4px rgb(8 60 44 / .25); }
.pill { font-weight: 700; }
.pill.acc { background: var(--accent-soft); color: var(--accent); }
.progress { height: 9px; background: var(--panel-2); }
.progress i { background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .9s var(--ease); }
.progress.neg i { background: linear-gradient(90deg, #ff8a8a, var(--neg)); } .progress.warn i { background: linear-gradient(90deg, #ffd27a, var(--warn)); }

/* ---------- Kartu ---------- */
.card { background: var(--surface); border: 1px solid var(--glass-edge); border-radius: var(--card-r); padding: 20px; box-shadow: var(--shadow); backdrop-filter: blur(16px) saturate(1.25); -webkit-backdrop-filter: blur(16px) saturate(1.25); }
.card > h2, .card-h h2 { font-size: 16.5px; font-weight: 700; letter-spacing: -.015em; }
.kpi { position: relative; overflow: hidden; transition: transform .3s var(--ease), box-shadow .3s; }
.kpi:hover { transform: translateY(-3px); box-shadow: 0 22px 40px -16px rgb(8 60 44 / .28); }
.kpi .label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.kpi .val { font-size: clamp(18px, 1.55vw, 24px); font-weight: 700; letter-spacing: -.035em; }
@media (max-width: 1280px) { .kpi .val { font-size: clamp(20px, 2.4vw, 27px); } }
.calm .eyebrow { display: none; }
.kpi.hero { background: linear-gradient(150deg, #12b27e, #0a7556 70%); border-color: transparent; color: #fff; box-shadow: 0 22px 40px -16px rgb(10 117 86 / .55); }
.kpi.hero:has(.val .neg) { background: linear-gradient(150deg, #ee6a72, #b72b3d 75%); box-shadow: 0 22px 40px -16px rgb(183 43 61 / .5); }
.kpi.hero .label, .kpi.hero .sub { color: rgb(255 255 255 / .82); }
.kpi.hero .val, .kpi.hero .val .pos, .kpi.hero .val .neg { color: #fff; }
.kpi.hero::after { content: ""; position: absolute; right: -40px; top: -50px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgb(255 255 255 / .22), transparent 70%); pointer-events: none; }
.kpi .spark { width: 100%; height: 38px; margin-top: 8px; overflow: visible; }
.kpi .spark path.ln { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 1.4s .25s var(--ease) forwards; }
.kpi .spark path.ar { stroke: none; opacity: 0; animation: fadein .8s .9s forwards; }
.kpi.hero .spark path.ln { stroke: #fff; }
.kpi .spark rect { rx: 2px; }
.ring .fg { stroke-linecap: round; transition: stroke-dasharray 1s var(--ease); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadein { to { opacity: 1; } }

/* ---------- Sapaan, insight, meteran ---------- */
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.hello h2 { font-size: clamp(24px, 3vw, 36px); font-weight: 800; letter-spacing: -.04em; line-height: 1.1; }
.hello h2 em { font-style: normal; background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hello p { margin: 6px 0 0; color: var(--muted); max-width: 60ch; }
.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.ins { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); backdrop-filter: blur(14px); min-width: 0; transition: transform .3s var(--ease); }
.ins:hover { transform: translateY(-2px); }
.ins .ic { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; flex: none; background: var(--t-soft, var(--accent-soft)); color: var(--t, var(--accent)); }
.ins .ic svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ins b { display: block; font-size: 13px; color: var(--muted); font-weight: 700; }
.ins span.v { display: block; font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.ins.t-g { --t: var(--pos); --t-soft: var(--pos-soft); } .ins.t-r { --t: var(--neg); --t-soft: var(--neg-soft); }
.ins.t-a { --t: var(--warn); --t-soft: var(--warn-soft); } .ins.t-b { --t: #3b82f6; --t-soft: rgb(59 130 246 / .12); }
.gauge { display: grid; justify-items: center; gap: 2px; margin: -4px 0 6px; }
.gauge svg { width: 190px; height: 112px; overflow: visible; }
.gauge .tr { fill: none; stroke: var(--panel-2); stroke-width: 14; stroke-linecap: round; }
.gauge .fg { fill: none; stroke: url(#gaugeG); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease); }
.gauge .pct { font-size: 28px; font-weight: 800; letter-spacing: -.03em; margin-top: -44px; }
.gauge .cap { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- Grafik ---------- */
.chart .line { stroke-width: 2.8; filter: drop-shadow(0 6px 8px color-mix(in srgb, var(--accent) 35%, transparent)); stroke-dasharray: 1600; stroke-dashoffset: 1600; animation: draw 1.8s .2s var(--ease) forwards; }
.chart .line.neg { filter: drop-shadow(0 6px 8px rgb(229 72 77 / .3)); }
.chart .end { stroke-width: 3; animation: pop .6s 1.6s var(--ease) both; }
@keyframes pop { from { transform: scale(0); transform-origin: center; transform-box: fill-box; } to { transform: scale(1); transform-box: fill-box; transform-origin: center; } }

/* ---------- Sidebar dan kerangka (desktop) ---------- */
.nav a { transition: background .2s, color .2s, transform .2s var(--ease); }
@media (min-width: 861px) {
  .shell { padding: 14px; gap: 14px; grid-template-columns: 262px minmax(0, 1fr); transition: grid-template-columns .45s var(--ease); }
  .shell.rail { grid-template-columns: 86px minmax(0, 1fr); }
  .side { top: 14px; height: calc(100vh - 28px); height: calc(100dvh - 28px); border: 1px solid rgb(255 255 255 / .08); border-radius: 28px; color: #d3ebe2;
    background: radial-gradient(260px 200px at 0 0, rgb(44 201 157 / .28), transparent 70%), linear-gradient(180deg, var(--rail-a), var(--rail-b)); box-shadow: 0 30px 60px -24px rgb(5 40 30 / .6), inset 0 1px 0 rgb(255 255 255 / .08); }
  .side .brand { color: #fff; }
  .nav .group { color: rgb(255 255 255 / .38); }
  .nav a { color: #b6d2c8; border-radius: 14px; padding: 10px 12px; position: relative; }
  .nav a:hover { background: rgb(255 255 255 / .07); color: #fff; transform: translateX(2px); }
  .nav a[aria-current="page"] { background: linear-gradient(135deg, rgb(44 201 157 / .34), rgb(44 201 157 / .12)); color: #fff; box-shadow: inset 0 0 0 1px rgb(95 230 187 / .28), 0 10px 24px -12px rgb(44 201 157 / .7); }
  .nav a[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 50%; width: 4px; height: 22px; margin-top: -11px; border-radius: 0 4px 4px 0; background: #5fe6bb; }
  .nav a[aria-current="page"] svg { color: #7df0c9; }
  .nav .badge { background: #2cc99d; color: #04241a; }
  .me { background: rgb(255 255 255 / .07); color: #fff; } .me span { color: rgb(255 255 255 / .6); } .me .av { background: linear-gradient(135deg, #2cc99d, #0e9f6e); color: #04241a; }
  .side .btn.ghost { color: #d3ebe2; border-color: rgb(255 255 255 / .16); } .side .btn.ghost:hover { background: rgb(255 255 255 / .08); }
  .side-promo { background: linear-gradient(150deg, rgb(44 201 157 / .35), rgb(14 159 110 / .12)); border: 1px solid rgb(95 230 187 / .25); }
  .side-promo .btn.accent { background: #fff; color: #0a3d2f; box-shadow: none; }
  .main { border-radius: 28px; background: rgb(255 255 255 / .46); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3); min-height: calc(100vh - 28px); }
  :root[data-theme="dark"] .main { background: rgb(255 255 255 / .025); }
  .topbar { background: transparent; backdrop-filter: none; border-bottom: 0; padding-top: 18px; }
  .view { padding-top: 6px; }
  .side .rail-btn { display: inline-grid; }
  .shell.rail .side { padding-left: 12px; padding-right: 12px; align-items: center; overflow-x: hidden; }
  .shell.rail .side .bn, .shell.rail .nav .group, .shell.rail .side-promo, .shell.rail .me > div, .shell.rail .side-foot .btn, .shell.rail .nav .badge { display: none; }
  .shell.rail .nav { justify-items: center; width: 100%; }
  .shell.rail .nav a { font-size: 0; justify-content: center; padding: 12px; width: 54px; gap: 0; }
  .shell.rail .nav a svg { width: 21px; height: 21px; }
  .shell.rail .nav a[aria-current="page"]::before { left: -12px; }
  .shell.rail .me { padding: 6px; justify-content: center; background: transparent; }
  .shell.rail .side .brand { justify-content: center; }
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .main { background: rgb(255 255 255 / .025); } }
.rail-btn { display: none; width: 30px; height: 30px; place-items: center; margin-left: auto; border-radius: 10px; border: 1px solid rgb(255 255 255 / .16); background: rgb(255 255 255 / .06); color: #d3ebe2; cursor: pointer; transition: background .2s, transform .35s var(--ease); }
.rail-btn:hover { background: rgb(255 255 255 / .14); }
.rail-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--ease); }
.shell.rail .rail-btn svg { transform: rotate(180deg); }
.shell.rail .rail-btn { margin: 6px 0 0; }
.shell.rail .side .brand { flex-direction: column; gap: 10px; }
@media (max-width: 860px) {
  .side { background: radial-gradient(260px 200px at 0 0, rgb(44 201 157 / .28), transparent 70%), linear-gradient(180deg, var(--rail-a), var(--rail-b)); color: #d3ebe2; border-right: 0; }
  .side .brand { color: #fff; } .nav .group { color: rgb(255 255 255 / .38); } .nav a { color: #b6d2c8; border-radius: 14px; }
  .nav a[aria-current="page"] { background: linear-gradient(135deg, rgb(44 201 157 / .34), rgb(44 201 157 / .12)); color: #fff; } .nav a[aria-current="page"] svg { color: #7df0c9; }
  .me { background: rgb(255 255 255 / .07); color: #fff; } .me span { color: rgb(255 255 255 / .6); }
  .side .btn.ghost { color: #d3ebe2; border-color: rgb(255 255 255 / .16); }
  .topbar { backdrop-filter: blur(16px); }
  .card { border-radius: 20px; padding: 16px; }
}

/* ---------- Animasi masuk halaman ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }
.view.anim > * { animation: rise .6s var(--ease) both; }
.view.anim > :nth-child(2) { animation-delay: .06s; } .view.anim > :nth-child(3) { animation-delay: .12s; } .view.anim > :nth-child(4) { animation-delay: .18s; }
.view.anim > :nth-child(5) { animation-delay: .24s; } .view.anim > :nth-child(6) { animation-delay: .3s; } .view.anim > :nth-child(n+7) { animation-delay: .36s; }
.view.anim .g-kpi > * { animation: rise .6s var(--ease) both; }
.view.anim .g-kpi > :nth-child(2) { animation-delay: .1s; } .view.anim .g-kpi > :nth-child(3) { animation-delay: .16s; } .view.anim .g-kpi > :nth-child(4) { animation-delay: .22s; }
.view.anim .g-kpi > :nth-child(5) { animation-delay: .28s; } .view.anim .g-kpi > :nth-child(6) { animation-delay: .34s; }
.view.anim .insights > * { animation: rise .55s var(--ease) both; }
.view.anim .insights > :nth-child(2) { animation-delay: .1s; } .view.anim .insights > :nth-child(3) { animation-delay: .18s; } .view.anim .insights > :nth-child(4) { animation-delay: .26s; }

/* ---------- Login dan dialog ---------- */
.login { background: radial-gradient(700px 420px at 20% 10%, rgb(44 201 157 / .3), transparent 65%), radial-gradient(600px 400px at 90% 90%, rgb(90 140 255 / .16), transparent 65%); }
.login-card { padding: 30px 28px; border-radius: 28px; background: var(--surface); border: 1px solid var(--glass-edge); box-shadow: var(--shadow); backdrop-filter: blur(20px); animation: rise .7s var(--ease) both; }
dialog { border-radius: 26px; border: 1px solid var(--glass-edge); backdrop-filter: blur(20px); box-shadow: 0 40px 80px -24px rgb(0 0 0 / .45); }
dialog::backdrop { background: rgb(4 24 18 / .5); backdrop-filter: blur(6px); }
.li { border-radius: 14px; transition: background .2s; } .li:hover { background: var(--panel); }
@media (prefers-reduced-motion: reduce) { .kpi .spark path.ln, .chart .line { stroke-dashoffset: 0 !important; animation: none !important; } .view.anim > *, .view.anim .g-kpi > *, .view.anim .insights > * { animation: none !important; } }
.kpi .spark path.ar { fill: var(--accent-soft); } .kpi.hero .spark path.ar { fill: rgb(255 255 255 / .2); }
#calcOut .kpi.hero .muted, #calcOut .kpi.hero span { color: rgb(255 255 255 / .85); }
#calcOut .kpi.hero b { color: #fff; }
