/* CEO Dashboard — Barokah Group
   Palet: netral + biru, divalidasi untuk tema terang & gelap. */
:root {
  color-scheme: light;
  --brand: #1d4ed8;
  --surface-1: #ffffff;
  --surface-2: #f6f7f9;
  --page: #f2f4f7;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #7b7a76;
  --grid: #e4e6ea;
  --line: #cfd3da;
  --border: rgba(11,11,11,.10);
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-ink: #046904; --warn-ink: #8a5a00; --crit-ink: #a52222;
  --good-bg: #e8f6e8; --warn-bg: #fdf3dc; --crit-bg: #fbe9e9; --info-bg: #eaf1fd;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.04);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-1: #17181b; --surface-2: #1f2125; --page: #101113;
    --ink: #ffffff; --ink-2: #c3c2b7; --muted: #8f8e88;
    --grid: #2c2c2a; --line: #383835; --border: rgba(255,255,255,.12);
    --good-ink: #58c758; --warn-ink: #e0ad4a; --crit-ink: #ef8080;
    --good-bg: #16281a; --warn-bg: #2b2415; --crit-bg: #2e1a1a; --info-bg: #161f2e;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #17181b; --surface-2: #1f2125; --page: #101113;
  --ink: #ffffff; --ink-2: #c3c2b7; --muted: #8f8e88;
  --grid: #2c2c2a; --line: #383835; --border: rgba(255,255,255,.12);
  --good-ink: #58c758; --warn-ink: #e0ad4a; --crit-ink: #ef8080;
  --good-bg: #16281a; --warn-bg: #2b2415; --crit-bg: #2e1a1a; --info-bg: #161f2e;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--page); color: var(--ink); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 0 0 .8em; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface-1); border-right: 1px solid var(--border); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 6px 8px 14px; }
.brand img { max-height: 34px; max-width: 120px; object-fit: contain; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.brand-name { font-weight: 680; font-size: 14px; line-height: 1.15; }
.brand-sub { font-size: 11px; color: var(--muted); }
.nav-group { margin-top: 10px; }
.nav-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 8px 8px 4px; font-weight: 640; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; color: var(--ink-2); font-size: 13px; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--info-bg); color: var(--brand); font-weight: 600; }
.nav a .dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.main { min-width: 0; }
.topbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 22px; background: var(--surface-1); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 640; }
.content { padding: 20px 22px 60px; max-width: 1400px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .sub { color: var(--muted); font-size: 13px; }

/* ---------- Kartu ---------- */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 14px; }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
@media (max-width: 1180px) { .g-5, .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px) { .app { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } .g-2, .g-3, .g-4, .g-5 { grid-template-columns: 1fr; } .content { padding: 16px; } }

/* ---------- Stat tile ---------- */
.tile { background: var(--surface-1); border: 1px solid var(--border); border-left: 3px solid var(--line); border-radius: var(--radius); padding: 13px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile.st-green { border-left-color: var(--good); } .tile.st-yellow { border-left-color: var(--warning); }
.tile.st-red { border-left-color: var(--critical); } .tile.st-info, .tile.st-na { border-left-color: var(--line); }
.tile .label { font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.tile .value { font-size: 23px; font-weight: 680; letter-spacing: -.02em; line-height: 1.15; }
.tile .meta { font-size: 12px; color: var(--ink-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tile .sparkwrap { margin-top: 2px; }

/* ---------- Pill / badge ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 620; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-green { background: var(--good-bg); color: var(--good-ink); }
.pill-yellow { background: var(--warn-bg); color: var(--warn-ink); }
.pill-red { background: var(--crit-bg); color: var(--crit-ink); }
.pill-info, .pill-na { background: var(--surface-2); color: var(--muted); }
.pill-plain { background: var(--surface-2); color: var(--ink-2); }
.pill-plain::before { display: none; }
.delta-up { color: var(--good-ink); font-weight: 620; }
.delta-down { color: var(--crit-ink); font-weight: 620; }

/* ---------- Tabel ---------- */
.tablewrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 640; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-name { font-weight: 600; }
.kpi-formula { font-size: 11.5px; color: var(--muted); }

/* ---------- Chart ---------- */
.chart { margin: 0; }
.chart-svg { width: 100%; height: auto; display: block; }
.grid { stroke: var(--grid); stroke-width: 1; }
.axis-label { font-size: 10.5px; fill: var(--muted); font-family: var(--font); }
.line-actual { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-target { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 4; opacity: .85; }
.dot { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
.dot-hit { fill: transparent; }
.pt-label { font-size: 11px; fill: var(--ink-2); font-weight: 620; font-family: var(--font); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.sw-actual { background: var(--series-1); }
.sw-target { background: var(--muted); }
.spark { width: 100%; height: 34px; display: block; }
.spark-line { fill: none; stroke: var(--series-1); stroke-width: 1.8; stroke-linejoin: round; }
.spark-area { fill: var(--series-1); opacity: .10; stroke: none; }
.spark-dot { fill: var(--series-1); }
.spark-bad .spark-line, .spark-bad .spark-dot { stroke: var(--critical); fill: var(--critical); }
.spark-bad .spark-area { fill: var(--critical); }
.spark-bad .spark-line { fill: none; }
.barlist { display: flex; flex-direction: column; gap: 7px; }
.barrow { display: grid; grid-template-columns: 150px 1fr 108px; gap: 10px; align-items: center; font-size: 12.5px; }
.barlabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bartrack { background: var(--surface-2); border-radius: 4px; height: 14px; overflow: hidden; }
.barfill { height: 100%; border-radius: 4px; background: var(--series-1); }
.barvalue { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tone-green { background: var(--good); } .tone-yellow { background: var(--warning); }
.tone-red { background: var(--critical); } .tone-info, .tone-na { background: var(--series-1); }
.bullet { position: relative; height: 8px; background: var(--surface-2); border-radius: 4px; width: 110px; }
.bullet-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.bullet-target { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-2); }
.donut .donut-track { stroke: var(--surface-2); }
.donut .donut-value { stroke: var(--series-1); }
.donut.dn-green .donut-value { stroke: var(--good); }
.donut.dn-yellow .donut-value { stroke: var(--warning); }
.donut.dn-red .donut-value { stroke: var(--critical); }
.donut { width: 88px; height: 88px; flex: 0 0 auto; }
.status-legend { display: grid; gap: 6px; font-size: 12.5px; }
.status-legend div { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.donut-text { font-size: 19px; font-weight: 680; fill: var(--ink); font-family: var(--font); }
.empty { color: var(--muted); font-size: 13px; padding: 10px 0; }

/* ---------- Form ---------- */
label { display: block; font-size: 12px; font-weight: 620; color: var(--ink-2); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=file], select, textarea {
  width: 100%; padding: 8px 10px; font: inherit; font-size: 13px; color: var(--ink); background: var(--surface-1);
  border: 1px solid var(--line); border-radius: 8px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
textarea { min-height: 76px; resize: vertical; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 180px; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-1); color: var(--ink); font: inherit; font-size: 13px; font-weight: 620; cursor: pointer; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: var(--brand); }
.btn-danger { color: var(--crit-ink); border-color: var(--crit-bg); background: var(--crit-bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.alert { padding: 10px 13px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.alert-ok { background: var(--good-bg); color: var(--good-ink); border-color: var(--good); }
.alert-err { background: var(--crit-bg); color: var(--crit-ink); border-color: var(--critical); }
.alert-info { background: var(--info-bg); color: var(--brand); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.toolbar .fld { display: flex; flex-direction: column; gap: 3px; }
.toolbar select, .toolbar input { min-width: 140px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 6px 12px; border-radius: 999px; font-size: 12.5px; background: var(--surface-1); border: 1px solid var(--border); color: var(--ink-2); }
.tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 620; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
@media (max-width: 880px) { .login-wrap { grid-template-columns: 1fr; } .login-hero { display: none; } }
.login-hero { background: linear-gradient(150deg, var(--brand), #0b1f4b 80%); color: #fff; padding: 44px; display: flex; flex-direction: column; justify-content: space-between; }
.login-hero h1 { color: #fff; font-size: 30px; max-width: 12ch; }
.login-hero .lead { color: rgba(255,255,255,.85); max-width: 46ch; }
.login-hero .principles { display: grid; gap: 10px; margin-top: 22px; }
.login-hero .principles div { font-size: 13px; color: rgba(255,255,255,.9); border-left: 2px solid rgba(255,255,255,.4); padding-left: 10px; }
.login-box { display: grid; place-items: center; padding: 34px; background: var(--page); }
.login-card { width: 100%; max-width: 380px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.login-logo { display: flex; justify-content: center; margin-bottom: 14px; }
.login-logo img { max-height: 54px; max-width: 190px; object-fit: contain; }

/* ---------- Lain-lain ---------- */
.meta-list { display: grid; gap: 6px; font-size: 13px; }
.meta-list div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--grid); padding-bottom: 5px; }
.area-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 13px; background: var(--surface-1); box-shadow: var(--shadow); }
.area-card h3 { display: flex; justify-content: space-between; align-items: center; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.area-kpi { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--grid); font-size: 13px; }
.area-kpi:first-of-type { border-top: none; }
.area-kpi .v { font-weight: 640; font-variant-numeric: tabular-nums; }
.trigger { font-size: 11.5px; color: var(--muted); margin-top: 8px; border-top: 1px dashed var(--grid); padding-top: 7px; }
.footer { color: var(--muted); font-size: 12px; padding: 18px 22px; border-top: 1px solid var(--border); }
.badge-role { font-size: 11px; padding: 2px 7px; border-radius: 5px; background: var(--surface-2); color: var(--ink-2); font-weight: 620; text-transform: uppercase; letter-spacing: .03em; }
.print-only { display: none; }
@media print {
  .sidebar, .topbar, .btn, .toolbar, .no-print { display: none !important; }
  .app { grid-template-columns: 1fr; } body { background: #fff; }
  .card { break-inside: avoid; box-shadow: none; }
  .print-only { display: block; }
}
