/* ============ Rindu Rumah 2.0 — Tema "Putih Ungu" (desain user 2026-08-06) ============
   Dipakai halaman WBP/keluarga (kios, nanti app). Panel admin/petugas TETAP app.css lama.
   Palet dari berkas desain: ungu #5643FF, aktif #8274FF, hijau #0CBA63,
   oranye #FF9214, salmon tombol telepon #FF7372, latar putih, teks #17151F. */

@font-face { font-family: 'Baloo 2'; src: url('/fonts/baloo2-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('/fonts/baloo2-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('/fonts/baloo2-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('/fonts/baloo2-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Baloo 2'; src: url('/fonts/baloo2-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --bg: #ffffff;
  --bg-2: #f4f3ff;
  --panel: #ffffff;
  --panel-2: #f4f3ff;
  --line: #e5e2f7;
  --text: #17151f;
  --muted: #6e6a85;
  --accent: #5643ff;     /* ungu utama */
  --accent-2: #4433e0;   /* ungu tua (hover/gradasi) */
  --aktif: #8274ff;      /* highlight nav aktif */
  --ok: #0cba63;
  --warn: #ff9214;
  --bad: #e11d48;
  --tel: #ff7372;        /* tombol telepon salmon */
  --r: 20px;
  --shadow: 0 8px 26px rgba(86, 67, 255, .13);
  --glow: 0 0 24px rgba(86, 67, 255, .28);
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font: 15px/1.5 'Baloo 2', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}
h1, h2, h3, .brand, .btn, .stat-num { font-family: 'Baloo 2', sans-serif; }
h3 { font-weight: 700; }
a { color: var(--accent); text-decoration: none; }
.wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 20px; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: .2px; }
.brand .logo { flex: none; display: grid; place-items: center; background: transparent; }
.brand .logo svg, .brand .logo img { width: 100%; height: 100%; object-fit: contain; }
.brand small { display: block; font-weight: 600; color: var(--muted); letter-spacing: 2px; font-size: 10px; text-transform: uppercase; }
.kios-label { font-weight: 800; color: var(--accent); letter-spacing: 1.5px; font-size: 15px; }

/* ---------- Komponen dasar ---------- */
.card {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: 0 4px 18px rgba(23, 21, 31, .05);
}
/* kartu blok ungu (form keluarga, kartu daftar) */
.card-ungu { background: var(--accent); border-color: #17151f22; color: #fff; }
.card-ungu h3 { color: #fff; }
.card-ungu .muted { color: rgba(255, 255, 255, .82); }
.card-ungu .label { color: #fff; }
.card-ungu .input, .card-ungu select.input { background: #fff; border-color: #fff; color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 14px; cursor: pointer;
  background: var(--panel-2); color: var(--accent);
  padding: 12px 20px; font-size: 15px; font-weight: 700; letter-spacing: .2px;
  font-family: 'Baloo 2', sans-serif;
  transition: transform .12s, box-shadow .2s, background .2s, filter .2s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { box-shadow: var(--glow); background: var(--accent-2); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-lg { padding: 15px 26px; font-size: 17px; border-radius: 16px; font-weight: 800; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
/* chip oranye "Isi Saldo" */
.btn-oranye { background: var(--warn); color: #fff; border-radius: 999px; }
/* tombol telepon salmon di kartu kontak */
.btn-call {
  background: var(--tel); color: #fff; border-radius: 14px;
  width: 52px; height: 52px; padding: 0; font-size: 22px; flex: none;
}
.btn-call:hover { box-shadow: 0 0 18px rgba(255, 115, 114, .5); }

.input, select.input {
  width: 100%; padding: 12px 15px; border-radius: 12px;
  border: 2px solid var(--accent); background: #fff; color: var(--text);
  font: inherit; font-weight: 600; outline: none; transition: border .2s, box-shadow .2s;
}
.input::placeholder { color: #a9a4c4; font-weight: 500; }
.input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(86, 67, 255, .18); }
.label { display: block; font-size: 13px; color: var(--text); margin: 14px 0 6px; letter-spacing: .8px; text-transform: uppercase; font-weight: 800; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; border: none; background: #fff; box-shadow: 0 1px 6px rgba(23, 21, 31, .12); }
.badge::before { content: ''; width: 8px; height: 8px; border-radius: 99px; background: currentColor; }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.bad { color: var(--bad); }
.badge.info { color: var(--accent); }
/* chip saldo hijau solid (header kios) */
.chip-saldo { background: var(--ok); color: #fff; border-radius: 999px; padding: 7px 16px; font-weight: 800; font-size: 14.5px; display: inline-flex; align-items: center; gap: 7px; box-shadow: 0 3px 12px rgba(12, 186, 99, .3); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; padding: 10px 12px; border-bottom: 2px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }

.muted { color: var(--muted); }
.row { display: flex; gap: 12px; align-items: center; }
.grow { flex: 1; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--text); border: none; color: #fff;
  padding: 12px 22px; border-radius: 14px; opacity: 0; pointer-events: none;
  transition: .25s; z-index: 99; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: 90vw;
  font-weight: 600;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--bad); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(23, 21, 31, .55); backdrop-filter: blur(6px); display: none; place-items: center; z-index: 50; padding: 18px; }
.modal-bg.open { display: grid; }
.modal { width: 100%; max-width: 470px; animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

/* ---------- Avatar inisial: kotak hijau ---------- */
.ava {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  display: grid; place-items: center; font-family: 'Baloo 2'; font-weight: 800; font-size: 19px;
  background: var(--ok); border: none; color: #fff;
  text-transform: uppercase;
}

/* ---------- Kartu kontak: pil ungu besar (desain) ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr; gap: 13px; }
.contact-card {
  display: flex; align-items: center; gap: 13px; padding: 12px 14px;
  border-radius: 18px; background: var(--accent); border: 2px solid #17151f2e;
  color: #fff; transition: transform .12s, box-shadow .2s;
  box-shadow: 0 4px 16px rgba(86, 67, 255, .22);
}
.contact-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(86, 67, 255, .3); }
.contact-card .muted { color: rgba(255, 255, 255, .78); }
.contact-card .cc-nama { font-size: 19px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; line-height: 1.2; color: #fff; }

/* ---------- Riwayat: kartu ungu + chip status putih ---------- */
.hist-item {
  background: var(--accent); color: #fff; border: 2px solid #17151f2e;
  border-radius: 16px; padding: 12px 15px; margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.hist-item b { font-size: 16.5px; text-transform: uppercase; letter-spacing: .3px; }
.hist-item .muted { color: rgba(255, 255, 255, .78); }

/* ---------- Chat ---------- */
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--accent); color: #fff; }
.chat-head .btn-ghost { color: #fff; font-size: 17px; }
.bubble { max-width: 78%; padding: 9px 13px; border-radius: 15px; font-weight: 500; }
.bubble.mine { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble.their { align-self: flex-start; background: #ececf3; color: var(--text); border-bottom-left-radius: 4px; }
#chatSend { background: var(--ok); color: #fff; }
#chatSend:hover { background: #0aa257; }

/* ---------- Layar panggilan (tetap gelap utk video, aksen ungu) ---------- */
.call-screen { position: fixed; inset: 0; background: #12101f; z-index: 40; display: none; flex-direction: column; }
/* Bug tampilan uji live 2026-08-15: bar bawah (waktu sisa + Akhiri) kadang
   melayang di atas tepi layar — inset:0 mengikuti layout viewport yang di
   WebView/Chrome Android bisa lebih tinggi dari layar tampak (URL bar/nav
   gesture). 100dvh mengikuti viewport DINAMIS = selalu pas tepi bawah. */
@supports (height: 100dvh) {
  .call-screen { height: 100dvh; bottom: auto; }
}
.call-screen.open { display: flex; }
.call-stage { flex: 1; position: relative; overflow: hidden; }
.call-stage video.remote { width: 100%; height: 100%; object-fit: contain; background: #12101f; }
.call-stage video.local {
  position: absolute; right: 16px; top: 16px; width: min(28vw, 200px); aspect-ratio: 3/4;
  object-fit: cover; border-radius: 16px; border: 2px solid rgba(130, 116, 255, .5); box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  background: #1d1935;
  transform: scaleX(-1); /* cermin kamera depan; video terkirim/terekam tidak terbalik */
}
.call-stage video.local.pakai-belakang { transform: none; }
.call-stage.swapped video.remote {
  position: absolute; right: 16px; top: 16px; left: auto; width: min(28vw, 200px); height: auto;
  aspect-ratio: 3/4; object-fit: cover; border-radius: 16px; border: 2px solid rgba(130, 116, 255, .5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); z-index: 2;
}
.call-stage.swapped video.local {
  position: absolute; inset: 0; right: auto; top: auto; width: 100%; height: 100%;
  aspect-ratio: auto; object-fit: contain; border: none; border-radius: 0; box-shadow: none; z-index: 0;
}
.call-stage video { touch-action: none; }
.call-topbar {
  position: absolute; top: 0; left: 0; right: 0; padding: 14px 18px;
  display: flex; align-items: center; gap: 10px; z-index: 2;
  background: linear-gradient(rgba(18, 16, 31, .82), transparent);
}
.rec-pill { display: inline-flex; align-items: center; gap: 7px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); color: #fff; border-radius: 999px; padding: 6px 13px; font-size: 12.5px; font-weight: 600; }
.rec-dot { width: 9px; height: 9px; border-radius: 99px; background: #ff5a5a; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.call-controls {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px; z-index: 2;
  display: flex; justify-content: center; align-items: center; gap: 14px;
  background: linear-gradient(transparent, rgba(18, 16, 31, .88));
  /* jangan tertutup gesture bar / notch bawah Android */
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}
.call-timer { font-family: 'Baloo 2'; font-size: 17px; font-weight: 700; letter-spacing: 1px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); color: #fff; border-radius: 999px; padding: 8px 16px; }

/* layar "memanggil..." */
.calling-box { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; z-index: 3; background: radial-gradient(600px 400px at 50% 35%, rgba(86, 67, 255, .25), transparent 70%), #12101f; color: #fff; }
.calling-box .muted { color: #b9b3d9; }
.pulse { position: relative; width: 110px; height: 110px; display: grid; place-items: center; }
.pulse .ava { width: 86px; height: 86px; font-size: 32px; border-radius: 26px; }
.pulse::before, .pulse::after {
  content: ''; position: absolute; inset: 0; border-radius: 32px;
  border: 2px solid rgba(130, 116, 255, .55); animation: ring 1.8s infinite;
}
.pulse::after { animation-delay: .9s; }
@keyframes ring { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.45); opacity: 0; } }

/* ---------- Tabs pil (fallback utk halaman lain yang memakai .tab) ---------- */
.tabs { display: flex; gap: 8px; margin: 18px 0; flex-wrap: wrap; }
.tab { padding: 10px 20px; border-radius: 999px; border: 2px solid var(--line); background: transparent; color: var(--muted); font: 700 14px 'Baloo 2'; cursor: pointer; }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Menu bawah: bar ungu solid (desain) ---------- */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; z-index: 40; background: var(--accent); border-top: none; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 22px rgba(86, 67, 255, .28); }
.bottom-nav .nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px 6px; background: none; border: none; border-radius: 14px; color: rgba(255, 255, 255, .85); font: 700 11.5px 'Baloo 2'; letter-spacing: .2px; cursor: pointer; position: relative; }
.bottom-nav .nav-item .ic { font-size: 21px; line-height: 1; }
.bottom-nav .nav-item .ic svg { width: 23px; height: 23px; display: block; }
.bottom-nav .nav-item.active { color: #fff; background: var(--aktif); }
.bottom-nav .nbadge { position: absolute; top: 1px; left: calc(50% + 8px); background: var(--warn); color: #fff; border-radius: 999px; font-size: 10.5px; font-weight: 800; min-width: 17px; height: 17px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.has-nav { padding-bottom: 96px; }

/* ---------- Login kios ---------- */
.login-logo { width: 210px; margin: 0 auto 6px; display: block; }
.login-tagline { text-align: center; font-weight: 700; font-size: 16.5px; margin-bottom: 22px; }
.login-note { text-align: center; font-size: 11.5px; color: var(--muted); font-style: italic; margin-top: 14px; line-height: 1.45; }

/* ---------- Admin layout (cadangan; panel tetap pakai app.css lama) ---------- */
.admin-shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { border-right: 1px solid var(--line); padding: 22px 14px; background: var(--bg-2); display: flex; flex-direction: column; gap: 6px; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: 12px; color: var(--muted); font-weight: 700; font-size: 14px; cursor: pointer; }
.side-link.active { background: var(--accent); color: #fff; }
.main { padding: 26px; max-width: 1100px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-num { font-size: 34px; font-weight: 800; color: var(--accent); }
@media (max-width: 760px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); }
}

/* ---------- Onboarding pemasangan pertama (app keluarga) ---------- */
/* Layar penuh di atas form Masuk (z 70) — tampil SEKALI per perangkat,
   ditutup animasi logo (z 80). Toast (z 99) tetap paling atas. */
.ob {
  position: fixed; inset: 0; z-index: 70; overflow-y: auto;
  background:
    radial-gradient(520px 340px at 50% -80px, rgba(86, 67, 255, .14), transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 42%);
  display: flex; align-items: center; justify-content: center; padding: 20px 18px;
}
.ob-card { width: 100%; max-width: 430px; }
.ob-step { animation: obMasuk .32s cubic-bezier(.22, 1, .36, 1); }
@keyframes obMasuk { from { opacity: 0; transform: translateY(14px); } }
.ob-logo { width: 168px; display: block; margin: 0 auto 4px; }
.ob-judul { font-size: 22px; text-align: center; margin-top: 6px; }
.ob-sub { text-align: center; font-size: 13.5px; color: var(--muted); margin: 4px 0 16px; }
.ob-dots { display: flex; gap: 7px; justify-content: center; margin: 18px 0 2px; }
.ob-dots i { width: 8px; height: 8px; border-radius: 99px; background: var(--line); transition: .25s; }
.ob-dots i.on { width: 24px; background: var(--accent); }
.ob-item {
  display: flex; gap: 13px; align-items: flex-start; padding: 12px 14px;
  background: var(--panel); border: 2px solid var(--line); border-radius: 16px; margin-top: 10px;
}
.ob-item .ic {
  flex: none; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  font-size: 21px; background: var(--bg-2); border: 1.5px solid var(--line); color: var(--accent);
}
.ob-item .ic svg { width: 22px; height: 22px; display: block; }
.ob-item b { font-size: 14.5px; display: block; }
.ob-item p { font-size: 12.5px; color: var(--muted); line-height: 1.45; margin-top: 1px; }
.ob-scroll {
  max-height: 44vh; overflow-y: auto; background: var(--panel); border: 2px solid var(--line);
  border-radius: 16px; padding: 14px 16px; margin-top: 12px; font-size: 13px; line-height: 1.55;
}
.ob-scroll h4 { font-size: 13.5px; color: var(--accent); margin: 12px 0 3px; }
.ob-scroll h4:first-child { margin-top: 0; }
.ob-scroll p, .ob-scroll li { color: var(--text); }
.ob-scroll ul { padding-left: 18px; margin: 3px 0; }
.ob-tunggu { text-align: center; font-size: 13px; color: var(--muted); margin-top: 12px; display: none; }
.ob-tunggu .rec-dot { display: inline-block; background: var(--accent); margin-right: 7px; }

/* ---------- Animasi logo (splash) sesudah onboarding ---------- */
.splash {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  background:
    radial-gradient(560px 420px at 50% 42%, rgba(86, 67, 255, .16), transparent 72%),
    var(--bg);
  transition: opacity .5s ease;
}
.splash.pergi { opacity: 0; pointer-events: none; }
.splash-panggung { position: relative; width: 210px; height: 190px; display: grid; place-items: center; }
.splash-panggung::before, .splash-panggung::after {
  content: ''; position: absolute; inset: 8px 22px; border-radius: 50%;
  border: 2px solid rgba(86, 67, 255, .45); animation: splashCincin 1.9s ease-out infinite;
}
.splash-panggung::after { animation-delay: .95s; }
@keyframes splashCincin {
  from { transform: scale(.72); opacity: 0; }
  30% { opacity: .8; }
  to { transform: scale(1.35); opacity: 0; }
}
.splash-logo {
  width: 158px; position: relative; z-index: 1;
  animation: splashMasuk .9s cubic-bezier(.34, 1.4, .4, 1) both, splashNgambang 2.6s ease-in-out .9s infinite;
  filter: drop-shadow(0 14px 30px rgba(86, 67, 255, .35));
}
@keyframes splashMasuk {
  from { opacity: 0; transform: scale(.55) rotate(-6deg); }
  60% { opacity: 1; transform: scale(1.06) rotate(1.5deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes splashNgambang {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}
.splash-teks {
  font: 800 15px 'Baloo 2'; letter-spacing: 3px; text-transform: uppercase; color: var(--accent);
  animation: splashTeks .8s ease .55s both;
}
@keyframes splashTeks { from { opacity: 0; transform: translateY(10px); letter-spacing: 8px; } }
