:root {
  --bg: #f3efe6;
  --ink: #1c1915;
  --muted: #6b6458;
  --card: #fffdf8;
  --line: #e4ddd0;
  --accent: #0b6e4f;
  --accent-ink: #fff;
  --warn: #9a3412;
  --today: #854d0e;
  --ok: #0b6e4f;
  --shadow: 0 10px 30px rgba(48, 38, 22, 0.06);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

body {
  min-height: 100vh;
}

a { color: var(--accent); }

.wrap {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto 64px;
}

.top {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 15px;
}

.who { font-family: ui-sans-serif, system-ui, sans-serif; }

.hero { margin: 18px 0 22px; }
.hero h1, .card h1, .card h2 {
  margin: 0 0 8px;
  letter-spacing: -0.03em;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: var(--muted);
}

.muted { color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin: 18px 0;
}

.auth { margin-top: 48px; }

.stack, .row, label { display: flex; gap: 10px; }
.stack { flex-direction: column; }
.row { align-items: center; }

label {
  flex-direction: column;
  font-size: 14px;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font: 16px/1.3 ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
}

textarea { resize: vertical; min-height: 84px; }
.optional { font-weight: 400; color: var(--muted); }
.bill .note { font-style: italic; }

.btn, .linkish, button {
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.btn {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.linkish {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 14px;
}

.linkish.danger { color: var(--warn); }

.folder-grid {
  display: grid;
  gap: 12px;
}

.folder-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}

.folder-card strong { font-size: 22px; }

.count {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #ece7dc;
}

.count.warn { background: #fde8d8; color: var(--warn); }
.count.ok { background: #dcefe7; color: var(--ok); }

.bill-list { display: grid; gap: 10px; }

.bill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
}

.bill p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.bill .detail, .card .detail { color: var(--muted); font-size: 14px; }
.bill.overdue { border-color: #e8b4a2; background: #fff6f1; }
.bill.overdue p { color: var(--warn); }
.bill.today { border-color: #e8d48a; background: #fffbeb; }
.bill.today p { color: var(--today); }
.bill.paid { opacity: 0.72; }

.month-nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 18px;
  font-size: 14px;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.month-nav a { color: var(--muted); text-decoration: none; }

.back {
  display: inline-block;
  margin: 8px 0 0;
  color: var(--muted);
  text-decoration: none;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
}

.flash {
  border-radius: 12px;
  padding: 12px 14px;
  margin: 8px 0 16px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
}

.flash-ok { background: #dcefe7; color: #14532d; }
.flash-error { background: #fde8d8; color: var(--warn); }

.push-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  background: #143d32;
  color: #f6f3ee;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.push-banner p { margin: 4px 0 0; color: #d7e4de; font-size: 14px; }
.push-banner .btn { background: #f6f3ee; color: #143d32; }
.push-banner[hidden] { display: none; }

.more { margin: 20px 0; color: var(--muted); }
.plain, .manage { list-style: none; padding: 0; margin: 0; }
.plain li, .manage li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.edit-bill {
  display: flex;
  gap: 8px;
  flex: 1;
  align-items: center;
  flex-wrap: wrap;
}

.edit-bill input[name="due_day"] { max-width: 72px; }
.edit-bill textarea { flex: 1 1 100%; min-height: 64px; }
.danger-form { margin-top: 14px; }

@media (max-width: 640px) {
  .bill, .folder-card, .push-banner, .month-nav { flex-direction: column; align-items: stretch; }
  .month-nav { text-align: center; }
  .edit-bill { flex-wrap: wrap; }
}
