:root {
  color-scheme: light;
  --bg: #f6f4ee;
  --panel: #ffffff;
  --ink: #202124;
  --muted: #6c6f75;
  --line: #d8d2c4;
  --green: #1f6f4a;
  --blue: #245c7a;
  --red: #b42318;
  --gold: #8a6200;
  --button: #202124;
  --button-text: #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

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

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

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

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(36, 92, 122, 0.25);
  outline-offset: 2px;
}

.app-shell {
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  display: grid;
  align-content: start;
  gap: 14px;
}

.topbar {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  gap: 8px;
  align-items: center;
}

.icon-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.icon-button.primary {
  background: var(--button);
  color: var(--button-text);
}

.icon-button.secondary {
  background: #ebe6da;
  color: var(--ink);
}

.date-button {
  min-width: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.summary-band,
.command-panel,
.list-panel,
dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-band {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 2.7rem;
  line-height: 1;
  letter-spacing: 0;
}

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

.totals div {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.totals span,
label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.totals strong {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.command-panel {
  padding: 14px;
}

.command-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 8px;
  margin-top: 8px;
}

input {
  width: 100%;
  height: 52px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.mic-icon {
  width: 16px;
  height: 24px;
  border: 2px solid currentColor;
  border-radius: 10px;
  position: relative;
}

.mic-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 18px;
  height: 9px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  transform: translateX(-50%);
}

.mic-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -15px;
  width: 2px;
  height: 8px;
  background: currentColor;
  transform: translateX(-50%);
}

.icon-button.is-listening {
  background: var(--red);
}

.send-button {
  width: 100%;
  margin-top: 10px;
  background: var(--green);
  color: #ffffff;
  font-weight: 800;
}

.status {
  min-height: 22px;
  margin: 12px 2px 0;
  color: var(--muted);
  line-height: 1.35;
}

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

.tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tools button {
  background: #ebe6da;
  color: var(--ink);
  font-weight: 800;
}

.lists {
  display: grid;
  gap: 14px;
}

.list-panel {
  padding: 14px;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

li {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: baseline;
  min-height: 42px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

li:last-child {
  border-bottom: 0;
}

.time {
  color: var(--muted);
  font-size: 0.88rem;
}

.description {
  min-width: 0;
  overflow-wrap: anywhere;
}

.calories {
  font-weight: 800;
  white-space: nowrap;
}

.empty {
  grid-template-columns: 1fr;
  color: var(--muted);
}

dialog {
  width: min(440px, calc(100% - 28px));
  padding: 0;
}

dialog::backdrop {
  background: rgba(32, 33, 36, 0.32);
}

dialog form {
  padding: 16px;
}

dialog header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

dialog label {
  margin-top: 12px;
}

dialog input {
  margin-top: 7px;
}

dialog footer {
  margin-top: 14px;
}

@media (min-width: 680px) {
  .app-shell {
    padding: 22px;
  }

  .summary-band {
    grid-template-columns: 1fr 1.15fr;
    align-items: end;
  }

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

@media (max-width: 390px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  h1 {
    font-size: 2.2rem;
  }

  li {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .calories {
    grid-column: 2;
  }
}
