:root {
  --ink: #18322b;
  --muted: #6d7d77;
  --cream: #f5f1e8;
  --paper: #fffdfa;
  --green: #1f745b;
  --green-dark: #15503f;
  --mint: #dcebe4;
  --line: #deded4;
  --danger: #b64b3d;
}

* { box-sizing: border-box; }
html { background: var(--cream); }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 90% 5%, rgba(219, 235, 227, .9), transparent 25rem), var(--cream); font-family: Arial, Helvetica, sans-serif; -webkit-font-smoothing: antialiased; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app-shell { width: min(100% - 32px, 1040px); margin: 0 auto; padding: 28px 0 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 34px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px 14px 14px 4px; background: var(--ink); color: white; font-family: Georgia, serif; font-size: 23px; font-weight: 700; }
.brand p { margin: 0; font-weight: 800; letter-spacing: -.02em; }
.brand span:last-child { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.install-button, .primary-button, .budget-form button { border: 0; border-radius: 12px; padding: 12px 17px; background: var(--green); color: white; font-weight: 700; transition: transform .16s ease, background .16s ease; }
.install-button:hover, .primary-button:hover, .budget-form button:hover { background: var(--green-dark); transform: translateY(-1px); }

.month-navigation { width: min(100%, 370px); margin: 0 auto 22px; display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; text-align: center; }
.month-navigation button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: rgba(255, 253, 250, .7); color: var(--ink); font-size: 20px; }
.month-navigation button:hover { border-color: var(--green); }
.month-navigation span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .14em; margin-bottom: 5px; }
.month-navigation strong { font-family: Georgia, serif; font-size: clamp(22px, 3vw, 28px); }

.notice { width: 100%; display: flex; justify-content: space-between; border: 1px solid #b8d2c6; background: #eff7f2; color: var(--green-dark); border-radius: 12px; padding: 11px 14px; margin-bottom: 12px; text-align: left; }
.hero-card { position: relative; overflow: hidden; background: var(--ink); color: white; border-radius: 28px; padding: clamp(25px, 5vw, 43px); box-shadow: 0 22px 55px rgba(24, 50, 43, .15); }
.hero-card::after { content: ""; position: absolute; right: -80px; top: -110px; width: 290px; height: 290px; border: 52px solid rgba(255,255,255,.04); border-radius: 50%; pointer-events: none; }
.hero-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .15em; color: #bed1ca; }
.hero-card h1 { margin: 8px 0 25px; font-family: Georgia, serif; font-size: clamp(36px, 7vw, 62px); line-height: 1; letter-spacing: -.04em; }
.percentage { min-width: 68px; padding: 11px 12px; border-radius: 14px; background: rgba(255,255,255,.09); font-size: 18px; font-weight: 800; text-align: center; }
.progress-track { height: 11px; border-radius: 20px; background: rgba(255,255,255,.13); overflow: hidden; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: #79d3ae; transition: width .5s ease; }
.hero-card.warning .progress-fill { background: #f5c573; }
.hero-card.danger .progress-fill { background: #ef8879; }
.budget-line { display: flex; justify-content: space-between; gap: 16px; margin-top: 12px; color: #d9e5e0; font-size: 13px; }
.over-budget { margin: 15px 0 0; color: #ffc2b9; font-weight: 700; }

.rhythm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0 28px; }
.rhythm-grid article { display: flex; gap: 14px; align-items: center; min-height: 118px; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,253,250,.82); }
.rhythm-icon { flex: 0 0 42px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--mint); color: var(--green-dark); font-family: Georgia, serif; font-weight: 700; }
.rhythm-grid p { margin: 0 0 5px; color: var(--muted); font-size: 13px; }
.rhythm-grid strong { display: block; font-family: Georgia, serif; font-size: clamp(22px, 4vw, 29px); }
.rhythm-grid small { display: block; color: var(--muted); margin-top: 5px; font-size: 11px; }

.content-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 18px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 22px; background: var(--paper); padding: 23px; }
.setup-panel { grid-column: 1; }
.history-panel { grid-column: 1 / -1; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.section-kicker { display: block; color: var(--green); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; margin-bottom: 5px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 22px; }
.entry-count { color: var(--muted); font-size: 12px; white-space: nowrap; }

form label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
input { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); padding: 0 13px; outline: none; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,116,91,.1); }
.money-input { position: relative; }
.money-input span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--green); font-size: 13px; font-weight: 800; }
.money-input input { padding-left: 39px; font-size: 20px; font-weight: 700; }
.budget-form button, .primary-button { width: 100%; margin-top: 14px; min-height: 46px; }
.form-row { display: grid; grid-template-columns: 1.25fr .75fr; gap: 12px; margin-top: 13px; }
.text-button { border: 0; background: none; color: var(--green); padding: 4px; font-size: 12px; font-weight: 700; }

.empty-state { min-height: 170px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.empty-state > span { width: 43px; height: 43px; display: grid; place-items: center; background: var(--mint); color: var(--green); border-radius: 50%; margin-bottom: 10px; }
.empty-state strong { color: var(--ink); }
.empty-state p { margin: 5px 0 0; font-size: 13px; }
.entry-list { list-style: none; padding: 0; margin: 0; }
.entry-list li { display: grid; grid-template-columns: 48px 1fr auto auto; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid #ecebe5; }
.entry-list li:first-child { border-top: 0; }
.entry-date { width: 45px; height: 49px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #f0f2eb; border-radius: 11px; }
.entry-date strong { line-height: 1; }
.entry-date span { margin-top: 3px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.entry-info strong { display: block; }
.entry-info span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.entry-amount { color: var(--danger); white-space: nowrap; }
.entry-actions { display: flex; gap: 5px; }
.entry-actions button { border: 0; background: #f1f1eb; color: var(--muted); padding: 7px 9px; border-radius: 8px; font-size: 11px; }
.entry-actions button:last-child:hover { color: var(--danger); }

.install-help { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; padding: 18px; background: rgba(17, 37, 31, .55); backdrop-filter: blur(5px); }
.install-sheet { position: relative; width: min(100%, 470px); border-radius: 24px; background: var(--paper); padding: 30px 24px 24px; text-align: center; box-shadow: 0 24px 70px rgba(0,0,0,.2); }
.install-sheet h2 { margin: 10px 0 8px; font-family: Georgia, serif; }
.install-sheet p { margin: 0; color: var(--muted); line-height: 1.55; }
.sheet-close { position: absolute; right: 14px; top: 12px; width: 35px; height: 35px; border: 0; border-radius: 50%; background: #efefe8; color: var(--muted); font-size: 20px; }
.share-symbol { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto; border-radius: 14px; background: var(--mint); color: var(--green); font-size: 27px; font-weight: 700; }

footer { display: flex; justify-content: center; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; padding-top: 24px; text-align: center; }
.privacy-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--green); }

@media (max-width: 680px) {
  .app-shell { width: min(100% - 22px, 1040px); padding-top: 18px; }
  .topbar { margin-bottom: 26px; }
  .brand span:last-child { display: none; }
  .install-button { padding: 10px 12px; font-size: 12px; }
  .hero-card { border-radius: 22px; }
  .rhythm-grid { gap: 9px; }
  .rhythm-grid article { display: block; padding: 16px; min-height: 148px; }
  .rhythm-icon { width: 35px; height: 35px; margin-bottom: 12px; }
  .rhythm-grid strong { font-size: 20px; }
  .content-grid { grid-template-columns: 1fr; }
  .setup-panel, .history-panel { grid-column: 1; }
  .panel { padding: 19px; border-radius: 18px; }
  .form-row { grid-template-columns: 1fr; }
  .entry-list li { grid-template-columns: 44px 1fr auto; gap: 10px; }
  .entry-actions { grid-column: 2 / -1; }
  footer { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
