:root {
  color-scheme: light;
  --blue-light: #BEE0FC;
  --blue-base: #81C3EE;
  --green-light: #C3EBCF;
  --green-base: #8FD8A6;
  --green-strong: #5DBF7B;
  --red-light: #F8C7C3;
  --red-base: #F29A91;
  --red-strong: #DE6B63;
  --yellow-light: #FCE8AE;
  --yellow-base: #F6CF68;
  --yellow-strong: #D9A93B;
  --outline: #090909;
  --highlight: #F8F8F8;
  --soft-gray: #E8E8E8;
  --paper: var(--highlight);
  --ink: var(--outline);
  --muted: var(--outline);
  --rule: var(--soft-gray);
  --wash: var(--highlight);
  --warning: var(--yellow-light);
  --danger: var(--red-strong);
  --focus: var(--blue-base);
  --primary: var(--blue-light);
  --primary-hover: var(--blue-base);
  --secondary: var(--soft-gray);
  --secondary-hover: var(--highlight);
  --success: var(--green-strong);
  --info: var(--blue-light);
  --meal-home-chef: #EDF0F2;
  --meal-home-chef-field: #F8F9FA;
  --meal-restaurant: #D9EBF7;
  --meal-restaurant-field: #F1F8FC;
  --meal-leftovers: #DDF0DF;
  --meal-leftovers-field: #F2F9F3;
  --meal-event: #F6DCE8;
  --meal-event-field: #FCF2F7;
  --meal-skipped: #E3E5EA;
  --meal-skipped-field: #F2F3F6;
  --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: var(--font-sans);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.42857143;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }

html { min-width: 300px; background: var(--paper); }

body { margin: 0; min-height: 100vh; background: var(--paper); }

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

button, input, select, textarea {
  border: 1px solid var(--soft-gray);
  border-radius: 4px;
  background: var(--highlight);
}

button, select, input { min-height: 2.125rem; }

button, .secondary-button {
  padding: 6px 12px;
  border-color: var(--soft-gray);
  background: var(--secondary);
  color: var(--outline);
  font-weight: 400;
  cursor: pointer;
  box-shadow: none;
}

button:hover, .secondary-button:hover, .secondary-button:focus { border-color: var(--outline); background: var(--secondary-hover); color: var(--ink); }
button:active, .secondary-button:active { background: var(--secondary); box-shadow: inset 0 3px 5px rgb(9 9 9 / .125); transform: none; }
button:disabled { cursor: not-allowed; color: var(--muted); box-shadow: none; opacity: .65; }

#parse-receipt,
#confirm-import,
#item-form button[type="submit"],
#grocery-store-form button[type="submit"],
#shopping-form button[type="submit"],
[data-save-shopping],
.auth-card button[type="submit"] {
  border-color: var(--blue-base);
  background: var(--primary);
  color: var(--outline);
}
#parse-receipt:hover,
#confirm-import:hover,
#item-form button[type="submit"]:hover,
#grocery-store-form button[type="submit"]:hover,
#shopping-form button[type="submit"]:hover,
[data-save-shopping]:hover,
.auth-card button[type="submit"]:hover {
  border-color: var(--blue-base);
  background: var(--primary-hover);
  color: var(--outline);
}

a { color: var(--outline); text-decoration-color: var(--blue-base); text-underline-offset: .15em; }
a:hover, a:focus { color: var(--outline); text-decoration: underline 2px var(--blue-base); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.skip-link {
  position: fixed;
  z-index: 50;
  left: .5rem;
  top: -5rem;
  padding: 8px 12px;
  background: var(--highlight);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.skip-link:focus { top: .5rem; }

.masthead {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  min-height: 50px;
  border: 1px solid var(--soft-gray);
  background: var(--highlight);
}

.brand { --brand-size: 1.5rem; display: flex; flex: 0 0 auto; align-items: center; gap: .5rem; padding: 12px 15px; }
.brand-icon { width: var(--brand-size); height: var(--brand-size); object-fit: contain; }
.wordmark {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
}

.nav { display: flex; overflow-x: auto; }
.nav a {
  display: flex;
  align-items: center;
  padding: 15px;
  font-weight: 400;
  color: var(--outline);
  white-space: nowrap;
  text-decoration: none;
}
.nav a:hover, .nav a:focus { background: var(--soft-gray); color: var(--outline); text-decoration: none; }
.nav a[aria-current="page"] { background: transparent; box-shadow: inset 0 -3px var(--blue-base); color: var(--outline); font-weight: 600; }
.export-data { flex: 0 0 auto; margin-left: auto; border: 1px solid var(--soft-gray); border-radius: 4px; background: var(--secondary); box-shadow: none; color: var(--outline); white-space: nowrap; }
.export-data:hover, .export-data:focus { border-color: var(--outline); background: var(--secondary-hover); color: var(--outline); }
.export-data:active { transform: none; }
.export-data.sign-out { margin-left: .5rem; margin-right: 15px; padding: 6px 12px; text-align: center; }
.account-menu { position: relative; flex: 0 0 auto; margin-left: .5rem; margin-right: 15px; }
.account-avatar {
  display: grid;
  width: 2.1rem;
  height: 2.1rem;
  place-items: center;
  padding: 0;
  border: 1px solid var(--soft-gray);
  border-radius: 50%;
  background: var(--secondary);
  color: var(--outline);
  box-shadow: none;
  cursor: pointer;
}
.account-avatar:hover, .account-avatar:focus-visible { border-color: var(--outline); background: var(--secondary-hover); color: var(--outline); }
.account-avatar:active { transform: none; }
.account-avatar svg { width: 1.2rem; height: 1.2rem; }
.account-menu-popover {
  position: absolute;
  top: calc(100% + .4rem);
  right: 0;
  z-index: 30;
  min-width: 220px;
  padding: .3rem;
  border: 1px solid var(--soft-gray);
  border-radius: 6px;
  background: var(--highlight);
  box-shadow: 0 4px 14px rgb(9 9 9 / .16);
}
.account-menu-email {
  padding: .5rem .6rem;
  border-bottom: 1px solid var(--soft-gray);
  color: var(--muted);
  font-size: .85rem;
  overflow-wrap: anywhere;
}
.account-menu-item {
  display: block;
  width: 100%;
  padding: .55rem .6rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  color: var(--outline);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.account-menu-item:hover, .account-menu-item:focus { border: 0; background: var(--soft-gray); box-shadow: none; color: var(--outline); text-decoration: none; }
.profile-account { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.profile-email { min-width: 0; }
.profile-email strong { display: block; margin-top: .15rem; font-weight: 500; overflow-wrap: anywhere; }
.profile-actions { margin-top: 0; }

main { width: 100%; max-width: 1400px; margin: 0 auto; padding: 20px 15px 70px; }

.view-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 70px;
  margin-bottom: 20px;
  padding: 10px 0 9px;
  border-bottom: 1px solid var(--soft-gray);
}
.view-heading-side { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.view-heading h1 { margin: 0; line-height: 1.1; }
.view-heading p { margin: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .2rem; font-size: 30px; font-weight: 400; line-height: 1.1; }
h2 { font-size: 24px; font-weight: 400; line-height: 1.1; }

.lede { max-width: 65ch; color: var(--muted); }
.muted, .help { color: var(--muted); font-size: .9rem; }

.notice {
  margin: 0 0 1rem;
  padding: 15px;
  border: 1px solid transparent;
  border-radius: 4px;
  border-color: var(--blue-base);
  background: var(--blue-light);
  color: var(--outline);
  font-weight: 400;
}
.notice.error { border-color: var(--red-base); background: var(--red-light); color: var(--outline); }
.notice.warning { border-color: var(--yellow-base); background: var(--warning); color: var(--outline); }

.filters {
  display: grid;
  grid-template-columns: minmax(12rem, 2fr) repeat(3, minmax(9rem, 1fr));
  gap: .75rem;
  align-items: end;
  margin-bottom: 1rem;
}
.table-actions {
  position: sticky;
  z-index: 15;
  top: var(--masthead-height, 0);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
  padding: 10px 15px;
  border: 1px solid var(--soft-gray);
  border-radius: 4px;
  background: var(--wash);
  box-shadow: none;
  font-weight: 400;
}
.inventory-add-actions, .selection-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.add-item-button {
  display: inline-flex;
  align-items: center;
  min-height: 2.125rem;
  padding: 6px 12px;
  border: 1px solid var(--blue-base);
  border-radius: 4px;
  background: var(--primary);
  color: var(--outline);
  font-weight: 400;
  white-space: nowrap;
  text-decoration: none;
}
.add-item-button:hover, .add-item-button:focus {
  border-color: var(--blue-base);
  background: var(--primary-hover);
  color: var(--outline);
  text-decoration: none;
}
.add-item-button.secondary-button, .add-item-button.secondary-button:hover, .add-item-button.secondary-button:focus { text-decoration: none; }
.add-item-button.secondary-button { border-color: var(--soft-gray); background: var(--secondary); color: var(--outline); }
.add-item-button.secondary-button:hover, .add-item-button.secondary-button:focus { border-color: var(--outline); background: var(--secondary-hover); color: var(--outline); }
.danger-button { border-color: var(--red-strong); background: var(--danger); color: var(--outline); }
.danger-button:not(:disabled):hover { border-color: var(--outline); background: var(--red-base); color: var(--outline); }

label, .field-label { display: grid; gap: 5px; font-weight: 700; }
input, select, textarea { width: 100%; padding: 6px 12px; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: 0; box-shadow: 0 0 0 3px var(--blue-light); }
textarea { min-height: 9rem; resize: vertical; }
input[type="search"] { direction: ltr; text-align: left; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--rule); border-radius: 4px; background: var(--highlight); }
.table-note { margin: .45rem 0 0; color: var(--muted); font-size: .85rem; }
table { width: 100%; min-width: 950px; border-collapse: collapse; }
th, td { padding: 8px; border-top: 1px solid var(--rule); text-align: left; vertical-align: top; }
thead th { border-top: 0; border-bottom: 2px solid var(--rule); }
th { position: sticky; z-index: 2; top: 0; padding: 0; vertical-align: middle; background: var(--wash); }
th button { width: 100%; border: 0; border-radius: 0; background: inherit; box-shadow: none; text-align: left; white-space: nowrap; }
th button:hover, th button:focus, th button:active { border: 0; background: inherit; color: inherit; transform: none; }
th button:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
th.actions-heading .field-label { display: flex; min-height: 2.55rem; align-items: center; padding: .45rem .75rem; }
th.select-cell input { display: block; margin: auto; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: var(--highlight); }
tbody tr:hover { background: var(--blue-light); }
.item-row-link { cursor: pointer; }
.item-row-link:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; background: var(--blue-light); }
.item-name { min-width: 13rem; font-weight: 700; }
.prepared-icon { width: 1.65rem; height: 1.65rem; margin-left: .4rem; object-fit: contain; vertical-align: middle; }
.date-heading, .date-cell { width: 10.5rem; min-width: 10.5rem; }
.select-cell { width: 3rem; min-width: 3rem; text-align: center; }
.select-cell input { width: 1.15rem; min-height: 1.15rem; accent-color: var(--primary); }
.status-cell { min-width: 12rem; }
.status-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .35rem; }
.status-actions button, .row-actions button { min-height: 2rem; padding: .25rem .45rem; font-size: .85rem; }
.row-actions { display: flex; justify-content: center; }
.icon-button { display: inline-grid; width: 2.25rem; min-width: 2.25rem; place-items: center; padding: .3rem; }
.icon-button svg { width: 1.15rem; height: 1.15rem; }

.tag {
  display: inline-block;
  margin: .1rem .2rem .1rem 0;
  padding: .2em .6em .3em;
  border: 0;
  border-radius: .25em;
  background: var(--soft-gray);
  color: var(--outline);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
}
.tag.warning { background: var(--yellow-base); }
.tag.status-available { background: var(--success); }
.tag.status-exhausted { background: var(--soft-gray); }
.tag.status-discarded { background: var(--danger); }
.tag.stocked { background: var(--info); cursor: help; }
.stocked-row td:first-child { font-weight: 400; }
.provenance { display: block; margin-top: .25rem; color: var(--muted); font-size: .78rem; }
.copy-id { display: inline-grid; width: 1.25rem; min-width: 0; min-height: 0; margin-left: .25rem; place-items: center; padding: 0; border: 0; outline-offset: 2px; background: transparent; box-shadow: none; color: inherit; vertical-align: middle; }
.copy-id:hover, .copy-id:focus-visible { border: 0; background: transparent; box-shadow: none; color: var(--ink); }
.copy-id:active { border: 0; background: transparent; box-shadow: none; transform: none; }
.copy-id svg { width: 1rem; height: 1rem; }
.receipt-id { display: block; margin-top: .35rem; color: var(--muted); font-size: .82rem; }
.receipt-id code { color: var(--ink); overflow-wrap: anywhere; }

.empty { padding: 40px 20px; border: 1px solid var(--soft-gray); border-radius: 4px; background: var(--highlight); text-align: center; }
.panel { max-width: 850px; padding: 15px; border: 1px solid var(--soft-gray); border-radius: 4px; background: var(--highlight); box-shadow: none; }
.item-price { display: flex; gap: .65rem; align-items: baseline; margin-bottom: 1rem; }
.item-form-toolbar { display: flex; max-width: 850px; justify-content: flex-end; margin-bottom: .65rem; }
.shopping-form { display: grid; grid-template-columns: minmax(12rem, 2fr) minmax(12rem, 1fr) auto; gap: .75rem; align-items: end; margin-bottom: 1rem; }
.shopping-table { max-width: 850px; }
.shopping-table table { min-width: 560px; }
.shopping-table th .field-label { display: flex; min-height: 2.55rem; align-items: center; padding: .45rem .75rem; }
.shopping-actions, .shopping-form-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.shopping-edit-row td { vertical-align: middle; }
.planner-year { display: flex; align-items: center; gap: .5rem; }
.planner-year strong { min-width: 4rem; text-align: center; font-size: 1.25rem; }
.planner-main { max-width: none; padding-inline: 10px; }
.analytics-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.analytics-card { display: grid; grid-template-rows: auto 1fr; min-height: 22rem; padding: 15px; border: 1px solid var(--soft-gray); border-radius: 4px; background: var(--highlight); box-shadow: none; }
.analytics-card h2 { margin-bottom: .35rem; }
.analytics-card p { color: var(--muted); }
.chart-placeholder { display: flex; position: relative; min-height: 13rem; margin-top: 1rem; align-items: flex-end; justify-content: space-around; gap: .5rem; padding: 2.5rem .75rem .75rem; border: 1px solid var(--rule); border-radius: 4px; background: repeating-linear-gradient(0deg, transparent, transparent 2.45rem, rgb(0 0 0 / .05) 2.45rem, rgb(0 0 0 / .05) 2.5rem); }
.chart-placeholder span { position: absolute; top: .65rem; left: .75rem; color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; }
.chart-placeholder i { width: 12%; border: 1px solid var(--primary-hover); border-radius: 3px 3px 0 0; background: var(--primary); }
.chart-placeholder i:nth-of-type(1) { height: 30%; }
.chart-placeholder i:nth-of-type(2) { height: 55%; }
.chart-placeholder i:nth-of-type(3) { height: 42%; }
.chart-placeholder i:nth-of-type(4) { height: 75%; }
.chart-placeholder i:nth-of-type(5) { height: 62%; }
.restaurant-frequency { margin: 1rem 0 0; padding: 0; list-style: none; }
.restaurant-frequency li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--rule); }
.planner-calendar table { width: 100%; min-width: 1100px; table-layout: fixed; font-size: .78rem; }
.planner-calendar thead th:first-child, .planner-week { width: 9rem; min-width: 9rem; }
.planner-calendar thead th:not(:first-child) { width: calc((100% - 9rem) / 7); }
.planner-calendar th, .planner-calendar td { padding: .3rem; }
.planner-calendar tbody tr:hover { background: transparent; }
.planner-day-past { background: var(--soft-gray); color: color-mix(in srgb, var(--outline) 65%, var(--soft-gray)); }
.planner-day-past .meal-slot { background: inherit; }
.planner-day-past input, .planner-day-past textarea { border-color: color-mix(in srgb, var(--outline) 15%, var(--soft-gray)); background: color-mix(in srgb, var(--highlight) 45%, var(--soft-gray)); color: inherit; }
.planner-day-past input::placeholder, .planner-day-past textarea::placeholder { color: color-mix(in srgb, var(--outline) 45%, var(--soft-gray)); opacity: 1; }
.planner-day-past input:focus, .planner-day-past textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 2px var(--blue-light); }
.planner-day-past button, .planner-day-past a { color: inherit; }
.planner-calendar th .field-label { display: flex; min-height: 2rem; align-items: center; padding: .3rem .4rem; }
.planner-week { position: sticky; z-index: 1; left: 0; vertical-align: top; background: var(--wash); }
.planner-week-heading { display: flex; align-items: center; justify-content: space-between; gap: .35rem; }
.planner-copy-button { flex: 0 0 auto; }
.planner-jump-bar { position: sticky; z-index: 16; top: var(--masthead-height, 50px); display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; margin-bottom: .75rem; border: 1px solid var(--soft-gray); border-radius: 4px; background: var(--wash); justify-content: flex-end; }
.planner-jump-label { font-size: .85rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.planner-more { display: flex; justify-content: flex-end; padding-top: .75rem; }
.planner-notes { display: grid; gap: .2rem; margin-top: .55rem; font-size: .68rem; text-align: left; text-transform: uppercase; }
.planner-notes textarea { min-height: 6rem; padding: .35rem; background: var(--highlight); font-size: .72rem; font-weight: 400; line-height: 1.3; text-transform: none; }
.planner-notes-collapsed thead th:first-child, .planner-notes-collapsed .planner-week { width: 2.5rem; min-width: 2.5rem; text-align: center; }
.planner-notes-collapsed thead th:not(:first-child) { width: calc((100% - 2.5rem) / 7); }
.planner-week-collapsed .planner-notes { display: none; }
.planner-week-collapsed .planner-copy-button { display: none; }
.planner-notes-toggle { display: inline-flex; align-items: center; gap: .15rem; min-width: 0; min-height: 0; padding: .1rem; border: 0; background: transparent; box-shadow: none; color: var(--muted); cursor: pointer; }
.planner-notes-toggle:hover { color: var(--ink); }
.planner-notes-toggle svg { width: .85rem; height: .85rem; flex-shrink: 0; }
.planner-date { display: flex; justify-content: space-between; gap: .35rem; margin-bottom: .3rem; }
.meal-slot { position: relative; margin: 0 0 .25rem; padding: .35rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--highlight); }
.meal-slot:focus { outline: none; }
.meal-slot.meal-kind-meal { background: var(--meal-home-chef); }
.meal-slot.meal-kind-restaurant { background: var(--meal-restaurant); }
.meal-slot.meal-kind-leftovers { background: var(--meal-leftovers); }
.meal-slot.meal-kind-event { background: var(--meal-event); }
.meal-slot.meal-kind-skipped { background: var(--meal-skipped); }
.meal-slot[draggable="true"] { cursor: grab; }
.meal-slot.meal-slot-dragging { opacity: .55; }
.meal-slot.meal-slot-drop { border-color: var(--focus); box-shadow: 0 0 0 2px var(--blue-light); }
.meal-card-header { display: flex; align-items: center; justify-content: space-between; gap: .25rem; margin-bottom: .15rem; }
.meal-label { display: block; font-size: .62rem; font-weight: 700; text-transform: uppercase; }
.meal-kind-icon { display: inline-grid; flex: 0 0 auto; width: 1.1rem; height: 1.1rem; place-items: center; color: var(--ink); }
.meal-kind-icon svg { width: 1rem; height: 1rem; }
.meal-slot input, .meal-slot select { min-height: 1.65rem; padding: .2rem .3rem; background: var(--highlight); font-size: .72rem; }
.meal-slot.meal-kind-meal input, .meal-slot.meal-kind-meal select { background: var(--meal-home-chef-field); }
.meal-slot.meal-kind-restaurant input, .meal-slot.meal-kind-restaurant select { background: var(--meal-restaurant-field); }
.meal-slot.meal-kind-leftovers input, .meal-slot.meal-kind-leftovers select { background: var(--meal-leftovers-field); }
.meal-slot.meal-kind-event input, .meal-slot.meal-kind-event select { background: var(--meal-event-field); }
.meal-slot.meal-kind-skipped input, .meal-slot.meal-kind-skipped select { background: var(--meal-skipped-field); }
.meal-slot select[data-meal-kind] { width: 100%; margin-bottom: .2rem; }
.meal-name-text { display: block; width: 100%; min-height: 0; padding: 0; border: 0; background: transparent; box-shadow: none; cursor: text; font-size: .74rem; font-weight: 400; line-height: 1.25; overflow-wrap: anywhere; text-align: left; user-select: text; white-space: normal; }
.meal-name-text:hover, .meal-name-text:active { border: 0; background: transparent; box-shadow: none; color: var(--ink); transform: none; }
.meal-name-link { color: var(--outline); text-decoration: underline 2px var(--blue-base); text-underline-offset: .15em; }
.meal-order-note { display: block; margin-top: .15rem; font-size: .68rem; color: var(--muted); font-style: italic; }
.meal-event-time { display: block; margin-top: .15rem; font-size: .68rem; color: var(--muted); cursor: pointer; }
.meal-skipped-note { display: block; width: 100%; font-size: .74rem; font-style: italic; line-height: 1.25; color: color-mix(in srgb, var(--outline) 60%, var(--soft-gray)); }
.meal-meta { display: flex; align-items: center; gap: .2rem; margin-top: .15rem; }
.meal-link-toolbar { position: fixed; z-index: 30; display: none; max-width: min(17rem, calc(100vw - 1rem)); align-items: center; gap: .3rem; padding: .3rem; border: 1px solid var(--outline); border-radius: 4px; background: var(--highlight); box-shadow: 0 3px 10px rgb(9 9 9 / .18); text-transform: none; }
.meal-slot.link-context-active .meal-link-toolbar { display: block; }
.meal-link-option { display: inline-grid; width: 1.7rem; min-width: 1.7rem; min-height: 1.7rem; place-items: center; padding: .2rem; }
.meal-link-option svg { width: .9rem; height: .9rem; }
.meal-link-selection { display: inline-block; max-width: 12rem; overflow: hidden; font-size: .68rem; font-weight: 700; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
.meal-link-editor { display: none; grid-template-columns: 1rem minmax(6rem, 1fr) auto auto; align-items: center; gap: .25rem; }
.meal-link-toolbar.link-editing .meal-link-option, .meal-link-toolbar.link-editing > .meal-link-selection { display: none; }
.meal-link-toolbar.link-editing .meal-link-editor { display: grid; }
.meal-link-editor svg { width: .9rem; height: .9rem; }
.meal-link-editor input { min-height: 1.7rem; padding: .2rem .3rem; font-size: .72rem; }
.meal-link-editor button { min-height: 1.7rem; padding: .2rem .35rem; font-size: .68rem; }
.stack { display: grid; gap: 1rem; }
.stack label { font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.form-grid label { font-weight: 400; }
.form-grid .required-label { font-weight: 700; }
.form-grid input[readonly] { color: var(--ink); background: var(--soft-gray); cursor: default; }
.required-mark { color: var(--danger); }
.span-all { grid-column: 1 / -1; }
.check { display: flex; grid-column: 1 / -1; align-items: flex-start; gap: .5rem; font-weight: 400; }
.check input { width: auto; min-height: auto; margin-top: .2rem; }
.acquisition { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; padding: .6rem .75rem; border: 1px solid var(--rule); border-radius: 4px; }
.acquisition legend { padding-inline: .35rem; font-weight: 700; }
.acquisition .radio { display: flex; align-items: center; gap: .45rem; font-weight: 400; }
.acquisition .radio input { width: auto; min-height: auto; accent-color: var(--primary); }
.actions { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.item-form-notice { flex-basis: 100%; margin: .35rem 0 0; }

.receipt-store { display: flex; align-items: flex-end; gap: .5rem; margin: .5rem 0; }
.receipt-store label { flex: 1; max-width: 20rem; }
.store-manage-link { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--rule); }
.store-manager { display: grid; gap: .6rem; }
.store-row { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; align-items: center; padding: .5rem .6rem; border: 1px solid var(--soft-gray); border-radius: 4px; background: var(--highlight); }
.store-rename-input { min-width: 0; }
.store-retroactive { font-size: .75rem; white-space: nowrap; }
.store-rename-save { padding: .3rem .8rem; font-size: .78rem; }
.candidate-list { display: grid; gap: .75rem; margin: 1rem 0; }
.candidate { padding: 15px; border: 1px solid var(--soft-gray); border-radius: 4px; background: var(--highlight); }
.candidate.uncertain { border-color: var(--yellow-base); background: var(--warning); }
.candidate-fields { display: grid; grid-template-columns: 2fr .7fr 1fr 1fr .8fr; gap: .5rem; }
.candidate-head { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }

.modal-backdrop { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgb(0 0 0 / .55); }
.modal { width: min(700px, 100%); max-height: 90vh; overflow: auto; padding: 15px; border: 1px solid rgb(9 9 9 / .2); border-radius: 6px; background: var(--paper); box-shadow: 0 5px 15px rgb(9 9 9 / .5); }

.history-list { max-width: 900px; margin: 0; padding: 0; list-style: none; }
.history-list li { display: grid; grid-template-columns: minmax(10rem, .7fr) 2fr; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid; }

.auth-card { width: min(420px, calc(100% - 30px)); margin: 60px auto; padding: 30px; border: 1px solid var(--soft-gray); border-radius: 6px; background: var(--highlight); box-shadow: 0 1px 1px rgb(9 9 9 / .05); }
.auth-card > .brand-icon { display: block; width: 48px; height: 48px; margin-bottom: 20px; }
.auth-card form { display: grid; gap: 15px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
button.link { min-height: 0; padding: 0; border: 0; background: transparent; box-shadow: none; color: var(--outline); text-decoration: underline; text-decoration-color: var(--blue-base); text-underline-offset: .15em; }
button.link:hover, button.link:focus { background: transparent; color: var(--outline); text-decoration: underline 2px var(--blue-base); }

/* Photo drop zone */
.photo-drop-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 2rem;
  border: 2px dashed var(--soft-gray);
  border-radius: 8px;
  background: var(--wash);
  transition: border-color .15s, background .15s;
}
.photo-drop-zone:hover, .photo-drop-zone.drag-over {
  border-color: var(--blue-base);
  background: var(--blue-light);
}
.photo-drop-zone.scanning {
  cursor: default;
  border-color: var(--blue-base);
  background: var(--blue-light);
}
.photo-drop-prompt { display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; }
.photo-drop-title { margin: 0; font-size: 1.1rem; font-weight: 600; color: var(--ink); }
.photo-drop-subtitle { margin: 0; color: var(--muted); font-size: .9rem; }
.photo-formats { margin: 0; color: var(--muted); font-size: .8rem; }
.photo-file-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.photo-choose-button {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 2.25rem;
  padding: 8px 16px;
  border: 1px solid var(--blue-base);
  border-radius: 4px;
  background: var(--primary);
  color: var(--outline);
  font-weight: 600;
  cursor: pointer;
}
.photo-choose-button:hover { background: var(--primary-hover); border-color: var(--blue-base); }
.photo-preview {
  max-width: 200px;
  max-height: 140px;
  margin-bottom: .75rem;
  border-radius: 4px;
  object-fit: contain;
  border: 1px solid var(--rule);
}
.photo-scanning { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.photo-scanning p { margin: 0; font-weight: 600; color: var(--ink); }
.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid var(--soft-gray);
  border-top-color: var(--blue-base);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.import-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: .5rem 0;
  color: var(--muted);
  font-size: .85rem;
}
.import-divider::before, .import-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

@media (max-width: 760px) {
  .masthead { display: block; }
  .brand { border-bottom: 1px solid var(--soft-gray); }
  .nav a { padding: .55rem .7rem; }
  .export-data { width: 100%; margin-left: 0; }
  .export-data.sign-out { display: block; width: 100%; margin-left: 0; padding: 6px 12px; text-align: center; }
  .account-menu { display: block; width: fit-content; margin: .35rem 15px .35rem auto; }
  main { padding-inline: .65rem; }
  .filters, .form-grid, .candidate-fields, .shopping-form { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .span-all { grid-column: auto; }
  .history-list li { grid-template-columns: 1fr; gap: .2rem; }
  .view-heading { flex-wrap: wrap; }
  .view-heading-side { width: 100%; justify-content: flex-start; }
  table { min-width: 800px; }
  th { top: 0; }
  th.item-heading, td.item-name, th.select-cell, td.select-cell { position: sticky; left: 0; z-index: 1; background: var(--highlight); box-shadow: 1px 0 0 var(--rule); }
  table.selectable th.item-heading, table.selectable td.item-name { left: 3rem; }
  th.item-heading, th.select-cell { z-index: 3; background: var(--wash); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Price tracking (within analytics) */
.analytics-price-tracking { margin-bottom: 1.5rem; padding: 1rem; border: 1px solid var(--soft-gray); border-radius: 4px; background: var(--highlight); }
.analytics-price-tracking h2 { margin-bottom: .25rem; }
.analytics-price-tracking .lede { margin-bottom: 1rem; }
.analytics-price-empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.analytics-price-empty p { margin: 0; }

/* Price tracking layout */
.prices-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 22rem) 1fr;
  gap: 1.25rem;
  align-items: start;
}
.price-product-list {
  display: grid;
  gap: .5rem;
  max-height: calc(100vh - 180px);
  overflow: hidden;
  border: 1px solid var(--soft-gray);
  border-radius: 4px;
  background: var(--highlight);
  padding: .75rem;
}
.price-search-label { font-weight: 700; }
.price-search-label input { margin-top: .35rem; }
.price-product-scroll {
  overflow-y: auto;
  max-height: calc(100vh - 280px);
}
.price-category-heading {
  padding: .4rem .5rem .2rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  margin-top: .5rem;
}
.price-category-heading:first-child { margin-top: 0; }
.price-product-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .35rem;
  width: 100%;
  min-height: 2.5rem;
  padding: .45rem .6rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  text-align: left;
  cursor: pointer;
}
.price-product-item:hover { background: var(--blue-light); border-color: transparent; }
.price-product-item.selected { background: var(--primary); border-color: var(--blue-base); font-weight: 600; }
.price-product-item.selected:hover { background: var(--primary-hover); }
.price-product-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.price-product-meta { display: flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.price-obs-count { font-size: .7rem; }
.price-empty-sidebar { padding: 1.5rem .75rem; text-align: center; color: var(--muted); }

.price-detail-area { min-width: 0; }
.price-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 24rem;
  padding: 2rem;
  border: 1px solid var(--soft-gray);
  border-radius: 4px;
  background: var(--highlight);
  text-align: center;
  color: var(--muted);
}
.price-detail-empty h2 { font-weight: 400; }

.price-detail {
  padding: 1rem;
  border: 1px solid var(--soft-gray);
  border-radius: 4px;
  background: var(--highlight);
}
.price-detail h2 { margin-bottom: .75rem; }

.price-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.price-stat {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 5rem;
  padding: .5rem .75rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--wash);
}
.price-stat-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--muted); }

.price-chart {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: .4rem;
  min-height: 11rem;
  margin-bottom: 1.25rem;
  padding: 2rem .75rem .75rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: repeating-linear-gradient(0deg, transparent, transparent 2.45rem, rgb(0 0 0 / .05) 2.45rem, rgb(0 0 0 / .05) 2.5rem);
}
.price-chart-label { position: absolute; top: .5rem; left: .75rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.price-bar-col { display: flex; flex-direction: column; align-items: center; gap: .25rem; flex: 1; min-width: 0; max-width: 4rem; height: 100%; }
.price-bar {
  width: 100%;
  min-height: 4px;
  border: 1px solid var(--blue-base);
  border-radius: 3px 3px 0 0;
  background: var(--primary);
  transition: height .2s;
}
.price-bar-label { font-size: .62rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.price-table { margin-bottom: 1.25rem; }
.price-table table { min-width: 400px; }

.price-trend-up { color: var(--red-strong); font-weight: 700; }
.price-trend-down { color: var(--green-strong); font-weight: 700; }
.price-trend-stable { color: var(--muted); font-weight: 700; }

/* Price detail tabs */
.price-tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: 1rem; border-bottom: 2px solid var(--rule); padding-bottom: 0; }
.price-tab {
  min-height: 2.25rem;
  padding: .45rem .85rem;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  bottom: -2px;
}
.price-tab:hover:not(:disabled) { background: var(--wash); color: var(--ink); }
.price-tab.active { border-color: var(--rule); border-bottom: 2px solid var(--highlight); background: var(--highlight); color: var(--ink); font-weight: 600; }
.price-tab:disabled { color: var(--soft-gray); cursor: not-allowed; opacity: .65; }
.price-tab:disabled:hover { background: transparent; }
.price-tab-note { display: inline-block; margin-left: .25rem; font-size: .68rem; font-weight: 400; color: var(--soft-gray); font-style: italic; }
.price-tab-badge { display: inline-block; margin-left: .35rem; padding: .05em .45em; border-radius: .25em; background: var(--blue-light); color: var(--outline); font-size: .68rem; font-weight: 700; }

/* Aggregate tab */
.price-agg-intro { margin-bottom: .75rem; color: var(--muted); }
.price-agg-brands { margin-top: 1rem; }
.price-agg-brands h3 { font-size: 1rem; font-weight: 600; margin-bottom: .5rem; }
.price-agg-review-help { margin-bottom: .6rem; color: var(--muted); font-size: .82rem; }
.price-agg-product { border-bottom: 1px solid var(--rule); }
.price-agg-product.excluded { color: var(--muted); background: var(--wash); }
.price-agg-product summary { display: grid; grid-template-columns: minmax(8rem, 1fr) auto auto auto; gap: .6rem; align-items: center; padding: .55rem .35rem; cursor: pointer; }
.price-agg-product-detail { padding: .25rem .75rem .75rem; }
.price-agg-product-detail > p { margin-bottom: .5rem; color: var(--muted); font-size: .82rem; }
.price-match-status { padding: .12rem .4rem; border-radius: 3px; background: var(--soft-gray); font-size: .7rem; font-weight: 600; white-space: nowrap; }
.price-match-status.confirmed { background: var(--green-light); color: var(--green-strong); }
.price-match-status.excluded { background: var(--red-light); color: var(--red-strong); }
.price-match-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.price-match-actions button { min-height: 2rem; padding: .35rem .65rem; font-size: .78rem; }

.price-comparison { margin-top: 1rem; }
.price-comparison h3 { font-size: 1rem; font-weight: 600; margin-bottom: .5rem; }
.price-compare-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) auto auto auto;
  gap: .5rem;
  align-items: center;
  padding: .5rem 0;
  border-bottom: 1px solid var(--rule);
}
.price-compare-name {
  min-height: auto;
  padding: .15rem .3rem;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--outline);
  text-decoration: underline;
  text-decoration-color: var(--blue-base);
  text-underline-offset: .15em;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.price-compare-name:hover { background: transparent; text-decoration: underline 2px var(--blue-base); }
.price-compare-avg { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.price-compare-latest { font-size: .82rem; white-space: nowrap; }
.price-compare-obs { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.price-compare-bars { grid-column: 1 / -1; display: grid; gap: .2rem; padding-top: .15rem; }
.price-compare-bar { height: .5rem; border-radius: 2px; min-width: 2px; }
.price-compare-bar.selected-bar { background: var(--primary); border: 1px solid var(--blue-base); }
.price-compare-bar.fuzzy-bar { background: var(--green-light); border: 1px solid var(--green-base); }

@media (max-width: 760px) {
  .prices-layout { grid-template-columns: 1fr; }
  .price-product-list { max-height: none; }
  .price-product-scroll { max-height: 15rem; }
  .price-compare-row { grid-template-columns: 1fr auto; }
  .price-compare-avg, .price-compare-obs { display: none; }
  .price-agg-product summary { grid-template-columns: 1fr auto; }
  .price-agg-product summary .price-compare-avg, .price-agg-product summary .price-compare-obs { display: none; }
}

@media print {
  .masthead, .filters, .table-actions, .select-cell, .row-actions, .status-actions { display: none; }
  main { padding: 0; }
  .table-wrap { overflow: visible; border: 0; }
  table { min-width: 0; }
}
