*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #2d6a4f;
  --primary-light: #52b788;
  --bg:            #f4f6f8;
  --card:          #ffffff;
  --text:          #1a1a2e;
  --muted:         #6b7280;
  --border:        #e0e4ea;
  --danger:        #dc2626;
  --success:       #16a34a;
  --radius:        10px;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
header {
  background: var(--primary);
  color: #fff;
  padding: 1rem 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
header h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -.3px; }

/* ── Main wrapper ─────────────────────────────────────────────────────────── */
main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.75rem 1rem 3rem;
}

/* ── Flashes ──────────────────────────────────────────────────────────────── */
.flashes { margin-bottom: 1rem; }
.flash {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: .5rem;
  font-size: .9rem;
}
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

/* ── Items grid ───────────────────────────────────────────────────────────── */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.item-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  transition: box-shadow .15s;
}
.item-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.item-card.out-of-stock { opacity: .55; }

.item-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: .2rem;
}

.item-name { font-weight: 700; font-size: 1rem; }
.item-desc  { color: var(--muted); font-size: .85rem; flex: 1; line-height: 1.4; }

.item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .3rem;
}

.item-price { font-weight: 700; font-size: 1.1rem; color: var(--primary); }

.stock-badge {
  font-size: .78rem;
  font-weight: 600;
  padding: .2rem .65rem;
  border-radius: 99px;
  background: #d1fae5;
  color: #065f46;
}
.stock-badge.low   { background: #fef3c7; color: #92400e; }
.stock-badge.empty { background: #fee2e2; color: #991b1b; }

.qty-control {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .4rem;
}
.qty-control label { font-size: .85rem; color: var(--muted); }

.qty-input {
  width: 72px;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .95rem;
  text-align: center;
  transition: border-color .15s;
}
.qty-input:focus { outline: none; border-color: var(--primary-light); }

/* ── Order form ───────────────────────────────────────────────────────────── */
.order-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.order-form h2 { margin-bottom: 1rem; font-size: 1.05rem; }

.total-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: .85rem 1.1rem;
  margin-bottom: 1.1rem;
}
.total-display span { color: var(--muted); font-size: .9rem; }
.total-display strong { font-size: 1.5rem; color: var(--primary); }

.form-group { margin-bottom: .9rem; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: .88rem;
  margin-bottom: .3rem;
  color: var(--text);
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--text);
  transition: border-color .15s;
}
.form-group input:focus,
.form-group textarea:focus { outline: none; border-color: var(--primary-light); }

.hint { text-align: center; margin-top: .5rem; font-size: .8rem; color: var(--muted); }
.hint-inline { font-weight: 400; font-size: .82rem; color: var(--muted); }
.empty-state { color: var(--muted); text-align: center; padding: 3rem 0; }

.already-ordered {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: .85rem 1.25rem;
  margin-bottom: 1.25rem;
  color: #1e40af;
  font-size: .95rem;
}
.already-ordered a {
  color: #1e40af;
  font-weight: 600;
  margin-left: .75rem;
  white-space: nowrap;
}

.banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  color: #78350f;
  font-size: .95rem;
  white-space: pre-line;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .6rem 1.4rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .95rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: filter .15s, opacity .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary   { background: var(--primary); color: #fff; width: 100%; text-align: center; }
.btn-secondary { background: #6b7280; color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-sm        { padding: .3rem .8rem; font-size: .82rem; }

/* ── Confirmation ─────────────────────────────────────────────────────────── */
.confirmation-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}
.checkmark {
  width: 56px; height: 56px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 1.6rem;
  line-height: 56px;
  margin: 0 auto 1rem;
}
.confirmation-box h2 { margin-bottom: .4rem; }
.confirmation-box > p { color: var(--muted); margin-bottom: 1.5rem; }
.spam-notice {
  font-size: .85rem;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: .7rem 1rem;
  margin-bottom: 1.25rem;
  text-align: left;
}

.order-summary {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.5rem 0;
}
.order-summary table { width: 100%; border-collapse: collapse; }
.order-summary th,
.order-summary td {
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
}
.order-summary th { background: var(--bg); font-weight: 600; }
.order-summary tfoot td { background: #f0fdf4; font-size: .95rem; }
.order-summary tr:last-child td { border-bottom: none; }

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-box {
  max-width: 360px;
  margin: 4rem auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}
.login-box h2 { margin-bottom: 1.25rem; text-align: center; }

/* ── Admin ────────────────────────────────────────────────────────────────── */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.admin-header h2 { font-size: 1.25rem; }

.admin-section { margin-bottom: 2.5rem; }
.admin-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: .4rem;
  margin-bottom: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: .88rem;
}
th, td {
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
th { background: var(--bg); font-weight: 600; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }

.badge {
  display: inline-block;
  padding: .18rem .6rem;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 700;
}
.badge-green  { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-grey   { background: #f3f4f6; color: #6b7280; }

.add-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.add-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem 1rem;
  margin-bottom: .75rem;
}
@media (max-width: 520px) { .add-form-grid { grid-template-columns: 1fr; } }

.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal h3 { margin-bottom: 1rem; }

.modal-actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 1rem;
}
.modal-actions .btn { width: auto; }

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-weight: 500 !important;
}
.checkbox-label input { width: auto; }
