:root {
  color-scheme: light;
  --bg: #f5f2ea;
  --surface: #ffffff;
  --surface-strong: #edf5ef;
  --text: #14211d;
  --muted: #64716a;
  --line: #d6ded7;
  --brand: #123c32;
  --brand-2: #2d6a55;
  --accent: #d58a58;
  --warn: #a84d2d;
  --ok: #25734d;
  --soft-warn: #f7e7dd;
  --shadow: 0 16px 46px rgb(18 38 32 / 10%);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, #e4efe8 0, transparent 390px),
    var(--bg);
}

body.modal-scroll-locked {
  position: fixed;
  right: 0;
  left: 0;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 4vw, 32px) 40px;
}

.topbar {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 112px 12px 0;
}

.topbar-actions {
  position: absolute;
  top: 18px;
  right: 0;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.app-update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 14px;
  padding: 12px 14px;
  border: 1px solid #9bc5ad;
  border-radius: var(--radius);
  color: var(--brand);
  background: #e8f5ed;
  font-weight: 820;
}

.app-update-banner[hidden] {
  display: none;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.brand-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 12px 26px rgb(18 60 50 / 14%);
}

.brand-lockup strong {
  display: block;
  color: var(--brand);
  font-size: clamp(2.1rem, 8vw, 3.4rem);
  font-weight: 950;
  line-height: 0.95;
}

.brand-lockup span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: clamp(1.05rem, 4vw, 1.28rem);
  font-weight: 780;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.95rem;
  font-weight: 900;
  text-transform: none;
  letter-spacing: 0;
}

.eyebrow::before {
  content: "V";
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 950;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 0;
  font-size: clamp(1.55rem, 4.5vw, 2.65rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 620px;
  margin: 12px 0 0;
  font-size: 1rem;
}

h2 {
  margin-bottom: 4px;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.08rem;
}

p {
  color: var(--muted);
  line-height: 1.45;
}

main {
  display: grid;
  gap: 14px;
}

.app-footer {
  padding: 18px 4px 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.band {
  padding: clamp(16px, 4vw, 24px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 84%);
  box-shadow: var(--shadow);
}

.profile-band,
.dashboard-band {
  background: var(--surface);
}

.mode-band {
  background:
    linear-gradient(90deg, rgb(18 60 50 / 5%), rgb(213 138 88 / 8%)),
    var(--surface);
}

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

.section-header p,
.dialog-header p {
  margin-bottom: 0;
}

.dialog-header > div {
  min-width: 0;
}

.dialog-header .icon-button {
  margin-left: auto;
}

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

.meter {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.meter-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.meter-value {
  margin-bottom: 10px;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 800;
}

.meter-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #d7e1db;
}

.meter-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-2);
}

.meter-fill.warn {
  background: var(--warn);
}

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

.mode-card {
  display: grid;
  gap: 6px;
  min-height: 128px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.mode-card[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 2px rgb(18 60 50 / 18%);
}

.mode-card span {
  color: var(--brand-2);
  font-size: 0.82rem;
  font-weight: 860;
  text-transform: uppercase;
}

.mode-card strong {
  font-size: clamp(1.08rem, 3vw, 1.45rem);
  line-height: 1.12;
}

.mode-card small {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

body:not(.advanced-mode) .advanced-only,
body:not(.advanced-mode) .advanced-only-inline {
  display: none;
}

.quick-entry {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcf9;
}

.quick-entry-header h3,
.quick-entry-header p {
  margin-bottom: 4px;
}

.quick-entry-form {
  display: grid;
  grid-template-columns: 1.3fr 1fr repeat(4, minmax(92px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.entry-list {
  display: grid;
  gap: 10px;
}

.saved-meal-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.side-dish-tools {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbf7;
}

.side-dish-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 0.35fr) auto;
  gap: 10px;
  align-items: end;
}

.saved-meals {
  margin-top: 16px;
}

.saved-meals h3 {
  margin-bottom: 10px;
}

.empty-log {
  margin: 0;
  padding: 14px;
  border: 1px dashed #b8c5bd;
  border-radius: var(--radius);
  color: var(--muted);
  background: #fff;
}

.entry-item {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(90px, 0.6fr) minmax(0, 2fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.entry-name {
  display: grid;
  gap: 2px;
}

.entry-name strong {
  overflow-wrap: anywhere;
}

.entry-name span,
.entry-values {
  color: var(--muted);
  font-size: 0.86rem;
}

.entry-amount input {
  min-height: 38px;
}

.entry-values {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.scan-layout,
.controls-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.camera-panel,
.text-panel {
  display: grid;
  gap: 10px;
  align-content: start;
}

.scan-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 10px;
}

.file-drop {
  display: grid;
  min-height: 158px;
  place-content: center;
  gap: 8px;
  padding: 18px;
  border: 2px dashed #a8b8af;
  border-radius: var(--radius);
  background: #fbfcf9;
  text-align: center;
  cursor: pointer;
}

.compact-drop {
  min-height: 118px;
}

.file-drop-title {
  color: var(--brand);
  font-size: 1.1rem;
  font-weight: 850;
}

.file-drop-subtitle,
.hint {
  color: var(--muted);
  font-size: 0.92rem;
}

#image-input,
#front-image-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.preview-image {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.analysis-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(12 28 23 / 58%);
  backdrop-filter: blur(2px);
}

.analysis-overlay[hidden] {
  display: none;
}

.analysis-box {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(100%, 340px);
  padding: 24px;
  border: 1px solid #cfd9d3;
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  text-align: center;
  box-shadow: var(--shadow);
}

.analysis-box strong {
  font-size: 1.2rem;
}

.analysis-box span {
  color: var(--muted);
}

.analysis-spinner {
  width: 52px;
  height: 52px;
  border: 5px solid #d9e2dd;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

label {
  display: grid;
  gap: 6px;
  color: #2c3733;
  font-size: 0.92rem;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 11px;
  border: 1px solid #c9d2cc;
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  outline: none;
}

textarea {
  min-height: 154px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgb(45 106 85 / 18%);
}

label.needs-value {
  color: var(--warn);
}

label.needs-value input {
  border-color: var(--warn);
  background: #fff8f4;
}

.barcode-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8faf8;
}

.barcode-panel label {
  color: #2c3733;
  font-weight: 850;
}

.scanner-dialog {
  width: min(560px, calc(100vw - 24px));
}

.about-dialog {
  max-height: calc(100dvh - 24px);
  width: min(820px, calc(100vw - 24px));
  overflow: hidden;
}

.about-dialog[open] {
  display: flex;
  flex-direction: column;
}

.about-dialog .dialog-header {
  position: sticky;
  top: 0;
  z-index: 1;
  margin-bottom: 0;
  padding: 18px clamp(16px, 4vw, 24px);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.about-content {
  display: grid;
  min-height: 0;
  gap: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(16px, 4vw, 24px);
  -webkit-overflow-scrolling: touch;
}

.about-content:focus {
  outline: none;
}

.about-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.about-guide {
  border-color: #b8cfc4;
  background:
    linear-gradient(180deg, rgb(18 60 50 / 5%), transparent),
    #fff;
}

.about-note {
  background: #f8faf8;
}

.about-section h3 {
  margin-bottom: 0;
}

.about-section p {
  margin-bottom: 0;
}

.about-steps,
.about-list {
  display: grid;
  gap: 8px;
  margin: 0;
  color: var(--muted);
}

.about-steps {
  padding-left: 24px;
}

.about-steps li {
  padding-left: 4px;
}

.about-steps li::marker {
  color: var(--brand);
  font-weight: 900;
}

.about-steps strong,
.about-steps span {
  display: block;
}

.about-steps strong {
  color: var(--text);
}

.about-steps span,
.about-list {
  line-height: 1.42;
}

.about-list {
  padding-left: 20px;
}

.about-content a {
  color: var(--brand);
  font-weight: 850;
}

.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.about-links a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #b8c5bd;
  border-radius: var(--radius);
  background: #fff;
  text-decoration: none;
}

.barcode-scanner-frame {
  position: relative;
  overflow: hidden;
  margin-top: 14px;
  border-radius: var(--radius);
  background: #0d1815;
  aspect-ratio: 4 / 3;
}

.barcode-scanner-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.barcode-guide {
  position: absolute;
  inset: 32% 9%;
  border: 2px solid #fff;
  border-radius: 10px;
  box-shadow:
    0 0 0 999px rgb(0 0 0 / 36%),
    0 0 0 4px rgb(18 60 50 / 32%);
}

.barcode-guide::before {
  content: "";
  position: absolute;
  right: 14px;
  left: 14px;
  top: 50%;
  height: 2px;
  background: rgb(255 255 255 / 86%);
  transform: translateY(-50%);
}

.off-details-panel {
  overflow-x: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.off-details-panel h3 {
  margin-bottom: 8px;
}

.off-details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.off-details-table th,
.off-details-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.off-details-table th {
  width: 38%;
  color: var(--muted);
  font-weight: 820;
}

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

.confidence {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--brand);
  background: #dfeee6;
  font-size: 0.82rem;
  font-weight: 800;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 10px;
  color: #2c3733;
  font-weight: 820;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

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

.segmented button,
.secondary-button,
.primary-button,
.icon-button {
  border: 1px solid #b8c5bd;
  border-radius: var(--radius);
  cursor: pointer;
}

.segmented button {
  min-height: 42px;
  padding: 8px 9px;
  color: #2f3c37;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 780;
}

.segmented button[aria-pressed="true"] {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.amount-input {
  max-width: 220px;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  padding: 10px 14px;
  font-weight: 850;
  text-decoration: none;
}

.primary-button {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.secondary-button {
  color: var(--brand);
  background: #fff;
}

.secondary-button.success-button {
  border-color: #9bc5ad;
  color: var(--brand);
  background: #e8f5ed;
}

.status-warning {
  display: block;
  padding: 10px 12px;
  border: 1px solid #e2c0b0;
  border-radius: var(--radius);
  color: #7b321d;
  background: var(--soft-warn);
  font-weight: 780;
}

.eye-icon {
  position: relative;
  display: inline-block;
  width: 17px;
  height: 11px;
  margin: 0 4px;
  border: 2px solid currentColor;
  border-radius: 999px / 700px;
  vertical-align: -1px;
}

.eye-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.primary-button:hover,
.secondary-button:hover,
.mode-card:hover,
.segmented button:hover {
  border-color: var(--brand-2);
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--brand);
  background: #fff;
  font-size: 1.45rem;
  line-height: 1;
}

.info-button {
  border-radius: 50%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 900;
}

.full-width {
  width: 100%;
}

.compact-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.entry-actions {
  justify-content: flex-end;
  margin-top: 0;
}

.entry-actions .secondary-button {
  min-height: 38px;
  padding: 8px 10px;
}

.result-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.verdict {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--brand-2);
  font-size: 0.86rem;
  font-weight: 880;
}

.verdict.limit,
.verdict.not_best_today {
  background: var(--warn);
}

.verdict.unknown {
  color: #3e3326;
  background: #efd6a3;
}

.nutrition-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}

.comparison-note,
.source-note {
  margin-bottom: 12px;
}

.source-note {
  font-size: 0.82rem;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.comparison-scale {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8faf8;
}

.scale-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 780;
}

.scale-head strong {
  color: var(--text);
  font-size: 0.98rem;
}

.scale-head span:last-child {
  text-align: right;
}

.scale-track {
  position: relative;
  height: 52px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f2d4c6, #f5f1df 50%, #d9ecdf);
  overflow: hidden;
}

.scale-midline {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 50%;
  width: 2px;
  background: rgb(18 60 50 / 24%);
}

.scale-pointer {
  position: absolute;
  top: 7px;
  width: 48px;
  height: 38px;
  transform: translateX(-50%);
}

.scale-stand {
  position: absolute;
  left: 22px;
  top: 4px;
  width: 4px;
  height: 30px;
  border-radius: 999px;
  background: var(--brand);
}

.scale-stand::before {
  content: "";
  position: absolute;
  top: 0;
  left: -12px;
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: var(--brand);
}

.scale-pan {
  position: absolute;
  top: 17px;
  width: 18px;
  height: 9px;
  border: 2px solid var(--brand);
  border-top: 0;
  border-radius: 0 0 999px 999px;
}

.scale-pan-left {
  left: 2px;
}

.scale-pan-right {
  right: 2px;
}

.comparison-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8faf8;
}

.comparison-item.better {
  border-color: #a7cdbc;
  background: #edf7f1;
}

.comparison-item.worse {
  border-color: #e2c0b0;
  background: var(--soft-warn);
}

.comparison-item span,
.comparison-item small {
  color: var(--muted);
}

.comparison-item span {
  font-size: 0.78rem;
  font-weight: 780;
}

.comparison-item strong {
  font-size: 1.05rem;
}

.comparison-item small {
  line-height: 1.28;
}

.summary-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8faf8;
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 780;
}

.summary-item strong {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem;
}

.reason-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reason-list li {
  padding: 9px 10px;
  border-radius: var(--radius);
  background: #f2f6f3;
  color: #33413c;
}

.reason-list li.warning {
  background: var(--soft-warn);
  color: #703019;
}

.reason-list li.complement {
  border: 1px solid #c6d9cf;
  background: #eef7f1;
  color: #224538;
}

dialog {
  width: min(760px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgb(14 24 20 / 56%);
}

.dialog-content {
  padding: clamp(16px, 4vw, 24px);
}

.disclaimer {
  margin: 14px 0 0;
  padding: 12px;
  border-radius: var(--radius);
  background: #f7f1e8;
  color: #5e4b38;
  font-size: 0.92rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-v2 .app-shell {
  width: min(960px, 100%);
}

.app-v2 .hero-copy {
  margin-top: 8px;
}

.v2-flow {
  gap: 12px;
}

.scan-context-band {
  padding-block: 12px;
}

.scan-context-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.scan-context-header .eyebrow {
  margin-bottom: 4px;
}

.scan-context-header h2 {
  margin-bottom: 2px;
  font-size: clamp(1.05rem, 2.8vw, 1.35rem);
}

.scan-context-header p {
  max-width: 700px;
  margin-bottom: 0;
  font-size: 0.9rem;
}

.mode-disclosure {
  margin-top: 10px;
}

.mode-disclosure summary {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid #b8c5bd;
  border-radius: var(--radius);
  color: var(--brand);
  background: #fff;
  cursor: pointer;
  font-weight: 850;
}

.mode-disclosure[open] summary {
  margin-bottom: 10px;
}

.v2-profile-band .section-header {
  margin-bottom: 12px;
}

.compact-mode-selector .mode-card {
  min-height: 74px;
  padding: 10px 12px;
}

.compact-mode-selector .mode-card strong {
  font-size: clamp(0.95rem, 2.4vw, 1.08rem);
}

.compact-mode-selector .mode-card small {
  font-size: 0.84rem;
}

.v2-primary-band {
  border-color: #b8cfc4;
  background:
    linear-gradient(180deg, rgb(18 60 50 / 5%), transparent),
    #fff;
}

.v2-scan-layout {
  grid-template-columns: minmax(0, 1fr);
}

.v2-main-drop {
  min-height: 92px;
  padding-block: 16px;
}

.v2-main-drop .file-drop-title {
  font-size: clamp(1rem, 3vw, 1.15rem);
}

.app-v2.show-image-fallback .v2-main-drop {
  min-height: clamp(190px, 34vw, 260px);
}

.app-v2.show-image-fallback .v2-main-drop .file-drop-title {
  font-size: clamp(1.25rem, 4vw, 1.7rem);
}

.v2-extra-scan {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.v2-details,
.v2-collapsible {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.v2-details {
  padding: 0;
}

.v2-details summary,
.v2-collapsible summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  color: var(--brand);
  cursor: pointer;
  font-weight: 850;
}

.v2-collapsible summary {
  margin: calc(clamp(16px, 4vw, 24px) * -1);
}

.v2-collapsible[open] summary {
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.v2-collapsible summary span:first-child {
  display: grid;
  gap: 3px;
}

.v2-collapsible summary small {
  color: var(--muted);
  font-weight: 650;
}

.v2-estimate-band {
  background: #fff;
}

.v2-result-panel {
  border-color: #c2d8cc;
  background: #fbfdfb;
}

.compact-section-header {
  margin-bottom: 12px;
}

@media (max-width: 840px) {
  .meter-grid,
  .mode-selector,
  .scan-layout,
  .controls-grid,
  .form-grid,
  .quick-entry-form,
  .saved-meal-tools,
  .side-dish-form,
  .entry-item,
  .comparison-grid,
  .nutrition-summary {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding-inline: 12px;
  }

  .topbar,
  .section-header,
  .result-head {
    align-items: stretch;
  }

  .dialog-header {
    align-items: flex-start;
    flex-direction: row;
  }

  .dialog-header .icon-button {
    align-self: flex-start;
  }

  .topbar-actions {
    flex-direction: row;
    align-items: center;
  }

  .scan-context-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .scan-context-header .compact-button,
  .mode-disclosure summary {
    width: 100%;
  }

  .section-header,
  .result-head {
    flex-direction: column;
  }

  .meter-grid,
  .scan-layout,
  .controls-grid,
  .form-grid,
  .quick-entry-form,
  .saved-meal-tools,
  .side-dish-form,
  .scan-actions,
  .entry-item,
  .comparison-grid,
  .nutrition-summary {
    grid-template-columns: 1fr;
  }

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

  .amount-input {
    max-width: none;
  }

  .button-row > * {
    flex: 1 1 180px;
  }
}
