:root {
  --ink: #25322b;
  --forest: #3f5948;
  --forest-dark: #2d4135;
  --sage: #dce6dc;
  --cream: #f5f1e8;
  --paper: #fffdf8;
  --line: #deddd6;
  --muted: #6d746f;
  --peach: #e9b89d;
  --danger: #9b3d38;
  --shadow: 0 16px 45px rgba(38, 52, 44, .08);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: "DM Sans", sans-serif;
  line-height: 1.5;
}
button, input, textarea { font: inherit; }
a { color: inherit; }

.site-header {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  background: rgba(255, 253, 248, .9);
  border-bottom: 1px solid rgba(63, 89, 72, .12);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--forest); color: white; font-family: "Newsreader", serif; font-size: 21px; }
.quiet-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }

.dashboard-shell { max-width: 1240px; margin: 0 auto; padding: 58px 24px 80px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 36px; }
h1, h2, h3 { font-family: "Newsreader", Georgia, serif; margin: 0; font-weight: 600; line-height: 1.05; }
h1 { font-size: clamp(44px, 6vw, 76px); max-width: 780px; letter-spacing: -.035em; }
h2 { font-size: 31px; letter-spacing: -.02em; }
.hero-copy { max-width: 630px; color: var(--muted); font-size: 17px; margin: 16px 0 0; }
.eyebrow { margin: 0 0 9px; text-transform: uppercase; letter-spacing: .13em; font-size: 11px; font-weight: 700; color: var(--forest); }

.primary-button, .secondary-button {
  border: 0;
  border-radius: 100px;
  padding: 13px 20px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  white-space: nowrap;
}
.primary-button { color: white; background: var(--forest); box-shadow: 0 8px 18px rgba(63, 89, 72, .2); }
.primary-button:hover { background: var(--forest-dark); }
.secondary-button { color: var(--forest); background: var(--sage); }
.secondary-button:hover { background: #cfddcf; }
.full-button { width: 100%; margin-top: 4px; }
.text-link { color: var(--forest); font-size: 14px; font-weight: 700; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.summary-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); min-height: 142px; display: flex; flex-direction: column; }
.summary-card span { color: var(--muted); font-size: 13px; font-weight: 600; }
.summary-card strong { font-family: "Newsreader", Georgia, serif; font-size: 35px; margin: 8px 0 auto; }
.summary-card small { color: var(--muted); }
.summary-card.accent { background: var(--sage); border-color: transparent; }
.summary-card.dark { background: var(--forest); color: white; border-color: transparent; }
.summary-card.dark span, .summary-card.dark small { color: rgba(255,255,255,.7); }

.content-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(260px, .8fr); gap: 22px; margin-bottom: 22px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.entry-panel, .side-panel, .settings-panel { padding: 28px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.field-row { display: flex; gap: 14px; }
.field-row > * { flex: 1; }
.date-row { max-width: 520px; margin-bottom: 16px; }
.four-up { display: grid; grid-template-columns: repeat(4, 1fr); }
.rate-row { margin: 20px 0 16px; }
.rate-row > label:first-child { max-width: 210px; }
label { display: flex; flex-direction: column; gap: 7px; font-size: 12px; font-weight: 700; color: var(--muted); }
label span { font-weight: 400; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  outline: none;
}
textarea { resize: vertical; }
input:focus, textarea:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(63, 89, 72, .12); }
input.invalid { border-color: var(--danger); background: #fff7f7; }
.day-display { border: 1px dashed #c8c9c1; border-radius: 10px; padding: 8px 13px; display: flex; flex-direction: column; justify-content: center; }
.day-display span { color: var(--muted); font-size: 11px; font-weight: 700; }
.field-hint { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.live-total { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #f3f5f1; border-radius: 12px; padding: 13px 15px; margin-bottom: 12px; font-size: 13px; }
.live-total strong { color: var(--forest); }
.side-panel { background: var(--forest-dark); color: white; }
.side-panel .eyebrow { color: var(--peach); }
.side-panel p:not(.eyebrow) { color: rgba(255,255,255,.7); font-size: 14px; }
.side-panel label { color: rgba(255,255,255,.75); }
.stack-form { display: flex; flex-direction: column; gap: 14px; margin-top: 24px; }

.log-panel { overflow: hidden; margin-bottom: 22px; }
.log-panel .panel-heading { padding: 28px 28px 12px; }
.month-heading { align-items: center; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav a { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; text-decoration: none; display: grid; place-items: center; }
.month-nav input { min-height: 38px; padding: 5px 9px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; text-transform: uppercase; letter-spacing: .08em; font-size: 10px; color: var(--muted); background: #f7f5ef; }
th, td { padding: 14px 18px; border-top: 1px solid var(--line); white-space: nowrap; }
td:first-child strong, td:first-child span { display: block; }
td:first-child span { color: var(--muted); font-size: 11px; margin-top: 2px; }
tfoot td { background: var(--forest); color: white; font-weight: 700; }
.actions { display: flex; align-items: center; gap: 10px; }
.actions a, .actions button { border: 0; background: transparent; padding: 0; color: var(--forest); text-decoration: underline; font-size: 12px; cursor: pointer; }
.actions button { color: var(--danger); }
.empty-state { padding: 58px 24px; text-align: center; color: var(--muted); }
.empty-state span { display: block; font-size: 36px; color: var(--peach); }
.empty-state h3 { color: var(--ink); font-size: 24px; margin: 8px 0; }

.settings-panel { display: grid; grid-template-columns: .65fr 1.35fr; gap: 40px; align-items: end; }
.settings-panel p:not(.eyebrow) { color: var(--muted); font-size: 14px; max-width: 370px; }
.settings-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.settings-form .secondary-button { min-height: 46px; grid-column: 1 / -1; }

.flash-stack { position: fixed; z-index: 30; right: 20px; top: 84px; width: min(370px, calc(100vw - 40px)); }
.flash { padding: 12px 15px; margin-bottom: 8px; border-radius: 10px; color: white; background: var(--forest); box-shadow: var(--shadow); }
.flash.error { background: var(--danger); }
.login-shell { min-height: calc(100vh - 70px); display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 20%, #e5d4c8 0, transparent 33%), var(--cream); }
.login-card { width: min(440px, 100%); padding: 38px; border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.login-card h1 { font-size: 48px; }
.login-card > p:not(.eyebrow) { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 960px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .settings-panel { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .dashboard-shell { padding: 38px 15px 60px; }
  .site-header { padding-inline: 16px; }
  .hero { display: block; }
  .hero .primary-button { margin-top: 22px; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .summary-card { min-height: 126px; padding: 17px; }
  .summary-card strong { font-size: 28px; }
  .entry-panel, .side-panel, .settings-panel { padding: 21px; }
  .four-up { grid-template-columns: 1fr 1fr; }
  .rate-row, .date-row { flex-direction: column; }
  .rate-row > label:first-child { max-width: none; }
  .settings-form { grid-template-columns: 1fr 1fr; }
  .settings-form .secondary-button { grid-column: 1 / -1; }
}
@media (max-width: 440px) {
  h1 { font-size: 42px; }
  .summary-grid { grid-template-columns: 1fr; }
  .four-up, .settings-form { grid-template-columns: 1fr; }
  .month-heading { align-items: flex-start; flex-direction: column; }
}
