:root {
  --bg: #f3f6f4;
  --card: #fff;
  --ink: #1c2420;
  --muted: #5c6b63;
  --line: #d5e0da;
  --accent: #1c7a40;
  --danger: #b42318;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}

.top {
  background: #1b3a2f;
  color: #fff;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-weight: 700; }
.brand a { color: #fff; text-decoration: none; }
.top nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.7rem 0.9rem; }
.top nav a { color: #d7ebe0; text-decoration: none; }
.top nav a:hover { color: #fff; }

.wrap { padding: 1rem; max-width: 880px; margin: 0 auto 3rem; }
h1 { font-size: 1.45rem; margin: 0 0 0.35rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.55rem; }
p { margin: 0.35rem 0; }
a { color: #146b38; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.muted, .field-hint { color: var(--muted); }
.field-hint { font-size: 0.85rem; margin: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.8rem;
}
.meal-card { display: block; color: inherit; text-decoration: none; }
.meal-card:hover { border-color: #9db8a6; }
.meal-top, .person {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-start;
}
.person { padding: 0.7rem 0; border-top: 1px solid var(--line); }
.person:first-of-type { border-top: 0; }
.bits { color: var(--muted); font-size: 0.92rem; }
.foods { white-space: pre-line; margin-top: 0.4rem; }
.pill { font-weight: 700; }

form, .inline-form { display: grid; gap: 0.7rem; margin-top: 0.6rem; }
label { display: grid; gap: 0.3rem; font-size: 0.92rem; color: var(--muted); }
input, select, textarea {
  font: inherit;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.check-row { display: flex; align-items: center; gap: 0.4rem; color: var(--ink); }
.check-row input { width: auto; }
.series { display: flex; flex-wrap: wrap; gap: 0.7rem 1rem; margin-bottom: 0.8rem; }
.filters { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.7rem; align-items: end; }
.food-row {
  display: grid;
  grid-template-columns: 1fr 7rem auto;
  gap: 0.6rem;
  align-items: end;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}
.food-row .bits { grid-column: 1 / -1; }

.btn, button, input[type=submit] {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 650;
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn.secondary, button.secondary { background: #5c6b63; }
.btn.danger, button.danger { background: var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.barcode-actions { align-self: end; }
.login-wrap { max-width: 460px; margin: 1.5rem auto; }
.password-line { display: flex; gap: 0.5rem; align-items: center; }
.password-line input { flex: 1; min-width: 0; }
.password-line button { flex: 0 0 auto; }
.error, .notice { padding: 0.75rem 0.9rem; border-radius: 10px; }
.error { background: #fde8e6; color: #8a1c13; }
.notice { background: #e5f6ea; color: #146b38; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.45rem 0.35rem; border-bottom: 1px solid var(--line); }
#chart { width: 100%; height: auto; background: #fff; }
#scan-video { width: 100%; border-radius: 10px; background: #111; margin-top: 0.6rem; }

@media (max-width: 700px) {
  .top { align-items: flex-start; flex-direction: column; }
  .row2, .filters, .food-row { grid-template-columns: 1fr; }
  .page-head, .meal-top, .person { flex-direction: column; }
}

@media print {
  .top, .filters, .page-head .btn, form, video { display: none !important; }
  body { background: #fff; }
  .card { break-inside: avoid; }
}
