:root {
  color-scheme: dark;
  --bg: #0b1220;
  --card: #141d2e;
  --text: #e8edf7;
  --muted: #8b9bb8;
  --accent: #3dd68c;
  --accent-dim: rgba(61, 214, 140, 0.12);
  --border: rgba(255, 255, 255, 0.08);
  --danger: #ff6b6b;
  --warn: #f5c542;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 28px;
}

.header { margin-bottom: 12px; }

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--border);
  position: relative;
  z-index: 2;
}

.tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 6px;
  border-radius: 10px;
  cursor: pointer;
}

.tab--active {
  background: var(--accent-dim);
  color: var(--accent);
}

.panel {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.panel.is-active {
  display: flex;
}

.hero-kcal {
  text-align: center;
  padding: 20px 12px;
  background: linear-gradient(160deg, rgba(61, 214, 140, 0.18), transparent);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.hero-kcal__label {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.hero-kcal__value {
  margin: 0;
  font-size: 42px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}

.hero-kcal__sub {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.section-sub {
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section-sub:first-of-type { margin-top: 0; }

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.field-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  padding: 12px;
  font: inherit;
  resize: vertical;
  min-height: 72px;
}

.field-input:focus {
  outline: 2px solid rgba(61, 214, 140, 0.35);
  outline-offset: 1px;
}

.row-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  background: var(--accent);
  color: #062015;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

.estimate-result {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--accent-dim);
  font-size: 14px;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  font-size: 14px;
}

.list-item__main { flex: 1; min-width: 0; }

.list-item__title {
  display: block;
  word-break: break-word;
}

.list-item__meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.list-item__kcal {
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.muted {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.stats { display: grid; gap: 10px; }

.stat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.stat__label { color: var(--muted); }
.stat__value { text-align: right; font-weight: 600; }
.stat--highlight .stat__value { color: var(--accent); }

.plan-block { margin-bottom: 12px; }
.plan-block:last-child { margin-bottom: 0; }
.plan-block h3 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.plan-block pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.empty {
  text-align: center;
  padding: 32px 8px;
}

.empty p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 20px;
}

.status {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  min-height: 1.2em;
}

.status--error { color: var(--danger); }

.tabs--scroll {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs--scroll::-webkit-scrollbar {
  display: none;
}

.tabs--scroll .tab {
  flex: 1 0 auto;
  min-width: 72px;
  font-size: 12px;
  padding: 10px 8px;
}

.field-input--single {
  min-height: auto;
  margin-bottom: 10px;
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.cal-month {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  text-transform: capitalize;
}

.cal-nav {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  padding: 0;
}

.cal-day--muted {
  color: var(--muted);
  opacity: 0.45;
  cursor: default;
}

.cal-day--today {
  border-color: var(--accent);
}

.cal-day--selected {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.cal-day--has::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-day-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.cal-day-entry:last-child {
  border-bottom: none;
}

.cal-del {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}
