:root {
  color-scheme: light;
  --background: #f5f7f8;
  --panel: #ffffff;
  --text: #15201b;
  --muted: #627067;
  --line: #dce4df;
  --accent: #1f8a63;
  --accent-strong: #126345;
  --danger: #9d3328;
  --shadow: 0 12px 30px rgba(20, 32, 27, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.entry-panel,
.summary-panel,
.history-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.entry-panel {
  min-height: 520px;
}

.history-panel {
  grid-column: 1 / -1;
}

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

.panel-header.compact {
  margin-bottom: 16px;
}

.brand-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.logo-mark {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 2rem;
  line-height: 1.1;
}

h2 {
  font-size: 1.2rem;
  line-height: 1.2;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-strip {
  margin: -10px 0 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: #fbfcfb;
  font-size: 0.92rem;
}

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

textarea {
  width: 100%;
  resize: vertical;
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--text);
  background: #fbfcfb;
  line-height: 1.45;
}

textarea:focus {
  outline: 3px solid rgba(31, 138, 99, 0.16);
  border-color: var(--accent);
}

.controls {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    transform 120ms ease;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.primary-button {
  background: var(--accent);
  color: white;
  font-weight: 750;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.icon-button,
.ghost-button {
  background: #f7faf8;
  color: var(--text);
  border-color: var(--line);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-button.is-recording {
  color: var(--danger);
  border-color: rgba(157, 51, 40, 0.35);
  background: #fff7f5;
}

.ghost-button:hover,
.icon-button:hover {
  border-color: #b8c6bf;
}

.hint {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.audio-preview {
  width: 100%;
  margin-top: 14px;
}

.totals-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.totals-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 74px;
  background: #fbfcfb;
}

.totals-grid strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1.1;
}

.totals-grid span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.reply-box {
  min-height: 220px;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  line-height: 1.45;
  background: #fbfcfb;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.meal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfb;
}

.meal-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  letter-spacing: 0;
}

.meal-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.meal-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    width: min(100% - 24px, 680px);
    padding: 18px 0;
  }

  .entry-panel {
    min-height: auto;
  }

  .logo-mark {
    width: 50px;
    height: 50px;
  }

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

.profile-shell {
  width: min(720px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.profile-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.form-section {
  border: none;
  padding: 0;
  margin: 18px 0 0;
}

.form-section legend {
  font-weight: 600;
  margin-bottom: 8px;
  padding: 0;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.92rem;
  color: var(--muted);
}

.form-grid label > span {
  color: var(--text);
}

.form-grid label .unit-suffix {
  color: var(--muted);
  font-style: normal;
  font-size: 0.85em;
}

.form-grid input,
.form-grid select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.form-grid input:focus,
.form-grid select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.reply-box[data-kind="error"] {
  color: var(--danger);
  border-color: rgba(157, 51, 40, 0.35);
}

.reply-box[data-kind="success"] {
  color: var(--accent-strong);
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}
