/* Billing Journal — Mobile UI ala Figma (Mobile Financial Tracking UI)
   Tema: indigo/ungu, kartu putih, latar abu terang, mobile-first 430px */

:root {
  --indigo: #4F46E5;
  --indigo-2: #6366F1;
  --indigo-3: #818CF8;
  --indigo-50: #EEF2FF;
  --indigo-100: #E0E7FF;
  --indigo-200: #C7D2FE;
  --bg: #F9FAFB;
  --card: #FFFFFF;
  --border: #F3F4F6;
  --line: #E5E7EB;
  --text: #111827;
  --muted: #9CA3AF;
  --soft: #6B7280;
  --green: #10B981;
  --green-bg: #ECFDF5;
  --red: #DC2626;
  --red-bg: #FEF2F2;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  background: #E5E7EB;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.phone {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 40px rgba(17, 24, 39, .08);
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Flash messages */
.flash-wrap { max-width: 430px; margin: 0 auto; padding: 12px 16px 0; }
.flash { border-radius: 14px; padding: 12px 16px; font-size: 14px; margin-bottom: 8px; }
.flash.success { background: #D1FAE5; color: #065F46; }
.flash.error { background: #FEE2E2; color: #991B1B; }
.flash.info { background: var(--indigo-100); color: #3730A3; }

/* Bottom navigation (persis Figma: Dashboard | Scan | Upload) */
.nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 430px);
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 10px 32px calc(18px + env(safe-area-inset-bottom));
  z-index: 40;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 0; cursor: pointer;
  color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .02em;
  text-decoration: none; padding: 4px 6px;
}
.nav-item.active { color: var(--indigo); }
.nav-center { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: -20px; }
.nav-center button {
  width: 56px; height: 56px; border-radius: 17.6px;
  background: var(--indigo); color: #fff; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 20px rgba(79, 70, 229, .35);
  transition: transform .12s;
}
.nav-center button:active { transform: scale(.92); }
.nav-center-label { font-size: 11px; font-weight: 600; color: var(--muted); }
.nav-center-label.active { color: var(--indigo); }

.app-main { padding-bottom: 120px; }
.app-main.plain { padding-bottom: 32px; }

/* Dashboard header */
.dash-head { padding: 56px 20px 20px; display: flex; justify-content: space-between; align-items: center; }
.greet { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.name { font-size: 20px; font-weight: 600; color: var(--text); margin-top: 2px; }
.avatar {
  width: 44px; height: 44px; border-radius: 9999px;
  background: var(--indigo); color: #fff; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; letter-spacing: .03em;
  box-shadow: 0 0 0 4px var(--indigo-100);
  transition: transform .12s;
}
.avatar:active { transform: scale(.94); }
.avatar-ghost {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
  margin-right: 10px;
}
.dash-actions { display: flex; align-items: center; }

/* Tombol Geek (akses /animation) — hanya untuk user yang di-grant */
.geek-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 229, 255, 0.08);
  color: #00d5f2;
  border: 1px solid rgba(0, 229, 255, 0.45);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  cursor: pointer;
  transition: background .2s, box-shadow .2s;
  margin-right: 8px;
}
.geek-btn:hover { background: rgba(0, 229, 255, 0.18); box-shadow: 0 0 12px rgba(0, 229, 255, 0.35); }

/* Varian tombol Geek di halaman login (lebar penuh) */
.geek-btn-login {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 14px;
  padding: 11px 12px;
  font-size: 12px;
  letter-spacing: 2px;
  text-decoration: none;
}

/* Hero card anggaran */
.hero {
  position: relative; margin: 0 20px 20px;
  background: linear-gradient(135deg, #4F46E5, #4338CA);
  border-radius: 24px; padding: 20px; color: #fff; overflow: hidden;
  box-shadow: 0 16px 32px rgba(79, 70, 229, .28);
}
.orb-a { position: absolute; top: -40px; right: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(99, 102, 241, .35); }
.orb-b { position: absolute; bottom: -32px; left: -32px; width: 128px; height: 128px; border-radius: 50%; background: rgba(67, 56, 202, .45); }
.hero .rel { position: relative; }
.hero-label { font-size: 11px; font-weight: 600; letter-spacing: .15em; text-transform: uppercase; color: var(--indigo-200); margin-bottom: 8px; }
.hero-amount { font-size: 42px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; margin-bottom: 20px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hero-cell { background: rgba(255, 255, 255, .12); border-radius: 16px; padding: 14px; }
.hero-cell .lbl { font-size: 11px; color: var(--indigo-200); margin-bottom: 6px; font-weight: 500; }
.hero-cell .val { font-size: 15px; font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Tabs filter */
.tabs { margin: 0 20px 20px; display: flex; background: rgba(243, 244, 246, .9); border-radius: 16px; padding: 4px; gap: 4px; }
.tab {
  flex: 1; padding: 10px 0; font-size: 13px; font-weight: 500; border-radius: 12px;
  color: var(--muted); text-align: center; text-decoration: none; transition: all .2s;
}
.tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.tab:not(.active):hover { color: #4B5563; }

/* Section & transaksi */
.section { padding: 0 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.section-action { font-size: 12px; font-weight: 600; color: var(--indigo-2); background: none; border: 0; cursor: pointer; text-decoration: none; }
.txn {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-radius: 16px; padding: 14px 16px; margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.txn-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.txn-icon.receipt { background: var(--indigo-50); color: var(--indigo-2); }
.txn-icon.bank { background: #F9FAFB; color: #9CA3AF; }
.txn-icon.income { background: var(--green-bg); color: var(--green); }
.txn-icon.manual { background: #F3F4F6; color: #6B7280; }
.txn-body { flex: 1; min-width: 0; }
.txn-name { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.txn-name { text-decoration: none; display: block; }
.txn-date { font-size: 12px; color: var(--muted); margin-top: 2px; }
.txn-amt { font-size: 14px; font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; flex-shrink: 0; }
.txn-amt.expense { color: var(--text); }
.txn-amt.income { color: var(--green); }
.txn-actions { display: flex; gap: 2px; flex-shrink: 0; }
.txn-act { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: flex; align-items: center; }
.txn-act:hover { background: var(--indigo-50); color: var(--indigo-2); }
.txn-act.danger:hover { background: #FEE2E2; color: #DC2626; }

/* Halaman Financial Health */
.fh-status { font-size: 15px; font-weight: 700; margin-top: 6px; }
.fh-status.excellent { color: var(--green); }
.fh-status.good { color: #2563EB; }
.fh-status.fair { color: #D97706; }
.fh-status.critical { color: #DC2626; }
.fh-rec { font-size: 13.5px; margin: 8px 0; line-height: 1.45; }
.fh-rec.pos { color: #065F46; }
.fh-rec.neg { color: #92400E; }
.fh-q { margin-bottom: 16px; }
.fh-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.fh-opt { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 13px; cursor: pointer; background: #fff; }
.fh-opt input { accent-color: var(--indigo); margin: 0; }
.fh-opt:has(input:checked) { border-color: var(--indigo); background: var(--indigo-50); color: var(--indigo-2); font-weight: 600; }

/* Kartu struk tersimpan (menu Struk) */
.receipt-card {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-radius: 16px; padding: 12px 14px; margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  text-decoration: none; color: inherit;
}
.receipt-thumb {
  width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex-shrink: 0;
}
.receipt-thumb-ph {
  display: flex; align-items: center; justify-content: center;
  background: var(--indigo-50); color: var(--indigo-2);
}
.receipt-body { flex: 1; min-width: 0; }
.receipt-store { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.receipt-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.receipt-note { font-size: 12px; color: var(--muted); margin-top: 2px; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.receipt-total { font-size: 14px; font-weight: 700; color: var(--text); margin-top: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.receipt-arrow { color: #C4C9D2; flex-shrink: 0; }

/* ── Multi-mata uang & ekspor ─────────────────────────────── */
.cur-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--indigo-2);
  background: rgba(99, 102, 241, .12);
  border: 1px solid rgba(99, 102, 241, .25);
  border-radius: 8px;
  padding: 1px 7px;
  vertical-align: middle;
}
.hero-home {
  font-size: 18px;
  font-weight: 700;
  color: #A5B4FC;
  margin-top: 2px;
}
.receipt-home {
  font-size: 12px;
  font-weight: 600;
  color: var(--indigo-2);
  white-space: nowrap;
}
.conv-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(99, 102, 241, .08);
  border: 1px dashed rgba(99, 102, 241, .35);
  border-radius: 12px;
}
.conv-preview .lbl { font-size: 12px; color: var(--muted); }
.conv-preview .val { font-size: 15px; font-weight: 700; color: var(--indigo-2); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.rate-form { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.conv-item .c-name { font-weight: 400; }
.export-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 20px 14px;
  flex-wrap: wrap;
}
.export-detail {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  margin-right: auto;
}

/* Ringkasan bagian bawah struk (Subtotal/SrvChg/GST/Rounding/Total2) */
.summary-line {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 0;
}
.summary-line .lbl { font-size: 13px; color: var(--text); }
.summary-line .val { font-size: 14px; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.summary-line input {
  width: 110px; text-align: right; border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 10px; font-size: 14px; color: var(--text);
  background: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.summary-line input:focus { outline: 2px solid var(--indigo-2); border-color: transparent; }

/* Empty state */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty .icon { font-size: 40px; margin-bottom: 10px; }
.empty p { font-size: 14px; }

/* Page header sub-halaman */
.page-head { display: flex; align-items: center; gap: 12px; padding: 20px 20px 14px; }
.back-btn {
  width: 38px; height: 38px; border-radius: 12px; background: #fff;
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  color: #374151; text-decoration: none; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); flex-shrink: 0;
}
.page-title { font-size: 20px; font-weight: 700; }
.page-sub { font-size: 13px; color: var(--muted); }

.card { background: #fff; border-radius: 20px; padding: 18px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); margin: 0 20px 16px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* Form */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: #4B5563; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 14px;
  padding: 12px 14px; font-size: 15px; color: var(--text); outline: none;
  transition: border .15s, box-shadow .15s; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--indigo-2); box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}
.field .hint { font-size: 11px; color: var(--muted); margin-top: 5px; }
select.input-warn { border-color: #e67e22 !important; box-shadow: 0 0 0 1px #e67e22; }
.item-row.low-conf { outline: 1px dashed #e67e22; background: rgba(230, 126, 34, .06); border-radius: 12px; }
.item-row.low-conf input { border-color: rgba(230, 126, 34, .55); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Tombol */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: 0; border-radius: 16px; padding: 15px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform .12s, background .15s; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--indigo); color: #fff; box-shadow: 0 8px 16px rgba(79, 70, 229, .25); }
.btn-primary:hover { background: #4338CA; }
.btn-ghost { background: #fff; color: #4B5563; border: 1px solid var(--line); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-sm { padding: 9px 14px; font-size: 13px; width: auto; border-radius: 12px; display: inline-flex; }
.btn-row { display: flex; gap: 10px; margin: 0 20px 24px; }
.btn-row .btn { flex: 1; }

/* Kotak upload */
.upload-box {
  border: 2px dashed #D1D5DB; border-radius: 20px; padding: 26px 16px;
  text-align: center; background: #fff; cursor: pointer; transition: all .15s;
}
.upload-box:hover { border-color: var(--indigo-2); background: var(--indigo-50); }
.upload-box .icon { font-size: 26px; margin-bottom: 8px; color: var(--indigo-2); }
.upload-box .t1 { font-size: 14px; font-weight: 600; color: var(--text); }
.upload-box .t2 { font-size: 12px; color: var(--muted); margin-top: 4px; }
.upload-box input[type=file] { display: none; }
.photo-preview { margin-top: 12px; }
.photo-preview img { width: 100%; max-height: 240px; object-fit: contain; border-radius: 14px; background: #F3F4F6; }
.btn-block { width: 100%; justify-content: center; }
.linkish { color: var(--indigo-2); font-size: 13px; cursor: pointer; text-decoration: underline; }

/* Baris dinamis (item) — 2 baris per item: nama + Qty×@harga=amount */
.item-row { margin-bottom: 10px; }
.item-row.txn-row { display: grid; grid-template-columns: 96px 1fr 110px 34px; gap: 8px; align-items: center; }
.item-row input {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 10px 12px; font-size: 14px; color: var(--text); outline: none; font-family: inherit;
}
.item-row input:focus { border-color: var(--indigo-2); }
.item-name-line { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.item-name-line input { flex: 1; }
.item-calc-line { display: flex; gap: 6px; align-items: center; }
.item-calc-line input[name="item_qty[]"] { width: 64px; flex: none; text-align: center; }
.item-calc-line input[name="item_price[]"] { flex: 1.4; min-width: 0; text-align: right; }
.item-calc-line input[name="item_amount[]"] { flex: 1.2; min-width: 0; text-align: right; font-weight: 600; background: var(--indigo-50); }
.item-calc-line .op { color: var(--soft); font-size: 14px; font-weight: 600; flex: none; }
.row-remove {
  width: 34px; height: 40px; border-radius: 10px; border: 1px solid #FECACA;
  background: var(--red-bg); color: var(--red); font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.add-row {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none;
  color: var(--indigo-2); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 0;
}
.total-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0 0; border-top: 1px dashed var(--line); margin-top: 8px; }
.total-row .lbl { font-size: 13px; font-weight: 600; color: var(--soft); }
.total-row .amt { font-size: 19px; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Chip mata uang & peringatan */
.cur-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--indigo-50); color: var(--indigo); border-radius: 999px;
  padding: 6px 12px; font-size: 12px; font-weight: 600; margin: 0 20px 14px;
}
.cur-warn { background: #FEF3C7; color: #92400E; border-radius: 14px; padding: 12px 14px; font-size: 13px; margin: 0 20px 16px; }
.cur-warn a { color: #92400E; font-weight: 700; }
.notice { border-radius: 14px; padding: 12px 14px; font-size: 13px; margin: 0 20px 16px; }
.notice.ok { background: var(--green-bg); color: #065F46; }
.notice.warn { background: #FEF3C7; color: #92400E; }

/* Modal lembar bawah (tambah pemasukan) */
.modal-overlay { display: none; position: fixed; inset: 0; z-index: 60; background: rgba(17, 24, 39, .5); align-items: flex-end; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal-sheet { width: min(100%, 430px); background: #fff; border-radius: 24px 24px 0 0; padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); }
.modal-sheet h3 { font-size: 17px; font-weight: 700; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: 0; font-size: 18px; color: var(--muted); cursor: pointer; }

/* Lightbox zoom foto struk — layar penuh, scroll bebas, baca footer jelas */
.lb-overlay {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: rgba(10, 12, 20, .96);
  align-items: center; justify-content: center;
  overflow: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.lb-overlay.open { display: flex; }
.lb-overlay img {
  max-width: 100%; max-height: 100%;
  object-fit: contain; margin: 56px auto;
  display: block; border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
  touch-action: pan-x pan-y; user-select: none; -webkit-user-select: none;
}
.lb-bar {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; justify-content: flex-end;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  z-index: 91;
}
.lb-btn {
  background: rgba(255, 255, 255, .12); border: 0; color: #fff;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lb-btn:active { transform: scale(.92); }

/* Detail */
.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.detail-row:last-child { border-bottom: 0; }
.detail-row .k { color: var(--muted); }
.detail-row .v { font-weight: 600; text-align: right; }

/* Detail item 4 kolom: nama | qty | @harga | amount */
.detail-item-head, .detail-item-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 46px 74px 84px; gap: 6px;
  align-items: center; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.detail-item-head { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.detail-item-row .c-name { overflow-wrap: anywhere; }
.detail-item-row .c-qty, .detail-item-row .c-price, .detail-item-row .c-amt { text-align: right; font-variant-numeric: tabular-nums; }
.detail-item-row .c-amt { font-weight: 600; }

/* Halaman login/register */
.auth-wrap { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px; }
.auth-logo {
  width: 64px; height: 64px; border-radius: 20px; background: var(--indigo); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 24px rgba(79, 70, 229, .35); margin-bottom: 16px;
}
.auth-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.auth-sub { font-size: 14px; color: var(--muted); margin-bottom: 28px; text-align: center; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 24px; padding: 24px; box-shadow: 0 4px 20px rgba(0, 0, 0, .06); }
.auth-links { margin-top: 18px; font-size: 14px; color: var(--muted); text-align: center; }
.auth-links a { color: var(--indigo); font-weight: 600; text-decoration: none; }

/* Pemilih bahasa kecil (halaman masuk) */
.lang-form { margin-bottom: 18px; }
.lang-form select {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 7px 14px; font-size: 13px; color: var(--text); outline: none; cursor: pointer;
}

/* Lencana status (admin / nonaktif) */
.badge {
  display: inline-block; border-radius: 999px; padding: 2px 8px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em; margin-left: 6px; vertical-align: middle;
}
.badge-admin { background: var(--indigo-50); color: var(--indigo); }
.badge-off { background: #FEE2E2; color: var(--red); }
.badge-geek { background: rgba(0, 229, 255, 0.12); color: #00b7d6; }

/* Tombol toggle Geek di User Management (btn-geek-on = sudah di-grant) */
.btn-geek-on {
  background: rgba(0, 229, 255, 0.15);
  color: #00b7d6;
  border-color: rgba(0, 229, 255, 0.5);
}

/* Tombol toggle LLM OCR di User Management (btn-llm-on = sudah di-grant) */
.btn-llm-on {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
  border-color: rgba(139, 92, 246, 0.5);
}

/* ── Spinner OCR + kunci form saat pemrosesan ─────────────── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: bjspin .7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes bjspin { to { transform: rotate(360deg); } }

form.is-processing input,
form.is-processing button,
form.is-processing select,
form.is-processing textarea {
  pointer-events: none;
  opacity: .55;
}

/* ── Animasi OCR loading ─────────────────────────────────────
 * barcode  : garis scan kiri→kanan→kiri (OCR biasa)
 * tiles    : 2 kolom × 6 baris, tile menyala warna dari atas ke bawah
 *           (OCR + LLM)
 */
.ocr-anim {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #0b1220;
  border: 1px solid rgba(255, 255, 255, .12);
}
.ocr-anim-barcode {
  height: 34px;
  background:
    repeating-linear-gradient(90deg,
      rgba(255, 255, 255, .18) 0 2px, transparent 2px 5px,
      rgba(255, 255, 255, .10) 5px 6px, transparent 6px 9px);
}
.ocr-barcode-bar {
  position: absolute;
  top: 0; bottom: 0;
  width: 28px;
  background: linear-gradient(90deg, transparent, rgba(34, 197, 94, .85), transparent);
  box-shadow: 0 0 12px rgba(34, 197, 94, .8);
  animation: ocrBarcodeSweep 1.5s ease-in-out infinite alternate;
}
@keyframes ocrBarcodeSweep {
  from { left: -10%; }
  to   { left: calc(100% - 18px); }
}
.ocr-anim-tiles {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ocr-tiles-grid {
  display: grid;
  grid-template-columns: repeat(2, 26px);
  grid-template-rows: repeat(6, 9px);
  gap: 4px;
}
.ocr-tile {
  border-radius: 3px;
  background: rgba(255, 255, 255, .10);
  animation: ocrTilePulse 1.2s linear infinite;
  animation-delay: calc(var(--td, 0) * 1s);
}
/* 2×6 = 12 tile; nyala dari atas (baris 1) ke bawah (baris 6).
 * row = floor((t-1)/2), delay = row * 0.18s */
.ocr-tile[data-t="1"] { --td: 0; }
.ocr-tile[data-t="2"] { --td: 0; }
.ocr-tile[data-t="3"] { --td: .18; }
.ocr-tile[data-t="4"] { --td: .18; }
.ocr-tile[data-t="5"] { --td: .36; }
.ocr-tile[data-t="6"] { --td: .36; }
.ocr-tile[data-t="7"] { --td: .54; }
.ocr-tile[data-t="8"] { --td: .54; }
.ocr-tile[data-t="9"] { --td: .72; }
.ocr-tile[data-t="10"] { --td: .72; }
.ocr-tile[data-t="11"] { --td: .90; }
.ocr-tile[data-t="12"] { --td: .90; }
@keyframes ocrTilePulse {
  0%   { background: rgba(255, 255, 255, .10); box-shadow: none; }
  25%  { background: #f97316; box-shadow: 0 0 8px #f97316; }   /* oranye */
  50%  { background: #22c55e; box-shadow: 0 0 8px #22c55e; }   /* hijau */
  75%  { background: #3b82f6; box-shadow: 0 0 8px #3b82f6; }   /* biru */
  100% { background: rgba(255, 255, 255, .10); box-shadow: none; }
}

/* ── Badge metode baca struk (LLM) ─────────────────────────── */
.llm-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: #fff;
  vertical-align: 1px;
  margin-left: 6px;
  letter-spacing: .3px;
}
.llm-badge .tkn {
  font-weight: 500;
  opacity: .85;
  font-size: 9px;
}
.local-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(34, 197, 94, .15);
  color: #16a34a;
  vertical-align: 1px;
  margin-left: 6px;
  letter-spacing: .3px;
}
.receipt-detail-llm {
  margin: 10px 0 4px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Superadmin ─────────────────────────────────────────────── */
/* Default = mobile: kartu bertumpuk seperti template lain.
   Media query (min-width) = desktop: container lebar + tabel. */

body.superadmin-page .phone {
  max-width: 430px;
  transition: max-width .2s ease;
}

.sa-main { padding-bottom: 32px; }
.sa-head { flex-wrap: wrap; }
.sa-badge {
  margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  background: var(--indigo-50); color: var(--indigo);
  border-radius: 999px; padding: 5px 10px; white-space: nowrap;
}
.sa-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 20px 16px; }
.sa-card {
  background: #fff; border-radius: 18px; padding: 14px 14px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04); border: 1px solid var(--border);
}
.sa-card-ico { font-size: 18px; margin-bottom: 6px; }
.sa-card-lbl { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.sa-card-val { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.sa-card-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.sa-card-accent { background: var(--indigo); color: #fff; }
.sa-card-accent .sa-card-lbl, .sa-card-accent .sa-card-sub { color: rgba(255, 255, 255, .75); }
.sa-card-income { background: var(--green-bg); }
.sa-card-income .sa-card-lbl { color: #047857; }
.sa-card-expense { background: var(--red-bg); }
.sa-card-expense .sa-card-lbl { color: var(--red); }

.sa-table-card { overflow: hidden; }
.sa-table-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sa-note { font-size: 10px; color: var(--muted); }

/* Tabel hanya untuk desktop (≥768px) */
.sa-table-wrap { display: none; }
.sa-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sa-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sa-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sa-table tr:last-child td { border-bottom: 0; }
.sa-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sa-table .num .sa-sub { display: block; font-size: 10px; color: var(--muted); }
.sa-table .sa-inc { color: #047857; font-weight: 600; }
.sa-table .sa-exp { color: var(--red); font-weight: 600; }
.sa-table .sa-dt { font-size: 12px; white-space: nowrap; }
.sa-table .sa-never { font-size: 11px; color: var(--muted); font-style: italic; }
.sa-row-off { opacity: .55; }
.sa-row-admin td { background: var(--indigo-50); }

.sa-user { display: flex; align-items: center; gap: 10px; }
.sa-avatar {
  width: 36px; height: 36px; border-radius: 12px; background: var(--indigo);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex: none;
}
.sa-user-body { display: flex; flex-direction: column; min-width: 0; }
.sa-username { font-weight: 700; font-size: 13px; display: flex; align-items: center; flex-wrap: wrap; }
.sa-fullname { font-size: 11px; color: var(--muted); }

/* Daftar kartu untuk mobile (layout sama dgn template lain) */
.sa-mobile-list { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.sa-mobile-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 14px; }
.sa-mobile-off { opacity: .6; }
.sa-mobile-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sa-mobile-name { font-size: 14px; font-weight: 700; display: flex; align-items: center; flex-wrap: wrap; }
.sa-mobile-full { font-size: 12px; color: var(--muted); margin-top: 1px; }
.sa-mobile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sa-cell { background: var(--bg); border-radius: 12px; padding: 8px 10px; }
.sa-cell-lbl { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.sa-cell-val { font-size: 13px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.sa-cell-val .sa-sub { font-size: 10px; color: var(--muted); font-weight: 400; }
.sa-inc { color: #047857; }
.sa-exp { color: var(--red); }
.sa-empty { font-size: 13px; color: var(--muted); padding: 10px 0; }
.sa-footnote { font-size: 11px; color: var(--muted); text-align: center; padding: 0 20px 24px; line-height: 1.5; }

/* Desktop: container lebar + tabel */
@media (min-width: 768px) {
  body.superadmin-page .phone { max-width: 1080px; }
  .sa-cards { grid-template-columns: repeat(6, 1fr); padding: 0 24px 20px; }
  .sa-card { padding: 18px 16px 14px; }
  .sa-card-val { font-size: 24px; }
  .sa-table-wrap { display: block; overflow-x: auto; margin-top: 6px; }
  .sa-mobile-list { display: none; }
  .sa-head { padding: 28px 24px 18px; }
  .sa-table-card { margin: 0 24px 16px; padding: 20px; }
  .sa-footnote { padding: 0 24px 28px; }
}

/* Layar sangat kecil: kartu 2 kolom tetap nyaman */
@media (max-width: 360px) {
  .sa-cards { grid-template-columns: 1fr; }
  .sa-mobile-grid { grid-template-columns: 1fr; }
}
