:root {
  --ink: #24322b;
  --muted: #718078;
  --paper: #f7f4ed;
  --card: #fffefa;
  --line: #dedfd6;
  --sage: #b8cbbb;
  --sage-dark: #385b48;
  --peach: #e7c9ad;
  --shadow: 0 18px 50px rgba(56, 72, 62, 0.1);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(231,201,173,.28), transparent 27rem),
    radial-gradient(circle at 92% 38%, rgba(184,203,187,.32), transparent 25rem),
    var(--paper);
  font-family: "DM Sans", sans-serif;
  min-height: 100vh;
}
button, input, select { font: inherit; }
button { color: inherit; }
.shell { width: min(1060px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 40px; }
.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--ink); border-radius: 50%; font-family: "DM Serif Display"; font-size: 18px; font-weight: 400; }
.date-pill { border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.4); padding: 8px 14px; font-size: 13px; color: var(--muted); }
.install-button { border: 0; border-radius: 999px; background: var(--ink); color: white; padding: 9px 14px; font-size: 12px; font-weight: 700; cursor: pointer; }
.hero { padding: 76px 0 62px; max-width: 850px; }
.eyebrow { margin: 0 0 10px; color: var(--sage-dark); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; }
h1 { margin: 0; font-family: "DM Serif Display"; font-size: clamp(54px, 8vw, 88px); line-height: .98; font-weight: 400; letter-spacing: -.035em; }
.lede { margin: 22px 0 32px; color: var(--muted); font-size: 18px; }
.composer { display: flex; padding: 7px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 18px; }
.composer:focus-within { border-color: var(--sage-dark); box-shadow: 0 18px 50px rgba(56,91,72,.14); }
.composer input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; padding: 17px 18px; font-size: 18px; color: var(--ink); }
.composer input::placeholder { color: #9a9e98; }
.log-button, .confirm-button { border: 0; border-radius: 12px; background: var(--ink); color: white; padding: 0 22px; font-weight: 600; cursor: pointer; }
.log-button span { margin-left: 10px; }
.input-hint { display: flex; justify-content: space-between; margin: 11px 5px 0; color: var(--muted); font-size: 11px; }
.review-panel { margin: -24px 0 56px; padding: 26px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.review-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
h2 { margin: 0; font-family: "DM Serif Display"; font-size: 30px; font-weight: 400; }
.icon-button { border: 0; background: transparent; font-size: 28px; color: var(--muted); cursor: pointer; }
.review-grid { display: grid; grid-template-columns: 1.5fr .7fr .7fr 1.5fr 1fr auto; gap: 12px; align-items: end; }
.review-grid label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.review-grid input, .review-grid select { width: 100%; min-width: 0; height: 44px; padding: 0 10px; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; background: #fbfaf6; text-transform: none; letter-spacing: normal; }
.confirm-button { height: 44px; white-space: nowrap; }
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); }
.tabs button { position: relative; padding: 12px 0 14px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; }
.tabs button.active { color: var(--ink); }
.tabs button.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); }
.summary { min-height: 260px; padding: 28px 0 24px; }
.summary-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.summary-header h2 { font-size: 34px; }
.summary-header p { color: var(--muted); margin: 0; }
.entry-list { display: grid; gap: 10px; }
.entry { display: grid; grid-template-columns: 58px 1fr auto auto; gap: 16px; align-items: center; padding: 17px 18px; background: rgba(255,254,250,.72); border: 1px solid var(--line); border-radius: 14px; }
.entry-time { color: var(--muted); font-size: 13px; }
.entry-name { font-weight: 700; }
.entry-amount { margin-top: 3px; color: var(--muted); font-size: 13px; }
.category { padding: 6px 10px; border-radius: 999px; background: #e8eee7; color: var(--sage-dark); font-size: 11px; font-weight: 700; }
.delete { border: 0; background: transparent; color: #9b9e97; cursor: pointer; font-size: 18px; }
.empty { padding: 54px 20px; border: 1px dashed #cfd2c8; border-radius: 18px; text-align: center; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 50px; height: 50px; margin: 0 auto 14px; border-radius: 50%; background: #e8eee7; color: var(--sage-dark); font-size: 24px; }
.empty h3 { margin: 0 0 7px; color: var(--ink); font-family: "DM Serif Display"; font-size: 25px; font-weight: 400; }
.empty p { margin: 0; }
.week-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.stat { padding: 20px; background: rgba(255,254,250,.72); border: 1px solid var(--line); border-radius: 14px; }
.stat strong { display: block; font-family: "DM Serif Display"; font-size: 34px; font-weight: 400; }
.stat span { color: var(--muted); font-size: 12px; }
.breakdown { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.trend-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 12px; margin-bottom: 26px; }
.trend-card { min-width: 0; padding: 20px; background: rgba(255,254,250,.72); border: 1px solid var(--line); border-radius: 14px; }
.trend-title, .log-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.trend-title { margin-bottom: 18px; }
.trend-title h3, .log-section-title h3 { margin: 0; font-family: "DM Serif Display"; font-size: 22px; font-weight: 400; }
.trend-title span, .log-section-title span { color: var(--muted); font-size: 11px; }
.day-chart { display: grid; grid-template-columns: repeat(7, 1fr); align-items: end; gap: 8px; height: 142px; }
.day-column { display: grid; grid-template-rows: 18px 1fr 18px; align-items: end; height: 100%; text-align: center; }
.day-count { color: var(--muted); font-size: 10px; }
.day-bar { justify-self: center; width: min(28px, 78%); min-height: 3px; border-radius: 6px 6px 3px 3px; background: var(--sage-dark); }
.day-label { padding-top: 5px; color: var(--muted); font-size: 10px; }
.item-frequency { display: grid; gap: 13px; }
.frequency-row > div { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; font-size: 12px; }
.frequency-row strong { color: var(--sage-dark); font-size: 11px; }
.frequency-track { display: block; height: 5px; overflow: hidden; border-radius: 99px; background: #e8e9e2; }
.frequency-track > span { display: block; height: 100%; border-radius: inherit; background: var(--peach); }
.log-section-title { margin: 4px 0 12px; }
footer { display: flex; justify-content: space-between; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
footer p { margin: 0; }
footer button { border: 0; background: transparent; color: var(--muted); text-decoration: underline; cursor: pointer; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 28px; transform: translate(-50%, 20px); display: flex; align-items: center; gap: 14px; padding: 11px 16px; border-radius: 999px; background: var(--ink); color: white; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.show { pointer-events: auto; }
.toast button { border: 0; padding: 0; color: var(--peach); background: transparent; font-size: 12px; font-weight: 700; text-decoration: underline; cursor: pointer; }
.app-notice { position: fixed; z-index: 10; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(520px, calc(100% - 24px)); display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; border-radius: 16px; color: white; background: var(--ink); box-shadow: 0 18px 50px rgba(20,35,27,.25); }
.app-notice[hidden] { display: none; }
.app-notice strong { font-size: 14px; }
.app-notice p { margin: 3px 0 0; color: rgba(255,255,255,.72); font-size: 12px; }
.app-notice > button { flex: 0 0 auto; border: 0; background: transparent; color: white; font-size: 22px; cursor: pointer; }
.app-notice .notice-action { padding: 8px 14px; border-radius: 999px; color: var(--ink); background: white; font-size: 12px; font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
@media (max-width: 850px) { .review-grid { grid-template-columns: repeat(2, 1fr); } .confirm-button { grid-column: span 2; } }
@media (max-width: 600px) {
  .shell { width: min(100% - 24px, 1060px); }
  .topbar { height: 70px; }
  .date-pill { display: none; }
  .hero { padding: 50px 0; }
  h1 { font-size: 52px; }
  .lede { font-size: 16px; }
  .composer { display: grid; }
  .composer input { padding: 15px 12px; font-size: 16px; }
  .log-button { height: 48px; }
  .entry { grid-template-columns: 52px 1fr auto; }
  .category { display: none; }
  .week-stats { grid-template-columns: 1fr; }
  .trend-grid { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr 1fr; }
  .review-grid label:first-child, .review-grid label:nth-child(4), .review-grid label:nth-child(5) { grid-column: span 2; }
}
