/* VaPertamina — Theme Klasik
   Latar krem hangat #FFF4E2, aksen oranye-merah #C2410C / #FE5A34,
   teks gelap #1E1A16, border gelap 2px, radius 20-28px, Poppins. */
:root {
  --bg: #FFF4E2;
  --bg-soft: #FFF9EF;
  --card: #FFFFFF;
  --card-cream: #FFF9EF;
  --ink: #1E1A16;
  --ink-soft: #6B5D4F;
  --accent: #C2410C;
  --accent-2: #FE5A34;
  --accent-soft: #FDE8DC;
  --ok: #15803D;
  --ok-soft: #DCFCE7;
  --warn: #B45309;
  --warn-soft: #FEF3C7;
  --bad: #B91C1C;
  --bad-soft: #FEE2E2;
  --border: #1E1A16;
  --radius-lg: 26px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --shadow: 0 2px 0 rgba(30, 26, 22, 0.9), 0 10px 24px rgba(30, 26, 22, 0.10);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, select, textarea { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; }

/* ---------- Splash ---------- */
#splash {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px; text-align: center;
  transition: opacity 0.5s ease;
}
#splash.fade-out { opacity: 0; pointer-events: none; }
.splash-logo-wrap { position: relative; width: 220px; height: 150px; display: flex; align-items: center; justify-content: center; }
.splash-logo-wrap::before {
  content: ""; position: absolute; inset: -30px;
  background: radial-gradient(circle, rgba(254, 90, 52, 0.35) 0%, rgba(254, 90, 52, 0.12) 45%, transparent 70%);
  border-radius: 50%; animation: glow 2.2s ease-in-out infinite;
}
@keyframes glow { 0%, 100% { transform: scale(1); opacity: 0.9; } 50% { transform: scale(1.12); opacity: 0.6; } }
.splash-logo { position: relative; width: 200px; height: auto; border-radius: 24px; }
.splash-name { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); min-height: 44px; }
.splash-name .ch { display: inline-block; opacity: 0; transform: translateY(10px); animation: letterIn 0.35s ease forwards; }
@keyframes letterIn { to { opacity: 1; transform: translateY(0); } }
.splash-credit { font-size: 13px; font-weight: 600; color: var(--ink-soft); opacity: 0; transition: opacity 0.6s ease; letter-spacing: 0.06em; }
.splash-credit.show { opacity: 1; }
.splash-bar { width: 200px; height: 10px; border: 2px solid var(--border); border-radius: 999px; overflow: hidden; background: #fff; }
.splash-bar > div { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width 0.2s linear; }
.splash-note { font-size: 12px; color: var(--ink-soft); }

/* ---------- App shell ---------- */
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; padding: 0 14px 110px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 2px 10px;
  background: var(--bg);
}
.topbar .logo { width: 44px; height: 44px; object-fit: cover; border-radius: 12px; border: 2px solid var(--border); flex: none; background: #fff; }
.topbar .brand { flex: 1; min-width: 0; }
.topbar .brand b { display: block; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.topbar .brand span { font-size: 12px; color: var(--ink-soft); }
.ping-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 2px solid var(--border); border-radius: 999px;
  padding: 7px 12px; font-size: 12px; font-weight: 700;
}
.ping-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.ping-chip.bad .dot { background: var(--bad); }
.ping-chip.warn .dot { background: var(--warn); }

.pane { display: none; }
.pane.active { display: block; animation: paneIn 0.2s ease; }
@keyframes paneIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.greet { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; margin: 6px 2px 2px; }
.date-line { font-size: 13px; color: var(--ink-soft); margin: 0 2px 14px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card.cream { background: var(--card-cream); }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; letter-spacing: -0.01em; margin-bottom: 12px; }
.card-title .sub { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 10px; line-height: 1.55; }
.label { font-size: 13px; font-weight: 700; margin: 14px 0 6px; }
.card-title + .label, .card > .label:first-child { margin-top: 0; }

/* ---------- Hero stok ---------- */
.hero-num { font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.hero-num small { font-size: 18px; font-weight: 700; color: var(--ink-soft); }
.hero-bar { height: 12px; border: 2px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--bg-soft); margin-top: 12px; }
.hero-bar > div { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width 0.4s ease; }
.hero-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-soft); margin-top: 8px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stat { background: var(--bg-soft); border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font-size: 11px; color: var(--ink-soft); font-weight: 600; }

/* ---------- Stock grid 3 kolom ---------- */
.stock-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stock-card {
  min-width: 0; background: var(--bg-soft); border: 2px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 6px 11px; text-align: center;
  transition: transform 0.1s ease, background 0.15s ease;
}
.stock-card:active { transform: scale(0.97); }
.stock-card.sel { background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.35); }
.stock-card .nm { font-size: 11px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock-card .num { font-size: 30px; font-weight: 800; margin: 5px 0 2px; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stock-card .meta { font-size: 11px; color: var(--ink-soft); line-height: 1.35; min-height: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock-card .sisa { font-size: 11.5px; margin-top: 6px; color: var(--ink-soft); }
.stock-card .sisa b { color: var(--ink); font-variant-numeric: tabular-nums; }
.stock-card .st { font-size: 11px; font-weight: 700; margin-top: 6px; line-height: 1.35; min-height: 28px; }
.stock-card .st.ok { color: var(--ok); }
.stock-card .st.warn { color: var(--warn); }
.stock-card .st.bad { color: var(--bad); }
.stock-card.disabled { opacity: 0.55; }

/* ---------- Forms & buttons ---------- */
textarea, input:not([type="checkbox"]), select {
  width: 100%; min-height: 48px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; background: var(--bg-soft); color: var(--ink);
  font-size: 15px; font-family: inherit; outline: none;
}
textarea:focus, input:not([type="checkbox"]):focus, select:focus { box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.25); background: #fff; }
textarea { resize: vertical; line-height: 1.5; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin: 10px 0 4px; cursor: pointer; }
.big-btn {
  width: 100%; border: 2px solid var(--border); border-radius: var(--radius-md);
  padding: 15px 16px; margin-top: 14px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; font-size: 16px; font-weight: 800; letter-spacing: -0.01em;
  box-shadow: 0 3px 0 rgba(30, 26, 22, 0.9);
  transition: transform 0.08s ease;
}
.big-btn:active { transform: translateY(2px); box-shadow: none; }
.big-btn:disabled { opacity: 0.45; }
.big-btn.secondary { background: #fff; color: var(--ink); }
.mini-btn {
  border: 2px solid var(--border); background: var(--bg-soft); color: var(--accent);
  border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 700; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center;
}
.mini-btn:active { transform: scale(0.97); }
.mini-btn.big { padding: 12px 18px; font-size: 14px; }
.mini-btn.danger { color: var(--bad); }
.mini-btn:disabled { opacity: 0.45; }
.danger-btn {
  width: 100%; border: 2px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 16px; margin-top: 14px; background: var(--bad-soft);
  color: var(--bad); font-size: 15px; font-weight: 700;
}
.row { display: flex; gap: 12px; }
.row .field { flex: 1; min-width: 0; }
.row-btns { display: flex; gap: 8px; margin: 14px 0 0; flex-wrap: wrap; }
.row-btns .mini-btn { flex: 1; min-width: 140px; white-space: normal; text-align: center; line-height: 1.35; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  flex: 1 1 auto; min-width: 84px; border: 2px solid var(--border); border-radius: 999px;
  padding: 10px 8px; background: var(--bg-soft); color: var(--ink);
  font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: inline-flex; align-items: center; justify-content: center;
}
.chip:active { transform: scale(0.97); }
.chip.sm { flex: none; padding: 9px 15px; }
.chip.sel { background: var(--accent); border-color: var(--border); color: #fff; }
.chip:disabled { opacity: 0.45; }
.seg { display: flex; gap: 4px; background: var(--bg-soft); border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 4px; }
.seg-btn { flex: 1; border: 0; border-radius: 10px; padding: 10px 0; background: transparent; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.seg-btn.sel { background: var(--accent); color: #fff; }
.stepper { display: flex; align-items: center; gap: 14px; margin: 12px 0; }
.step-btn { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--border); background: var(--accent); color: #fff; font-size: 20px; font-weight: 800; flex: none; }
.step-btn:active { transform: scale(0.94); }
.step-val { text-align: center; flex: 1; }
.step-val b { font-size: 34px; display: block; line-height: 1; font-variant-numeric: tabular-nums; }
.step-val span { font-size: 12px; color: var(--ink-soft); }
.notice { border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; line-height: 1.55; margin-top: 12px; background: var(--bg-soft); }
.notice.warn { background: var(--warn-soft); }
.notice.good { background: var(--ok-soft); }
.notice.bad { background: var(--bad-soft); }
.nik-info { font-size: 13px; color: var(--ink-soft); margin-top: 8px; line-height: 1.5; }
.nik-info.good { color: var(--ok); font-weight: 600; }
.nik-info.warn { color: var(--warn); font-weight: 600; }
.nik-info.bad { color: var(--bad); font-weight: 600; }

/* ---------- Lists / history ---------- */
.hist { font-size: 14px; }
.hist-card {
  background: var(--bg-soft); border: 2px solid var(--border); border-left: 6px solid var(--ink-soft);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 8px;
}
.hist-card.ok { border-left-color: var(--ok); }
.hist-card.skip { border-left-color: var(--warn); }
.hist-card.fail { border-left-color: var(--bad); }
.hist-card.running { border-left-color: var(--accent); }
.hc-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hc-nik { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-nik.mono { font-family: ui-monospace, monospace; }
.hc-sub { display: flex; align-items: flex-start; gap: 8px; margin-top: 7px; min-width: 0; }
.hc-reason { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; word-break: break-word; }
.hc-time { flex: none; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { font-size: 12px; background: var(--bg-soft); border: 2px solid var(--border); padding: 4px 11px; border-radius: 999px; font-weight: 700; line-height: 1.3; white-space: nowrap; }
.badge.ok { color: var(--ok); }
.badge.skip { color: var(--warn); }
.badge.fail { color: var(--bad); }
.badge.run { color: var(--accent); }
.row-line { display: flex; justify-content: space-between; padding: 10px 2px; border-bottom: 2px solid rgba(30, 26, 22, 0.12); gap: 8px; align-items: center; }
.row-line:last-child { border-bottom: 0; }
.row-line .nik { font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all; }
.row-line .ok { color: var(--ok); font-weight: 700; }
.row-line .skip { color: var(--warn); font-weight: 700; }
.row-line .fail { color: var(--bad); font-weight: 700; }
.bar { height: 12px; background: var(--bg-soft); border: 2px solid var(--border); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width 0.4s ease; }
.big-line { font-size: 20px; font-weight: 800; margin: 12px 0 2px; font-variant-numeric: tabular-nums; }
.step-line { font-size: 13px; color: var(--ink-soft); margin: 8px 0 12px; line-height: 1.5; background: var(--bg-soft); border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.flow-steps { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.flow-step { flex: 1; min-width: 70px; text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-soft); background: var(--bg-soft); border: 2px solid var(--border); border-radius: 10px; padding: 8px 4px; }
.flow-step.done { background: var(--ok-soft); color: var(--ok); }
.flow-step.now { background: var(--accent-soft); color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; font-size: 11px; font-weight: 600; color: var(--ink-soft); margin-top: 12px; }
.stats > div { background: var(--bg-soft); border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 10px 4px 9px; line-height: 1.35; }
.stats b { display: block; font-size: 19px; color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 2px; }
.cur { font-size: 13.5px; margin-top: 10px; line-height: 1.5; }
.cur b { font-variant-numeric: tabular-nums; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 9px 2px; border-bottom: 2px solid rgba(30, 26, 22, 0.10); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--ink-soft); font-weight: 600; }
.kv span:last-child { font-weight: 700; text-align: right; word-break: break-word; }
.terms-body { font-size: 14px; line-height: 1.65; }
.terms-body h2 { font-size: 16px; font-weight: 800; margin: 18px 0 6px; }
.terms-body h3 { font-size: 14.5px; font-weight: 800; margin: 14px 0 4px; }
.terms-body p { margin: 6px 0; }
.terms-body ul, .terms-body ol { margin: 6px 0; padding-left: 20px; }
.terms-body li { margin-bottom: 4px; }

/* ---------- Auth ---------- */
#auth { max-width: 480px; margin: 0 auto; padding: 24px 14px 40px; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; }
.auth-logo { width: 120px; height: auto; border-radius: 20px; border: 2px solid var(--border); display: block; margin: 0 auto 14px; background: #fff; }
.auth-title { text-align: center; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.auth-sub { text-align: center; font-size: 13px; color: var(--ink-soft); margin: 4px 0 18px; }
.auth-card { background: var(--card); border: 2px solid var(--border); border-radius: var(--radius-lg); padding: 20px 18px; box-shadow: var(--shadow); }
.link-btn { background: none; border: 0; color: var(--accent); font-weight: 700; font-size: 13.5px; padding: 6px 0; text-decoration: underline; }
.lock-box { text-align: center; padding: 14px; background: var(--warn-soft); border: 2px solid var(--border); border-radius: var(--radius-sm); margin-top: 12px; }
.lock-box b { font-size: 26px; font-variant-numeric: tabular-nums; display: block; }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 30;
  width: 100%; max-width: 480px;
  background: var(--card); border-top: 2px solid var(--border);
  display: flex; align-items: stretch; padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.nav-btn {
  flex: 1; border: 0; background: transparent; color: var(--ink-soft);
  font-size: 11px; font-weight: 700; padding: 6px 2px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0;
}
.nav-btn .ic { font-size: 21px; line-height: 1; }
.nav-btn.sel { color: var(--accent); }
.nav-btn.center { flex: none; width: 64px; margin-top: -26px; }
.nav-btn.center .fab {
  width: 58px; height: 58px; border-radius: 50%; border: 2px solid var(--border);
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff;
  font-size: 28px; font-weight: 800; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 0 rgba(30, 26, 22, 0.9);
}
.nav-btn.center span { font-size: 11px; font-weight: 700; color: var(--ink); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 14px; z-index: 60; max-width: 88vw; text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.empty { text-align: center; color: var(--ink-soft); font-size: 13.5px; padding: 18px 8px; line-height: 1.6; }
.pager { display: flex; gap: 8px; margin-top: 12px; }
.pager .mini-btn { flex: 1; }

@media (max-width: 359px) {
  #app { padding: 0 10px 110px; }
  body { font-size: 14px; }
  .greet { font-size: 20px; }
  .card { padding: 14px; }
  .stock-card .num { font-size: 24px; }
  .hero-num { font-size: 42px; }
  .row { flex-direction: column; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .splash-name { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .splash-logo-wrap::before { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
