/* =========================================================================
   M-Finance — Dashboard Report MarkPlus Corporate
   Palet dari dataviz reference palette (tervalidasi light & dark).
   ========================================================================= */

:root {
  color-scheme: light;

  --plane:          #f9f9f7;
  --surface:        #fcfcfb;
  --surface-sunk:   #f2f2ef;
  --ink:            #0b0b0b;
  --ink-2:          #52514e;
  --ink-muted:      #898781;
  --grid:           #e1e0d9;
  --axis:           #c3c2b7;
  --hairline:       rgba(11, 11, 11, .10);

  /* kategorikal: slot 1-3 (lolos all-pairs di kedua mode) */
  --mpi:            #2a78d6;
  --mii:            #eb6834;
  --mkt:            #1baf7a;
  --target:         #c3c2b7;

  /* status (tetap, tidak ikut tema) */
  --good:           #0ca30c;
  --warning:        #fab219;
  --serious:        #ec835a;
  --critical:       #d03b3b;
  --good-ink:       #006300;

  --r:              10px;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane:        #0d0d0d;
    --surface:      #1a1a19;
    --surface-sunk: #232321;
    --ink:          #f0efec;
    --ink-2:        #c3c2b7;
    --ink-muted:    #898781;
    --grid:         #2c2c2a;
    --axis:         #383835;
    --hairline:     rgba(255, 255, 255, .10);
    --mpi:          #3987e5;
    --mii:          #d95926;
    --mkt:          #199e70;
    --target:       #383835;
    --good-ink:     #0ca30c;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:        #0d0d0d;
  --surface:      #1a1a19;
  --surface-sunk: #232321;
  --ink:          #f0efec;
  --ink-2:        #c3c2b7;
  --ink-muted:    #898781;
  --grid:         #2c2c2a;
  --axis:         #383835;
  --hairline:     rgba(255, 255, 255, .10);
  --mpi:          #3987e5;
  --mii:          #d95926;
  --mkt:          #199e70;
  --target:       #383835;
  --good-ink:     #0ca30c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px 72px; }

/* ---------------------------------------------------------------- header */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--plane) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.topbar-in {
  max-width: 1280px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  text-decoration: none; color: inherit; min-width: 0;
}
.brand-logo { height: 30px; width: auto; display: block; flex: none; }
.brand-txt {
  font-size: 16px; font-weight: 620; letter-spacing: -.01em;
  padding-left: 11px; border-left: 1px solid var(--hairline);
  color: var(--ink-2); white-space: nowrap;
}
.topbar-meta { color: var(--ink-muted); font-size: 13px; }
.spacer { flex: 1 1 auto; }

/* ------------------------------------------------------- tombol ikon */
.icon-btn {
  width: 36px; height: 36px; flex: none;
  display: inline-grid; place-items: center; position: relative;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--hairline); border-radius: 9px;
  cursor: pointer; text-decoration: none; padding: 0;
}
.icon-btn:hover { color: var(--ink); border-color: var(--axis); }
.icon-btn:focus-visible { outline: 2px solid var(--mpi); outline-offset: 2px; }
.icon-btn > svg { width: 18px; height: 18px; }
.icon-btn > svg[class^="flag-"] { width: 22px; height: 15px; border-radius: 3px; }
.icon-tag {
  position: absolute; bottom: -5px; right: -4px;
  font-size: 8.5px; font-weight: 700; letter-spacing: .03em;
  padding: 1px 3px; border-radius: 4px;
  background: var(--surface); border: 1px solid var(--hairline); color: var(--ink-2);
}

/* Hanya ikon TUJUAN yang tampil.
   Mode terang -> bulan (klik untuk gelap). Mode gelap -> matahari.
   Bahasa Indonesia aktif -> bendera EN. English aktif -> bendera ID. */
.i-moon, .i-sun, .flag-en, .flag-id { display: none; }
:root[data-theme="light"] .i-moon { display: block; }
:root[data-theme="dark"]  .i-sun  { display: block; }
html[lang="id"] .flag-en { display: block; }
html[lang="en"] .flag-id { display: block; }

/* Logo ikut tema: ungu di terang, putih di gelap. */
.logo-light, .logo-dark { display: none; }
:root[data-theme="light"] .logo-light { display: block; }
:root[data-theme="dark"]  .logo-dark  { display: block; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }

/* -------------------------------------------------------------- warnings */
.notice {
  margin: 20px 0 0; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-left: 3px solid var(--warning); border-radius: var(--r);
  font-size: 14px; color: var(--ink-2);
}
.notice strong { color: var(--ink); }
.notice.critical { border-left-color: var(--critical); }

/* --------------------------------------------------------------- sources */
.srcbar { display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
          margin: 18px 0 0; font-size: 13px; color: var(--ink-2); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 2px 7px 2px 5px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--surface-sunk);
  color: var(--ink-2); white-space: nowrap;
}
.badge::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-muted); flex: none;
}
.badge[data-src="erp"]   { color: var(--good-ink); }
.badge[data-src="erp"]::before   { background: var(--good); }
.badge[data-src="deck"]  { color: var(--ink-2); }
.badge[data-src="deck"]::before  { background: var(--warning); }
.badge[data-src="none"]  { color: var(--ink-muted); }
.badge[data-src="none"]::before  {
  background: transparent; border: 1.5px dashed var(--ink-muted);
  width: 8px; height: 8px;
}

/* ----------------------------------------------------------------- cards */
section { margin-top: 32px; }
.sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sec-head h2 { font-size: 15px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.sec-head .sub { font-size: 13px; color: var(--ink-muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  padding: 18px;
}
.card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.card-head h3 { font-size: 14px; font-weight: 620; margin: 0; }
.card-head .ket { font-size: 12px; color: var(--ink-muted); }

.grid { display: grid; gap: 14px; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }

/* ------------------------------------------------------------------ hero */
.hero { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 28px; align-items: center; }
.hero-num { font-size: 52px; font-weight: 680; letter-spacing: -.03em; line-height: 1.05; }
.hero-num .unit { font-size: 22px; font-weight: 500; color: var(--ink-2); margin-left: 4px; }
.hero-lbl { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.hero-sub { font-size: 13px; color: var(--ink-muted); margin-top: 8px; }

/* ------------------------------------------------------------- stat tile */
.tile-lbl { font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.tile-val { font-size: 30px; font-weight: 660; letter-spacing: -.02em; line-height: 1.1; }
.tile-val .unit { font-size: 15px; font-weight: 500; color: var(--ink-2); margin-left: 3px; }
.tile-sub { font-size: 12px; color: var(--ink-muted); margin-top: 5px; }
.pct { font-weight: 640; }
.pct.ok   { color: var(--good-ink); }
.pct.warn { color: var(--ink); }
.pct.bad  { color: var(--critical); }

/* ----------------------------------------------------------------- table */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--grid); }
th:first-child, td:first-child { text-align: left; }
thead th {
  font-size: 11px; font-weight: 620; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-muted); border-bottom: 1px solid var(--axis); white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; }
tr.sum td { font-weight: 640; background: var(--surface-sunk); }
tr.gap td { padding-top: 16px; }
.cell-miss { color: var(--ink-muted); font-style: italic; }

/* ------------------------------------------------------------------ misc */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------------------------------------------------------------- bullet */
.blt { padding: 11px 0; border-bottom: 1px solid var(--grid); }
.blt:last-child { border-bottom: 0; }
.blt-top { display: flex; justify-content: space-between; align-items: baseline;
           gap: 14px; margin-bottom: 7px; flex-wrap: wrap; }
.blt-lbl { font-size: 13px; font-weight: 600; }
.blt-ket { font-weight: 400; color: var(--ink-muted); font-size: 12px; }
.blt-val { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.blt-val b { color: var(--ink); font-weight: 640; }
.blt-of { color: var(--ink-muted); }
.blt-val .pct { margin-left: 8px; }
.blt-note { font-size: 11px; color: var(--ink-muted); margin-top: 6px; }

.blt-track {
  position: relative; height: 10px; border-radius: 5px;
  background: var(--surface-sunk); overflow: visible;
}
.blt-fill {
  position: absolute; inset: 0 auto 0 0; border-radius: 5px;
  /* cincin surface 2px supaya isian tidak menempel ke penanda target */
  box-shadow: 0 0 0 2px var(--surface);
}
.blt-tgt {
  position: absolute; top: -4px; bottom: -4px; width: 2px;
  background: var(--ink-2); border-radius: 1px; z-index: 2;
}

/* ----------------------------------------------------------------- meter */
.meter-track { height: 12px; border-radius: 6px; background: var(--surface-sunk); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 6px; background: var(--mpi); }
.meter-cap { display: flex; justify-content: space-between;
             font-size: 11px; color: var(--ink-muted); margin-top: 6px; }

svg { display: block; width: 100%; height: auto; overflow: visible; }
svg text { font-family: var(--sans); }

.foot { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--hairline);
        font-size: 12px; color: var(--ink-muted); line-height: 1.65; }
.foot strong { color: var(--ink-2); }

.tt {
  position: fixed; pointer-events: none; z-index: 60; opacity: 0;
  transition: opacity .09s; background: var(--surface); color: var(--ink);
  border: 1px solid var(--axis); border-radius: 8px; padding: 8px 10px;
  font-size: 12px; line-height: 1.45; box-shadow: 0 6px 20px rgba(0,0,0,.14);
  max-width: 260px;
}
.tt b { font-weight: 620; }
.tt .r { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.tt i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

@media (max-width: 900px) {
  .g3, .g2 { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; gap: 18px; }
  .hero-num { font-size: 42px; }
}

@media (max-width: 760px) {
  /* periode pindah ke bawah brand supaya tombol ikon tidak terdorong */
  .topbar-in { gap: 10px; row-gap: 8px; }
  .topbar-meta { order: 10; flex-basis: 100%; }
  .brand-txt { font-size: 14px; }
}

@media (max-width: 620px) {
  /* separator "·" jadi menggantung sendirian saat baris membungkus */
  .srcbar { flex-direction: column; align-items: flex-start; gap: 4px; }
  .srcbar > span:nth-child(2) { display: none; }
  .blt-top { gap: 4px; }
  .brand-logo { height: 26px; }
  .brand-txt { display: none; }  /* logo sudah cukup mengidentifikasi */
}
