:root {
  --pine:#163a29; --moss:#3f7a5b; --terracotta:#bd6b3c; --paper:#f4f0e6;
  --red:#a3402c; --amber:#bd6b3c; --green:#3f7a5b;
}
* { box-sizing: border-box; }
body {
  margin:0; background:var(--paper); color:var(--pine);
  font-family: Inter, system-ui, sans-serif; line-height:1.5;
}
h1,h2 { font-family: Bitter, Georgia, serif; }
.wrap { max-width:640px; margin:0 auto; padding:16px 14px 60px; }
header.site { display:flex; align-items:baseline; gap:10px; justify-content:center; padding:8px 0 4px; flex-wrap:wrap; }
header.site a { color:var(--pine); text-decoration:none; font-weight:700; }
header.site .tagline { color:var(--terracotta); font-weight:700; font-family: Bitter, serif; }

.panel {
  background:#fff; border:1px solid #e2dbc9; border-radius:12px;
  padding:16px; margin:16px 0;
}
.panel h2 { margin:0 0 8px; font-size:1.15rem; }
.hidden { display:none !important; }

.score-card {
  background:#fff; border:1px solid #e2dbc9; border-radius:14px;
  padding:20px 16px; text-align:center; margin:14px 0;
}
.score-num { font-family:Bitter, serif; font-size:3rem; font-weight:700; color:var(--pine); line-height:1; }
.score-label { color:#5a6b60; margin-top:2px; }
.score-sub { margin-top:12px; font-size:.95rem; }
.score-note { color:#5a6b60; font-size:.8rem; margin-top:6px; }
.score-card.band-red .score-num { color:var(--red); }
.score-card.band-amber .score-num { color:var(--amber); }
.score-card.band-green .score-num { color:var(--green); }

.btn, .btn-primary, .btn-link {
  font: inherit; border-radius:10px; border:1px solid #d8d0ba;
  background:#fff; color:var(--pine); padding:12px 16px; cursor:pointer;
  min-height:44px; display:inline-flex; align-items:center; justify-content:center;
}
.btn-primary { background:var(--pine); color:#fff; border-color:var(--pine); font-weight:600; }
.btn-block { width:100%; margin-top:6px; }
.btn-link { border:none; background:none; color:var(--terracotta); text-decoration:underline; padding:8px; }
.panel-actions { display:flex; gap:10px; flex-wrap:wrap; margin-top:10px; }
.visually-hidden { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }

label { display:block; font-size:.85rem; color:#3a463f; margin:10px 0 4px; }
input, select { font: inherit; width:100%; padding:11px 10px; border:1px solid #d8d0ba; border-radius:8px; background:#fff; min-height:44px; }
.row { display:flex; gap:10px; }
.row > label { flex:1; }
.row-actions { display:flex; gap:10px; }
.row-actions > .btn-block { flex:1; margin-top:6px; }
hr { border:none; border-top:1px solid #e2dbc9; margin:14px 0; }
.fine-print { font-size:.78rem; color:#5a6b60; margin-top:10px; }
.section-note { font-size:.85rem; color:#5a6b60; margin:0 0 10px; }

.combo { position:relative; display:block; }
.combo-list {
  list-style:none; margin:2px 0 0; padding:4px; position:absolute; z-index:20;
  top:100%; left:0; right:0; max-height:260px; overflow-y:auto;
  background:#fff; border:1px solid #d8d0ba; border-radius:8px;
  box-shadow:0 6px 16px rgba(22,58,41,.15);
}
.combo-list.hidden { display:none !important; }
.combo-option {
  padding:11px 10px; min-height:44px; display:flex; align-items:center;
  border-radius:6px; cursor:pointer;
}
.combo-option:hover, .combo-option.active { background:#f4f0e6; }
.combo-empty { padding:11px 10px; color:#5a6b60; font-size:.85rem; }

.chip-row { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.chip {
  font: inherit; font-size:.85rem; border-radius:20px; border:1px solid #d8d0ba;
  background:#fff; color:var(--pine); padding:8px 14px; cursor:pointer;
  min-height:44px; display:inline-flex; align-items:center;
}
.chip:hover, .chip:focus-visible { background:#f4f0e6; }
.chip.active { background:var(--pine); color:#fff; border-color:var(--pine); }

.count-badge { font-size:.85rem; color:#5a6b60; font-weight:400; font-family:Inter,sans-serif; }
.category-group { margin-bottom:14px; }
.category-group h3 { font-size:.95rem; color:var(--terracotta); text-transform:uppercase; letter-spacing:.03em; margin:0 0 6px; }
.item-list { list-style:none; margin:0; padding:0; }
.item-row {
  display:flex; justify-content:space-between; align-items:center; gap:8px;
  padding:10px 0; border-bottom:1px solid #eee5d0;
}
.item-row:last-child { border-bottom:none; }
.item-name { font-weight:600; }
.item-meta { font-size:.82rem; color:#5a6b60; }
.item-row.expiring .item-name { color:var(--red); }
.item-del { background:none; border:none; color:#a3402c; font-size:1.2rem; cursor:pointer; padding:8px; min-height:44px; min-width:44px; }
.item-edit-target {
  flex:1; text-align:left; background:none; border:none; font:inherit; color:inherit;
  cursor:pointer; padding:8px 4px; min-height:44px; border-radius:8px;
}
.item-edit-target:hover, .item-edit-target:focus-visible { background:#f4f0e6; }
.empty-state { color:#5a6b60; font-style:italic; }

.restock-cat { margin-bottom:14px; }
.restock-cat h3 { font-size:1rem; margin:0 0 6px; }
.restock-products { display:flex; flex-direction:column; gap:8px; }
.restock-product {
  display:flex; gap:10px; align-items:center; border:1px solid #e2dbc9;
  border-radius:8px; padding:8px;
}
.restock-product img { width:52px; height:52px; object-fit:cover; border-radius:6px; flex-shrink:0; background:#f4f0e6; }
.restock-product a { color:var(--pine); font-weight:600; text-decoration:none; font-size:.9rem; }
.restock-product .price { color:var(--terracotta); font-size:.85rem; }
.tt-disc { font-size:.78rem; color:#5a6b60; border-top:1px dashed #d8d0ba; padding-top:10px; margin-top:10px; }

footer { text-align:center; color:#5a6b60; font-size:.82rem; margin-top:30px; }
.offline-stamp { font-size:.76rem; margin-top:6px; }

@media print {
  header.site, .score-card button, #settingsPanel, #addForm, #restockPanel, footer { display:none !important; }
  body { background:#fff; }
  .panel { border:1px solid #ccc; break-inside:avoid; }
}
