@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --ink: #0E1420;
  --ink-soft: #5B6472;
  --surface: #F6F7FB;
  --card: #FFFFFF;
  --line: #E3E7EF;
  --brand: #2851E3;
  --brand-dim: #E8EDFC;
  --confirm: #0E9F6E;
  --confirm-dim: #E4F6EF;
  --warn: #D97706;
  --danger: #DC2626;
  --danger-dim: #FDEAEA;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.display {
  font-family: 'Space Grotesk', 'IBM Plex Sans', sans-serif;
}

/* ── App shell ─────────────────────────────────────────────── */

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 84px; /* clears the fixed bottom nav */
  position: relative;
}

.screen-header {
  padding: 22px 20px 6px 20px;
}

.screen-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 21px;
  font-weight: 600;
  margin: 0 0 3px 0;
}

.screen-header p {
  color: var(--ink-soft);
  font-size: 13.5px;
  margin: 0;
  line-height: 1.4;
}

.content {
  padding: 12px 20px 20px 20px;
}

/* ── Bottom tab bar ────────────────────────────────────────── */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)) 6px;
  z-index: 50;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 4px 5px 4px;
  text-decoration: none;
  color: var(--ink-soft);
  border-radius: 12px;
}

.nav-item svg { width: 22px; height: 22px; }
.nav-item span { font-size: 10.5px; font-weight: 500; }

.nav-item.active {
  color: var(--brand);
}

/* ── Balance hero (no card chrome — it's the one bold element) */

.balance-hero {
  padding: 4px 0 18px 0;
}

.balance-hero .label {
  color: var(--ink-soft);
  font-size: 13px;
  margin-bottom: 6px;
}

.balance-hero .amount {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.balance-hero .amount .currency {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-right: 4px;
}

/* ── Structural blocks: hairline border, not soft-shadow cards ─ */

.block {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--card);
}

.block-label {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.row:last-child { border-bottom: none; }

.row .amount { font-variant-numeric: tabular-nums; font-weight: 500; }

.total-row {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 18px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 2px solid var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ── Form elements ─────────────────────────────────────────── */

input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 16px;
  margin-bottom: 10px;
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
}

input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-dim);
}

button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 11px;
  font-size: 15.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

button:focus-visible { outline: 3px solid var(--brand-dim); outline-offset: 2px; }

.btn-primary { background: var(--brand); color: white; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--card);
  color: var(--brand);
  border: 1.5px solid var(--brand);
  margin-bottom: 8px;
}

.btn-row { display: flex; gap: 8px; }
.btn-row button { margin-bottom: 0; }

/* ── Status text ───────────────────────────────────────────── */

.status-confirm { color: var(--confirm); font-weight: 600; }
.status-warn { color: var(--warn); font-weight: 600; }
.error-text { color: var(--danger); font-size: 13.5px; margin: -2px 0 10px 0; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}
.badge-confirm { background: var(--confirm-dim); color: var(--confirm); }
.badge-warn { background: #FEF3E2; color: var(--warn); }
.badge-danger { background: var(--danger-dim); color: var(--danger); }

/* ── Chips (catalog tap-to-add grid) ──────────────────────────*/

.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.chip {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13.5px;
  text-align: center;
  cursor: pointer;
}
.chip strong { display: block; margin-top: 2px; }
.chip:active { background: var(--brand-dim); border-color: var(--brand); }

/* ── Camera ────────────────────────────────────────────────── */

.camera-frame {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 14px;
  overflow: hidden;
  background: var(--ink);
  margin-bottom: 10px;
  position: relative;
}
.camera-frame video { width: 100%; height: 100%; object-fit: cover; }

/* ── Empty states ──────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
}
.empty-state .display { font-size: 16px; color: var(--ink); margin-bottom: 6px; }
