:root {
  color: #17211b;
  background: #f6f4ee;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

/* Author rules like `display: grid` outrank the UA stylesheet, so an element
   toggled through the `hidden` attribute stays visible without this. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 32px;
}

.summary-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: stretch;
  max-width: 1120px;
  margin: 0 auto 24px;
}

.eyebrow {
  margin: 0 0 12px;
  color: #6d3b1f;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 14px;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.summary-copy {
  max-width: 620px;
  margin-bottom: 0;
  color: #566158;
  font-size: 1.05rem;
  line-height: 1.5;
}

.next-panel,
.tool-panel,
.history {
  border: 1px solid #ddd7ca;
  border-radius: 8px;
  background: #fffdf8;
  box-shadow: 0 18px 55px rgba(58, 48, 31, 0.08);
}

.next-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  padding: 22px;
}

.panel-heading,
.section-title {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #355545;
  font-weight: 800;
}

.icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
}

.next-panel strong {
  display: block;
  font-size: 2rem;
}

#next-relative {
  color: #667269;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  max-width: 1120px;
  margin: 0 auto 24px;
}

.tool-panel,
.history {
  padding: 22px;
}

.section-title h2 {
  margin: 0;
  font-size: 1.2rem;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 20px 0;
  padding: 4px;
  border: 1px solid #e5ded0;
  border-radius: 8px;
  background: #f5f1e7;
}

.segmented button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #586258;
  font-size: 0.92rem;
  font-weight: 700;
}

.segmented button.active {
  background: #2f6b4f;
  color: white;
}

label {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: #4a554d;
  font-size: 0.92rem;
  font-weight: 700;
}

.checkbox-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.checkbox-row input {
  flex: 0 0 20px;
  width: 20px;
  min-height: 20px;
  accent-color: #2f6b4f;
}

.checkbox-row span {
  line-height: 1.35;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d9d1c0;
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  color: #17211b;
}

input:focus {
  border-color: #2f6b4f;
  outline: 3px solid rgba(47, 107, 79, 0.14);
}

.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin-top: 20px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  background: #2f6b4f;
  color: white;
}

.secondary-button {
  background: #26392f;
  color: white;
}

.error-banner {
  max-width: 1120px;
  margin: 0 auto 24px;
  border: 1px solid #e2a29a;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff0ed;
  color: #7c241c;
  font-weight: 700;
}

.history {
  max-width: 1120px;
  margin: 0 auto;
}

.meal-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.meal-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-height: 150px;
  border: 1px solid #e5ded0;
  border-radius: 8px;
  padding: 16px;
  background: #fffaf0;
}

.meal-card h3 {
  margin-bottom: 6px;
  font-size: 1.3rem;
}

.meal-card p {
  margin-bottom: 6px;
  color: #606b62;
}

.meal-type {
  display: block;
  margin-bottom: 8px;
  color: #6d3b1f;
  font-size: 0.8rem;
  font-weight: 800;
}

.meal-card.planned {
  background: #f3f7f1;
  border-color: #c9dbc9;
}

.meal-card.planned .meal-type {
  color: #2f6b4f;
}

.actual-controls {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.actual-controls input {
  min-height: 38px;
}

.small-action-button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: #2f6b4f;
  color: white;
  font-weight: 800;
}

.small-secondary-button {
  min-height: 38px;
  border: 1px solid #c9dbc9;
  border-radius: 8px;
  background: white;
  color: #2f6b4f;
  font-weight: 800;
}

.note {
  font-weight: 700;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 1px solid #e4dac8;
  border-radius: 8px;
  background: white;
  color: #7c241c;
  font-size: 1.6rem;
  line-height: 1;
}

.muted {
  margin: 18px 0 0;
  color: #667269;
}

.settings-hint {
  margin: 14px 0 0;
  border-left: 3px solid #2f6b4f;
  padding-left: 12px;
  color: #566158;
  font-size: 0.92rem;
  line-height: 1.45;
}

.calendar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border: 1px solid #c9dbc9;
  border-radius: 8px;
  color: #2f6b4f;
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 20px;
  }

  .summary-band,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .next-panel {
    min-height: 160px;
  }

  .meal-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 14px;
  }

  .segmented {
    grid-template-columns: 1fr 1fr;
  }

  .time-row {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.35rem;
  }
}

.today-progress {
  margin-top: 10px;
  color: #355545;
  font-weight: 800;
}

.today-note {
  margin-top: 4px;
  color: #7c5a1c;
  font-size: 0.92rem;
  font-weight: 700;
}

.auth-gate {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  border: 1px solid #ddd7ca;
  border-radius: 8px;
  padding: 22px;
  background: #fffdf8;
  box-shadow: 0 18px 55px rgba(58, 48, 31, 0.08);
}

.auth-card .muted {
  margin: 12px 0 0;
}

.auth-error {
  margin: 14px 0 0;
  border: 1px solid #e2a29a;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff0ed;
  color: #7c241c;
  font-weight: 700;
}

.push-block {
  margin-top: 14px;
}

button.calendar-link {
  background: transparent;
}

button.calendar-link:disabled {
  border-color: #e0dccf;
  color: #96a29a;
  cursor: default;
}
