/* EasyPantry demo — one stylesheet, mobile-first, no build step.
 * Tested down to 344px (foldable cover screens). No horizontal scroll, 44px touch
 * targets, 16px inputs (no iOS zoom), tables scroll inside their card, never the page.
 * Motion respects prefers-reduced-motion. Inter is self-hosted (no external requests). */

@font-face {
  font-family: 'InterVariable';
  src: url('/fonts/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #faf8f5;
  --card: #ffffff;
  --ink: #1c1c21;
  --muted: #6b6a66;
  --line: #e7e3dc;
  --brand: #2f7d4f;
  --brand-dark: #256641;
  --brand-soft: #e8f4ec;
  --amber-bg: #fef3c7;
  --amber-ink: #92400e;
  --amber-line: #f5d38a;
  --red-bg: #fee2e2;
  --red-ink: #b91c1c;
  --green-bg: #e8f4ec;
  --green-ink: #256641;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 28, 33, 0.04), 0 2px 8px rgba(28, 28, 33, 0.04);
  --shadow-lift: 0 2px 4px rgba(28, 28, 33, 0.06), 0 10px 24px rgba(28, 28, 33, 0.08);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 'InterVariable', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  font-optical-sizing: auto;
}
::selection { background: var(--brand); color: #fff; }

.demo-banner {
  background: repeating-linear-gradient(-45deg, #1c1c21, #1c1c21 14px, #3a3a41 14px, #3a3a41 28px);
  color: #fff;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 6px 10px;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 14px 14px 56px; }
@media (min-width: 700px) { .wrap { padding: 20px 20px 60px; } }

/* ---- header + app tab bar ---- */
header.site { border-bottom: 1px solid var(--line); padding: 10px 0 12px; margin-bottom: 12px; }
.brand-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
header.site h1 { font-size: 20px; margin: 0; letter-spacing: -0.02em; font-weight: 750; }
header.site .pantry-name { color: var(--muted); font-size: 13.5px; min-width: 0; }
.spacer { flex: 1; }
.header-links { display: flex; gap: 2px; }

nav.tabs {
  position: sticky; top: 8px; z-index: 30;
  display: flex; gap: 4px; margin: 0 0 14px;
  background: rgba(240, 237, 231, 0.82);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(231, 227, 220, 0.9);
  border-radius: 999px; padding: 4px;
  box-shadow: var(--shadow);
}
nav.tabs a {
  flex: 1; text-align: center; text-decoration: none; color: var(--ink);
  padding: 9px 6px; border-radius: 999px; font-weight: 600; font-size: 14px;
  min-height: 40px; display: flex; align-items: center; justify-content: center;
  white-space: nowrap;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
nav.tabs a.active { background: var(--brand); color: #fff; box-shadow: 0 2px 6px rgba(47, 125, 79, 0.35); }
nav.tabs a:not(.active):hover { background: rgba(255, 255, 255, 0.8); }
nav.tabs[hidden] { display: none; }
@media (min-width: 700px) {
  nav.tabs { max-width: 420px; }
  nav.tabs a { font-size: 15px; }
}

h2 { font-size: clamp(19px, 4.5vw, 22px); margin: 4px 0 6px; letter-spacing: -0.02em; font-weight: 730; }

/* ---- view transitions ---- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.view-enter { animation: rise 0.28s var(--ease); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 4px; font-size: 16px; letter-spacing: -0.01em; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }

/* ---- controls ---- */
button, .btn {
  font: inherit; font-weight: 600; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--card); color: var(--ink); padding: 10px 16px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  transition: transform 0.12s var(--ease), background 0.15s var(--ease),
              border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
button:hover, .btn:hover { border-color: #cfcabf; box-shadow: var(--shadow); }
button:active, .btn:active { transform: scale(0.97); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); box-shadow: 0 4px 14px rgba(47, 125, 79, 0.3); }
.btn-big { font-size: 18px; padding: 14px 22px; width: 100%; min-height: 56px; }
.btn-quiet {
  border: none; background: none; color: var(--muted); font-weight: 500; font-size: 13px;
  text-decoration: underline; padding: 8px 6px; min-height: 40px;
}
.btn-quiet:hover { box-shadow: none; color: var(--ink); }
.btn-danger-quiet { color: var(--red-ink); }
.btn-danger-quiet:hover { color: var(--red-ink); }
button:disabled { opacity: 0.5; cursor: default; transform: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

input[type="text"], input[type="number"], input[type="password"], select {
  font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff; width: 100%; max-width: 420px; min-height: 44px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 125, 79, 0.18); }
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 4px; }
.field-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.field-row > input, .field-row > select { flex: 1 1 140px; width: auto; }
.field-row > button { flex: 0 0 auto; }
@media (max-width: 480px) { .field-row > button { flex: 1 1 100%; } }

.chip {
  display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 600;
  border-radius: 999px; padding: 4px 10px; background: #f0ede7; color: var(--muted);
  vertical-align: middle; line-height: 1.3;
}
.chip-green { background: var(--green-bg); color: var(--green-ink); }
.chip-amber { background: var(--amber-bg); color: var(--amber-ink); }
.chip-red { background: var(--red-bg); color: var(--red-ink); }

.flag-banner {
  border: 1px solid var(--amber-line); background: var(--amber-bg); color: var(--amber-ink);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-weight: 600;
  font-size: 15px; animation: rise 0.3s var(--ease);
}
.flag-banner ul { margin: 6px 0 0; padding-left: 18px; }
.flag-banner li { margin: 4px 0; }
.ok-banner {
  border: 1px solid #bfdcc9; background: var(--green-bg); color: var(--green-ink);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-weight: 600;
}

/* ---- manifest lines ---- */
.line-row { padding: 14px 0; border-top: 1px solid var(--line); }
.line-row:first-of-type { border-top: none; }
.line-main { min-width: 0; }
.line-title { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.line-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.line-actions > button { flex: 1 1 auto; }
.line-actions > .chip { align-self: center; }
.line-actions > input { flex: 1 1 90px; width: auto; max-width: 140px; }
@media (min-width: 700px) {
  .line-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .line-main { flex: 1 1 200px; }
  .line-actions { margin-top: 0; justify-content: flex-end; }
  .line-actions > button { flex: 0 0 auto; }
}

/* ---- stats ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
@media (max-width: 359px) { .stat-grid { grid-template-columns: 1fr; } }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 10px; text-align: center; box-shadow: var(--shadow); min-width: 0;
}
.stat .num {
  font-size: clamp(21px, 5.5vw, 30px); font-weight: 800; letter-spacing: -0.02em;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.stat .lbl { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 2px; }
.stat.short { background: var(--red-bg); border-color: #f3b9b9; }
.stat.short .num { color: var(--red-ink); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
th { text-align: left; color: var(--muted); font-size: 13px; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); }

/* ---- recipient ---- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 14px; box-shadow: var(--shadow);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.cat-card .cat-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.notice {
  background: #f0ede7; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px;
  font-weight: 600; color: #4b4a45; font-size: 14.5px;
}
.success-flash {
  border: 1px solid #bfdcc9; background: var(--green-bg); color: var(--green-ink);
  border-radius: var(--radius); padding: 14px; font-size: 17px; font-weight: 700; text-align: center;
  margin-bottom: 12px; animation: rise 0.3s var(--ease);
}

/* ---- landing ---- */
.hero { padding: 26px 0 10px; }
.hero h1 {
  font-size: clamp(30px, 7.5vw, 46px); line-height: 1.08; letter-spacing: -0.03em;
  font-weight: 820; margin: 0 0 12px;
}
.hero h1 .accent { color: var(--brand); }
.hero .sub { font-size: clamp(16px, 4vw, 19px); color: var(--muted); max-width: 560px; margin: 0 0 6px; }
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 18px; }
.home-cards .card { margin: 0; display: flex; flex-direction: column; gap: 8px; transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.home-cards .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.home-cards .card .btn { align-self: flex-start; }
.error-text { color: var(--red-ink); font-weight: 600; margin-top: 8px; }
.footnote { color: var(--muted); font-size: 13px; margin-top: 20px; }

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