/* PDAM Mobile – tampilan web pembayaran (mobile-first, tanpa build step) */
:root {
  --bg: #F4F7F9;
  --surface: #FFFFFF;
  --ink: #0F2633;
  --muted: #4A6272;
  --line: #DCE4E9;
  --line-soft: #E6ECF0;
  --field: #9DB1BD;
  --primary: #0A6680;
  --primary-hover: #08546A;
  --primary-soft: #E3F1F5;
  --primary-tint: #F0F8FA;
  --success: #1E7A4C;
  --success-soft: #E4F4EA;
  --warn: #8A4B00;
  --warn-soft: #FFF1DC;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --dark: #0F2633;
  --radius: 12px;
  --shadow: 0 10px 28px rgba(15, 38, 51, 0.07);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: #E9EEF1;
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

:focus-visible { outline: 3px solid #6CB4C8; outline-offset: 2px; }

.app {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* Header */
.appbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.appbar--brand { padding: 12px 16px; gap: 10px; }
.appbar__title { flex: 1; font-size: 17px; font-weight: 800; }
.appbar__chip {
  font-size: 12px; font-weight: 700; color: var(--primary);
  padding: 6px 10px; background: var(--primary-soft); border-radius: 999px;
}
.icon-btn {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--ink);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand__logo {
  width: 40px; height: 40px; border-radius: var(--radius); background: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__name { font-weight: 800; font-size: 16px; }
.brand__tag { font-size: 12px; color: var(--muted); }

.main { flex: 1; padding: 16px 16px 24px; display: flex; flex-direction: column; gap: 18px; }
.main--roomy { padding-top: 28px; gap: 24px; }

h1, h2 { margin: 0; font-weight: 800; }
.h1 { font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; }
.h2 { font-size: 18px; }
.h3 { font-size: 16px; }
.lead { margin: 6px 0 0; font-size: 15px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.card--raised { border-radius: 20px; padding: 20px 18px; gap: 18px; box-shadow: var(--shadow); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Form */
.field { display: flex; flex-direction: column; gap: 8px; }
.label { font-weight: 700; font-size: 14px; }
.input, .select {
  width: 100%; height: 54px; padding: 0 16px;
  border: 1.5px solid var(--field); border-radius: var(--radius);
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
}
.input { letter-spacing: 0.02em; }
.input:focus, .select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.input.is-invalid, .select.is-invalid { border-color: var(--danger); }
.select-wrap { position: relative; }
.select { appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer; }
.select-wrap svg { position: absolute; right: 16px; top: 17px; pointer-events: none; }
.error { font-size: 13px; color: var(--danger); font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); }

/* Buttons */
.btn {
  height: 54px; border-radius: var(--radius); border: 0;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-weight: 700; font-size: 16px;
  text-decoration: none; cursor: pointer; width: 100%;
}
.btn--primary { background: var(--primary); color: #FFFFFF; }
.btn--primary:hover { background: var(--primary-hover); color: #FFFFFF; }
.btn--outline { background: var(--surface); color: var(--primary); border: 1.5px solid var(--primary); }
.btn--outline:hover { background: var(--primary-tint); }
.btn--sm { height: 48px; font-size: 15px; }
.btn[disabled] { background: var(--line-soft); color: var(--muted); cursor: not-allowed; }
.link-btn { align-self: center; padding: 12px; font-size: 14px; font-weight: 700; }

/* Alert */
.alert { padding: 12px 14px; border-radius: var(--radius); font-size: 14px; }
.alert--danger { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.alert--warn { background: var(--warn-soft); color: var(--warn); }

/* App download */
.apps { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.apps__head { text-align: center; display: flex; flex-direction: column; gap: 4px; }
.apps__row { display: flex; gap: 10px; }
.store-btn {
  flex: 1; min-height: 52px; border-radius: var(--radius); background: var(--dark); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 8px 12px; text-decoration: none;
}
.store-btn:hover { background: #1B3A4B; color: #FFFFFF; }
.store-btn__text { display: flex; flex-direction: column; line-height: 1.2; }
.store-btn__small { font-size: 11px; color: #C9D6DE; }
.store-btn__big { font-size: 15px; font-weight: 700; }

/* Definition rows */
.rows { margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.row { display: flex; justify-content: space-between; gap: 12px; }
.row dt { color: var(--muted); }
.row dd { margin: 0; font-weight: 600; text-align: right; }
.row--strong dd { font-weight: 700; }
.row--warn dt, .row--warn dd { color: var(--warn); font-weight: 700; }
.divider { height: 1px; background: var(--line-soft); }

/* Bill cards */
.section { display: flex; flex-direction: column; gap: 12px; }
.bill { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; overflow: hidden; }
.bill:has(input:checked) { border-color: var(--primary); }
.bill:has(input:checked) .bill__head { background: var(--primary-tint); }
.bill__head { display: flex; align-items: flex-start; gap: 12px; padding: 16px; cursor: pointer; }
.bill__head input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--primary); flex-shrink: 0; }
.bill__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.bill__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 16px; font-weight: 800; }
.bill__top span:last-child { white-space: nowrap; }
.bill__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.bill__body { padding: 14px 16px 16px; border-top: 1px solid var(--line-soft); }
.badge { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--success { background: var(--success-soft); color: var(--success); font-size: 12px; padding: 3px 10px; }

/* Methods */
.methods { display: flex; flex-direction: column; gap: 10px; border: 0; margin: 0; padding: 0; }
.method {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border: 2px solid var(--line); background: var(--surface); border-radius: 14px; cursor: pointer;
}
.method:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); }
.method input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); flex-shrink: 0; }
.method__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.method__name { font-size: 15px; font-weight: 700; }
.method__desc { font-size: 13px; line-height: 1.4; color: var(--muted); }

/* Pay bar */
.paybar {
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 -8px 24px rgba(15, 38, 51, 0.06);
  position: sticky; bottom: 0;
}
.paybar__total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.paybar__label { font-size: 14px; font-weight: 700; color: var(--muted); }
.paybar__amount { font-size: 24px; font-weight: 800; color: var(--primary); }

/* Empty state & result */
.center { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.status-icon { width: 68px; height: 68px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.status-icon--success { background: var(--success-soft); }
.status-icon--wait { background: var(--primary-soft); }
.status-icon--fail { background: var(--danger-soft); }
.amount { font-size: 32px; font-weight: 800; color: var(--primary); letter-spacing: -0.01em; }
.receipt { background: var(--surface); border: 1px dashed #B9C7D0; border-radius: 16px; padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* Payment instructions */
.qr { background: #FFFFFF; padding: 12px; border-radius: 16px; border: 1px solid var(--line); align-self: center; line-height: 0; }
.qr svg { width: 220px; height: 220px; }
.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg); border-radius: var(--radius); padding: 12px 14px;
}
.code-box__value { font-size: 20px; font-weight: 800; letter-spacing: 0.04em; word-break: break-all; }
.copy-btn {
  height: 40px; padding: 0 14px; border-radius: 10px; border: 1.5px solid var(--primary);
  background: var(--surface); color: var(--primary); font: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
}
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.sim { border: 2px dashed var(--warn); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--warn-soft); }

.footer { padding: 16px; text-align: center; font-size: 12px; color: var(--muted); }

/* ---------- Tambahan untuk web statis (bayar.pdammobile.com) ---------- */
[hidden] { display: none !important; }

.view { flex: 1; display: flex; flex-direction: column; }

/* Pemilih PDAM dengan pencarian */
.picker { position: relative; }
.picker__btn {
  width: 100%; min-height: 54px; padding: 10px 44px 10px 16px; text-align: left;
  border: 1.5px solid var(--field); border-radius: var(--radius); background: var(--surface);
  font: inherit; font-size: 16px; color: var(--ink); cursor: pointer; position: relative;
}
.picker__btn.is-empty { color: var(--muted); }
.picker__btn svg { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); }
.picker__panel {
  margin-top: 8px; border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; box-shadow: var(--shadow);
}
.picker__search { border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; height: 50px; }
.picker__list { list-style: none; margin: 0; padding: 4px 0; max-height: 300px; overflow-y: auto; }
.picker__item {
  width: 100%; min-height: 44px; padding: 10px 16px; border: 0; background: none; text-align: left;
  font: inherit; font-size: 15px; color: var(--ink); cursor: pointer; display: flex; justify-content: space-between; gap: 8px;
}
.picker__item:hover, .picker__item:focus-visible { background: var(--primary-tint); }
.picker__item[aria-disabled="true"] { color: var(--muted); cursor: not-allowed; }
.picker__empty { padding: 14px 16px; font-size: 14px; color: var(--muted); }

/* Loading */
.spinner {
  width: 20px; height: 20px; border-radius: 999px; flex-shrink: 0;
  border: 2.5px solid rgba(255, 255, 255, 0.4); border-top-color: #FFFFFF;
  animation: spin 0.8s linear infinite;
}
.spinner--dark { border-color: var(--line); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 40px 0; color: var(--muted); }

/* Status chip & countdown */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.chip--wait { background: var(--primary-soft); color: var(--primary); }
.chip--proc { background: var(--warn-soft); color: var(--warn); }
.chip--ok { background: var(--success-soft); color: var(--success); }
.chip--fail { background: var(--danger-soft); color: var(--danger); }
.countdown { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ink); }

/* Metode */
.method__fee { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.method[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.method-group { font-size: 13px; font-weight: 700; color: var(--muted); margin: 6px 0 0; }

/* Rincian per bulan */
.months { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.months li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  max-width: 440px; width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px;
  background: var(--dark); color: #FFFFFF; font-size: 14px; box-shadow: var(--shadow);
}

/* Mode debug (?debug=1) */
.debug { margin: 0 16px 16px; padding: 12px; background: #0F2633; color: #C9D6DE; border-radius: 12px; font-size: 11px; white-space: pre-wrap; word-break: break-all; max-height: 320px; overflow: auto; }

/* Cetak struk */
@media print {
  body { background: #FFFFFF; }
  .app { max-width: none; background: #FFFFFF; }
  .appbar, .stack, .footer, .debug, .toast, .no-print { display: none !important; }
  .receipt { border-style: solid; }
}
.qr img { width: 220px; height: 220px; display: block; image-rendering: pixelated; }
.inline-actions { display: flex; gap: 10px; }
.inline-actions .btn { flex: 1; }
.alert--success { background: var(--success-soft); color: var(--success); }
.alert .debug { margin: 10px 0 0; }

/* Popup support */
.modal {
  position: fixed; inset: 0; z-index: 60; background: rgba(15, 38, 51, 0.55);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
}
@media (min-width: 520px) { .modal { align-items: center; } }
.modal__card {
  width: 100%; max-width: 420px; background: var(--surface); border-radius: 20px;
  padding: 24px 20px 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow);
}
.btn--wa { background: #1A7F45; color: #FFFFFF; }
.btn--wa:hover { background: #156A39; color: #FFFFFF; }
