:root {
  color-scheme: light dark;
  --bg: #f3f5fa;
  --surface: rgba(255, 255, 255, 0.36);
  --surface-strong: rgba(255, 255, 255, 0.66);
  --surface-soft: rgba(226, 235, 255, 0.4);
  --text: #192338;
  --muted: #52617a;
  --line: rgba(67, 87, 125, 0.13);
  --chrome-surface: rgba(255, 255, 255, 0.58);
  --glass-border: rgba(255, 255, 255, 0.78);
  --glass-shine: rgba(255, 255, 255, 0.84);
  --glass-reflection: rgba(255, 255, 255, 0.3);
  --accent: #005bc5;
  --income: #096443;
  --expense: #aa3445;
  --shadow: 0 12px 40px rgba(40, 69, 118, 0.09), 0 2px 6px rgba(40, 69, 118, 0.025), inset 0 1px 1px var(--glass-shine), inset 0 -1px 1px rgba(255, 255, 255, 0.3);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 14px;
  --safe-bottom: max(16px, env(safe-area-inset-bottom));
  --nav-height: 88px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  overscroll-behavior-y: contain;
  background:
    radial-gradient(ellipse at 0% 12%, rgba(107, 160, 255, 0.52), transparent 50%),
    radial-gradient(ellipse at 105% 38%, rgba(184, 150, 249, 0.42), transparent 45%),
    radial-gradient(ellipse at 72% 105%, rgba(100, 217, 218, 0.4), transparent 52%),
    linear-gradient(145deg, #edf3ff, #f2f2fc 58%, #e9f7f8);
  background-attachment: fixed;
}

.pull-refresh {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  z-index: 50;
  width: 42px;
  height: 42px;
  margin-left: -21px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 12px 24px rgba(31, 53, 91, 0.1);
  opacity: 0;
  transform: translateY(-18px) scale(0.88);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.pull-refresh.visible {
  opacity: 1;
}

.pull-refresh.ready {
  transform: translateY(0) scale(1);
}

.pull-refresh.loading {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.pull-refresh-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  transition: transform 120ms linear;
}

.pull-refresh.loading .pull-refresh-spinner {
  animation: pull-refresh-spin 0.8s linear infinite;
}

button,
input,
select,
textarea {
  font: inherit;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--surface-strong);
  color: var(--text);
}

textarea {
  resize: vertical;
}

button {
  min-height: 48px;
  padding: 0 16px;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.app-shell {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 24px calc(var(--nav-height) + 32px + var(--safe-bottom));
}

.hero.compact {
  padding: 8px 4px 28px;
}

h1,
h2,
p,
dl,
dd {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.12;
  letter-spacing: -0.045em;
  font-weight: 750;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1.12rem;
}

.panel-heading p,
.tree-node-meta,
.category-card-meta,
.hint,
.empty-state {
  color: var(--muted);
}

.content,
.screen,
.tree-container,
.category-list {
  display: grid;
  gap: 16px;
}

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

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-soft);
}

.attachment-item.pending {
  color: var(--muted);
  font-size: 0.92rem;
}

.attachment-item a,
.attachment-inline-list a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-word;
}

.attachment-inline-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-actions-grid {
  display: grid;
  gap: 12px;
}

.file-action {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.file-action span {
  font-weight: 600;
}

.consumption-insights {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.screen {
  display: none;
}

.screen.active {
  display: grid;
}

.summary-grid.single {
  display: grid;
  grid-template-columns: 1fr;
}

.summary-card,
.panel,
.tree-node-card,
.category-card,
.person-balance-card,
.overview-tree-column {
  -webkit-backdrop-filter: blur(28px) saturate(175%);
  backdrop-filter: blur(28px) saturate(175%);
  background: linear-gradient(135deg, var(--glass-reflection), transparent 45%), var(--surface);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
}

.summary-card {
  padding: 18px 16px;
  min-height: 110px;
}

.summary-card strong {
  font-size: 1.6rem;
}

.summary-card-row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
  width: 100%;
}

.summary-card-row > div:first-child {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 74px;
}

.summary-people {
  display: grid;
  gap: 8px;
  min-width: 110px;
  text-align: right;
}

.summary-person-line {
  display: grid;
  gap: 2px;
  font-size: 0.78rem;
  color: var(--muted);
}

.summary-person-line strong {
  font-size: 0.9rem;
}

.summary-card.accent {
  background: var(--surface);
}

.panel,
.overview-tree-column {
  padding: 18px;
}

.section-title-row,
.panel-heading,
.tree-node-head,
.category-card-head,
.tree-node-title-row,
.category-card-title-row,
.category-badge-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading {
  margin-bottom: 16px;
}

.label {
  font-size: 0.84rem;
  color: var(--muted);
}

.tab-bar.fixed-bottom {
  position: fixed;
  left: 50%;
  bottom: var(--safe-bottom);
  transform: translateX(-50%);
  z-index: 30;
  width: min(calc(100% - 32px), 560px);
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
  border-radius: 32px;
  -webkit-backdrop-filter: blur(32px) saturate(170%);
  backdrop-filter: blur(32px) saturate(170%);
  background: linear-gradient(120deg, var(--glass-reflection), transparent 48%, var(--glass-reflection)), var(--chrome-surface);
  border: 1px solid var(--glass-border);
  box-shadow: 0 12px 40px rgba(32, 53, 88, 0.2), inset 0 2px 1px var(--glass-shine), inset 1px 0 1px var(--glass-shine), inset 0 -1px 1px rgba(255, 255, 255, 0.45);
}

.tab-button,
.segment,
button[type="submit"] {
  border-color: transparent;
}

.tab-button,
.segment {
  background: transparent;
  color: var(--muted);
}

.icon-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  min-width: 0;
  min-height: 44px;
  padding: 0;
}

.icon-tab svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-button.active,
.segment.active {
  color: var(--text);
  background: var(--surface-strong);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 6px;
  margin-bottom: 16px;
  background: var(--surface-soft);
  border-radius: 999px;
}

.overview-tree-grid {
  display: grid;
  gap: 16px;
}

.overview-tree-column {
  padding: 16px;
}

.overview-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: nowrap;
}

.small-action {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.84rem;
}

.wide-create-button {
  width: 100%;
  min-height: 44px;
  font-size: 1.2rem;
  font-weight: 600;
}

.overview-tree-stack,
.overview-node-children,
.category-badge-list,
.entry-form,
.form-actions {
  display: grid;
  gap: 14px;
}

.entry-form label {
  display: grid;
  gap: 8px;
}

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

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.toggle-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

button[type="submit"] {
  background: var(--accent);
  color: #fff;
}

.secondary-button,
.icon-button {
  background: transparent;
  color: var(--text);
}

.delete-button {
  color: var(--expense);
}

.hidden {
  display: none !important;
}

.tree-node-card,
.category-card,
.person-balance-card {
  padding: 16px;
}

.tree-node-card {
  background: var(--surface);
}

.tree-node-amount-wrap {
  min-width: 132px;
  text-align: right;
}

.tree-node-amount,
.category-card-amount,
.person-balance-amount {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.tree-node-categories,
.tree-node-children {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.tree-node-children {
  padding-left: 12px;
  border-left: 2px solid var(--line);
}

.pill,
.tree-node-rounding {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  color: var(--text);
  background: var(--surface-soft);
}

.category-badge {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 18px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.category-badge-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.category-menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  min-width: 22px;
  padding: 0 6px;
  font-size: 0.85rem;
  line-height: 1;
}

.category-add-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px dashed var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.consumption-grid {
  display: grid;
  gap: 16px;
}

.chart-wrap {
  display: grid;
  gap: 8px;
}

.chart-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-value-line {
  stroke: var(--accent);
}

.chart-target-line {
  stroke: var(--muted);
  stroke-dasharray: 8 8;
}

.chart-point {
  fill: var(--surface-strong);
  stroke: var(--accent);
  stroke-width: 2;
}

.chart-axis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 6px;
  font-size: 0.76rem;
  color: var(--muted);
  text-align: center;
}

.inline-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.category-card-info {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.collapsible-card {
  cursor: pointer;
}

.collapsible-head {
  align-items: center;
}

.collapsible-end {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inventory-head-main {
  min-width: 0;
  flex: 1;
}

.info-row {
  display: grid;
  gap: 2px;
}

.info-row dt {
  font-size: 0.78rem;
  color: var(--muted);
}

.empty-state {
  padding: 18px;
  border-radius: var(--radius-lg);
  text-align: center;
  background: var(--surface-soft);
  border: 1px dashed var(--line);
}

.overview-node {
  padding: 14px;
  border-radius: 20px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.overview-node-expandable .overview-node-head {
  cursor: pointer;
}

.overview-node-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.overview-node-main {
  display: grid;
  gap: 4px;
}

.overview-node-name-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.overview-node-children {
  margin-top: 12px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}

.overview-node-children.hidden {
  display: none !important;
}

.income {
  color: var(--income);
}

.expense {
  color: var(--expense);
}

@media (min-width: 860px) {
  .overview-tree-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .inline-fields,
  .panel-heading,
  .tree-node-head,
  .category-card-head,
  .category-badge-top,
  .collapsible-head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .summary-card-row,
  .overview-column-head,
  .section-title-row,
  .overview-node-head {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }

  .overview-node-head {
    flex-wrap: nowrap;
  }

  .overview-node-main {
    min-width: 0;
  }

  .overview-node-head .inline-action-row {
    flex-wrap: nowrap;
    margin-left: auto;
  }

  .collapsible-end {
    width: 100%;
    justify-content: space-between;
  }

  .inventory-card .collapsible-head {
    flex-direction: row;
    align-items: center;
  }

  .inventory-card .collapsible-end {
    width: auto;
    margin-left: auto;
  }

  .summary-people {
    min-width: 96px;
  }

  .summary-card strong {
    font-size: 1.48rem;
  }

  .summary-person-line strong {
    font-size: 0.82rem;
  }

  .tree-node-amount-wrap {
    min-width: 0;
    width: 100%;
    text-align: left;
  }


}

@keyframes pull-refresh-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Liquid Glass surfaces, with solid content layers for readable numbers. */
.hero-topline, .brand, .summary-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hero-topline { margin-bottom: 26px; gap: 12px; }
.brand { gap: 8px; text-decoration: none; color: var(--text); font-size: 0.88rem; font-weight: 650; letter-spacing: -0.02em; }
.brand svg { width: 28px; height: 28px; padding: 5px; border-radius: 9px; background: linear-gradient(150deg, #69adff, #0067dc); fill: none; stroke: #fff; stroke-width: 1.7; stroke-linejoin: round; box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), 0 3px 8px rgba(0, 88, 196, 0.18); }
.hero-date { color: var(--muted); font-size: 0.8rem; white-space: nowrap; padding: 7px 12px; border-radius: 100px; background: var(--surface); border: 1px solid var(--glass-border); box-shadow: inset 0 1px 0 var(--glass-shine); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.hero-subtitle { margin-top: 8px; color: var(--muted); font-size: 0.95rem; line-height: 1.5; }
.content, .screen { gap: 22px; }
.summary-card.accent {
  padding: 24px 28px 20px;
  background:
    linear-gradient(125deg, var(--glass-reflection), transparent 40%, rgba(172, 203, 255, 0.14) 72%, var(--glass-reflection)),
    var(--surface);
  border-color: var(--glass-border);
  box-shadow: 0 16px 48px rgba(47, 78, 131, 0.12), inset 0 2px 1px var(--glass-shine), inset 1px 0 1px var(--glass-shine), inset 0 -1px 1px rgba(255, 255, 255, 0.35);
}
.summary-caption { gap: 12px; margin-bottom: 22px; }
.summary-kicker { font-size: 0.65rem; font-weight: 750; letter-spacing: 0.15em; color: var(--muted); }
.period-badge { padding: 5px 10px; border-radius: 100px; background: var(--surface-soft); color: var(--muted); font-size: 0.7rem; font-weight: 550; }
.summary-card-row { align-items: center; gap: 24px; }
.summary-card-row > div:first-child { justify-content: center; gap: 8px; min-height: auto; min-width: 0; }
#overview-balance { font-size: clamp(1.9rem, 5.8vw, 3rem); line-height: 1.1; letter-spacing: -0.045em; font-weight: 730; white-space: nowrap; }
.summary-people { gap: 14px; padding-left: 24px; border-left: 1px solid var(--line); min-width: 140px; }
.summary-person-line { gap: 4px; }
.summary-person-line > span { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.summary-person-line strong { font-size: 0.93rem; letter-spacing: -0.02em; }
.person-dot { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-soft); color: var(--muted); font-size: 0.5rem; font-style: normal; font-weight: 700; }
.cashflow-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; }
.cashflow-item { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--glass-border); box-shadow: inset 0 1px 0 var(--glass-shine); min-width: 0; }
.cashflow-item > div { display: grid; gap: 5px; min-width: 0; }
.cashflow-item strong { font-size: 1.1rem; font-weight: 650; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.cashflow-icon, .flow-heading-icon { display: inline-grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 12px; font-size: 1.3rem; background: var(--surface-strong); }
.summary-footnote { color: var(--muted); margin-top: 14px; font-size: 0.7rem; line-height: 1.5; }
strong { font-variant-numeric: tabular-nums; }
.summary-card, .panel, .overview-tree-column, .tab-bar { position: relative; }
.summary-card::before, .panel::before, .overview-tree-column::before, .tab-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  padding: 1px;
  background: linear-gradient(135deg, var(--glass-shine) 0%, transparent 36%, transparent 62%, var(--glass-reflection) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}
#settings-backup-button { color: #fff; background: #0067dc; border-color: transparent; }

.panel, .overview-tree-column { padding: 22px; }
.overview-tree-grid { gap: 20px; align-items: start; }
.overview-column-head { flex-wrap: wrap; gap: 14px 8px; }
.overview-column-head > .section-title-row { align-items: center; justify-content: flex-start; gap: 10px; }
.overview-column-head h2 { font-size: 1rem; letter-spacing: -0.02em; margin-bottom: 3px; }
.overview-column-head .label { font-size: 0.7rem; }
.overview-column-total { width: 100%; order: 3; padding: 4px 0 8px; }
.overview-column-total strong { font-size: 1.6rem; letter-spacing: -0.04em; font-weight: 700; }
.overview-column-head > button { margin-left: auto; }
.overview-tree-stack { gap: 8px; }
.overview-node { border-radius: 16px; padding: 0; background: var(--surface); border-color: var(--glass-border); box-shadow: inset 0 1px 0 var(--glass-shine); }
.overview-node-head { padding: 16px 14px; align-items: center; gap: 10px; min-height: 56px; border-radius: 16px; }
.overview-node-head:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.overview-node-head::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); flex: 0 0 auto; margin-right: 2px; transition: transform 180ms ease; }
.overview-node-head[aria-expanded="true"]::after { transform: rotate(45deg); }
.overview-node-main { flex: 1; min-width: 0; }
.overview-node-name-row { gap: 3px 7px; font-size: 0.9rem; }
.overview-node-name-row strong { font-weight: 600; overflow-wrap: anywhere; }
.overview-node-head .inline-action-row { font-size: 0.87rem; white-space: nowrap; }
.overview-node-children { margin: 0 12px 12px; padding: 0 0 0 10px; gap: 8px; }
.category-badge, .category-add-card { border-radius: 12px; }
.category-badge { background: var(--surface-soft); font-size: 0.87rem; }
.category-badge .hint { font-size: 0.78rem; line-height: 1.5; }
.tab-button.icon-tab { flex-direction: column; gap: 4px; padding: 8px 2px; min-height: 56px; border-radius: 26px; color: var(--muted); }
.tab-button.icon-tab svg { width: 22px; height: 22px; }
.tab-label { font-size: 0.61rem; font-weight: 600; letter-spacing: -0.01em; }
.tab-button.active { color: var(--accent); background: linear-gradient(150deg, var(--glass-reflection), transparent), var(--surface); border-color: var(--glass-border); box-shadow: 0 3px 10px rgba(50, 82, 135, 0.08), inset 0 1px 1px var(--glass-shine); }
.tab-button:hover, .tab-button:focus-visible { transform: none; }
.segmented-control { gap: 3px; padding: 4px; border-radius: 16px; }
.segment { min-height: 42px; border-radius: 12px; font-size: 0.9rem; font-weight: 600; }
.segment.active { box-shadow: 0 2px 6px rgba(31, 53, 91, 0.08); }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; font-weight: 550; }
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: default; }
.secondary-button, .icon-button { background: var(--surface); border-color: var(--glass-border); color: var(--accent); box-shadow: inset 0 1px 0 var(--glass-shine); }
.delete-button { color: var(--expense); }
.small-action { min-height: 44px; font-size: 0.75rem; border-radius: 100px; padding: 0 12px; }
.category-menu-button { min-width: 44px; min-height: 44px; border-radius: 14px; font-size: 1.1rem; }
.wide-create-button { width: auto; min-height: 44px; white-space: nowrap; background: var(--accent); color: #fff; border: 0; border-radius: 100px; padding: 0 18px; font-size: 0.85rem; }
.panel-heading { align-items: center; }
.panel-heading p { margin-top: 6px; font-size: 0.85rem; line-height: 1.5; }
.entry-form label { min-width: 0; }
.entry-form label > span { font-size: 0.83rem; font-weight: 550; }
.entry-form { gap: 18px; }
input, select, textarea { font-size: 16px; border-color: var(--line); background: var(--surface-strong); }
input[type="file"] { font-size: 0.8rem; }
input[type="file"]::file-selector-button { background: var(--surface-soft); color: var(--text); border: 0; padding: 8px; border-radius: 8px; margin-right: 8px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
.toggle-row input { appearance: none; -webkit-appearance: none; position: relative; width: 46px; height: 28px; min-height: 28px; border-radius: 100px; padding: 0; background: var(--surface-soft); cursor: pointer; }
.toggle-row input::after { content: ""; position: absolute; width: 22px; height: 22px; top: 2px; left: 2px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18); transition: transform 180ms ease; }
.toggle-row input:checked { background: var(--accent); }
.toggle-row input:checked::after { transform: translateX(18px); }
.hint, .empty-state { line-height: 1.55; }
.empty-state { font-size: 0.85rem; }
.category-card, .tree-node-card { box-shadow: none; border-radius: 18px; }
.category-card-meta, .tree-node-meta { line-height: 1.5; font-size: 0.85rem; margin-top: 4px; }
.category-card-title-row, .tree-node-title-row { flex-wrap: wrap; }
.category-card-title, .tree-node-title, .inventory-head-main { overflow-wrap: anywhere; }
.attachment-item { flex-wrap: wrap; }
.screen.active { animation: screen-appear 200ms ease-out; }
@keyframes screen-appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 860px) {
  .app-shell { padding-top: 38px; }
  .summary-card.accent { padding: 28px 32px 22px; }
  .cashflow-grid { margin-top: 28px; }
  .cashflow-item { padding: 18px; }
  .cashflow-item strong { font-size: 1.3rem; }
  .summary-people { grid-template-columns: 1fr 1fr; min-width: 280px; gap: 32px; }
  .summary-person-line strong { font-size: 1.1rem; }
  .settings-actions-grid { grid-template-columns: 1fr 1fr; align-items: center; }
  .file-action { grid-row: span 2; }
  .form-actions { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
@media (max-width: 700px) {
  .app-shell { padding-left: 18px; padding-right: 18px; }
  .hero.compact { padding-bottom: 22px; }
  .panel, .overview-tree-column { padding: 18px; }
  .summary-card.accent { padding: 20px; }
  .summary-card-row { align-items: center; gap: 16px; }
  .summary-people { min-width: 100px; padding-left: 14px; gap: 10px; }
  .summary-person-line strong { font-size: 0.83rem; }
  .cashflow-grid { gap: 8px; }
  .cashflow-item { gap: 8px; padding: 12px 10px; }
  .cashflow-icon { width: 28px; height: 28px; border-radius: 9px; font-size: 1.05rem; }
  .cashflow-item .label { font-size: 0.72rem; }
  .cashflow-item strong { font-size: 1rem; }
  .panel-heading:has(.wide-create-button) { flex-direction: row; align-items: center; }
  .overview-node-head { align-items: center; }
  .summary-caption { margin-bottom: 20px; }
}
@media (max-width: 374px) {
  .app-shell { padding-left: 12px; padding-right: 12px; }
  .summary-card.accent { padding: 18px 16px; }
  .summary-card-row { flex-direction: column; align-items: stretch; gap: 20px; }
  .summary-people { grid-template-columns: 1fr 1fr; border-left: 0; border-top: 1px solid var(--line); padding: 14px 0 0; text-align: left; }
  .summary-person-line > span { justify-content: flex-start; }
  .cashflow-icon { display: none; }
  .hero-subtitle { font-size: 0.85rem; }
  .tab-label { font-size: 0.58rem; }
}

.sync-status[data-status="draft"] .sync-dot { background: #b27b13; }
/* Interaction and layout: mobile first, with clear focus and feedback. */
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; left: 16px; top: 16px; z-index: 100; padding: 12px 18px; border-radius: 14px; color: #fff; background: #0067dc; }
.hero.compact { position: relative; }
.hero-topline { margin-bottom: 16px; }
.page-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; min-height: 32px; }
.back-button { display: inline-flex; align-items: center; gap: 2px; padding: 0 10px 0 2px; min-height: 44px; border: 0; background: transparent; color: var(--accent); font-size: 0.85rem; }
.back-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sync-status { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 9px; margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 0.68rem; font-weight: 500; }
.sync-status:disabled { opacity: 1; }
.sync-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--income); flex: 0 0 auto; }
.sync-status[data-status="saving"] .sync-dot, .sync-status[data-status="loading"] .sync-dot { width: 11px; height: 11px; background: transparent; border: 1.5px solid var(--line); border-top-color: var(--accent); animation: pull-refresh-spin 800ms linear infinite; }
.sync-status[data-status="error"], .sync-status[data-status="offline"] { color: var(--expense); }
.sync-status[data-status="error"] .sync-dot, .sync-status[data-status="offline"] .sync-dot { background: var(--expense); }
.collection-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin: 20px 0 12px; }
.search-field { position: relative; display: flex; align-items: center; min-width: 0; }
.search-field svg { position: absolute; width: 19px; height: 19px; left: 13px; stroke: var(--muted); fill: none; stroke-width: 1.7; pointer-events: none; }
.search-field input { padding-left: 40px; border-radius: 16px; background: var(--surface); border-color: var(--glass-border); box-shadow: inset 0 1px 0 var(--glass-shine); min-width: 0; }
input[type="search"] { -webkit-appearance: none; appearance: none; }
.sort-field { min-width: 0; }
.sort-field select { width: auto; max-width: 100%; padding: 12px 28px 12px 12px; background: var(--surface); border-color: var(--glass-border); border-radius: 16px; font-size: 0.8rem; }
.collection-results { margin: 0 2px 16px; color: var(--muted); font-size: 0.73rem; line-height: 1.5; }
.collapsible-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.collapsible-end { width: auto; gap: 8px; align-items: center; }
.disclosure-title { display: flex; align-items: center; justify-content: flex-start; gap: 8px; min-width: 0; padding: 0; min-height: 44px; text-align: left; border: 0; border-radius: 8px; background: transparent; color: var(--text); }
.disclosure-title > * { min-width: 0; }
.disclosure-title::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); flex: 0 0 auto; margin: 0 2px; transition: transform 180ms ease; }
.disclosure-title[aria-expanded="true"]::before { transform: rotate(45deg); }
.disclosure-title .category-card-title-row { display: grid; gap: 6px; justify-items: start; }
.disclosure-title strong { font-size: 0.94rem; line-height: 1.35; }
.collapsible-head .category-card-amount { margin: 0; font-size: 0.95rem; white-space: nowrap; }
.collapsible-card { cursor: default; }
.collapsible-card:has([aria-expanded="true"]) { border-color: var(--glass-border); background: linear-gradient(140deg, var(--glass-reflection), transparent), var(--surface); }
.category-card-info { border-top: 1px solid var(--line); padding-top: 16px; gap: 12px; }
.category-card-info.hidden { border: 0; padding: 0; }
.info-row dd { line-height: 1.5; overflow-wrap: anywhere; }
.form-group { display: grid; gap: 18px; min-width: 0; margin: 0; padding: 18px 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.form-group legend { padding: 0 10px 0 0; color: var(--muted); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; }
.entry-form .form-group + .form-group { margin-top: 10px; }
.form-group .inline-fields { min-width: 0; }
.entry-form input, .entry-form select { min-width: 0; max-width: 100%; }
.entry-form .toggle-row { gap: 12px; min-height: 44px; }
.entry-form .toggle-row > span { line-height: 1.4; }
.entry-form .form-actions { padding-top: 8px; }
input[type="date"], input[type="month"] { min-inline-size: 0; -webkit-appearance: none; appearance: none; }
input[type="date"]::-webkit-date-and-time-value, input[type="month"]::-webkit-date-and-time-value { text-align: left; }
.editor-dock { position: fixed; display: flex; align-items: center; gap: 8px; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + var(--keyboard-inset, 0px)); width: min(calc(100% - 32px), 560px); padding: 8px; z-index: 35; border-radius: 28px; border: 1px solid var(--glass-border); background: linear-gradient(130deg, var(--glass-reflection), transparent), var(--chrome-surface); -webkit-backdrop-filter: blur(32px) saturate(170%); backdrop-filter: blur(32px) saturate(170%); box-shadow: var(--shadow), 0 12px 36px rgba(26, 45, 78, 0.16); }
.editor-dock > button { flex: 1; border-radius: 20px; min-height: 48px; font-size: 0.9rem; }
.editor-dock > .primary-button { flex: 1.5; }
.primary-button { background: #0067dc; color: #fff; border: 1px solid transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 3px 8px rgba(0, 85, 200, 0.15); }
.primary-button span { margin-left: 8px; }
.is-editing .tab-bar, .keyboard-open .tab-bar { display: none; }
.is-editing .hero-subtitle { font-size: 0.85rem; }
.toast-region { position: fixed; z-index: 60; bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--keyboard-inset, 0px)); left: 50%; transform: translateX(-50%); width: min(calc(100% - 32px), 520px); pointer-events: none; }
.toast { display: grid; align-items: center; grid-template-columns: 24px minmax(0, 1fr) 44px; gap: 8px 10px; padding: 14px 12px 14px 16px; border-radius: 22px; border: 1px solid var(--glass-border); background: var(--surface-strong); color: var(--text); -webkit-backdrop-filter: blur(32px); backdrop-filter: blur(32px); box-shadow: var(--shadow), 0 8px 32px rgba(26, 45, 78, 0.16); pointer-events: auto; font-size: 0.82rem; line-height: 1.5; animation: toast-enter 220ms ease-out; }
.toast-symbol { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-soft); color: var(--expense); font-weight: 700; }
.toast-success { pointer-events: none; }
.toast-success .toast-close { pointer-events: auto; }
.toast-success .toast-symbol { color: var(--income); }
.toast > button:not(.toast-close) { grid-column: 2; min-height: 40px; padding: 4px 8px; justify-self: start; color: var(--accent); background: var(--surface-soft); border: 0; font-size: 0.78rem; }
.toast .toast-close { grid-column: 3; grid-row: 1; align-self: start; color: var(--muted); background: transparent; border: 0; min-width: 44px; min-height: 44px; padding: 0; font-size: 1.3rem; }
.action-dialog { color: var(--text); width: min(calc(100% - 32px), 440px); max-height: 85dvh; padding: 28px 24px 22px; border-radius: 30px; border: 1px solid var(--glass-border); background: var(--surface-strong); -webkit-backdrop-filter: blur(40px) saturate(150%); backdrop-filter: blur(40px) saturate(150%); box-shadow: 0 24px 80px rgba(10, 24, 50, 0.24), inset 0 1px 1px var(--glass-shine); }
.action-dialog[open] { animation: dialog-enter 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.action-dialog::backdrop { background: rgba(13, 25, 48, 0.38); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.action-dialog form { display: grid; gap: 16px; }
.action-dialog h2 { font-size: 1.35rem; letter-spacing: -0.03em; }
.action-dialog p { color: var(--muted); font-size: 0.92rem; line-height: 1.6; }
.dialog-symbol { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 15px; color: var(--expense); background: var(--surface-soft); font-size: 1.4rem; font-weight: 650; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.danger-button { background: #ad3547; color: #fff; border: 0; }
.modal-open { overflow: hidden; }
.loading-panel { min-height: 350px; display: flex; align-items: center; flex-direction: column; justify-content: center; gap: 16px; text-align: center; padding: 36px 24px; border-radius: 28px; background: var(--surface); border: 1px solid var(--glass-border); box-shadow: var(--shadow); }
.loading-panel p { color: var(--muted); font-size: 0.9rem; line-height: 1.5; max-width: 30ch; }
.loading-symbol { width: 28px; height: 28px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: pull-refresh-spin 800ms linear infinite; }
.load-failed .loading-symbol { animation: none; border-color: var(--expense); }
.skeleton-lines { display: grid; gap: 12px; width: 100%; margin-top: 12px; }
.skeleton-lines span { height: 14px; border-radius: 10px; background: linear-gradient(90deg, var(--surface-soft), var(--surface-strong), var(--surface-soft)); background-size: 200% 100%; animation: skeleton-shimmer 1.6s ease infinite; }
.skeleton-lines span:nth-child(2) { width: 70%; }
.skeleton-lines span:nth-child(3) { width: 85%; }
.load-failed .skeleton-lines { display: none; }
body:not(.is-loading) .loading-panel, .is-loading .content { display: none; }
.is-loading .tab-bar { opacity: 0.5; pointer-events: none; }
.empty-state { display: grid; justify-items: center; gap: 12px; padding: 28px 18px; border-style: solid; border-color: var(--glass-border); background: var(--surface); }
.empty-title { font-size: 1rem; color: var(--text); }
.empty-state p { max-width: 34ch; }
.empty-state button { margin-top: 2px; font-size: 0.83rem; }
.utility-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: var(--surface); border: 1px solid var(--glass-border); box-shadow: inset 0 1px 0 var(--glass-shine); color: var(--accent); flex: 0 0 auto; }
.utility-warmwater { color: var(--expense); }
.utility-electricity { color: #8c6717; }
.utility-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.consumption-insights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 18px; }
.consumption-insights > div { display: grid; align-content: start; gap: 7px; padding: 4px 0; min-width: 0; }
.consumption-insights span { font-size: 0.68rem; }
.consumption-insights strong { font-size: 0.92rem; color: var(--text); overflow-wrap: anywhere; }
.screen.active { animation: screen-appear 240ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.tab-button { transition: background 220ms ease, box-shadow 220ms ease, color 180ms ease; }
.tab-button.active svg { animation: icon-select 280ms ease-out; }
@keyframes icon-select { 0% { transform: scale(0.84); } 65% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes toast-enter { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes skeleton-shimmer { to { background-position: -200% 0; } }
@media (hover: hover) {
  .overview-node-head:hover, .disclosure-title:hover { background: var(--surface-soft); }
  .category-card:has(.disclosure-title:hover) { box-shadow: 0 6px 18px rgba(25, 48, 85, 0.06); }
  .primary-button:hover, button[type="submit"]:hover, .wide-create-button:hover { filter: brightness(1.07); }
}
@media (min-width: 900px) { .consumption-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; } .consumption-grid .overview-column-head { gap: 12px 4px; } .consumption-grid .overview-column-head > button { margin-left: 0; } }
@media (max-width: 700px) {
  .collection-tools { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .sort-field { justify-self: end; }
  .sort-field select { min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
  .collapsible-head { display: grid; flex-direction: row; align-items: center; }
  .collapsible-end { width: auto; gap: 4px; margin-left: 0; }
  .disclosure-title { width: 100%; }
  .category-card-amount { font-size: 0.9rem; }
  .category-menu-button { min-width: 44px; padding: 0; }
  .entry-form .form-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .entry-form .form-actions > button[type="submit"] { grid-column: 1 / -1; }
  .action-dialog { position: fixed; bottom: max(16px, env(safe-area-inset-bottom)); top: auto; margin: auto; }
  .form-group { gap: 16px; }
}
@media (min-width: 375px) and (max-width: 700px) { .form-group .inline-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 374px) { .collapsible-end { flex-direction: column; align-items: flex-end; gap: 0; } .collection-results { font-size: 0.7rem; } .page-toolbar { margin-bottom: 8px; } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .panel, .summary-card, .overview-tree-column, .tab-bar.fixed-bottom, .editor-dock, .toast, .action-dialog { background: var(--surface-strong); }
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1220;
    --surface: rgba(25, 35, 54, 0.5);
    --surface-strong: rgba(34, 49, 75, 0.72);
    --surface-soft: rgba(85, 110, 153, 0.19);
    --text: #eef3ff;
    --muted: #a4b2ca;
    --line: rgba(185, 205, 242, 0.13);
    --chrome-surface: rgba(25, 35, 54, 0.68);
    --glass-border: rgba(201, 221, 255, 0.22);
    --glass-shine: rgba(223, 235, 255, 0.32);
    --glass-reflection: rgba(193, 218, 255, 0.09);
    --accent: #82b5ff;
    --income: #73d6aa;
    --expense: #ff9caa;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  }
  body { background: radial-gradient(ellipse at 0% 12%, rgba(43, 87, 168, 0.55), transparent 55%), radial-gradient(ellipse at 110% 42%, rgba(94, 58, 157, 0.4), transparent 50%), radial-gradient(ellipse at 65% 110%, rgba(30, 120, 134, 0.35), transparent 50%), var(--bg); }
  .summary-card.accent, .tab-bar.fixed-bottom { border-color: var(--glass-border); }
  .tab-bar.fixed-bottom { box-shadow: 0 8px 36px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06); }
  .tab-button.active { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
  button[type="submit"], .wide-create-button { background: #2369d7; }
  .brand svg, .toggle-row input:checked { background: #2369d7; }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --surface: #fff; --surface-strong: #fff; --chrome-surface: #fff; }
  .summary-card.accent { background: var(--surface); }
  .tab-bar.fixed-bottom, .panel, .summary-card, .overview-tree-column, .tree-node-card, .category-card, .person-balance-card, .hero-date, .editor-dock, .toast, .action-dialog { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-color-scheme: dark) and (prefers-reduced-transparency: reduce) {
  :root { --surface: #192336; --surface-strong: #202d43; --chrome-surface: #192336; }
}
@media (prefers-contrast: more) {
  :root { --muted: #38465d; --line: #8995a8; --surface: #fff; }
  .tab-bar.fixed-bottom { border-color: var(--line); }
}
@media (prefers-color-scheme: dark) and (prefers-contrast: more) {
  :root { --muted: #d0daeb; --line: #71829d; --surface: #192336; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Recipes: the existing glass surfaces, with a quiet kitchen accent. */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.recipe-import-panel { background: linear-gradient(145deg, rgba(76, 172, 141, 0.12), transparent 70%), var(--surface); }
.recipe-import-panel .summary-kicker { display: block; margin-bottom: 8px; color: var(--income); }
.recipe-import-form { display: grid; gap: 12px; }
.recipe-import-form > label, .recipe-import-form details > label { font-size: 0.83rem; font-weight: 550; }
.recipe-link-row { display: flex; gap: 10px; }
.recipe-link-row input { min-width: 0; flex: 1; }
.recipe-link-row button { flex: 0 0 auto; background: var(--accent); color: var(--bg); }
.recipe-import-form details, .recipe-help { border-top: 1px solid var(--line); padding-top: 14px; }
.recipe-import-form summary, .recipe-help summary { cursor: pointer; color: var(--accent); font-size: 0.85rem; min-height: 36px; line-height: 1.5; }
.recipe-import-form details p, .recipe-help p { font-size: 0.83rem; line-height: 1.65; margin-bottom: 12px; }
.recipe-import-form details textarea { margin-top: 8px; }
.recipe-import-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0; }
#recipe-import-status:empty { display: none; }
#recipe-import-status { line-height: 1.6; overflow-wrap: anywhere; }
#recipe-ai-option { align-items: flex-start; font-size: 0.8rem; line-height: 1.6; }
#recipe-ai-option input { width: 22px; min-height: 22px; flex: 0 0 22px; }
.recipe-search { display: block; margin-bottom: 18px; }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 16px; }
.recipe-card { display: flex; flex-direction: column; text-align: left; padding: 0; overflow: hidden; border: 1px solid var(--glass-border); border-radius: 20px; background: var(--surface); color: var(--text); min-width: 0; width: 100%; }
.recipe-picture { position: relative; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; background: linear-gradient(135deg, rgba(91, 164, 131, 0.2), rgba(208, 174, 107, 0.15)); display: grid; place-items: center; }
.recipe-picture-placeholder { font-size: 3.2rem; font-weight: 400; color: var(--income); opacity: 0.6; }
.recipe-picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.recipe-card-body { display: grid; gap: 8px; padding: 16px; width: 100%; }
.recipe-card h3 { margin: 0; font-size: 1.05rem; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.recipe-source-label { color: var(--muted); font-size: 0.7rem; font-weight: 500; overflow-wrap: anywhere; }
.recipe-card .hint { font-size: 0.75rem; }
.recipe-badge { width: fit-content; font-size: 0.7rem; color: var(--expense); padding: 5px 8px; border-radius: 8px; background: var(--surface-soft); }
.recipe-empty { grid-column: 1 / -1; text-align: center; padding: 30px 12px; display: grid; gap: 12px; }
.recipe-empty-title { font-weight: 650; font-size: 1.05rem; }
.recipe-empty p { max-width: 360px; margin: auto; line-height: 1.65; }
#recipe-show-more { margin-top: 16px; }
#recipe-detail { scroll-margin-top: 20px; }
.recipe-detail-heading { gap: 16px; flex-direction: row; }
.recipe-detail-heading h2 { font-size: 1.5rem; overflow-wrap: anywhere; }
.recipe-detail-picture { max-height: 340px; border-radius: 18px; margin-bottom: 16px; }
.recipe-source-links { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; font-size: 0.85rem; }
.recipe-source-links a { color: var(--accent); padding: 8px 0; }
.recipe-notice { border-radius: 14px; background: var(--surface-soft); padding: 12px 16px; margin-bottom: 18px; font-size: 0.8rem; color: var(--muted); line-height: 1.6; }
.recipe-notice ul { padding-left: 16px; margin: 0; }
.recipe-servings { display: grid; gap: 12px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.recipe-servings > label { font-weight: 650; }
.recipe-serving-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.recipe-serving-controls input { width: 80px; text-align: center; font-weight: 650; padding: 10px 6px; }
.recipe-serving-controls button { min-width: 48px; }
.recipe-servings p { font-size: 0.78rem; line-height: 1.6; }
.recipe-cooking-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.2fr); gap: 36px; }
.recipe-cooking-grid h3 { margin: 0 0 14px; font-size: 1rem; }
.recipe-ingredient-list { padding: 0; list-style: none; margin: 0; }
.recipe-ingredient-list li { border-bottom: 1px solid var(--line); }
.recipe-ingredient-list label { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; cursor: pointer; font-size: 0.9rem; line-height: 1.6; overflow-wrap: anywhere; }
.recipe-ingredient-list input { width: 20px; min-height: 20px; height: 20px; margin: 2px 0 0; flex: 0 0 20px; accent-color: var(--income); }
.recipe-ingredient-list input:checked + span { text-decoration: line-through; color: var(--muted); }
.recipe-step-list { margin: 0; padding-left: 26px; font-size: 0.9rem; line-height: 1.8; }
.recipe-step-list li { padding: 0 0 18px 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.recipe-step-list li::marker { color: var(--income); font-weight: 650; }
.recipe-cooking-hint { margin-top: 20px; font-size: 0.76rem; line-height: 1.65; }
.recipe-notes { white-space: pre-wrap; font-size: 0.9rem; line-height: 1.7; margin: 12px 0; overflow-wrap: anywhere; }
.recipe-actions { margin-top: 20px; }
#recipe-form .form-group { min-width: 0; }
@media (max-width: 600px) {
  .recipe-cooking-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .recipe-card-body { padding: 12px; }
  .recipe-card h3 { font-size: 0.9rem; }
  .recipe-import-footer { align-items: flex-start; }
  .recipe-import-footer > .hint { font-size: 0.75rem; line-height: 1.6; }
  .recipe-link-row { flex-direction: column; }
  .recipe-detail-heading { align-items: flex-start; }
  .recipe-detail-heading h2 { font-size: 1.25rem; }
}
@media (max-width: 360px) {
  .tab-bar.fixed-bottom { width: calc(100% - 12px); gap: 0; padding: 4px; }
  .tab-label { font-size: 0.57rem; }
}

/* Household home: every area has the same space and visual weight. */
.home-section-heading { margin-bottom: 14px; }
.home-section-heading h2 { font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.home-menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 16px; }
.home-menu-card { display: flex; flex-direction: column; gap: 5px; padding: 20px; text-align: left; border-radius: 22px; border: 1px solid var(--glass-border); background: var(--surface); box-shadow: var(--shadow); color: var(--text); min-width: 0; }
.home-menu-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-height: 32px; }
.home-menu-icon { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 10px; background: var(--surface-soft); color: var(--accent); display: grid; place-items: center; }
.home-menu-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.home-menu-title { font-size: 1rem; font-weight: 650; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.home-menu-arrow { margin-left: auto; color: var(--muted); font-size: 0.9rem; }
.home-menu-stat { font-size: 1.15rem; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.home-menu-description { font-size: 0.76rem; font-weight: 450; color: var(--muted); line-height: 1.4; }
.home-menu-facts { display: grid; align-content: start; gap: 5px; margin-top: 10px; font-size: 0.76rem; line-height: 1.45; color: var(--muted); font-weight: 450; }
.home-menu-facts > span { overflow-wrap: anywhere; }
.is-home .hero.compact { padding-bottom: 16px; }
.is-home .hero-topline { margin-bottom: 6px; }
.is-home .page-toolbar { margin-bottom: 4px; }
@media (max-width: 700px) {
  .home-menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .home-menu-card { padding: 14px; }
  .home-menu-top { gap: 6px; margin-bottom: 7px; }
  .home-menu-title { font-size: 0.9rem; }
  .home-menu-icon { width: 26px; height: 26px; flex-basis: 26px; border-radius: 8px; }
  .home-menu-icon svg { width: 18px; height: 18px; }
  .home-menu-stat { font-size: 1.05rem; }
  .home-menu-description { font-size: 0.7rem; }
  .home-menu-facts { font-size: 0.7rem; gap: 4px; }
}
@media (max-width: 400px) {
  .tab-bar.fixed-bottom { width: calc(100% - 4px); padding: 2px; gap: 0; }
  .tab-button.icon-tab { min-width: 44px; }
  .tab-button.icon-tab svg { width: 20px; height: 20px; }
  .tab-label { font-size: 0.56rem; }
  .home-menu-card { padding: 12px; }
  .home-menu-top { flex-wrap: wrap; }
  .home-menu-title { flex: 1; min-width: 0; }
  .home-menu-arrow { display: none; }
}
@media (prefers-reduced-transparency: reduce) { .home-menu-card { background: var(--surface-strong); } }
.home-menu-facts > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.is-home .page-toolbar { position: absolute; top: 42px; right: 4px; margin: 0; }
.is-home #screen-title { padding-right: 110px; font-size: 1.8rem; }
@media (max-width: 700px) {
  .home-menu-grid { gap: 10px; }
  .home-menu-card { gap: 4px; }
  .home-menu-top { margin-bottom: 4px; }
  .home-menu-facts { margin-top: 8px; gap: 3px; }
}

/* Cooking is a separate, opaque surface with no household navigation. */
.recipe-cook-entry { display: grid; justify-items: start; gap: 8px; margin: 8px 0 20px; }
.recipe-cook-entry p { font-size: 0.78rem; line-height: 1.6; }
.cook-primary { background: var(--accent); color: var(--bg); border-color: transparent; font-weight: 650; }
body.is-cooking { overflow: hidden; background: var(--bg); }
.is-cooking > .app-shell, .is-cooking > .pull-refresh, .is-cooking > .toast-region, .is-cooking > .editor-dock { display: none; }
.cook-dialog { position: fixed; inset: 0; margin: 0; padding: 0; border: 0; border-radius: 0; width: 100%; max-width: none; height: 100%; height: 100dvh; max-height: none; background: var(--bg); color: var(--text); overflow-y: auto; overscroll-behavior: contain; }
.cook-dialog::backdrop { background: var(--bg); }
.cook-shell { display: flex; flex-direction: column; gap: 18px; min-height: 100%; width: min(100%, 1040px); margin: auto; padding: max(18px, env(safe-area-inset-top)) 24px max(14px, env(safe-area-inset-bottom)); }
.cook-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.cook-header > div { min-width: 0; }
.cook-eyebrow { display: block; font-size: 0.67rem; letter-spacing: 0.12em; font-weight: 650; color: var(--muted); margin-bottom: 6px; }
.cook-header h1 { font-size: 1.05rem; line-height: 1.4; letter-spacing: -0.02em; font-weight: 600; }
.cook-header > button { flex-shrink: 0; font-size: 0.8rem; min-height: 44px; padding: 8px 12px; }
.cook-content { flex: 1; min-width: 0; }
.cook-content h2 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); line-height: 1.25; letter-spacing: -0.035em; outline-offset: 6px; }
.cook-content h3 { font-size: 1.05rem; margin: 0; }
.cook-muted { color: var(--muted); }
.cook-small { font-size: 0.8rem; line-height: 1.65; }
.cook-intro { margin: 10px 0 26px; }
.cook-intro p { margin-top: 10px; line-height: 1.6; font-size: 0.95rem; }
.cook-setup-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 20px; align-items: start; }
.cook-card { padding: 22px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-strong); min-width: 0; }
.cook-portions-form { display: grid; gap: 16px; }
.cook-field { display: grid; gap: 8px; }
.cook-field > span, .cook-portions-form > label { font-weight: 600; }
.cook-portion-controls { display: flex; align-items: center; gap: 12px; }
.cook-portion-controls > button { min-width: 54px; min-height: 54px; font-size: 1.3rem; }
.cook-portion-controls > input { width: 100px; text-align: center; font-size: 1.6rem; font-weight: 650; min-height: 58px; padding: 8px; }
.cook-text-button { border: 0; background: transparent; color: var(--accent); padding: 10px 0; text-decoration: underline; text-underline-offset: 3px; text-align: left; font-size: 0.85rem; margin-top: 10px; }
.cook-section-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.cook-ingredient-list { list-style: none; padding: 0; margin: 14px 0 0; }
.cook-ingredient-list li { border-bottom: 1px solid var(--line); }
.cook-ingredient-list li:last-child { border-bottom: 0; }
.cook-ingredient-list label { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; cursor: pointer; }
.cook-ingredient-list input { flex: 0 0 22px; width: 22px; height: 22px; min-height: 22px; margin: 2px 0 0; accent-color: var(--accent); }
.cook-ingredient-text { display: grid; gap: 5px; min-width: 0; }
.cook-ingredient-text strong { font-size: 1rem; line-height: 1.55; font-weight: 550; overflow-wrap: anywhere; }
.cook-ingredient-text small { color: var(--muted); font-size: 0.76rem; line-height: 1.6; overflow-wrap: anywhere; }
.cook-ingredient-list input:checked + .cook-ingredient-text strong { text-decoration: line-through; color: var(--muted); }
.cook-progress-row { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: 0.85rem; font-weight: 600; margin: 8px 0 12px; }
.cook-content progress { width: 100%; height: 6px; display: block; accent-color: var(--accent); border: 0; border-radius: 8px; overflow: hidden; }
.cook-content progress::-webkit-progress-bar { background: var(--line); }
.cook-content progress::-webkit-progress-value { background: var(--accent); }
.cook-step-card { margin: 32px 0 24px; max-width: 790px; }
.cook-step-text { font-size: clamp(1.2rem, 2.8vw, 1.7rem); line-height: 1.75; letter-spacing: -0.01em; white-space: pre-wrap; overflow-wrap: anywhere; margin: 18px 0 24px; }
.cook-next-preview { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 24px; color: var(--muted); }
.cook-next-preview summary { cursor: pointer; min-height: 44px; font-size: 0.85rem; }
.cook-next-preview p { font-size: 0.9rem; line-height: 1.8; padding-bottom: 16px; white-space: pre-wrap; }
.cook-utilities { display: flex; flex-wrap: wrap; gap: 8px; }
.cook-utilities > button { font-size: 0.8rem; min-height: 44px; padding: 8px 13px; }
.cook-awake { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.cook-feedback { font-size: 0.8rem; color: var(--muted); line-height: 1.6; }
.cook-feedback:has(p:empty):not(:has(button:not(.hidden))) { display: none; }
.cook-footer { position: sticky; bottom: calc(-1 * max(14px, env(safe-area-inset-bottom))); display: grid; grid-template-columns: minmax(100px, 0.6fr) minmax(0, 1fr); gap: 12px; padding: 14px 0 max(14px, env(safe-area-inset-bottom)); margin-top: 4px; background: var(--bg); border-top: 1px solid var(--line); z-index: 2; }
.cook-footer > button { min-height: 56px; padding: 10px 14px; font-size: 1rem; }
.cook-sheet { position: fixed; z-index: 5; inset: auto 0 0; max-height: 88%; max-height: 88dvh; width: min(100%, 760px); margin: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 26px 26px 0 0; padding: 0 24px max(22px, env(safe-area-inset-bottom)); overflow-y: auto; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.5); overscroll-behavior: contain; }
.cook-sheet-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 0; background: var(--bg); z-index: 1; }
.cook-sheet h2 { font-size: 1.1rem; line-height: 1.5; }
.cook-sheet-head > button { flex-shrink: 0; min-height: 44px; }
.cook-notes { line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem; }
.cook-step-index { padding-left: 28px; margin: 4px 0; }
.cook-step-index li { margin-bottom: 10px; }
.cook-step-index button { text-align: left; width: 100%; background: var(--surface-strong); color: var(--text); padding: 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.cook-step-index button[aria-current] { border: 2px solid var(--accent); }
.cook-timer-readout { display: block; font-size: 2.4rem; margin: 10px 0; font-variant-numeric: tabular-nums; }
.cook-timer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.cook-timer-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin: 24px 0 16px; }
.cook-timer-form label { grid-column: 1 / -1; font-weight: 600; }
.cook-timer-form input { min-width: 0; }
.cook-timer-form button { padding: 10px 14px; }
.cook-sheet-content > p, #cook-sheet-content > p { margin: 16px 0; }
.cook-timer-finished { border-color: var(--expense); color: var(--expense); }
.cook-done { text-align: center; padding: clamp(24px, 8vh, 90px) 0; display: grid; gap: 18px; line-height: 1.7; }
.cook-done-mark { display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 10px; border-radius: 50%; background: var(--surface-soft); color: var(--income); font-size: 2.4rem; }
@media (max-width: 700px) {
  .cook-shell { padding-left: 18px; padding-right: 18px; gap: 16px; }
  .cook-header { gap: 10px; }
  .cook-setup-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .cook-card { padding: 18px; }
  .cook-step-card { margin-top: 26px; }
  .cook-sheet { padding-left: 18px; padding-right: 18px; }
  .cook-timer-form { grid-template-columns: minmax(0, 1fr); }
}
.cook-dialog { overflow: hidden; }
.cook-shell { height: 100%; min-height: 0; }
.cook-header, .cook-utilities, .cook-feedback { flex-shrink: 0; }
.cook-header h1 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.cook-content { min-height: 0; overflow-y: auto; padding: 3px; overscroll-behavior: contain; }
.cook-footer { position: static; flex-shrink: 0; padding-bottom: 0; }
.cook-step-index li > p { padding: 14px; line-height: 1.7; white-space: pre-wrap; }
.keyboard-open .cook-dialog { height: calc(100dvh - var(--keyboard-inset, 0px)); }
.cook-sheet { bottom: var(--keyboard-inset, 0px); max-height: calc(88dvh - var(--keyboard-inset, 0px)); }

/* Source-backed nutrition values, with explicit gaps and editable food matches. */
#screen-recipes, #recipe-detail, #recipe-nutrition { min-width: 0; }
.nutrition-panel { border: 1px solid var(--line); background: var(--surface-soft); border-radius: 18px; padding: 18px; margin: 4px 0 24px; min-width: 0; }
.nutrition-panel h3 { font-size: 1rem; margin: 0 0 16px; }
.nutrition-macro-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; }
.nutrition-macro-grid > div { min-width: 0; display: grid; align-content: start; gap: 6px; }
.nutrition-macro-grid dt { color: var(--muted); font-size: 0.72rem; overflow-wrap: anywhere; }
.nutrition-macro-grid dd { color: var(--text); font-size: 1rem; font-weight: 650; overflow-wrap: anywhere; }
.nutrition-status { font-size: 0.76rem; color: var(--muted); line-height: 1.65; margin: 14px 0 10px; }
.nutrition-panel > .hint { font-size: 0.76rem; line-height: 1.6; margin: 10px 0; }
.nutrition-details { border-top: 1px solid var(--line); padding-top: 12px; }
.nutrition-details > summary { cursor: pointer; min-height: 44px; color: var(--accent); font-size: 0.8rem; line-height: 1.65; }
.nutrition-table-scroll { width: 100%; overflow-x: auto; margin: 12px 0; }
.nutrition-table-scroll:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.nutrition-panel table { width: 100%; min-width: 410px; border-collapse: collapse; font-size: 0.75rem; }
.nutrition-panel th, .nutrition-panel td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: right; vertical-align: top; }
.nutrition-panel th:first-child { text-align: left; }
.nutrition-panel thead th { color: var(--muted); font-weight: 600; }
.nutrition-panel td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.nutrition-panel td small { display: block; font-size: 0.65rem; color: var(--muted); margin-top: 4px; }
.nutrition-source { font-size: 0.72rem; color: var(--muted); line-height: 1.7; margin-top: 12px; }
.nutrition-source a { color: var(--accent); }
.nutrition-details > .hint { font-size: 0.74rem; line-height: 1.65; margin-top: 12px; }
.nutrition-ingredient-button { display: block; width: 100%; min-height: 44px; font-size: 0.72rem; font-weight: 450; line-height: 1.65; text-align: left; padding: 6px 0 10px 32px; background: transparent; border: 0; color: var(--accent); overflow-wrap: anywhere; }
.nutrition-ingredient-button small { display: block; font-size: 0.7rem; color: var(--muted); margin-top: 3px; }
.nutrition-dialog { position: fixed; inset: 0; width: min(calc(100% - 28px), 700px); max-height: calc(100dvh - 32px); margin: auto; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 24px; padding: 0 24px 20px; overscroll-behavior: contain; }
.nutrition-dialog::backdrop { background: rgba(10, 18, 32, 0.6); }
.nutrition-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; position: sticky; top: 0; padding: 20px 0 14px; background: var(--bg); z-index: 1; }
.nutrition-dialog h2 { font-size: 1.2rem; line-height: 1.4; }
.nutrition-dialog-head button { min-height: 44px; flex-shrink: 0; }
.nutrition-original { font-size: 0.9rem; font-weight: 600; line-height: 1.65; margin-bottom: 20px; overflow-wrap: anywhere; }
.nutrition-form, #nutrition-fields { display: grid; gap: 16px; }
.nutrition-form label { display: grid; gap: 7px; min-width: 0; font-size: 0.82rem; font-weight: 550; }
.nutrition-form .hint { font-size: 0.76rem; font-weight: 450; line-height: 1.6; }
.nutrition-input-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.nutrition-form input[readonly] { color: var(--muted); background: var(--surface-soft); }
.nutrition-search-results { display: grid; gap: 6px; max-height: 230px; overflow-y: auto; margin: 10px 0; }
.nutrition-food-option { width: 100%; padding: 12px; min-height: 44px; font-size: 0.8rem; font-weight: 450; line-height: 1.65; text-align: left; color: var(--text); background: var(--surface-strong); overflow-wrap: anywhere; }
.nutrition-food-option[aria-pressed=true] { border: 2px solid var(--accent); }
.nutrition-dialog-actions { position: sticky; bottom: -20px; background: var(--bg); padding: 14px 0 20px; border-top: 1px solid var(--line); }
.nutrition-dialog-actions button { min-height: 52px; width: 100%; }
.nutrition-compact { padding: 12px; margin: 12px 0; }
.nutrition-compact > summary { cursor: pointer; color: var(--accent); min-height: 28px; padding: 4px 0; font-size: 0.8rem; line-height: 1.65; }
.nutrition-compact[open] > summary { margin-bottom: 14px; }

/* Per-person diary: the same surfaces and equal dashboard card as every other area. */
#screen-nutrition, .tracker-overview, #tracker-summary, #tracker-week, #tracker-week-content { min-width: 0; }
.tracker-profile-row { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.tracker-profile-row > label { display: grid; gap: 7px; flex: 1 1 100px; font-size: 0.85rem; font-weight: 600; min-width: 0; }
.tracker-profile-row > button { font-size: 0.8rem; min-height: 48px; }
#tracker-profile-edit { font-size: 1.5rem; width: 44px; padding: 6px; }
#tracker-profile-new { padding: 8px 12px; }
.tracker-date-row { display: flex; gap: 8px; align-items: center; margin-bottom: 24px; }
.tracker-date-row label { min-width: 0; flex: 1; }
.tracker-date-row input { min-width: 0; }
.tracker-date-row button { min-width: 44px; padding: 8px 12px; }
.tracker-overview > h2 { line-height: 1.6; margin-bottom: 20px; }
.tracker-overview > .cook-primary { width: 100%; margin-top: 20px; }
.tracker-source { font-size: 0.73rem; line-height: 1.75; margin-top: 18px; }
.tracker-source a { color: var(--accent); }
.tracker-macros { gap: 20px; }
.tracker-macros dd { display: grid; gap: 6px; font-size: 1.3rem; }
.tracker-macros small { font-size: 0.72rem; line-height: 1.6; font-weight: 450; }
.tracker-macros progress { width: 100%; height: 7px; accent-color: var(--accent); margin-top: 4px; }
.tracker-partial { color: var(--muted); }
.tracker-more-values { font-size: 0.8rem; }
.tracker-more-values > summary { cursor: pointer; min-height: 44px; padding: 10px 0; color: var(--accent); }
.tracker-value-list { display: grid; gap: 10px; padding: 12px 0; }
.tracker-value-list > div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.tracker-value-list dd { text-align: right; }
.tracker-empty { line-height: 1.8; color: var(--muted); }
.tracker-meals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.tracker-meal { min-width: 0; }
.tracker-meal-heading { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.tracker-meal-heading > button { font-size: 0.8rem; min-height: 44px; }
.tracker-entry-list { list-style: none; padding: 0; margin: 8px 0 0; }
.tracker-entry-list li { display: flex; align-items: start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tracker-entry-list li:last-child { border: 0; }
.tracker-entry-open { display: grid; flex: 1; min-width: 0; min-height: 44px; gap: 7px; color: var(--text); background: transparent; border: 0; padding: 8px 0; text-align: left; line-height: 1.7; overflow-wrap: anywhere; }
.tracker-entry-open strong { font-size: 0.95rem; font-weight: 600; }
.tracker-entry-open span { font-size: 0.85rem; }
.tracker-entry-open small { font-size: 0.75rem; color: var(--muted); }
.tracker-entry-list li > .small-action { flex-shrink: 0; }
.tracker-week-table { min-width: 460px; width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.tracker-week-table caption { text-align: left; padding: 16px 0; line-height: 1.7; }
.tracker-week-table td, .tracker-week-table th { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: right; white-space: nowrap; }
.tracker-week-table th:first-child { text-align: left; }
.tracker-week-table small { display: block; font-size: 0.65rem; color: var(--muted); }
.tracker-day-button { min-height: 44px; color: var(--accent); background: transparent; border: 0; padding: 5px; }
.tracker-day-button[aria-current] { font-weight: 700; text-decoration: underline; }
.tracker-entry-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: end; }
.tracker-entry-meta > button { font-size: 0.8rem; }
.tracker-picker-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tracker-picker-tabs button { flex: 1; font-size: 0.8rem; padding: 8px 12px; min-height: 44px; color: var(--muted); background: var(--surface-soft); }
.tracker-picker-tabs button[aria-pressed=true] { color: var(--accent); border-color: var(--accent); }
.tracker-results { max-height: 260px; }
.tracker-results .nutrition-food-option { display: grid; gap: 5px; }
.tracker-results small { color: var(--muted); font-size: 0.73rem; }
.tracker-selection { display: grid; gap: 16px; border-top: 1px solid var(--line); padding-top: 20px; min-width: 0; }
.tracker-selection h3 { font-size: 1rem; line-height: 1.7; overflow-wrap: anywhere; margin: 0; }
.tracker-selection .tracker-macros { margin: 6px 0 10px; }
.tracker-selection .tracker-macros dd { font-size: 1rem; }
.nutrition-form .tracker-check { display: flex; align-items: start; gap: 12px; font-weight: 450; line-height: 1.7; }
.tracker-check input { flex: 0 0 22px; width: 22px; height: 22px; min-height: 22px; margin: 2px 0 0; }
.tracker-dialog .form-group { min-width: 0; }
.tracker-dialog > .nutrition-dialog-head { z-index: 2; }
.tab-bar.fixed-bottom { grid-template-columns: repeat(8, minmax(44px, 1fr)); overflow-x: auto; overscroll-behavior-x: contain; }
.tab-button.icon-tab { flex-shrink: 0; min-width: 44px; }
@media (max-width: 600px) {
  .tracker-meals { grid-template-columns: minmax(0, 1fr); }
  .tracker-entry-meta { gap: 12px; }
  .tracker-macros dd { font-size: 1.1rem; }
  .tracker-date-row { gap: 5px; }
  .tracker-date-row button { padding: 7px 10px; }
}
@media (max-width: 360px) {
  .tracker-date-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; }
  #tracker-today { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .nutrition-panel { padding: 14px; }
  .nutrition-dialog { width: calc(100% - 12px); padding-left: 18px; padding-right: 18px; }
  .nutrition-dialog-head { gap: 10px; }
  .nutrition-macro-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .nutrition-macro-grid dd { font-size: 0.9rem; }
}

/* Food batches and stock movements share the app's existing surfaces. */
.tab-bar.fixed-bottom { grid-template-columns: repeat(9, minmax(44px, 1fr)); }
#screen-pantry, .pantry-overview, .pantry-card, .pantry-grid { min-width: 0; }
.pantry-main-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
.pantry-main-actions > button { flex: 1; min-height: 52px; }
.pantry-search-label { display: grid; gap: 7px; font-size: 0.8rem; font-weight: 550; }
.pantry-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 8px 0 14px; }
.pantry-filters label { display: grid; gap: 7px; font-size: 0.8rem; font-weight: 550; min-width: 0; }
.pantry-filters select { font-size: 0.8rem; padding-left: 10px; padding-right: 6px; }
.pantry-note { font-size: 0.78rem; line-height: 1.75; margin: 16px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.pantry-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.pantry-card-heading { display: grid; gap: 8px; margin-bottom: 14px; }
.pantry-card h2 { font-size: 1.1rem; line-height: 1.6; overflow-wrap: anywhere; }
.pantry-kind { font-size: 0.72rem; color: var(--muted); }
.pantry-amount { font-size: 1.5rem; font-weight: 650; margin-bottom: 10px; }
.pantry-card > .hint { font-size: 0.8rem; line-height: 1.7; }
.pantry-date-badge { margin: 14px 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-soft); font-size: 0.76rem; line-height: 1.7; }
.pantry-date-due { border: 1px solid var(--line); font-weight: 600; }
.pantry-details > summary { min-height: 44px; color: var(--accent); cursor: pointer; padding: 12px 0; font-size: 0.8rem; line-height: 1.7; }
.pantry-details[open] > summary { margin-bottom: 8px; }
.pantry-details .hint { font-size: 0.76rem; line-height: 1.7; }
.pantry-details .nutrition-input-grid { margin: 8px 0 16px; }
.pantry-details h3 { font-size: 0.9rem; line-height: 1.7; margin: 18px 0 12px; }
.pantry-nutrition { border-top: 1px solid var(--line); padding: 16px 0; min-width: 0; }
.pantry-nutrition h3 { font-size: 0.9rem; line-height: 1.7; margin: 0 0 16px; }
.pantry-nutrition .tracker-more-values p { font-size: 0.73rem; line-height: 1.7; overflow-wrap: anywhere; }
.pantry-nutrition .tracker-value-list { font-size: 0.8rem; }
.pantry-history { padding-left: 18px; margin: 10px 0; font-size: 0.76rem; color: var(--muted); line-height: 1.8; overflow-wrap: anywhere; }
.pantry-history li { margin-bottom: 10px; }
.pantry-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pantry-card-actions > button { min-height: 44px; font-size: 0.78rem; flex: 1; padding: 10px 12px; }
.pantry-dialog .nutrition-input-grid > label { min-width: 0; }
.pantry-dialog #pantry-source-chosen { overflow-wrap: anywhere; }
.pantry-dialog .tracker-value-list > div { min-width: 0; }
.pantry-card .tracker-value-list > div dd { min-width: 0; overflow-wrap: anywhere; }
.pantry-card .tracker-value-list > div dt { flex-shrink: 0; }
.pantry-used-row { padding: 14px 0; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.pantry-used-row > button { justify-self: end; }
.pantry-recipe-list { max-height: 180px; overflow-y: auto; font-size: 0.8rem; line-height: 1.8; padding-left: 20px; }
@media (max-width: 700px) { .pantry-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .pantry-grid { grid-template-columns: minmax(0, 1fr); } .pantry-nutrition .nutrition-macro-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Recipe availability and the reviewed shopping export. */
.cooking-recommendations, .cooking-card, #pantry-cooking, .shopping-dialog { min-width: 0; }
.cooking-controls { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }
.cooking-controls > label { display: grid; gap: 7px; font-size: 0.82rem; font-weight: 550; }
.cooking-controls input { max-width: 130px; }
.cooking-controls button { min-height: 48px; }
.cooking-date-option { display: flex; align-items: start; gap: 12px; line-height: 1.7; font-size: 0.78rem; color: var(--muted); margin: 12px 0; }
.cooking-footnote { font-size: 0.75rem; line-height: 1.7; margin-top: 18px; }
.cooking-recommendation-list, .cooking-pantry-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.cooking-pantry-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cooking-card { border: 1px solid var(--line); border-radius: 18px; padding: 18px; background: var(--surface-soft); }
.cooking-card h3 { font-size: 1rem; line-height: 1.6; margin: 0 0 12px; overflow-wrap: anywhere; }
.cooking-coverage { font-size: 0.9rem; font-weight: 600; line-height: 1.7; margin-bottom: 8px; }
.cooking-card > .hint { font-size: 0.76rem; line-height: 1.7; margin: 8px 0; }
.cooking-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.cooking-card-actions button { flex: 1; font-size: 0.76rem; min-height: 44px; padding: 8px 12px; }
.cooking-table { width: 100%; min-width: 490px; font-size: 0.75rem; border-collapse: collapse; }
.cooking-table td, .cooking-table th { padding: 10px 8px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: top; }
.cooking-table td { white-space: nowrap; }
.cooking-table th:first-child { text-align: left; min-width: 140px; }
.cooking-table small { display: block; font-size: 0.68rem; font-weight: 450; color: var(--muted); line-height: 1.7; margin-top: 7px; }
.shopping-dialog { width: min(calc(100% - 28px), 850px); }
.shopping-dialog h3 { font-size: 1rem; line-height: 1.6; margin: 18px 0 12px; }
.shopping-dialog .hint { font-size: 0.76rem; line-height: 1.75; }
.shopping-recipe-selection { max-height: 360px; overflow-y: auto; margin: 14px 0; }
.shopping-recipe-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(125px, 0.6fr); align-items: start; gap: 12px; padding: 16px 4px; border-bottom: 1px solid var(--line); }
.shopping-recipe-row > .hint { grid-column: 1 / -1; }
.nutrition-form .shopping-recipe-check, .shopping-item-check { display: flex; align-items: start; gap: 12px; line-height: 1.7; font-size: 0.85rem; font-weight: 550; overflow-wrap: anywhere; }
.shopping-recipe-check input, .shopping-item-check input { width: 22px; height: 22px; min-height: 22px; flex: 0 0 22px; margin: 1px 0 0; }
.shopping-item { display: grid; gap: 12px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.shopping-item > label:not(.shopping-item-check) { display: grid; gap: 7px; font-size: 0.78rem; }
.shopping-item small { font-size: 0.72rem; line-height: 1.7; color: var(--muted); }
.shopping-connection { padding-top: 14px; border-top: 1px solid var(--line); margin: 22px 0; }
.shopping-connection button { margin: 12px 0; min-height: 44px; font-size: 0.8rem; }
.shopping-footer { display: grid; grid-template-columns: minmax(0, 0.55fr) minmax(0, 1fr); gap: 10px; }
.shopping-footer button { font-size: 0.85rem; min-height: 52px; padding: 10px; }
#shopping-copy-label { display: grid; gap: 8px; font-size: 0.8rem; }
@media (max-width: 700px) { .cooking-pantry-list { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .cooking-recommendation-list { grid-template-columns: minmax(0, 1fr); }
  .shopping-recipe-row { grid-template-columns: minmax(0, 1fr); }
  .shopping-recipe-row input[type=number] { max-width: 160px; }
  .shopping-dialog { width: calc(100% - 12px); }
}

/* Product scanning stays local; the review uses the existing nutrition form. */
.barcode-main-actions, .barcode-camera-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.barcode-main-actions > button, .barcode-camera-actions > button { flex: 1 1 150px; min-height: 48px; font-size: 0.85rem; }
.barcode-dialog { max-width: 620px; }
.barcode-dialog .hint { line-height: 1.7; overflow-wrap: anywhere; }
.barcode-dialog h3 { font-size: 1rem; line-height: 1.6; margin: 18px 0 10px; }
.barcode-capture { display: grid; gap: 14px; }
.barcode-video-wrap { position: relative; background: #101923; overflow: hidden; border-radius: 14px; height: 220px; }
.barcode-video-wrap video { display: block; width: 100%; height: 100%; object-fit: cover; }
.barcode-viewfinder { position: absolute; inset: 22% 8%; border: 3px solid white; border-radius: 12px; box-shadow: 0 0 0 80px #0005; pointer-events: none; }
.barcode-photo-label { position: relative; display: grid; place-items: center; min-height: 48px; cursor: pointer; font-size: 0.85rem; }
.barcode-photo-label input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.barcode-photo-label:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.barcode-lookup-form { display: grid; gap: 10px; }
.barcode-lookup-form label { display: grid; gap: 8px; font-size: 0.85rem; }
.barcode-lookup-form input { font-size: 16px; letter-spacing: 0.06em; }
#barcode-status { min-height: 24px; margin: 16px 0; }
#barcode-product-form { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 10px; }
#barcode-stock-options { display: grid; gap: 10px; }
#barcode-stock-options button { min-height: 48px; white-space: normal; text-align: left; line-height: 1.6; }
#barcode-product-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#barcode-product-form label, #barcode-product-form input, #barcode-product-form select { min-width: 0; }
#barcode-ingredients, #barcode-allergens { white-space: pre-wrap; }
#barcode-use { width: 100%; min-height: 52px; white-space: normal; }
@media (max-width: 400px) { .barcode-dialog { width: calc(100% - 12px); } .barcode-dialog .nutrition-dialog-head h2 { font-size: 1.1rem; } }
.barcode-photo-label { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--surface-soft); text-align: center; line-height: 1.5; font-weight: 550; color: var(--accent); }
#barcode-product-heading { scroll-margin-top: 90px; }
.https-address-label { display: grid; gap: 8px; margin: 18px 0 10px; font-size: 0.85rem; }
.https-address-label input { min-width: 0; font-size: 16px; }
.https-access-link { display: inline-flex; justify-content: center; align-items: center; min-height: 48px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; color: var(--accent); background: var(--surface-soft); font-size: 0.85rem; line-height: 1.5; text-align: center; }
#barcode-camera-hint .https-access-link { display: flex; margin-top: 12px; }
