:root {
  --bg: #f5f4f1;
  --surface: #ffffff;
  --ink: #17171a;
  --ink-2: #6e6e73;
  --ink-3: #8b8a87;
  --line: #e7e5e1;
  --accent: #ff4b2b;
  --success: #1faa59;
  --warn-bg: #fff6e9;
  --warn-line: #f5dfb0;
  --warn-ink: #8a5a12;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; border: 0; background: none; color: inherit; cursor: pointer; }
input { font: inherit; }
[hidden] { display: none !important; }

#app { max-width: 430px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; padding: 0 20px 24px; }
.topbar { display: flex; align-items: center; padding: 18px 0 8px; gap: 8px; }
.topbar h1 { flex: 1; text-align: center; font-size: 16px; margin: 0 36px 0 0; }
.icon-btn { width: 36px; height: 36px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; }
.muted { color: var(--ink-3); font-size: 12px; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .3px; color: var(--ink-3); text-transform: uppercase; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px; border-radius: 14px; font-weight: 700; font-size: 15px; width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-outline { background: var(--surface); border: 1.5px solid var(--ink); }
.btn-link { height: 36px; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.btn[disabled] { opacity: .4; pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input { height: 48px; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 0 14px; font-size: 15px; }
.error { color: var(--accent); font-size: 13px; min-height: 18px; }

.card { background: #fff; border-radius: 22px; overflow: hidden; box-shadow: 0 2px 14px rgba(23, 23, 26, .06); }
.card-head, .card-foot { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; }
.card-foot { border-top: 1px solid #edece9; }
.card-mid { height: 132px; background: linear-gradient(135deg, #efede9, #e2e0db); display: grid; place-items: center; text-align: center; }
.avatar { width: 56px; height: 56px; border-radius: 28px; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; margin: 0 auto 8px; }
.big { font-size: 20px; font-weight: 800; }
.warn { margin-top: 12px; display: flex; gap: 8px; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 12px; padding: 10px 12px; font-size: 12px; line-height: 16px; color: var(--warn-ink); }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }

.row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid #edece9; font-size: 13px; }
.pos { color: var(--success); font-weight: 700; }
.neg { color: var(--accent); font-weight: 700; }

.fieldbtn { display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 16px; border-radius: 14px; background: #fff; border: 1.5px solid #fff; text-align: left; width: 100%; }
.fieldbtn.active { border-color: var(--accent); }
.fieldbtn .v { font-size: 20px; font-weight: 800; }
.fieldbtn .v.empty { color: #b4b3b0; }
.hint { font-size: 11.5px; line-height: 15px; color: var(--ink-3); padding: 2px 4px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: auto; padding-top: 12px; }
.keypad button { height: 54px; border-radius: 16px; background: #fff; font-size: 21px; font-weight: 600; }
.summary { background: #fff; border-radius: 14px; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.summary div { display: flex; justify-content: space-between; }
.summary b { font-size: 13px; color: var(--ink); }

.result { align-items: center; text-align: center; padding-top: 72px; }
.badge { width: 84px; height: 84px; border-radius: 42px; display: grid; place-items: center; margin-bottom: 20px; }
.result .amount { font-size: 38px; font-weight: 800; margin: 6px 0; }

.scan { background: #0b0b0c; color: #fff; padding: 0; position: relative; overflow: hidden; }
.scan video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan .frame { position: absolute; top: 160px; left: 50%; width: 240px; height: 240px; margin-left: -120px; border: 4px solid #fff; border-radius: 24px; }
.scan .frame::after { content: ''; position: absolute; left: 12px; right: 12px; top: 50%; height: 2px; background: var(--accent); box-shadow: 0 0 12px 2px rgba(255, 75, 43, .8); }
.scan .cap { position: absolute; top: 420px; left: 0; right: 0; text-align: center; padding: 0 40px; font-weight: 700; }
.scan .bottom { position: absolute; bottom: 36px; left: 20px; right: 20px; display: flex; gap: 8px; }
.scan input { flex: 1; height: 48px; border-radius: 24px; border: 0; padding: 0 16px; }
.scan .icon-btn { position: absolute; top: 20px; left: 20px; background: rgba(255, 255, 255, .14); border: 0; color: #fff; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats div { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.stats b { font-size: 18px; font-weight: 800; }
.stats span { font-size: 11px; color: var(--ink-3); }
