:root {
  --ink: #17241f;
  --muted: #68766f;
  --paper: #f6f3eb;
  --panel: #fffdf8;
  --green: #1d614b;
  --green-dark: #124333;
  --mint: #dcebe3;
  --orange: #e46e3d;
  --orange-soft: #f8ded2;
  --red: #a33a32;
  --line: #ddd9cf;
  --shadow: 0 18px 48px rgba(25, 42, 34, .09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 100% 0, #e8eee7 0, transparent 28rem), var(--paper); }
a { color: var(--green); text-decoration: none; }
button, input, select, textarea { font: inherit; }
input, select, textarea {
  width: 100%;
  padding: .78rem .85rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  color: var(--ink);
  background: white;
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(29, 97, 75, .17); border-color: var(--green); }
label { font-size: .87rem; font-weight: 700; }
h1, h2, h3 { margin: 0 0 .6rem; letter-spacing: -.035em; line-height: 1.08; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.35rem, 5vw, 4.8rem); font-weight: 600; }
h2 { font-size: clamp(1.55rem, 3vw, 2.4rem); }
p { line-height: 1.55; }
footer { max-width: 1240px; margin: 4rem auto 0; padding: 2rem; color: var(--muted); border-top: 1px solid var(--line); font-size: .86rem; }

.site-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: .8rem max(1.2rem, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid rgba(221, 217, 207, .8);
  background: rgba(246, 243, 235, .88);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); font-weight: 850; font-size: 1.05rem; }
.brand-mark { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 50%; background: var(--green); color: white; font-family: Georgia, serif; font-size: 1.3rem; }
nav { display: flex; align-items: center; gap: 1.4rem; flex: 1; }
nav a { color: var(--muted); font-size: .92rem; font-weight: 650; }
nav a:hover { color: var(--green); }
.identity { display: flex; align-items: center; gap: .8rem; font-size: .84rem; color: var(--muted); }
.identity form { margin: 0; }
.link-button { border: 0; padding: 0; background: transparent; color: var(--green); cursor: pointer; }
.page { width: min(1240px, calc(100% - 2.4rem)); margin: 0 auto; padding: 3.5rem 0; }
.narrow { width: min(820px, 100%); margin: 0 auto; }
.eyebrow { margin: 0 0 .6rem; color: var(--orange); font-size: .74rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.lede { max-width: 700px; color: var(--muted); font-size: 1.06rem; }
.hero { display: grid; grid-template-columns: 1fr auto; gap: 3rem; align-items: end; padding: 2rem 0 4.5rem; }
.hero h1 { max-width: 760px; }
.balance-card { min-width: 260px; padding: 1.4rem; border-radius: 1.2rem; background: var(--green); color: white; box-shadow: var(--shadow); }
.balance-card span { display: block; opacity: .75; font-size: .82rem; }
.balance-card strong { display: block; margin: .35rem 0 .9rem; font: 600 2.35rem/1 Georgia, serif; }
.balance-card a { color: white; font-size: .82rem; }
.balance-card.compact { min-width: 220px; }
.section-heading, .page-title, .manager-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin: 1rem 0 1.5rem; }
.compact-heading { margin-top: 0; }
.meal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.meal-card { display: grid; grid-template-columns: 86px 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 1.25rem; background: var(--panel); box-shadow: 0 8px 24px rgba(25, 42, 34, .04); }
.date-tile { display: flex; flex-direction: column; align-items: center; padding: 1.5rem .7rem; background: var(--green); color: white; }
.date-tile strong { font: 600 2rem Georgia, serif; }
.date-tile span { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; }
.meal-card-body { padding: 1.35rem; }
.meal-card-body h3 { font-size: 1.4rem; }
.meal-card-body > p { color: var(--muted); min-height: 3em; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; color: var(--muted); font-size: .77rem; }
.status, .pill { display: inline-flex; align-items: center; width: max-content; padding: .26rem .62rem; border-radius: 99px; font-size: .72rem; font-weight: 800; }
.status.scheduled, .pill.good { background: var(--mint); color: var(--green-dark); }
.status.closed, .pill.neutral { background: #e8e7e2; color: #5d625f; }
.status.cancelled, .pill.bad { background: var(--orange-soft); color: var(--red); }
.variation { padding: .7rem .8rem; border-left: 3px solid var(--orange); background: #fcf1e9; color: #734631; font-size: .86rem; }
.meal-meta { display: flex; flex-wrap: wrap; gap: .55rem 1.2rem; margin: 1rem 0; color: var(--muted); font-size: .82rem; }
.meal-meta.large { gap: 1rem 2rem; font-size: .95rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .78rem 1rem;
  border: 1px solid var(--green);
  border-radius: .72rem;
  background: var(--green);
  color: white;
  font-weight: 750;
  cursor: pointer;
}
.button:hover { background: var(--green-dark); }
.button.secondary { background: transparent; color: var(--green); }
.button.danger { border-color: var(--red); background: var(--red); }
.button.danger-outline { border-color: #d6a9a4; background: transparent; color: var(--red); }
.button.small { padding: .48rem .7rem; font-size: .78rem; }
.button.full { width: 100%; }
.back-link { display: inline-block; margin-bottom: 2rem; font-weight: 700; }
.panel { padding: 1.5rem; border: 1px solid var(--line); border-radius: 1.2rem; background: var(--panel); box-shadow: 0 6px 22px rgba(25, 42, 34, .035); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; margin-top: 2rem; }
.field { display: flex; flex-direction: column; gap: .45rem; }
.field.wide, .wide { grid-column: 1 / -1; }
.field small, .helptext { color: var(--muted); }
.errorlist { margin: .2rem 0 0; padding-left: 1rem; color: var(--red); font-size: .82rem; }
.actions { display: flex; gap: .7rem; }
.meal-hero { display: grid; grid-template-columns: 1fr minmax(260px, 340px); gap: 2rem; padding: 1rem 0 2.5rem; }
.variation-card { align-self: stretch; padding: 1.5rem; border-radius: 1.2rem; background: #f4d8c8; }
.variation-card strong { font: 600 2rem Georgia, serif; }
.signup-panel { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 3rem; border-left: 4px solid var(--green); }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.inline-form select, .inline-form input { min-width: 180px; width: auto; flex: 1; }
.notice { padding: .75rem 1rem; border-radius: .7rem; }
.notice.success { background: var(--mint); color: var(--green-dark); }
.manager-heading { margin-top: 4rem; }
.manager-heading p:last-child { max-width: 690px; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin: 1rem 0 1.3rem; }
.metric { padding: 1.1rem; border: 1px solid var(--line); border-radius: 1rem; background: rgba(255, 253, 248, .7); }
.metric span, .metric small { display: block; color: var(--muted); font-size: .75rem; }
.metric strong { display: block; margin: .35rem 0; font: 600 1.8rem Georgia, serif; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .85rem .75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.negative { color: var(--red); }
.positive { color: var(--green); }
.stack-form { display: flex; flex-direction: column; align-items: stretch; gap: .55rem; }
.stack-form p { margin: 0; }
.stack-form p label { display: block; margin-bottom: .3rem; }
.stack-form input, .stack-form select { min-width: 160px; }
.check { display: flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .76rem; }
.check input { width: auto; }
details { margin-top: .4rem; }
summary { color: var(--green); font-weight: 750; cursor: pointer; }
details form { margin-top: .6rem; }
.operations-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.privacy-note { color: var(--muted); font-size: .83rem; }
.close-panel { display: flex; justify-content: space-between; align-items: center; gap: 2rem; margin-top: 1rem; padding: 1.5rem; border-radius: 1.2rem; background: var(--ink); color: white; }
.close-panel p { margin-bottom: 0; color: #c8d1cc; }
.cancel-meal { margin: 1rem 0 0 auto; width: max-content; max-width: 100%; }
.empty-state { grid-column: 1 / -1; padding: 4rem; text-align: center; border: 1px dashed #bbb7ad; border-radius: 1rem; }
.messages { display: grid; gap: .5rem; margin-bottom: 1rem; }
.message { padding: .8rem 1rem; border-radius: .7rem; background: #e8e7e2; }
.message.success { background: var(--mint); color: var(--green-dark); }
.message.error { background: var(--orange-soft); color: var(--red); }
.warning-box { margin: 1.5rem 0; padding: 1rem 1.2rem; border-left: 4px solid var(--orange); background: #fcf1e9; }
.danger-box { border-color: var(--red); background: var(--orange-soft); }
.auth-shell { min-height: calc(100vh - 180px); display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: clamp(2rem, 7vw, 7rem); }
.auth-intro h1 { font-size: clamp(3rem, 6vw, 5.7rem); }
.auth-intro > p { max-width: 600px; color: var(--muted); font-size: 1.1rem; }
.auth-promise { display: inline-flex; gap: .6rem; margin-top: 1rem; padding: .7rem 1rem; border-radius: 99px; background: var(--mint); color: var(--green-dark); font-weight: 750; }
.auth-card { padding: clamp(1.5rem, 4vw, 2.5rem); border: 1px solid var(--line); border-radius: 1.4rem; background: var(--panel); box-shadow: var(--shadow); }
.auth-card h1 { font-size: 2.6rem; }
.auth-card h2 { font: 600 2.4rem Georgia, serif; }
.auth-card .field { margin: 1rem 0; }
.center-link { display: block; margin-top: 1rem; text-align: center; font-weight: 700; }
.auth-single { width: min(530px, 100%); margin: 5vh auto; }

@media (max-width: 850px) {
  .site-header { flex-wrap: wrap; gap: .8rem 1.2rem; }
  nav { order: 3; width: 100%; overflow-x: auto; }
  .identity span { display: none; }
  .hero, .meal-hero, .auth-shell { grid-template-columns: 1fr; }
  .balance-card { width: 100%; }
  .meal-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .operations-grid { grid-template-columns: 1fr; }
  .signup-panel, .close-panel { align-items: stretch; flex-direction: column; }
}

@media (max-width: 560px) {
  .page { width: min(100% - 1.2rem, 1240px); padding-top: 2rem; }
  .site-header { padding-inline: .8rem; }
  h1 { font-size: 2.5rem; }
  .form-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .meal-card { grid-template-columns: 64px 1fr; }
  .section-heading, .page-title, .manager-heading { align-items: stretch; flex-direction: column; }
}
