:root {
  --bg: #0f172a;
  --bg2: #1e293b;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #4f46e5;
  --brand2: #6366f1;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f1f5f9; color: var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}
.hidden { display: none !important; }

/* ---------- App bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, var(--bg) 0%, #312e81 100%);
  color: #fff; padding: calc(env(safe-area-inset-top) + 14px) 18px 14px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow);
}
.appbar .brand { font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.appbar .who { font-size: 13px; opacity: .85; }
.appbar .logout { background: rgba(255,255,255,.15); border: 0; color: #fff;
  padding: 7px 12px; border-radius: 9px; font-size: 13px; font-weight: 600; }

.wrap { max-width: 560px; margin: 0 auto; padding: 16px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: 16px; padding: 16px;
  box-shadow: var(--shadow); margin-bottom: 14px; }
.card h2 { margin: 0 0 12px; font-size: 15px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; font-weight: 700; }

/* ---------- Big action buttons ---------- */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.action {
  border: 0; border-radius: 18px; padding: 22px 14px; color: #fff;
  font-size: 16px; font-weight: 700; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer;
}
.action .ic { font-size: 30px; line-height: 1; }
.action.float { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.action.expense { background: linear-gradient(135deg, #ea580c, #c2410c); }
.action.full { grid-column: 1 / -1; }

/* ---------- Balances ---------- */
.bal-row { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--line); }
.bal-row:last-child { border-bottom: 0; }
.bal-name { font-weight: 600; }
.bal-amt { font-weight: 800; font-size: 17px; }
.bal-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; margin-left: 6px; }
.chip.warn { background: #fef3c7; color: #92400e; }
.total-card { background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; }
.total-card h2 { color: rgba(255,255,255,.8); }
.total-amt { font-size: 34px; font-weight: 800; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 16px; background: #fff; color: var(--ink); font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
textarea { resize: vertical; min-height: 64px; }
.amount-input { font-size: 26px; font-weight: 800; text-align: center; }
.perhead { font-size: 13px; color: var(--green); font-weight: 700; margin-top: 6px; }
.btn { width: 100%; padding: 16px; border: 0; border-radius: 14px; font-size: 16px;
  font-weight: 700; color: #fff; background: var(--brand); margin-top: 18px; cursor: pointer; }
.btn:disabled { opacity: .5; }
.btn.ghost { background: #f1f5f9; color: var(--ink); }
.btn.green { background: var(--green); } .btn.red { background: var(--red); }
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cat-btn { padding: 16px 10px; border: 1.5px solid var(--line); border-radius: 14px;
  background: #fff; font-weight: 700; font-size: 14px; text-align: center; cursor: pointer; }
.cat-btn.sel { border-color: var(--brand); background: #eef2ff; color: var(--brand); }
.proof-drop { border: 2px dashed var(--line); border-radius: 14px; padding: 22px;
  text-align: center; color: var(--muted); font-size: 14px; }
.proof-drop img { max-width: 100%; border-radius: 10px; margin-top: 10px; }
.req { color: var(--red); }

/* ---------- Pending / list ---------- */
.tx { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.tx-head { display: flex; justify-content: space-between; align-items: flex-start; }
.tx-amt { font-weight: 800; font-size: 18px; }
.tx-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.tx-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.b-pending { background: #fef3c7; color: #92400e; }
.b-approved { background: #dcfce7; color: #166534; }
.b-rejected { background: #fee2e2; color: #991b1b; }
.b-float { background: #dbeafe; color: #1e40af; }
.tx-proof { margin-top: 10px; }
.tx-proof img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.tx-actions { display: flex; gap: 10px; margin-top: 12px; }
.tx-actions .btn { margin-top: 0; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab { flex: 1; padding: 11px; text-align: center; border-radius: 11px; background: #fff;
  font-weight: 700; font-size: 13px; color: var(--muted); border: 1px solid var(--line); cursor: pointer; }
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tab .badge { background: var(--red); color: #fff; border-radius: 999px; padding: 1px 7px;
  font-size: 11px; margin-left: 5px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  padding: 24px; max-width: 420px; margin: 0 auto; }
.login .logo { text-align: center; font-size: 40px; margin-bottom: 6px; }
.login h1 { text-align: center; margin: 0 0 4px; font-size: 24px; }
.login p { text-align: center; color: var(--muted); margin: 0 0 26px; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.pinkey { padding: 18px; font-size: 22px; font-weight: 700; border-radius: 14px;
  background: #fff; border: 1px solid var(--line); cursor: pointer; }
.pindots { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.pindot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.pindot.on { background: var(--brand); }

/* ---------- Dashboard ---------- */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--card); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.kpi-l { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.kpi-v { font-size: 22px; font-weight: 800; margin-top: 6px; }
.kpi-warn { background: #fffbeb; box-shadow: 0 0 0 1.5px #fde68a inset, var(--shadow); }
.trend { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding-top: 8px; }
.tcol { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.tbar { width: 70%; background: linear-gradient(180deg, #6366f1, #4f46e5); border-radius: 6px 6px 0 0; min-height: 2px; }
.tlbl { font-size: 11px; color: var(--muted); margin-top: 6px; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }
.spin { text-align: center; padding: 30px; color: var(--muted); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(60px);
  background: #0f172a; color: #fff; padding: 13px 20px; border-radius: 12px; font-size: 14px;
  font-weight: 600; opacity: 0; transition: .3s; z-index: 100; max-width: 90%; text-align: center; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.err { background: var(--red); } .toast.ok { background: var(--green); }
