* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  background-color: #fdfaf5;
  color: #3d2b1f;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.55;
  padding: 20px 14px 60px;
}
.container {
  max-width: 900px;          /* ← slightly wider to give columns breathing room */
  margin: 0 auto;
}
header {
  text-align: center;
  padding: 40px 0 30px;
}
h1 {
  font-size: 2.6rem;
  font-weight: 500;
  color: #5d4037;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.tagline {
  font-size: 1.1rem;
  color: #8d6e63;
  font-style: italic;
  margin-bottom: 12px;
}
.updated {
  font-size: 0.95rem;
  color: #a1887f;
}
.controls {
  text-align: center;
  margin: 20px 0 30px;
  font-size: 1rem;
  color: #6d4c41;
}
.controls label {
  background: #6d4c41;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-block;
  transition: background 0.2s;
}
.controls label:hover {
  background: #8d6e63;
}
.controls input[type="file"] {
  display: none;
}
.controls button {
  background: #6d4c41;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  margin-left: 12px;
  transition: background 0.2s;
}
.controls button:hover {
  background: #8d6e63;
}
main {
  background: #fffef9;
  border: 1px solid #f0e4d9;
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: 0 4px 14px rgba(139, 69, 19, 0.06), 0 1px 3px rgba(139, 69, 19, 0.08);
  min-height: 200px;
}

/* ── TWO-COLUMN LAYOUT ──────────────────────────────────────── */
#content {
  column-count: 2;
  column-gap: 32px;
  orphans: 3;                /* avoid breaking near bottom of column */
  widows: 3;                 /* avoid orphan heading at top of column */
  margin-bottom: 28px;
}

.category {
  break-inside: avoid-column;   /* try to keep whole categories together */
  margin-bottom: 24px;          /* reduced a bit for compactness */
}

.category h2 {
  font-size: 1.55rem;
  color: #6d4c41;
  padding-bottom: 10px;
  border-bottom: 2px solid #f5e8d3;
  margin-bottom: 14px;
  font-weight: 500;
  break-after: avoid-column;
}

.item {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0 9px;           /* slightly tighter */
  border-bottom: 1px dashed #e6d5c0;
  gap: 16px;
  break-inside: avoid;          /* keep individual items together */
}

.name {
  font-weight: 500;
  color: #3d2b1f;
  user-select: none;
}
.portion {
  font-size: 0.92rem;
  color: #8d6e63;
  font-style: italic;
}
.price {
  font-weight: 600;
  color: #5d4037;
  white-space: nowrap;
  font-size: 1.03rem;
  user-select: none;
}

/* ── BUTTONS (drag & edit) ───────────────────────────────────── */
.add-item-btn,
.remove-item-btn {
  position: absolute;
  bottom: -16px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #a1887f;
  color: white;
  font-size: 13.5px;
  font-weight: bold;
  line-height: 21px;
  text-align: center;
  border: none;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.15s ease;
  z-index: 5;
}

.add-item-btn {
  left: calc(50% + 20px);
  transform: translateX(-50%);
}

.remove-item-btn {
  left: calc(50%);
  transform: translateX(-50%);
}

.item:hover .add-item-btn,
.item:hover .remove-item-btn {
  opacity: 1;
}

.add-item-btn:hover,
.remove-item-btn:hover,
.add-item-btn:focus,
.remove-item-btn:focus {
  transform: translateX(-50%) scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.item.dragging {
  opacity: 0.35;
  background: rgba(161, 136, 127, 0.15);
  transform: scale(0.98);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ── OTHER ELEMENTS ──────────────────────────────────────────── */
.note {
  font-size: 0.88rem;
  color: #9c7c6f;
  padding: 14px 18px;
  background: #fdf8f0;
  border-radius: 10px;
  border-left: 4px solid #d7b99f;
}
.asterisk {
  font-size: 0.77rem;
  color: #9c7c6f;
  margin-top: 14px;
  margin-bottom: 7px;
  font-style: italic;
  text-align: center;
}
footer {
  text-align: center;
  margin-top: 40px;
  color: #a1887f;
  font-size: 0.9rem;
}

/* ── MEDIA QUERIES ───────────────────────────────────────────── */
@media (max-width: 680px) {
  #content {
    column-count: 1;           /* single column on narrow screens/phones */
  }
  .container {
    max-width: 100%;
  }
}

@media print {
  .controls,
  .note,
  footer,
  .add-item-btn,
  .remove-item-btn {
    display: none !important;
  }
  body {
    padding: 0.5cm;
    font-size: 0.94rem;
  }
  .container {
    max-width: none;
  }
  main {
    border: none;
    box-shadow: none;
    padding: 0;
    background: white;
  }
  #content {
    column-count: 2;
    column-gap: 2.5cm;
  }
  h1 { font-size: 2.2rem; margin-bottom: 0.4cm; }
  .category h2 { font-size: 1.4rem; margin-bottom: 0.5cm; }
  .item { padding: 0.25cm 0; }
  .name[contenteditable="true"],
  .price[contenteditable="true"] {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
  }
}