:root {
  color-scheme: dark;
  font:
    15px/1.5 system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #f0f3f2;
  background: #101820;
  --surface: #1b2630;
  --surface-raised: #23313d;
  --border: #374653;
  --muted: #b4c0c9;
  --accent: #9bbbd4;
  --accent-hover: #c2d8e9;
}
* {
  box-sizing: border-box;
}
body {
  min-height: 100vh;
  margin: 0;
  background: #101820;
}
a {
  color: var(--accent-hover);
  text-underline-offset: 3px;
}
.site-header {
  background: #1a2834;
  border-bottom: 1px solid #3c4d5b;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1200px;
  margin: auto;
  padding: 17px 24px;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 1px solid #7295b1;
  border-radius: 7px;
  background: #2a4254;
  color: #d4e8f6;
  font-size: 11px;
  font-weight: 800;
}
header h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -0.035em;
}
header p {
  margin: 2px 0 0;
  color: #aebdc8;
  font-size: 12px;
}
.header-meta {
  color: #9fb2c1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.wrap {
  max-width: 1200px;
  margin: auto;
  padding: 24px;
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #18232d;
}
.mobile-navigation {
  display: none;
}
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: #17212b;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: none;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    transform 120ms ease;
}
button:hover,
.btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
button:active,
.btn:active {
  transform: translateY(1px);
}
button.secondary,
nav button {
  border-color: transparent;
  background: #2b3945;
  color: #e7ecee;
}
button.secondary:hover,
nav button:hover {
  background: #3b4c59;
}
button.danger {
  border-color: #96524a;
  background: #87443f;
  color: #fff;
}
button.danger:hover {
  background: #a6534b;
}
nav button {
  padding-inline: 13px;
  font-size: 13px;
  white-space: nowrap;
}
nav button.active,
nav button.active:hover {
  border-color: #6388a5;
  background: #354e63;
  color: #f2f7fa;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent-hover);
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
section {
  display: none;
}
section.active {
  display: block;
}
.card {
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 28px #00000021;
}
.card h2,
.card h3 {
  margin: 0 0 15px;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.card h2 {
  font-size: 24px;
}
.card h3 {
  font-size: 19px;
}
.card p {
  margin-top: 0;
}
details.card > summary,
.planner-options > summary {
  min-height: 35px;
  cursor: pointer;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.02em;
}
details.card > summary::marker,
.planner-options > summary::marker {
  color: var(--accent);
}
details.card[open] > summary,
.planner-options[open] > summary {
  margin-bottom: 15px;
}
.planner-options {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #17222c;
}
.planner-options > summary {
  font-size: 15px;
}
#calculate {
  margin-top: 14px;
}
.overview-card {
  background: var(--surface);
}
.kickoff-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px;
  border-color: #435b6d;
  background: #20303d;
}
.eyebrow {
  color: #b0c9dc;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.kickoff-card h2 {
  margin: 5px 0 5px;
  font-size: clamp(21px, 2.2vw, 27px);
}
.kickoff-card p {
  margin-bottom: 0;
  color: #d0d7db;
}
.kickoff-card button {
  flex: 0 0 auto;
}
#stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 15px 17px;
  border: 1px solid #455766;
  border-radius: 8px;
  background: #13212d99;
  color: #c5d0d8;
  font-size: 13px;
}
.stat b {
  color: var(--accent);
  font-size: 29px;
  line-height: 1;
  letter-spacing: -0.05em;
}
.quick-start {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.quick-start li {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #17222c;
  counter-increment: step;
}
.quick-start li::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  margin-bottom: 9px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.12em;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}
.field {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  min-width: 140px;
}
[hidden] {
  display: none !important;
}
label {
  font-size: 13px;
  font-weight: 700;
  color: #d8e0e5;
}
input,
select,
textarea {
  width: 100%;
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid #4b5d6a;
  border-radius: 6px;
  background: #111b24;
  color: #f4f6f4;
  font: inherit;
}
input::placeholder,
textarea::placeholder {
  color: #8998a3;
}
input[type="checkbox"] {
  width: 17px;
  height: 17px;
  min-height: 0;
  padding: 0;
  accent-color: var(--accent);
}
input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}
textarea {
  min-height: 78px;
  resize: vertical;
}
.muted,
small {
  color: var(--muted);
}
.muted {
  font-size: 13px;
}
.warn {
  color: #ffb08b;
  font-weight: 700;
}
.good {
  color: #8edcb1;
  font-weight: 700;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 39px;
  padding: 7px 0;
}
.preference-field {
  min-width: 230px;
}
.range-ends {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}
.capability-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #17222c;
}
.capability-fields b {
  width: 100%;
}
.capability-fields .checkbox-label {
  padding: 2px 0;
}
.day,
.saved-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #17222c;
}
td small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid #33434f;
  text-align: left;
  vertical-align: top;
}
th {
  color: #c6d0d7;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
tbody tr:hover {
  background: #263542;
}
td input {
  min-width: 75px;
}
.scroll {
  overflow-x: auto;
}
.pill {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid #5c6570;
  border-radius: 5px;
  background: #2b3945;
  color: #e2e8eb;
  font-size: 12px;
  font-weight: 700;
}
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(160px, 1fr));
  gap: 8px;
  overflow-x: auto;
}
.day {
  min-width: 160px;
  padding: 12px;
}
.day h3 {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
}
.meal {
  display: block;
  padding: 9px 0;
  border-top: 1px solid #33434f;
}
.meal select {
  padding: 5px;
  font-size: 12px;
}
.meal small {
  display: block;
  margin-bottom: 3px;
}
.snack-slots > summary {
  padding: 8px 0;
  cursor: pointer;
  font-size: 13px;
}
.coverage-day > small {
  display: block;
}
.recipe-directions {
  white-space: pre-line;
}
.chart-picker {
  display: block;
  max-width: 300px;
}
.price-chart svg {
  display: block;
  width: 100%;
  max-width: 770px;
  height: auto;
}
.price-chart text {
  fill: #c0ccd4;
  font:
    12px system-ui,
    sans-serif;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
#planSummary > p:first-child,
.grocery-total {
  padding: 14px;
  border: 1px solid #526e84;
  border-radius: 8px;
  background: #21313f;
}
#planSummary > p:first-child b,
.grocery-total strong {
  color: var(--accent-hover);
}
.grocery-total {
  display: grid;
  gap: 4px;
  margin-top: 12px;
}
.grocery-total:empty {
  display: none;
}
.grocery-total small {
  color: var(--muted);
}
.saved-list {
  margin: 12px 0;
  padding: 14px;
}
.saved-list summary {
  cursor: pointer;
  font-weight: 650;
}
.saved-list-items {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}
.saved-list-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px;
  border: 1px solid #354653;
  border-radius: 6px;
  background: #1d2b36;
}
.saved-list-item input {
  margin-top: 3px;
}
.saved-list-meals {
  margin: 10px 0;
}
.saved-list-meals > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}
.saved-list-meals p {
  margin: 8px 0 0;
}
#notice {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: none;
  max-width: 85vw;
  padding: 12px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #26313b;
  color: #fff;
  box-shadow: 0 14px 32px #0008;
}
.tiny {
  min-height: 0;
  padding: 6px 9px;
  font-size: 12px;
}
.import-label {
  cursor: pointer;
}
#import {
  display: none;
}
.mobile-inventory {
  display: none;
}
.food-dialog {
  width: min(520px, calc(100vw - 20px));
  max-height: calc(100dvh - 20px);
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: #f0f3f2;
  box-shadow: 0 24px 70px #0009;
}
.quick-product-card,
.saved-runs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.quick-product-card h2,
.saved-runs-head h3 {
  margin-bottom: 4px;
}
.quick-product-card p {
  margin: 0;
}
.photo-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.photo-actions label {
  flex: 1;
}
.photo-actions input[hidden],
#quickNewFood[hidden],
#quickListPackagesField[hidden],
#quickPhotoPreview[hidden] {
  display: none;
}
#quickPhotoPreview img {
  display: block;
  max-width: 100%;
  max-height: 180px;
  margin-bottom: 8px;
  border-radius: 6px;
}
.quick-cost {
  margin: 0;
  color: #c9e5bd;
  font-weight: 700;
}
.product-thumb {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: cover;
  margin-top: 4px;
  border-radius: 4px;
}
.food-dialog::backdrop {
  background: #050a10c9;
}
.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dialog-head {
  margin-bottom: 16px;
}
.dialog-head h2 {
  margin: 0;
  font-size: 21px;
}
.dialog-close {
  min-width: 40px;
  padding: 4px 10px;
  font-size: 25px;
}
.dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.dialog-grid label {
  min-width: 0;
}
.dialog-grid .dialog-wide {
  grid-column: 1 / -1;
}
.dialog-grid input,
.dialog-grid select {
  width: 100%;
  margin-top: 4px;
}
.dialog-grid .checkbox-label {
  align-self: end;
}
.dialog-grid .checkbox-label input {
  width: auto;
  margin: 0;
}
.dialog-actions {
  justify-content: flex-end;
  margin-top: 18px;
}
.dialog-actions .danger {
  margin-right: auto;
}
#mobileInventoryForm .field {
  min-width: 130px;
}
#mobileInventoryForm > button {
  width: 100%;
}
@media (max-width: 800px) {
  .kickoff-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }
  #stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quick-start {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .calendar {
    grid-template-columns: repeat(7, 165px);
  }
}
@media (max-width: 600px) {
  .quick-product-card {
    padding: 14px;
  }
  .quick-product-card h2 {
    font-size: 18px;
  }
  .quick-product-card button {
    flex: none;
  }
  .product-dialog .dialog-grid {
    gap: 9px;
  }
  .product-dialog .dialog-grid label {
    min-width: 0;
  }
  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }
  button,
  .btn {
    min-height: 44px;
  }
  input[type="checkbox"] {
    min-height: 0;
  }
  .header-inner {
    padding: 14px 16px;
  }
  .header-meta {
    display: none;
  }
  .wrap {
    padding: 10px;
  }
  #tabs {
    display: none;
  }
  .mobile-navigation {
    position: sticky;
    z-index: 10;
    top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #18232d;
    box-shadow: 0 6px 18px #0005;
  }
  .mobile-navigation label {
    flex: 0 0 auto;
  }
  .mobile-navigation select {
    min-height: 38px;
    padding: 6px 10px;
    font-weight: 700;
  }
  .card {
    margin-bottom: 10px;
    padding: 13px;
  }
  .card h2 {
    margin-bottom: 9px;
    font-size: 21px;
  }
  .card h3 {
    margin-bottom: 9px;
    font-size: 18px;
  }
  .desktop-add-card,
  .desktop-inventory-card {
    display: none;
  }
  .mobile-inventory {
    display: block;
  }
  .mobile-inventory-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
  }
  .mobile-inventory-head h2,
  .mobile-inventory-head p {
    margin: 0;
  }
  .mobile-inventory-head p {
    font-size: 12px;
  }
  #openAddFood {
    flex: 0 0 auto;
  }
  #inventorySearch {
    width: 100%;
    margin-bottom: 9px;
  }
  .mobile-food-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 54px;
    margin-top: 5px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    background: #17222c;
    color: #eef3f5;
    text-align: left;
  }
  .mobile-food-row:hover {
    border-color: #71899b;
    background: #22313e;
  }
  .mobile-food-main {
    min-width: 0;
  }
  .mobile-food-main strong,
  .mobile-food-main small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-food-main strong {
    font-size: 14px;
  }
  .mobile-food-main small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
  }
  .mobile-food-qty {
    flex: 0 0 auto;
    color: #d0e1ed;
    font-size: 13px;
    font-weight: 800;
  }
  .mobile-food-qty.is-low {
    color: #f4bd82;
  }
  .mobile-empty-foods {
    margin-top: 10px;
  }
  .mobile-empty-foods summary {
    padding: 8px 2px;
    color: var(--muted);
    cursor: pointer;
    font-weight: 700;
  }
  .food-dialog {
    padding: 14px;
  }
  .food-dialog .dialog-grid {
    gap: 10px;
  }
  .food-dialog .dialog-grid label {
    font-size: 13px;
  }
  .dialog-actions button {
    padding-inline: 10px;
  }
  #lowStockCard.empty,
  #savedRunsCard.empty,
  #draftCard.empty,
  #coveragePanel.empty {
    display: none;
  }
  #grocery.active {
    display: flex;
    flex-direction: column;
  }
  #draftCard {
    display: flex;
    flex-direction: column;
    scroll-margin-top: 76px;
  }
  #draftCard h3 {
    order: 0;
  }
  #groceryTotal {
    order: 1;
    margin: 0 0 8px;
  }
  #draftCard > .scroll {
    order: 3;
  }
  #planSummary {
    order: 5;
  }
  #planSummary > p:first-child {
    display: none;
  }
  #draftCard > button {
    order: 4;
  }
  #groceryTotal strong {
    display: block;
    font-size: 23px;
  }
  #savedRunsCard {
    order: -1;
  }
  .planner-intro,
  .draft-help {
    display: none;
  }
  .planner-core {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  .planner-core > .field {
    min-width: 0;
  }
  #rideFields {
    grid-column: 1 / -1;
  }
  .planner-options {
    margin-top: 10px;
    padding: 9px 11px;
  }
  .planner-options > summary {
    min-height: 28px;
  }
  #calculate {
    width: 100%;
    margin-top: 10px;
  }
  #stats {
    gap: 6px;
  }
  .stat {
    padding: 10px;
    font-size: 11px;
  }
  .stat b {
    font-size: 24px;
  }
  .quick-start {
    grid-template-columns: 1fr;
  }
  .saved-list {
    margin: 8px 0;
    padding: 10px;
  }
  .saved-list summary {
    min-height: 38px;
  }
  #draftTable,
  #draftTable tbody {
    display: block;
    width: 100%;
  }
  #draftTable thead {
    display: none;
  }
  #draftTable tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 10px;
    margin: 5px 0;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #17222c;
  }
  #draftTable td {
    min-width: 0;
    padding: 2px 0;
    border: 0;
    overflow-wrap: anywhere;
    font-size: 13px;
  }
  #draftTable td:first-child {
    grid-column: 1;
    grid-row: 1;
    font-weight: 750;
  }
  #draftTable td:nth-child(2) {
    display: none;
  }
  #draftTable td:nth-child(3) {
    grid-column: 1;
    grid-row: 2;
    color: var(--muted);
  }
  #draftTable td:nth-child(4) {
    grid-column: 2;
    grid-row: 1;
    font-weight: 750;
    text-align: right;
  }
  #draftTable td[data-label]::before {
    display: none;
  }
  #draftTable .empty-row td {
    grid-column: 1 / -1;
    font-weight: 400;
  }
  th,
  td {
    padding: 8px 6px;
  }
}

/* Meals list and meal dialog */
.meal-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.meal-list-head h2,
.meal-list-head p {
  margin: 0;
}
.meal-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 10px;
}
.meal-filters input {
  flex: 1 1 220px;
}
.meal-list {
  max-height: min(65vh, 640px);
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.meal-list li + li {
  border-top: 1px solid var(--border);
}
.meal-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}
.meal-row:hover,
.meal-row:focus-visible {
  background: var(--surface-raised);
}
.meal-row small {
  color: var(--muted);
  font-weight: 400;
}
.meal-empty {
  padding: 14px;
}
.meal-dialog {
  width: min(640px, calc(100vw - 20px));
}
.meal-dialog h3 {
  margin: 16px 0 6px;
}
.meal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}
.meal-ingredients {
  margin: 0;
  padding: 0;
  list-style: none;
}
.meal-ingredients li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
#mealForm[hidden],
#mealView[hidden],
#deleteMeal[hidden] {
  display: none;
}
#mealForm textarea {
  width: 100%;
  min-height: 110px;
  margin-top: 4px;
}
.ingredient-editor {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.ingredient-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 56px auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.dialog-grid .ingredient-row input,
.dialog-grid .ingredient-row select {
  margin-top: 0;
}
.ingredient-unit {
  color: var(--muted);
  font-size: 13px;
}
@media (max-width: 600px) {
  .ingredient-row {
    grid-template-columns: minmax(0, 1fr) 80px auto;
  }
  .ingredient-unit {
    display: none;
  }
}
.drink-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
#drinkOptions[hidden] {
  display: none;
}
