*, *::before, *::after { box-sizing: border-box; }
:root {
  --brand: #cddc29;
  --brand-dark: #a8b520;
  --brand-text: #252900;
  --ink: #171a21;
  --muted: #6b7280;
  --subtle: #98a1b2;
  --line: #e0e5ed;
  --paper: #fff;
  --wash: #f3f5f8;
  --soft: #eef2f7;
  --blue: #2563eb;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #ea580c;
  --shadow: 0 12px 30px rgba(17, 24, 39, .08);
  --radius: 8px;
  --font: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--wash);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: var(--brand-text);
  font-weight: 900;
  flex: 0 0 auto;
}
.brand strong { display: block; font-size: .98rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand span { display: block; color: var(--muted); font-size: .75rem; }
.actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.btn {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  font-size: .84rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); border-color: var(--brand-dark); color: var(--brand-text); }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-red { background: #fee2e2; border-color: #fecaca; color: #991b1b; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.icon-btn { width: 38px; min-width: 38px; padding: 0; }

.admin-layout {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(440px, 1fr) minmax(320px, 430px);
  gap: 18px;
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 18px;
  align-items: start;
}
.public-layout {
  width: min(520px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: #f1f3f7;
}
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel.sticky { position: sticky; top: 80px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: .95rem; }
.panel-body { padding: 16px; }

.field-stack { display: grid; gap: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label, .label {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.input, .textarea, .select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: 0;
  padding: 9px 11px;
  font-size: .88rem;
}
.textarea { min-height: 90px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.switch-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.switch-row span { font-size: .84rem; font-weight: 800; }
.switch { position: relative; display: inline-flex; width: 44px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5e1;
}
.slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: transform .16s;
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  min-height: 42px;
  padding: 6px 12px;
  text-align: left;
  flex: 0 0 auto;
  min-width: 112px;
}
.tab strong { display: block; font-size: .8rem; }
.tab span { display: block; color: var(--muted); font-size: .72rem; }
.tab.active { background: var(--brand); border-color: var(--brand-dark); }
.tab.active span { color: #4b5200; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  min-height: 24px;
  padding: 0 8px;
  font-size: .72rem;
  font-weight: 900;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-orange { background: #ffedd5; color: #9a3412; }

.editor-grid { display: grid; gap: 16px; }
.day-tools {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}
.form-grid { display: grid; grid-template-columns: minmax(220px, 1.05fr) minmax(220px, .95fr); gap: 14px; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }

.item-list { display: grid; gap: 10px; }
.item-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
}
.item-row strong { display: block; font-size: .9rem; }
.item-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 5px; color: var(--muted); font-size: .76rem; font-weight: 700; }
.item-actions { display: flex; align-items: center; gap: 6px; }

.empty-state {
  min-height: 140px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  background: var(--soft);
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
  padding: 24px;
}
.empty-state i { display: block; color: var(--subtle); font-size: 1.5rem; margin-bottom: 8px; }
.empty-state p { margin: 0; font-weight: 800; }

.public-header {
  background: linear-gradient(135deg, #171a21, #2f3947);
  color: #fff;
  text-align: center;
  padding: 26px 18px 22px;
}
.public-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--brand);
  border: 3px solid rgba(255,255,255,.25);
}
.public-header h1 { margin: 10px 0 3px; font-size: 1.45rem; }
.public-header p { margin: 0; color: rgba(255,255,255,.68); font-size: .82rem; }
.public-contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.public-contact strong { display: block; font-size: .82rem; }
.public-contact span { color: var(--muted); display: block; font-size: .75rem; }
.day-tabs-wrap {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}
.menu-content { padding: 12px; padding-bottom: 104px; }
.category-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 2px 8px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 900;
  text-transform: uppercase;
}
.category-title::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.category-title.featured { color: var(--brand-text); }

.menu-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 9px;
}
.menu-card.featured { border: 2px solid var(--brand-dark); }
.menu-card.sold-out { opacity: .58; }
.menu-top { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; }
.menu-name { margin: 0; font-size: .92rem; font-weight: 900; }
.menu-desc { margin: 5px 0 0; color: var(--muted); font-size: .78rem; }
.menu-price { font-size: .9rem; font-weight: 900; white-space: nowrap; }
.menu-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.variant-list { display: grid; gap: 7px; margin-top: 10px; }
.variant-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}
.variant-row:first-child { border-top: 0; padding-top: 0; }
.variant-row strong { display: block; font-size: .82rem; }
.variant-row span { display: block; color: var(--muted); font-size: .76rem; }
.qty {
  display: grid;
  grid-template-columns: 30px 30px 30px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.qty button { width: 30px; height: 30px; border: 0; background: #fff; font-weight: 900; }
.qty button:last-child { background: var(--brand); color: var(--brand-text); }
.qty b { display: block; text-align: center; font-size: .82rem; }

.cart-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  display: none;
  width: min(520px, 100%);
  transform: translateX(-50%);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  background: var(--brand);
  border-top: 1px solid var(--brand-dark);
  box-shadow: 0 -10px 30px rgba(17, 24, 39, .12);
}
.cart-bar.visible { display: flex; }
.cart-bar strong { display: block; }
.cart-bar span { display: block; color: #4b5200; font-size: .74rem; font-weight: 800; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 24px));
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(17, 24, 39, .94);
  color: #fff;
  text-align: center;
  font-size: .82rem;
  transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1180px) {
  .admin-layout { grid-template-columns: 300px 1fr; }
  .admin-layout .preview-panel { grid-column: 1 / -1; }
}
@media (max-width: 800px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .actions { width: 100%; justify-content: stretch; }
  .actions .btn { flex: 1; }
  .admin-layout { grid-template-columns: 1fr; padding: 12px; }
  .panel.sticky { position: static; }
  .day-tools, .field-row, .form-grid { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 1fr; }
  .item-actions { justify-content: flex-end; }
}
