/* RTG Power KPI - global styles
   Identitas: "Red to Green" adalah logika inti aplikasi, jadi hijau = tercapai,
   merah = belum. Palet didasarkan warna status, bukan dekorasi. */

:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --ink: #1c2432;
  --ink-2: #56606f;
  --ink-3: #8892a0;
  --line: #dfe4ec;

  --green: #0f9d58;
  --green-soft: #e6f6ed;
  --red: #d7263d;
  --red-soft: #fdebee;
  --amber: #e39a00;
  --amber-soft: #fff5e1;
  --blue: #2f5fe0;
  --blue-soft: #eaf0ff;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 36, 50, .06), 0 4px 16px rgba(28, 36, 50, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.brand small { color: var(--ink-3); font-weight: 500; }
.topbar .spacer { flex: 1; }
.who { color: var(--ink-2); font-size: 14px; }
.who b { color: var(--ink); }

/* ---------- Layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; }
.page-head .sub { color: var(--ink-2); font-size: 14px; margin-top: 4px; }

.grid { display: grid; gap: 16px; }
.grid.kpi4 { grid-template-columns: repeat(4, 1fr); }
.grid.kpi3 { grid-template-columns: repeat(3, 1fr); }
.grid.two { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 900px) {
  .grid.kpi4, .grid.kpi3, .grid.two { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .grid.kpi4, .grid.kpi3, .grid.two { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 20px; }
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 14px; color: var(--ink-2); font-weight: 600; margin-bottom: 10px; }
.big { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.label { color: var(--ink-2); font-size: 13px; margin-top: 4px; }
.tiny { color: var(--ink-3); font-size: 12px; }

/* Status pill */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 650;
}
.pill.green { background: var(--green-soft); color: #0a7a42; }
.pill.red { background: var(--red-soft); color: #a81d2f; }
.pill.amber { background: var(--amber-soft); color: #8a5b00; }
.pill.blue { background: var(--blue-soft); color: #1c47b8; }
.pill .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- Progress bar ---------- */
.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .4s ease; }
.bar.red > i { background: var(--red); }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; font-weight: 600; color: var(--ink-2);
  background: #f7f9fc; padding: 11px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfd; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Forms & buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue); color: #fff; border: 0; border-radius: var(--radius-sm);
  padding: 9px 16px; font-weight: 600; cursor: pointer; text-decoration: none; font-size: 14px;
}
.btn:hover { background: #2550bd; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f3f5f9; }
.btn.green { background: var(--green); }
.btn.green:hover { background: #0c8448; }
.btn.red { background: var(--red); }
.btn.red:hover { background: #b81f34; }
.btn.sm { padding: 6px 11px; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.hint { font-size: 12px; color: var(--ink-3); }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 600px at 15% -10%, #dfeaff 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #e3f6ea 0%, transparent 55%),
    var(--bg);
  padding: 24px;
}
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 34px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 24px; }
.login-card .lead { color: var(--ink-2); margin: 8px 0 24px; font-size: 14px; }
.alert { background: var(--red-soft); color: #a81d2f; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; margin-bottom: 16px; }

/* ---------- Store card (SPG) ---------- */
.store-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.store-head .name { font-weight: 650; }
.chan { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: var(--ink-2); color: #fff; }
.chan.MT { background: #6d5bd0; }
.chan.DT { background: #1f7a8c; }
.weeks { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.weeks .wk { background: #f5f7fb; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 5px; text-align: center; font-size: 12px; color: var(--ink-2); }
.weeks .wk b { display: block; color: var(--ink); font-size: 13px; }
@media (max-width: 560px) { .weeks { grid-template-columns: repeat(5, 1fr); font-size: 11px; } }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button {
  background: none; border: 0; padding: 10px 14px; cursor: pointer;
  color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--ink); border-bottom-color: var(--blue); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: all .3s ease; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty { text-align: center; color: var(--ink-3); padding: 30px 10px; }
.section-title { font-size: 17px; margin: 26px 0 12px; }
