:root {
  --blue: #0072BC;
  --blue-deep: #005A9C;
  --cyan: #00C2FF;
  --gold: #F4B400;
  --ok: #16A34A;
  --danger: #EF4444;
  --warn: #F59E0B;
  --bg: #F3F4F6;
  --card: #ffffff;
  --ink: #0F172A;
  --muted: #64748B;
  --line: #E5E7EB;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --nav: 76px;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.app-header, .card, .sheet, .auth-card {
  background: var(--card);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 16px 8px;
}
.brand img, .auth-card > img { border-radius: 22%; display: block; }
.brand img { width: 48px; height: 48px; }
.auth-card > img { width: 72px; height: 72px; }
.brand h1 { font-size: 1.15rem; margin: 0; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.sync-chip {
  margin-left: auto; font-size: .75rem; padding: 6px 10px; border-radius: 999px;
  background: #E0F2FE; color: var(--blue-deep); max-width: 42vw; text-align: center;
}
.sync-chip.warn { background: #FEF3C7; color: #92400E; }
.sync-chip.bad { background: #FEE2E2; color: #991B1B; }
.sync-chip.ok { background: #DCFCE7; color: #166534; }
main { padding: 8px 16px calc(var(--nav) + 24px); max-width: 980px; margin: 0 auto; }
.card {
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
.row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.muted { color: var(--muted); }
.amount { font-size: 1.8rem; font-weight: 750; letter-spacing: -.03em; }
.amount.neg { color: var(--danger); }
.views { display: flex; gap: 8px; overflow: auto; padding-bottom: 8px; }
.views button, .seg button, .btn, .nav button {
  border: 0; border-radius: 14px; min-height: 48px;
}
.views button, .seg button {
  background: #E8EEF5; color: var(--blue-deep); padding: 0 14px; white-space: nowrap;
}
.views button.active, .seg button.active { background: var(--blue); color: white; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: #F8FAFC; border-radius: 14px; padding: 12px; }
.stat b { display: block; font-size: 1rem; }
label { display: block; font-size: .85rem; margin: 10px 0 6px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  background: white; min-height: 48px;
}
textarea { min-height: 80px; }
.btn { background: var(--blue); color: white; padding: 0 16px; width: 100%; font-weight: 650; }
#bio { margin-top: 5px; display: flex; align-items: center; justify-content: center; gap: 8px; }
#bio .ico { width: 22px; height: 22px; }
.btn.secondary { background: #E8EEF5; color: var(--blue-deep); }
.btn.danger { background: var(--danger); }
.btn.gold { background: var(--gold); color: #1f2937; }
.help {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: #E0F2FE; color: var(--blue-deep);
  font-weight: 700;
}
.list-item, .op {
  display: flex; justify-content: space-between; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.op small, .list-item small { color: var(--muted); display: block; }
.op-side { display: flex; align-items: center; gap: 8px; flex: none; }
#kind { margin-bottom: 8px; }
.edit-op { text-align: left; overflow: visible; }
.edit-op p { margin: 0 0 8px; }
.op-side strong.in { color: #16A34A; }
.op-side strong.out { color: var(--danger); }
.op-del {
  width: 40px; height: 40px; border: 0; border-radius: 12px; background: #FEE2E2; color: var(--danger);
  display: flex; align-items: center; justify-content: center;
}
.op-del .ico { width: 20px; height: 20px; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--nav);
  background: white; display: flex; justify-content: space-around; align-items: center;
  box-shadow: 0 -8px 24px rgba(15,23,42,.06); padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}
.nav button { background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; }
.nav button.active { color: var(--blue); }
.nav .add {
  background: var(--blue); color: white; width: auto; min-width: 68px; height: 58px;
  padding: 6px 8px 4px; border-radius: 18px; margin-top: -22px; font-size: .68rem; line-height: 1.1;
}
.nav .add span { font-weight: 700; }
.ico { width: 24px; height: 24px; fill: currentColor; }
.chart-wrap {
  position: relative; width: min(100%, 240px); height: 240px; margin: 8px auto;
}
.chart-wrap canvas { width: 100% !important; height: 100% !important; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; list-style: none; margin: 0; padding: 0 0 4px; }
.legend li { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .82rem; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shortcut {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 8px;
  min-height: 88px; padding: 12px; border: 0; border-radius: 16px; background: #F8FAFC; color: var(--ink); text-align: left;
}
.shortcut .ico { width: 28px; height: 28px; color: var(--blue); }
.shortcut span { font-weight: 650; line-height: 1.2; }
.center-amount {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; text-align: center;
}
.center-amount strong { font-size: 1.15rem; }
.center-amount span { color: var(--ink); font-weight: 650; font-size: .92rem; }
.auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(180deg, #0072BC 0%, #005A9C 42%, #F3F4F6 42%);
}
.auth-card { width: min(460px, 100%); border-radius: 28px; padding: 24px; box-shadow: var(--shadow); }
.profiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.profiles button { min-height: 88px; border-radius: 18px; border: 2px solid transparent; background: #F8FAFC; }
.profiles button.active { border-color: var(--blue); background: #E0F2FE; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pinpad button { min-height: 58px; border: 0; border-radius: 16px; background: #F8FAFC; font-size: 1.3rem; }
.dots { display: flex; gap: 8px; justify-content: center; margin: 12px 0; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: #E5E7EB; display: block; }
.dots i.on { background: var(--blue); }
.steps { display: flex; gap: 6px; margin-bottom: 12px; }
.steps span { flex: 1; height: 6px; border-radius: 99px; background: #E5E7EB; }
.steps span.on { background: var(--gold); }
.alert { background: #FEF3C7; border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.alert.danger { background: #FEE2E2; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 800px) {
  .layout { display: grid; grid-template-columns: 220px 1fr; }
  .nav { position: sticky; top: 0; height: 100vh; flex-direction: column; justify-content: flex-start; padding-top: 24px; width: 220px; }
  .nav .add { margin-top: 12px; }
  main { padding-bottom: 32px; }
}
