:root {
  --bg: #f4ede3;
  --bg-accent: #efe2cb;
  --ink: #1f1d1a;
  --muted: #6d655b;
  --line: rgba(31, 29, 26, 0.12);
  --card: rgba(255, 250, 244, 0.9);
  --green: #2d6a4f;
  --green-soft: #d9efe2;
  --amber: #c77d2a;
  --amber-soft: #f5e2cb;
  --red: #b33a3a;
  --shadow: 0 18px 44px rgba(75, 55, 31, 0.14);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 28%),
    linear-gradient(180deg, var(--bg-accent), var(--bg));
}

h1,
h2,
h3,
strong {
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.app-shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 96px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h1 {
  font-size: 2rem;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.eyebrow {
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--muted);
}

.page {
  display: grid;
  gap: 18px;
}

.page-block,
.auth-card,
.surface-card,
.status-hero,
.history-card,
.empty-card,
.mini-stat,
.phase-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.auth-card,
.page-block {
  padding: 22px;
}

.hero-chip {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  margin-bottom: 14px;
  color: var(--muted);
}

.muted,
.phase-meta {
  color: var(--muted);
}

.lead-copy {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--muted);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

.inline-link {
  color: var(--amber);
  font-weight: 600;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.stack-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.stack-form span {
  font-size: 0.92rem;
}

input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
}

input:disabled {
  color: var(--muted);
  background: rgba(239, 226, 203, 0.5);
}

.primary-button,
.danger-button,
.ghost-button {
  border: 0;
  border-radius: 18px;
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  background: var(--green);
  color: white;
}

.danger-button {
  background: var(--red);
  color: white;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.giant-button {
  min-height: 72px;
  font-size: 1.1rem;
}

.status-panel {
  display: grid;
  gap: 12px;
}

.status-hero {
  padding: 22px;
  display: grid;
  gap: 18px;
}

.status-hero.fasting {
  background:
    linear-gradient(180deg, rgba(217, 239, 226, 0.86), rgba(255, 250, 244, 0.92));
}

.status-hero.eating {
  background:
    linear-gradient(180deg, rgba(245, 226, 203, 0.86), rgba(255, 250, 244, 0.92));
}

.hero-metrics,
.stats-grid,
.timeline-grid {
  display: grid;
  gap: 12px;
}

.hero-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hero-metrics div,
.mini-stat {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
}

.hero-metrics span,
.mini-stat span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
  font-size: 0.86rem;
}

.hero-metrics strong,
.mini-stat strong {
  font-size: 1rem;
}

.progress-block {
  display: grid;
  gap: 10px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.92rem;
}

.progress-track {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.7);
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #7bc79e);
}

.surface-card {
  padding: 16px;
}

.phase-card {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.phase-card.current {
  border-color: var(--green);
  background: rgba(217, 239, 226, 0.72);
}

.phase-card.complete {
  opacity: 0.74;
}

.phase-head {
  display: grid;
  gap: 4px;
}

.phase-head span {
  color: var(--muted);
  font-size: 0.82rem;
}

.phase-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 6px;
}

.alert {
  padding: 14px 16px;
  border-radius: 18px;
}

.alert.error {
  background: #fae0e0;
  color: #7d1f1f;
}

.alert.success {
  background: #def4e6;
  color: #1c5a3c;
}

.history-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.history-card,
.empty-card {
  padding: 18px;
}

.history-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.history-card {
  display: grid;
  gap: 12px;
}

.history-form {
  margin-top: 6px;
}

.history-note {
  font-size: 0.9rem;
}

.history-actions,
.history-delete-form {
  display: flex;
}

.history-delete-button {
  width: 100%;
  justify-content: center;
  border: 1px solid var(--line);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(680px, calc(100% - 24px));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 250, 244, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.bottom-nav a {
  text-align: center;
  padding: 12px;
  border-radius: 16px;
  color: var(--muted);
  font-weight: 700;
}

.bottom-nav a.active {
  background: rgba(31, 29, 26, 0.08);
  color: var(--ink);
}

@media (min-width: 700px) {
  .app-shell {
    padding-left: 24px;
    padding-right: 24px;
  }

  .timeline-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
