:root {
  color-scheme: light;
  --ink: #17332e;
  --muted: #697973;
  --paper: #f5f1e8;
  --card: rgba(255, 255, 255, 0.84);
  --line: #d9dfd8;
  --green: #123c35;
  --green-2: #22695d;
  --mint: #dcebe3;
  --yellow: #f7c95c;
  --coral: #ff725e;
  --shadow: 0 18px 50px rgba(20, 55, 47, 0.1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

button, input, select { font: inherit; }
button { cursor: pointer; }

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.55;
  pointer-events: none;
  z-index: -1;
}
.ambient-one { width: 420px; height: 420px; background: #d8e9de; right: -150px; top: 70px; }
.ambient-two { width: 300px; height: 300px; background: #f9df9d; left: -180px; bottom: 80px; }

.topbar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { color: inherit; text-decoration: none; display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: var(--green); color: var(--yellow); font-weight: 900; font-size: 20px;
  box-shadow: 0 8px 18px rgba(18, 60, 53, 0.2);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: 0.01em; }
.brand small { color: var(--muted); margin-top: 2px; font-size: 11px; }
.privacy-pill {
  border: 1px solid rgba(18, 60, 53, 0.12); background: rgba(255,255,255,.55);
  border-radius: 999px; padding: 9px 13px; color: var(--muted); font-size: 12px; font-weight: 650;
}
.privacy-pill span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #3a9b75; margin-right: 6px; }

.shell { max-width: 1180px; margin: 0 auto; padding: 34px 28px 70px; }
.hero { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 40px; margin: 28px 0 42px; }
.eyebrow { margin: 0 0 10px; color: var(--green-2); letter-spacing: .16em; font-size: 11px; font-weight: 800; }
.hero h1 { margin: 0; font-size: clamp(46px, 8vw, 82px); line-height: .93; letter-spacing: -.06em; max-width: 760px; }
.hero h1 em { color: var(--coral); font-family: Georgia, serif; font-weight: 500; }
.hero-copy { color: var(--muted); line-height: 1.65; max-width: 560px; margin: 26px 0 0; font-size: 16px; }
.hero-stat { min-width: 180px; display: flex; gap: 14px; align-items: center; border-left: 1px solid var(--line); padding-left: 30px; }
.hero-stat span { font-family: Georgia, serif; font-size: 58px; color: var(--green-2); }
.hero-stat p { margin: 0; color: var(--muted); line-height: 1.35; font-size: 13px; }

.demo-notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border: 1px solid #ecd28d; background: #fff6d9; border-radius: 15px; margin-bottom: 24px; }
.demo-notice > span { color: #a36d00; font-size: 22px; line-height: 1; }
.demo-notice strong { font-size: 13px; }
.demo-notice p { margin: 3px 0 0; color: #7c6b3e; font-size: 12px; }
.demo-notice.is-live { border-color: #b9d8c7; background: #edf8f0; }
.demo-notice.is-live > span { color: #2d7a55; }
.demo-notice.is-live p { color: #557064; }
.demo-notice.is-error { border-color: #e6bbb3; background: #fff0ed; }
.demo-notice.is-error > span { color: #a84f40; }
.demo-notice.is-error p { color: #805d56; }

.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tab { border: 0; background: none; color: var(--muted); padding: 12px 15px; font-weight: 750; font-size: 13px; position: relative; }
.tab::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; background: transparent; border-radius: 3px 3px 0 0; }
.tab.is-active { color: var(--ink); }
.tab.is-active::after { background: var(--coral); }
.tab span { display: inline-grid; place-items: center; min-width: 19px; height: 19px; border-radius: 10px; background: var(--mint); margin-left: 4px; font-size: 10px; }

.view { display: none; }
.view.is-active { display: block; animation: enter .3s ease both; }
#list-view.is-active { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } }

.panel { background: var(--card); border: 1px solid rgba(18,60,53,.1); border-radius: 24px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.composer-panel { padding: 30px; }
.sources-panel { padding: 24px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.section-heading h2 { margin: 0; font-size: 25px; letter-spacing: -.025em; }
.section-heading.compact h2 { font-size: 20px; }
.item-counter, .sync-time { color: var(--muted); font-size: 12px; }
.sync-time { margin: 10px 0 0; line-height: 1.45; }
.sync-button { border: 0; background: transparent; color: var(--green-2); padding: 4px 0; font-size: 11px; font-weight: 750; }
.sync-button:hover { text-decoration: underline; }
.sync-button:disabled { color: var(--muted); cursor: wait; text-decoration: none; }

.add-form { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; margin-top: 24px; padding: 6px; border: 1px solid #cad5cd; border-radius: 16px; background: #fff; transition: box-shadow .2s, border-color .2s; }
.add-form:focus-within { border-color: var(--green-2); box-shadow: 0 0 0 4px rgba(34,105,93,.11); }
.search-icon { color: var(--muted); font-size: 25px; padding-left: 10px; transform: rotate(-20deg); }
.add-form input { min-width: 0; border: 0; outline: 0; padding: 12px 4px; color: var(--ink); background: transparent; }
.add-form button, .primary-button { border: 0; background: var(--green); color: #fff; border-radius: 12px; padding: 12px 18px; font-weight: 750; transition: transform .15s, background .15s; }
.add-form button:hover, .primary-button:hover { background: var(--green-2); transform: translateY(-1px); }

.quick-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 20px; }
.quick-add span { color: var(--muted); font-size: 11px; margin-right: 2px; }
.quick-add button { border: 1px solid var(--line); background: transparent; color: var(--green-2); border-radius: 999px; padding: 7px 10px; font-size: 11px; font-weight: 700; }
.quick-add button:hover { background: var(--mint); border-color: #c4d8cc; }

.shopping-list { border-top: 1px solid var(--line); }
.list-item { display: grid; grid-template-columns: 42px minmax(0,1fr) auto auto; align-items: center; gap: 13px; padding: 17px 2px; border-bottom: 1px solid var(--line); }
.food-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; background: var(--mint); font-size: 19px; }
.item-copy strong, .item-copy small { display: block; }
.item-copy strong { font-size: 14px; }
.item-copy small { color: var(--muted); font-size: 11px; margin-top: 4px; }
.quantity { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.quantity button { width: 29px; height: 29px; border: 0; background: transparent; color: var(--green-2); font-weight: 800; }
.quantity span { min-width: 28px; text-align: center; font-size: 12px; font-weight: 750; }
.remove-button { width: 32px; height: 32px; border: 0; background: transparent; border-radius: 10px; color: #9a5b51; font-size: 18px; }
.remove-button:hover { background: #ffebe8; }
.empty-state { padding: 50px 20px; text-align: center; color: var(--muted); }
.empty-state span { display: block; font-size: 35px; margin-bottom: 10px; }

.compare-bar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 25px; padding: 20px; background: #ecf2ed; border-radius: 17px; }
.compare-bar div span, .compare-bar div strong { display: block; }
.compare-bar div span { color: var(--muted); font-size: 10px; margin-bottom: 3px; }
.compare-bar div strong { font-size: 20px; }
.primary-button { padding: 13px 20px; }
.primary-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.source-list { margin-top: 18px; display: grid; gap: 8px; }
.source { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; padding: 12px; background: rgba(245,248,245,.9); border-radius: 14px; }
.source-logo { width: 34px; height: 34px; display: grid; place-items: center; color: white; border-radius: 10px; font-size: 12px; font-weight: 900; }
.source strong, .source small { display: block; }
.source strong { font-size: 12px; }
.source small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #d2a73c; }
.status-dot.is-live { background: #3a9b75; box-shadow: 0 0 0 4px rgba(58,155,117,.12); }
.status-dot.is-loading { background: #d2a73c; animation: pulse 1.1s ease-in-out infinite; }
.status-dot.is-error { background: #c86454; }
.status-dot.is-tested { background: #1e9bd7; box-shadow: 0 0 0 4px rgba(30,155,215,.12); }
.status-dot.is-blocked { background: #8b7b72; }
@keyframes pulse { 50% { opacity: .35; } }

.page-heading { margin: 24px 0; }
.text-button { border: 0; background: transparent; color: var(--green-2); font-size: 12px; font-weight: 750; }
.plans { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
.plan-card { position: relative; border: 1px solid rgba(18,60,53,.11); background: rgba(255,255,255,.7); border-radius: 20px; padding: 22px; text-align: left; color: inherit; box-shadow: 0 10px 26px rgba(20,55,47,.06); }
.plan-card:hover { transform: translateY(-2px); border-color: #afc9bd; }
.plan-card.is-selected { background: var(--green); color: #fff; border-color: var(--green); }
.plan-kicker { color: var(--green-2); font-size: 10px; font-weight: 850; letter-spacing: .1em; }
.plan-card.is-selected .plan-kicker, .plan-card.is-selected .plan-note { color: #bcd7cd; }
.plan-card h3 { margin: 10px 0 4px; font-size: 17px; }
.plan-total { display: block; margin: 18px 0 4px; font-family: Georgia, serif; font-size: 31px; }
.plan-note { color: var(--muted); font-size: 11px; }
.saving { position: absolute; top: 16px; right: 16px; background: var(--yellow); color: #60490d; padding: 5px 8px; border-radius: 8px; font-size: 9px; font-weight: 850; }
.plan-detail { padding: 26px; }
.plan-detail h3 { margin: 0 0 4px; }
.detail-subtitle { margin: 0 0 20px; color: var(--muted); font-size: 12px; }
.detail-store { margin-top: 20px; }
.detail-store-heading { display: flex; justify-content: space-between; align-items: center; padding-bottom: 9px; border-bottom: 2px solid var(--ink); }
.detail-store-heading strong { font-size: 14px; }
.detail-row { display: grid; grid-template-columns: 1fr minmax(150px, .8fr) auto; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.detail-row span:nth-child(2) { color: var(--muted); }
.detail-row a { color: var(--green-2); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.detail-row strong { text-align: right; }
.missing { color: #9b4d41; background: #ffebe8; border-radius: 10px; padding: 9px 12px; margin-top: 12px; font-size: 12px; }

.select-label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.select-label select { border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); padding: 9px 12px; }
.history-panel { padding: 28px; }
.history-data-note { margin: 0 0 18px; color: var(--muted); font-size: 11px; }
.history-data-note strong { color: var(--green-2); }
.history-summary { display: flex; gap: 34px; flex-wrap: wrap; margin-bottom: 22px; }
.history-metric span, .history-metric strong { display: block; }
.history-metric span { color: var(--muted); font-size: 10px; margin-bottom: 4px; }
.history-metric strong { font-size: 20px; }
.deal-badge { align-self: center; border-radius: 999px; padding: 8px 12px; background: var(--mint); color: var(--green-2); font-size: 11px; font-weight: 800; }
.deal-badge.caution { background: #fff0c7; color: #7b5b09; }
.chart { min-height: 330px; overflow: hidden; }
.chart svg { width: 100%; height: 330px; display: block; }
.grid-line { stroke: #dce2dd; stroke-width: 1; }
.axis-label { fill: #87948f; font-size: 10px; }
.chart-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { stroke: #fff; stroke-width: 2; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.legend-item { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.legend-item i { width: 18px; height: 3px; border-radius: 4px; }

footer { max-width: 1180px; margin: 0 auto; padding: 22px 28px 34px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

@media (max-width: 820px) {
  #list-view.is-active { grid-template-columns: 1fr; }
  .plans { grid-template-columns: 1fr; }
  .sources-panel { order: 2; }
}

@media (max-width: 600px) {
  .topbar, .shell, footer { padding-left: 18px; padding-right: 18px; }
  .topbar { padding-top: 18px; }
  .privacy-pill { font-size: 0; padding: 10px; }
  .privacy-pill span { margin: 0; }
  .hero { grid-template-columns: 1fr; margin-top: 12px; }
  .hero-stat { display: none; }
  .hero h1 { font-size: 50px; }
  .composer-panel, .sources-panel, .history-panel, .plan-detail { padding: 20px; border-radius: 19px; }
  .add-form { grid-template-columns: auto 1fr; }
  .add-form button { grid-column: 1 / -1; }
  .list-item { grid-template-columns: 38px minmax(0,1fr) auto; }
  .quantity { grid-column: 2; width: max-content; }
  .remove-button { grid-column: 3; grid-row: 1 / span 2; }
  .compare-bar { align-items: stretch; flex-direction: column; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
  .detail-row { grid-template-columns: 1fr auto; }
  .detail-row span:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .page-heading { align-items: flex-end; }
  .select-label { align-items: flex-start; flex-direction: column; gap: 4px; }
  footer { gap: 12px; flex-direction: column; }
}
