/* Pantry Expiry Queue - visual identity: leaf green + cream, four vertical urgency lanes, use-first hero. */
:root {
  --green: #3A7D44;
  --green-deep: #2C5F34;
  --green-soft: #DCEBDD;
  --cream: #FFF8E7;
  --cream-deep: #F4E9CF;
  --ink: #1F2A21;
  --ink-soft: #5B6A5E;
  --line: #E3D9C0;
  --white: #FFFFFF;
  --lane-today: #B7412E;
  --lane-today-bg: #FBE6E1;
  --lane-three: #C7830A;
  --lane-three-bg: #FBEFD6;
  --lane-week: #3A7D44;
  --lane-week-bg: #E2EFE3;
  --lane-later: #6B7F6E;
  --lane-later-bg: #ECEDE6;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(31, 42, 33, 0.08), 0 6px 18px rgba(31, 42, 33, 0.06);
  --focus: 0 0 0 3px var(--cream), 0 0 0 6px var(--green);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html { background: var(--cream); color-scheme: light; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--cream);
  min-height: 100vh;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--cream-deep); padding: 0 4px; border-radius: 4px; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }

.skip-link {
  position: absolute; left: -999px; top: 8px; background: var(--green); color: var(--white);
  padding: 8px 14px; border-radius: var(--radius-sm); z-index: 10;
}
.skip-link:focus { left: 8px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 40px);
  background: var(--green);
  color: var(--cream);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-icon { width: 40px; height: 40px; flex: none; border-radius: 10px; }
.topbar h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: 0.01em; }
.tagline { font-size: 0.9rem; opacity: 0.9; }
.topbar-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 0.9rem; }
.today-chip { background: rgba(255, 248, 231, 0.18); padding: 4px 12px; border-radius: 999px; }
.today-chip time { font-weight: 600; margin-left: 4px; }
.summary-line { opacity: 0.95; }

main { padding: 20px clamp(16px, 4vw, 40px) 32px; max-width: 1280px; margin: 0 auto; }

/* ---------- hero: use-first card ---------- */
.hero {
  background: var(--white);
  border: 2px solid var(--green);
  border-left-width: 10px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px clamp(16px, 3vw, 28px);
  margin-bottom: 20px;
}
.hero.is-empty { border-style: dashed; border-left-width: 2px; background: transparent; box-shadow: none; }
.hero-kicker {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--green); font-weight: 700;
  margin-bottom: 6px;
}
.hero-lead { color: var(--ink-soft); font-size: 0.95rem; }
.hero-name { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; line-height: 1.1; margin: 4px 0; color: var(--ink); }
.hero-meta { color: var(--ink-soft); font-size: 0.95rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.hero-more { margin-top: 10px; font-size: 0.9rem; color: var(--ink-soft); }

/* ---------- buttons ---------- */
.btn {
  border: 1.5px solid var(--green); background: var(--white); color: var(--green-deep);
  border-radius: 999px; padding: 8px 16px; cursor: pointer; font-weight: 600; font-size: 0.95rem;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}
.btn:hover { background: var(--green-soft); }
.btn:active { transform: translateY(1px); }
.btn-primary, .btn-hero { background: var(--green); color: var(--white); border-color: var(--green); }
.btn-primary:hover, .btn-hero:hover { background: var(--green-deep); }
.btn-hero { padding: 10px 22px; font-size: 1.05rem; }
.btn-hero-ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); padding: 10px 18px; }
.btn-hero-ghost:hover { background: var(--cream-deep); }
.btn-small { padding: 4px 11px; font-size: 0.82rem; }
.btn-ghost { border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { background: var(--cream-deep); }
.btn-danger { border-color: var(--lane-today); color: var(--lane-today); }
.btn-danger:hover { background: var(--lane-today-bg); }
.btn-link { border: none; background: none; color: var(--green-deep); text-decoration: underline; padding: 0; font-weight: 600; }

/* ---------- intake form ---------- */
.intake {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px clamp(14px, 3vw, 24px); margin-bottom: 20px;
}
.intake h2, .tools h2 { font-size: 1.05rem; margin-bottom: 10px; color: var(--green-deep); }
.intake-form {
  display: grid; gap: 12px 14px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 4px; grid-column: span 6; }
.field-name { grid-column: span 12; }
.field-note { grid-column: span 9; }
.field-submit { grid-column: span 3; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.optional { font-weight: 400; opacity: 0.8; }
.field input, .field select, .field textarea {
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; background: var(--cream);
  width: 100%; min-height: 42px;
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { border-color: var(--green); }
.field-submit .btn { width: 100%; min-height: 42px; }
.form-errors { grid-column: 1 / -1; color: var(--lane-today); font-size: 0.92rem; }
.form-errors:empty { display: none; }
.form-errors ul { margin: 0; padding-left: 20px; }

/* ---------- empty state ---------- */
.empty-state {
  background: var(--white); border: 2px dashed var(--green); border-radius: var(--radius);
  padding: 22px; text-align: center; margin-bottom: 20px;
}
.empty-state h2 { font-size: 1.2rem; color: var(--green-deep); margin-bottom: 6px; }
.empty-state p { max-width: 56ch; margin: 0 auto 6px; color: var(--ink-soft); }

/* ---------- the four lanes ---------- */
.lanes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.lanes.is-empty { opacity: 0.55; }
.lane {
  display: flex; flex-direction: column;
  border-radius: var(--radius);
  background: var(--lane-bg);
  border-top: 6px solid var(--lane-color);
  min-height: 260px;
  padding: 12px 12px 14px;
}
.lane-today { --lane-color: var(--lane-today); --lane-bg: var(--lane-today-bg); }
.lane-three { --lane-color: var(--lane-three); --lane-bg: var(--lane-three-bg); }
.lane-week { --lane-color: var(--lane-week); --lane-bg: var(--lane-week-bg); }
.lane-later { --lane-color: var(--lane-later); --lane-bg: var(--lane-later-bg); }
.lane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lane-head h2 { font-size: 1.05rem; color: var(--lane-color); font-weight: 800; letter-spacing: 0.01em; }
.lane-count {
  min-width: 28px; height: 28px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--lane-color); color: var(--white); font-weight: 700; font-size: 0.85rem; padding: 0 8px;
}
.lane-hint { font-size: 0.78rem; color: var(--ink-soft); margin: 2px 0 10px; }
.lane-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.lane-empty { color: var(--ink-soft); font-size: 0.85rem; font-style: italic; padding: 8px 4px; }

.item {
  background: var(--white); border-radius: var(--radius-sm); padding: 10px 10px 8px;
  border-left: 4px solid var(--lane-color);
  box-shadow: 0 1px 2px rgba(31, 42, 33, 0.06);
  display: grid; gap: 6px;
  animation: slide-in 220ms ease-out;
}
.item.status-expired { border-left-color: var(--lane-today); background: #FFF2EF; }
.item-main { display: flex; flex-direction: column; }
.item-name { font-weight: 700; overflow-wrap: anywhere; }
.item-meta { font-size: 0.8rem; color: var(--ink-soft); }
.item-note { font-size: 0.8rem; color: var(--ink-soft); font-style: italic; overflow-wrap: anywhere; }
.item-when { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: 0.82rem; }
.item-when .days { font-weight: 700; color: var(--lane-color); }
.item-when time { color: var(--ink-soft); font-family: var(--mono); font-size: 0.78rem; }
.flow { font-size: 0.75rem; color: var(--ink-soft); width: 100%; }
.item-actions { display: flex; gap: 6px; }

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- tools ---------- */
.tools { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px clamp(14px, 3vw, 24px); }
.tool-row { display: flex; flex-wrap: wrap; gap: 8px; }
.import-box { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.import-box summary { cursor: pointer; font-weight: 600; color: var(--green-deep); }
.import-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 10px; }
.import-grid .field { grid-column: auto; }
.import-grid textarea { font-family: var(--mono); font-size: 0.82rem; resize: vertical; }
.import-grid .btn { margin-top: 6px; align-self: flex-start; }
.hint { font-size: 0.82rem; color: var(--ink-soft); margin-top: 8px; }
.status-msg { margin-top: 12px; font-size: 0.92rem; color: var(--green-deep); min-height: 1.4em; }
.status-msg.is-error { color: var(--lane-today); }

.foot { padding: 12px clamp(16px, 4vw, 40px) 28px; font-size: 0.8rem; color: var(--ink-soft); max-width: 1280px; margin: 0 auto; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .lanes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field { grid-column: span 6; }
}
@media (max-width: 600px) {
  .lanes { grid-template-columns: 1fr; }
  .lane { min-height: 0; }
  .field, .field-note, .field-submit { grid-column: span 12; }
  .topbar { padding-top: 12px; padding-bottom: 12px; }
  .brand-icon { width: 34px; height: 34px; }
  .topbar h1 { font-size: 1.15rem; }
  .tagline { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .item { animation: none; }
  .btn { transition: none; }
  .btn:active { transform: none; }
}

/* ---------- print: the use-first list only ---------- */
@media print {
  .topbar { background: none; color: var(--ink); padding: 0 0 8px; border-bottom: 2px solid var(--ink); }
  .brand-icon, .skip-link, .intake, .tools, .foot, .empty-state, .item-actions, .hero-actions, .hero-more, .flow { display: none !important; }
  main { padding: 0; max-width: none; }
  .hero { border-left-width: 6px; box-shadow: none; page-break-inside: avoid; }
  .lanes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .lane { min-height: 0; background: none; border: 1px solid #999; border-top-width: 5px; page-break-inside: avoid; }
  .item { box-shadow: none; border: 1px solid #ccc; animation: none; page-break-inside: avoid; }
  body { background: #fff; }
}
