*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --c-green-900: #1b4332;
  --c-green-700: #2d6a4f;
  --c-green-500: #40916c;
  --c-green-300: #74c69d;
  --c-green-100: #d8f3dc;
  --c-green-50: #f0faf4;
  --c-amber: #ffd166;
  --c-amber-dark: #e6a700;
  --c-red: #e63946;
  --c-red-light: #fce4e6;
  --c-text: #1a1a2e;
  --c-text-light: #4a4e69;
  --c-bg: #f8f9fa;
  --c-white: #ffffff;
  --c-border: #dee2e6;
  --c-shadow: 0 2px 8px rgba(0,0,0,.08);
  --c-shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --radius: 8px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
}
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--c-text); background: var(--c-bg); line-height: 1.6; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { background: var(--c-white); border-bottom: 1px solid var(--c-border); position: sticky; top: 0; z-index: 100; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--c-green-900); font-weight: 700; font-size: 1.1rem; }
.nav { display: flex; gap: 20px; }
.nav a { text-decoration: none; color: var(--c-text-light); font-weight: 500; padding: 6px 0; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.nav a:hover { color: var(--c-green-700); border-bottom-color: var(--c-green-500); }

/* Hero */
.hero { background: linear-gradient(135deg, var(--c-green-900), var(--c-green-700)); color: var(--c-white); padding: 60px 0 48px; }
.hero h1 { font-size: 2.4rem; font-weight: 800; margin-bottom: 12px; line-height: 1.2; }
.hero-sub { font-size: 1.15rem; opacity: .9; max-width: 560px; margin-bottom: 32px; }
.hero-stats { display: flex; gap: 24px; flex-wrap: wrap; }
.stat { background: rgba(255,255,255,.12); border-radius: var(--radius); padding: 16px 20px; min-width: 160px; }
.stat strong { display: block; font-size: 1.4rem; color: var(--c-amber); }
.stat span { font-size: .85rem; opacity: .85; }

/* Planner Section */
.planner-section { padding: 48px 0; }
.planner-layout { display: grid; grid-template-columns: 1fr 280px; gap: 32px; }
.planner-main h2 { font-size: 1.5rem; margin-bottom: 20px; color: var(--c-green-900); }

/* Preset Chips */
.preset-bar { margin-bottom: 16px; }
.preset-label { font-size: .85rem; color: var(--c-text-light); display: block; margin-bottom: 8px; }
.preset-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--c-green-100); border: 1px solid var(--c-green-300); border-radius: 20px; padding: 6px 14px; font-size: .82rem; cursor: pointer; color: var(--c-green-900); font-family: var(--font); transition: background .2s, transform .1s; }
.chip:hover { background: var(--c-green-300); }
.chip:active { transform: scale(.97); }

/* Form */
.add-form { background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 140px; }
.field label { font-size: .82rem; font-weight: 600; color: var(--c-text-light); }
.field input { padding: 10px 12px; border: 1px solid var(--c-border); border-radius: var(--radius); font-size: .95rem; font-family: var(--font); transition: border-color .2s; }
.field input:focus { outline: none; border-color: var(--c-green-500); box-shadow: 0 0 0 3px rgba(64,145,108,.15); }
.field-qty { max-width: 70px; }
.btn { padding: 10px 20px; border-radius: var(--radius); font-size: .95rem; font-weight: 600; font-family: var(--font); cursor: pointer; border: 2px solid transparent; transition: all .2s; white-space: nowrap; }
.btn-primary { background: var(--c-green-700); color: var(--c-white); border-color: var(--c-green-700); }
.btn-primary:hover { background: var(--c-green-900); }
.btn-outline { background: var(--c-white); color: var(--c-green-700); border-color: var(--c-green-500); }
.btn-outline:hover { background: var(--c-green-50); }
.btn-danger { background: var(--c-white); color: var(--c-red); border-color: var(--c-red); }
.btn-danger:hover { background: var(--c-red-light); }

/* Actions Bar */
.actions-bar { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; align-items: center; }
.save-status { font-size: .85rem; color: var(--c-green-500); font-weight: 500; margin-left: auto; }

/* Groups Output */
.groups-output { min-height: 200px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--c-text-light); }
.empty-state svg { margin-bottom: 16px; opacity: .5; }
.group { margin-bottom: 24px; }
.group-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.group-title { font-size: 1.15rem; font-weight: 700; }
.group-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

.badge-urgent { background: var(--c-red); color: var(--c-white); }
.badge-week { background: #ff8c00; color: var(--c-white); }
.badge-2weeks { background: var(--c-amber); color: var(--c-text); }
.badge-month { background: #4a90d9; color: var(--c-white); }
.badge-later { background: var(--c-green-300); color: var(--c-green-900); }
.badge-expired { background: #333; color: var(--c-white); }

.group-items { background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--radius-lg); overflow: hidden; }
.group-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--c-border); gap: 12px; }
.group-item:last-child { border-bottom: none; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 600; font-size: .95rem; }
.item-name .qty { color: var(--c-text-light); font-weight: 400; font-size: .85rem; }
.item-date { font-size: .82rem; color: var(--c-text-light); }
.item-date .days-away { font-weight: 600; }
.item-date .days-away.red { color: var(--c-red); }
.item-date .days-away.orange { color: #ff8c00; }
.item-date .days-away.blue { color: #4a90d9; }
.item-remove { background: none; border: none; color: var(--c-text-light); cursor: pointer; padding: 4px; border-radius: 4px; font-size: 1.1rem; line-height: 1; transition: color .2s; flex-shrink: 0; }
.item-remove:hover { color: var(--c-red); }

/* Side Panel */
.planner-side { display: flex; flex-direction: column; gap: 20px; }
.side-card { background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: 20px; }
.side-card h3 { font-size: 1rem; margin-bottom: 12px; color: var(--c-green-900); }
.storage-guide { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: .82rem; }
.storage-guide dt { font-weight: 600; color: var(--c-text); }
.storage-guide dd { color: var(--c-text-light); }
.quick-stats { display: flex; flex-direction: column; gap: 12px; }
.qstat { display: flex; flex-direction: column; align-items: center; background: var(--c-green-50); border-radius: var(--radius); padding: 12px; }
.qstat-num { font-size: 1.6rem; font-weight: 800; color: var(--c-green-700); }
.qstat-label { font-size: .78rem; color: var(--c-text-light); text-align: center; }

/* Guide Section */
.guide-section { background: var(--c-white); border-top: 1px solid var(--c-border); padding: 60px 0; }
.guide-section h2 { font-size: 1.6rem; margin-bottom: 32px; color: var(--c-green-900); }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 40px; }
.guide-card { background: var(--c-green-50); border-radius: var(--radius-lg); padding: 24px; }
.guide-card h3 { font-size: 1.05rem; margin-bottom: 8px; color: var(--c-green-900); }
.guide-card p { font-size: .9rem; color: var(--c-text-light); line-height: 1.7; }
.guide-full { margin-bottom: 32px; }
.guide-full h3 { font-size: 1.15rem; margin-bottom: 12px; color: var(--c-green-900); }
.guide-full p, .guide-full li { font-size: .93rem; color: var(--c-text-light); line-height: 1.75; }
.mistake-list { list-style: none; padding: 0; }
.mistake-list li { padding: 10px 0; border-bottom: 1px solid var(--c-border); }
.mistake-list li:last-child { border-bottom: none; }
.scenario-steps { padding-left: 20px; margin: 12px 0; }
.scenario-steps li { margin-bottom: 8px; }

/* Footer */
.site-footer { background: var(--c-green-900); color: var(--c-white); padding: 32px 0; }
.footer-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.footer-brand { font-weight: 700; }
.footer-updated { font-size: .82rem; opacity: .7; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--c-green-300); text-decoration: none; font-size: .85rem; transition: color .2s; }
.footer-links a:hover { color: var(--c-white); }

/* Print */
@media print {
  .site-header, .site-footer, .preset-bar, .add-form, .actions-bar, .planner-side, .guide-section { display: none !important; }
  .planner-section { padding: 0; }
  .group-items { border: none; }
  .group-item { border-bottom: 1px solid #ccc; }
  .item-remove { display: none; }
  body { font-size: 12pt; }
  .group-badge { border: 1px solid #999; background: none !important; color: #000 !important; }
}

/* Responsive */
@media (max-width: 860px) {
  .planner-layout { grid-template-columns: 1fr; }
  .planner-side { flex-direction: row; flex-wrap: wrap; }
  .side-card { flex: 1; min-width: 240px; }
  .guide-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.8rem; }
  .hero-stats { gap: 12px; }
  .stat { min-width: 120px; padding: 12px 14px; }
  .form-row { flex-direction: column; align-items: stretch; }
  .field { min-width: 0; }
  .field-qty { max-width: none; }
  .storage-guide { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .hero { padding: 40px 0 32px; }
  .hero h1 { font-size: 1.5rem; }
  .nav { gap: 12px; }
  .nav a { font-size: .85rem; }
  .actions-bar { justify-content: flex-start; }
  .save-status { margin-left: 0; width: 100%; }
}


/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
