:root {
  --forest: #1f6b4f;
  --forest-deep: #124c38;
  --mint: #c6f1db;
  --cream: #fff9f2;
  --surface: #fffcf8;
  --ink: #19201d;
  --muted: #5c6b64;
  --line: #e4ddd3;
  --danger: #b3261e;
  --amber: #ffe3b3;
  --shadow: 0 8px 24px rgba(25, 32, 29, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
}

#app { max-width: 980px; margin: 0 auto; padding: 16px 16px 88px; }

h1, h2, h3 { margin: 0 0 8px; }
p { margin: 0; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.brand { font-weight: 800; font-size: 1.35rem; }
.sub { color: var(--muted); font-size: 0.9rem; }

.card {
  background: var(--surface);
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card h3 { font-size: 1.05rem; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack { display: grid; gap: 10px; }
.grid2 { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

label { font-size: 0.82rem; color: var(--muted); display: grid; gap: 4px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
  font: inherit;
  background: #fff;
}
textarea { min-height: 72px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  width: auto;
}
.btn:hover { background: #f6f1ea; }
.btn.primary {
  background: var(--forest);
  border-color: var(--forest);
  color: #fff;
}
.btn.primary:hover { background: var(--forest-deep); }
.btn.danger { color: var(--danger); border-color: #f0c7c4; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.filled { background: var(--mint); border-color: transparent; }

.pill {
  display: inline-block;
  background: var(--mint);
  color: var(--forest-deep);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}
.muted { color: var(--muted); font-size: 0.88rem; }
.error { color: var(--danger); font-size: 0.9rem; }
.ok { color: var(--forest); font-size: 0.9rem; font-weight: 650; }

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 720px) { .summary { grid-template-columns: 1fr; } }
.stat { background: var(--mint); border-radius: 16px; padding: 12px; }
.stat.amber { background: var(--amber); }
.stat b { display: block; font-size: 1.15rem; margin-top: 4px; }

.item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: 0; }
.item .name { font-weight: 700; }
.money { font-weight: 750; white-space: nowrap; }
.money.debt { color: var(--danger); }

.details {
  margin-top: 6px;
}
.details > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  height: 32px;
  align-items: center;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--mint);
  font-size: 0.82rem;
  font-weight: 700;
}
.details > summary::-webkit-details-marker { display: none; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
}
.nav button.on {
  color: var(--forest);
  background: var(--mint);
}

.modal-back {
  position: fixed; inset: 0;
  background: rgba(25, 32, 29, 0.4);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 20;
}
.modal {
  background: var(--surface);
  border-radius: 20px;
  padding: 18px;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow);
}

.range { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.range button.on { background: var(--forest); color: #fff; border-color: var(--forest); }

.auth { max-width: 440px; margin: 8vh auto; }

.hero {
  background: var(--forest);
  color: #fff;
  border-radius: 24px;
  padding: 22px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.hero .kicker {
  letter-spacing: 1px;
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.78;
  margin-bottom: 6px;
}
.hero .hero-amount { font-size: 2rem; font-weight: 800; margin-bottom: 10px; }
.hero .range button {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: transparent;
}
.hero .range button.on { background: #fff; color: var(--forest-deep); }
.hero-metrics { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; }
.hero-metrics span { display: block; font-size: 0.8rem; opacity: 0.8; }
.hero-metrics b { font-size: 1.05rem; }

.nav button { display: grid; justify-items: center; gap: 2px; min-width: 64px; }
.nav .ico { font-size: 1.05rem; line-height: 1; }

.quick { display: flex; gap: 12px; }
.quick .btn { flex: 1; height: 42px; }

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.setting-row:last-child { border-bottom: 0; }
.setting-row .btn { flex: 0 0 auto; }

.perm-grid { display: grid; gap: 6px; }
.perm-grid label { display: flex; gap: 8px; align-items: center; color: var(--ink); }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
}

@media print {
  .nav, .btn, .details, .range { display: none !important; }
  body { background: #fff; }
  #app { padding: 0; max-width: none; }
}

