@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --wonder-green: #1C4F2A;
  --wonder-green-dark: #163d20;
  --wonder-green-light: #2a6b39;
  --wonder-sage: #EEF3E8;
  --wonder-sage-dark: #d8e6cc;
  --wonder-sage-mid: #c5d9b5;
}

* { box-sizing: border-box; }

body {
  background-color: var(--wonder-sage);
  font-family: 'Inter', system-ui, sans-serif;
  color: #1a1a1a;
}

/* ── MODAL ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
}
.modal-box {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  max-height: 90vh;
  overflow-y: auto;
}

/* ── COLD RAIL GRID ──────────────────────────────────────── */
.cold-rail-grid {
  display: grid;
  gap: 4px;
  background: var(--wonder-green-dark);
  border: 3px solid var(--wonder-green-dark);
  border-radius: 10px;
  padding: 4px;
  overflow-x: auto;
}


/* ── DRY RAIL GRID ───────────────────────────────────────── */
/* Purple-tinted border & background to distinguish from cold rail */
.dry-rail-grid {
  background: #4c1d95;  /* deep purple */
  border-color: #4c1d95 !important;
  display: block !important; /* override .cold-rail-grid's display:grid */
  padding: 0 !important;     /* padding handled in JS via PAD constant */
  gap: 0 !important;
  overflow: hidden !important;
}

.dry-rail-pan {
  /* height is set directly in JS — remove conflicting min/max constraints */
  min-height: unset !important;
  max-height: unset !important;
}

/* Filled dry-rail pan: soft lavender background */
.dry-rail-pan.filled {
  background: #f5f3ff !important;
  border-color: #7c3aed !important;
}

/* Empty dry-rail pan: slightly lavender tinted */
.dry-rail-pan.empty {
  background: #faf8ff !important;
  border-color: #c4b5fd !important;
  border-style: dashed !important;
  color: #c4b5fd !important;
}

.dry-rail-pan:hover {
  border-color: #7c3aed !important;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.15) !important;
}

.pan-cell {
  background: white;
  border: 2px solid #ccc;
  border-radius: 6px;
  padding: 5px 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  font-size: 10px;
  line-height: 1.25;
  overflow: hidden;
  word-break: break-word;
  hyphens: auto;
  /* cells fill their grid area exactly */
  box-sizing: border-box;
}

.pan-cell:hover {
  border-color: var(--wonder-green);
  box-shadow: 0 0 0 3px rgba(28,79,42,0.15);
}

.pan-cell.filled {
  background: #f0f7eb;
  border-color: var(--wonder-green-light);
}

/* Vertical pans (row-span ≥ 2): align content to top, not center */
.pan-cell.pan-vertical {
  justify-content: flex-start;
  padding-top: 22px; /* leave room for the size badge */
}

/* Mid-row divider line shown inside V pans so the row boundary is visible */
.pan-v-divider {
  position: absolute;
  left: 6px;
  right: 6px;
  /* sits exactly at the midpoint of the spanned height: 50% of the cell */
  top: calc(50% - 1px);
  height: 2px;
  background: rgba(28, 79, 42, 0.18);
  border-radius: 1px;
  pointer-events: none;
}

.pan-cell.empty {
  background: #fafafa;
  border-color: #ddd;
  border-style: dashed;
  color: #999;
}

/* 40px filler cell that pads gaps before non-even-aligned pans */
.pan-cell.pan-cell-narrow {
  border-style: dashed;
  opacity: 0.4;
  padding: 0;
  min-height: unset;
}

.pan-cell.selected {
  border-color: var(--wonder-green);
  box-shadow: 0 0 0 3px rgba(28,79,42,0.3);
}

.pan-cell .pan-item-name {
  font-weight: 700;
  font-size: 9.5px;
  color: #1a1a1a;
  margin-bottom: 2px;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
  width: 100%;
  line-height: 1.2;
}

.pan-cell .pan-item-id {
  font-size: 8.5px;
  color: #444;
  margin-bottom: 2px;
}

.pan-cell .pan-utensil {
  font-size: 8.5px;
  color: var(--wonder-green);
  font-weight: 600;
  margin-top: 2px;
  word-break: break-word;
  max-width: 100%;
}

.pan-cell .pan-size-badge {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 9px;
  color: #999;
  font-weight: 500;
}

.pan-cell .allergen-badge {
  font-size: 9px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  border-radius: 3px;
  padding: 1px 4px;
  margin-top: 2px;
}

/* ── ALLERGEN COLORS ──────────────────────────────────────── */
.pan-cell[data-allergens*="Gluten"] { border-left: 3px solid #f59e0b; }
.pan-cell[data-allergens*="Dairy"] { border-left: 3px solid #3b82f6; }
.pan-cell[data-allergens*="Nut"] { border-left: 3px solid #8b5cf6; }
.pan-cell[data-allergens*="Soy"] { border-left: 3px solid #ec4899; }
.pan-cell[data-allergens*="Egg"] { border-left: 3px solid #f97316; }
.pan-cell[data-allergens*="Shellfish"] { border-left: 3px solid #ef4444; }

/* ── DRAG AND DROP ──────────────────────────────────────── */
.pan-cell[draggable="true"] { cursor: grab; }
.pan-cell[draggable="true"]:active { cursor: grabbing; }
.pan-cell.dragging { opacity: 0.4; transform: scale(0.97); }
.pan-cell.drag-over {
  border-color: var(--wonder-green) !important;
  box-shadow: 0 0 0 3px rgba(28,79,42,0.35);
  background: #e8f4e8 !important;
}

/* ── DUPLICATE ITEM GLOW ────────────────────────────────── */
@keyframes panGlow {
  0%,100% { box-shadow: 0 0 0 3px rgba(234,179,8,0.3), 0 0 12px 3px rgba(234,179,8,0.2); }
  50%      { box-shadow: 0 0 0 5px rgba(234,179,8,0.6), 0 0 20px 6px rgba(234,179,8,0.4); }
}
.pan-glow {
  animation: panGlow 0.9s ease-in-out infinite;
  border-color: #eab308 !important;
  z-index: 10;
}

/* ── PAN CONTROLS OVERLAY (rotate + assign) ─────────────── */
.pan-on-rail .pan-controls {
  display: none;
  position: absolute;
  top: 2px;
  left: 2px;
  gap: 3px;
  z-index: 15;
  flex-direction: row;
}
.pan-on-rail:hover .pan-controls {
  display: flex;
}
.pan-ctrl-btn {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
  padding: 0;
  line-height: 1;
}
.pan-ctrl-rotate {
  background: rgba(28,79,42,0.85);
  color: white;
}
.pan-ctrl-rotate:hover { background: #1C4F2A; }
.pan-ctrl-assign {
  background: rgba(59,130,246,0.85);
  color: white;
}
.pan-ctrl-assign:hover { background: #2563eb; }

/* ── DROP ZONE CELLS ──────────────────────────────────────── */
.pan-cell.drop-zone {
  background: #f8fafc;
  border-color: #e2e8f0;
  border-style: dashed;
  opacity: 0.6;
}
.pan-cell.drop-zone:hover,
.pan-cell.drop-zone.drag-over {
  opacity: 1;
  background: #e8f5e9 !important;
  border-color: var(--wonder-green) !important;
  box-shadow: 0 0 0 2px rgba(28,79,42,0.2);
}

/* ── DIVIDER HOTSPOT ──────────────────────────────────────── */
.divider-hotspot {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.15s;
}
.divider-hotspot:hover > div {
  background: rgba(234,179,8,0.8) !important;
  width: 4px !important;
}

/* ── SECTION DIVIDER ZONES ──────────────────────────────── */
.divider-zone {
  background: var(--wonder-green-dark);
  cursor: pointer;
  position: relative;
  z-index: 2;
  transition: background 0.15s;
}
.divider-zone:hover { background: #0f2a15; }
/* Subtle "×" indicator on hover so user knows they can click to remove */
.divider-zone::before {
  content: '×';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  line-height: 1;
}
.divider-zone:hover::before { opacity: 1; }

/* Thin invisible hot-spot between pan slots — only active in Divider Mode */
.divider-toggle {
  cursor: default;
  position: relative;
  z-index: 3;
  opacity: 0;
  pointer-events: none; /* disabled by default — only enabled in dividerMode */
}
/* When divider mode is active, toggles become clickable */
.divider-toggle-active {
  cursor: pointer !important;
  pointer-events: auto !important;
  opacity: 1 !important;
}
.divider-toggle-active:hover {
  background: rgba(255,255,255,0.18);
  border-radius: 2px;
}
.divider-toggle-active:hover::after {
  content: '+';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  pointer-events: none;
}

/* ── COLUMN ADD / REMOVE BUTTONS ────────────────────────── */
.col-adj-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  border-radius: 8px;
  background: var(--wonder-green-dark);
  color: rgba(255,255,255,0.7);
  border: none;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.col-adj-btn:hover { background: var(--wonder-green); color: white; }
.col-adj-add { background: #1C4F2A; }

/* ── HOLDING TRAY ───────────────────────────────────────── */
.holding-tray {
  margin-top: 16px;
  background: #fff8e7;
  border: 2px dashed #f59e0b;
  border-radius: 10px;
  padding: 12px;
}
.holding-tray-header {
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 10px;
}
.holding-tray-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tray-item {
  background: white;
  border: 2px solid #f59e0b;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: grab;
  min-width: 90px;
  max-width: 140px;
  text-align: center;
  transition: all 0.15s;
}
.tray-item:hover {
  border-color: var(--wonder-green);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.tray-item:active { cursor: grabbing; }

/* ── PRINT — hide interactive elements ──────────────────── */
.no-screen { display: none; }
@media print { .no-screen { display: block; } }

/* ── NAV ────────────────────────────────────────────────── */
.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  color: rgba(255,255,255,0.75);
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  font-size: 14px;
}
.nav-link:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-link.active { background: rgba(255,255,255,0.15); color: white; }

/* ── BUTTONS ──────────────────────────────────────────── */
.btn-primary {
  background: var(--wonder-green);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 14px;
}
.btn-primary:hover { background: var(--wonder-green-light); }

.btn-secondary {
  background: var(--wonder-sage);
  color: var(--wonder-green);
  border: 2px solid var(--wonder-sage-mid);
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
}
.btn-secondary:hover { background: var(--wonder-sage-dark); }

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
}
.btn-danger:hover { background: #fecaca; }

/* ── FORM INPUTS ──────────────────────────────────────── */
.form-input {
  width: 100%;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  transition: border-color 0.15s;
  outline: none;
  font-family: inherit;
}
.form-input:focus { border-color: var(--wonder-green); }

/* ── CARDS ────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ── TOAST ────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: 10px;
  color: white;
  font-weight: 500;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.2s ease;
  max-width: 320px;
}
.toast.success { background: var(--wonder-green); }
.toast.error { background: #dc2626; }
.toast.info { background: #2563eb; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── PRINT STYLES ─────────────────────────────────────── */
@media print {
  @page { size: landscape; margin: 12mm; }

  body {
    background: white !important;
    margin: 0;
    padding: 0;
  }

  /* Hide everything that isn't the schematic */
  .no-print,
  #sidebar,
  #sidebar-overlay,
  #top-nav,
  #bottom-nav { display: none !important; }

  /* Show print-only elements */
  .no-screen { display: block !important; }

  /* Center the entire print area on the page */
  #print-area {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  /* Let the grid shrink to fit the page width */
  .cold-rail-grid {
    gap: 2px;
    background: #333;
    border-color: #333;
    padding: 2px;
    max-width: 100%;
    overflow: visible;
  }

  /* Dry rail: same centering treatment */
  #dry-rail-wrapper {
    max-width: 100%;
    overflow: visible;
  }

  .pan-cell {
    min-height: 70px;
    font-size: 10px;
    break-inside: avoid;
  }
}

/* ── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--wonder-sage-mid); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--wonder-green-light); }

/* ── TRANSITIONS ──────────────────────────────────────── */
.fade-in { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* ── SIDEBAR ──────────────────────────────────────────── */
#sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--wonder-green);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
}

#main-content {
  margin-left: 240px;
  min-height: 100vh;
  padding: 32px;
}

/* ── ITEM CHIP ─────────────────────────────────────────── */
.item-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--wonder-sage);
  border: 1px solid var(--wonder-sage-mid);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
}

/* ── ALLERGEN CHECKBOX GRID ──────────────────────────── */
.allergen-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.allergen-checkbox {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #444;
  transition: all 0.15s;
  background: white;
  user-select: none;
}

.allergen-checkbox:hover {
  border-color: #9ca3af;
  background: #f9fafb;
}

.allergen-checkbox.checked {
  border-color: var(--wonder-green);
  background: var(--wonder-sage);
  color: var(--wonder-green);
  font-weight: 600;
}

.allergen-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── UTENSIL TAG (checkbox-style, used in Add Item modal) ─── */
.utensil-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: #555;
  background: white;
  transition: all 0.12s;
  user-select: none;
  white-space: nowrap;
}
.utensil-tag:hover {
  border-color: var(--wonder-green);
  color: var(--wonder-green);
}
.utensil-tag.selected {
  background: var(--wonder-green);
  border-color: var(--wonder-green);
  color: white;
  font-weight: 600;
}

/* ── UTENSIL OPTION BTN ───────────────────────────────── */
.utensil-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
  background: white;
  font-size: 14px;
  font-weight: 500;
}
.utensil-option:hover {
  border-color: var(--wonder-green);
  background: var(--wonder-sage);
  color: var(--wonder-green);
}

/* ════════════════════════════════════════════════════════════
   MOBILE / RESPONSIVE LAYOUT
   ════════════════════════════════════════════════════════════ */

/* ── TOP NAV BAR (mobile only) ────────────────────────────── */
#top-nav {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--wonder-green);
  z-index: 200;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}
#top-nav .app-title {
  flex: 1;
  font-size: 1.3rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.5px;
}
#hamburger-btn {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
#hamburger-btn:hover { background: rgba(255,255,255,0.15); }

/* ── SIDEBAR OVERLAY (mobile) ─────────────────────────────── */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 150;
}
#sidebar-overlay.visible { display: block; }

/* ── BOTTOM NAV (mobile) ──────────────────────────────────── */
#bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--wonder-green);
  z-index: 200;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid rgba(255,255,255,0.15);
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: rgba(255,255,255,0.6);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: 8px;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border: none;
  background: none;
}
.bottom-nav-item i { font-size: 18px; }
.bottom-nav-item.active { color: white; }
.bottom-nav-item.active i { color: #a3e0b4; }

/* ── ADMIN TAB ROW (mobile) ───────────────────────────────── */
@media (max-width: 640px) {
  /* Sticky tab row at top of admin page on mobile */
  #admin-tabs {
    position: sticky;
    top: 56px;
    background: var(--wonder-sage);
    z-index: 50;
    margin: 0 -16px 16px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--wonder-sage-mid);
    flex-wrap: nowrap !important;
    overflow-x: auto;
    gap: 8px !important;
    -webkit-overflow-scrolling: touch;
  }
  #admin-tabs button {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 13px;
    padding: 8px 14px;
  }

  /* Item cards on mobile: stack allergen/utensil rows */
  .admin-item-card {
    flex-direction: column !important;
    gap: 12px;
  }
  .admin-item-card .card-actions {
    display: flex;
    gap: 8px;
    width: 100%;
  }
  .admin-item-card .card-actions button {
    flex: 1;
    font-size: 13px;
    padding: 10px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
    transition: all 0.15s;
  }
  .admin-item-card .card-actions .edit-btn {
    color: var(--wonder-green);
    border-color: var(--wonder-sage-mid);
  }
  .admin-item-card .card-actions .edit-btn:hover {
    background: var(--wonder-sage);
  }
  .admin-item-card .card-actions .delete-btn {
    color: #dc2626;
    border-color: #fca5a5;
  }
  .admin-item-card .card-actions .delete-btn:hover {
    background: #fee2e2;
  }

  /* Utensil/station cards mobile */
  .admin-utensil-card {
    padding: 14px 16px;
  }
  .admin-utensil-card .card-actions button {
    padding: 10px 16px;
    font-size: 13px;
  }

  /* Search input: bigger tap target */
  #item-search {
    font-size: 16px; /* prevents iOS zoom */
    padding: 12px 14px;
  }

  /* Modal: full-height sheet on mobile */
  .modal-box {
    max-width: 100% !important;
    width: 100% !important;
    max-height: 92vh !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 1.5rem 1.25rem !important;
    margin: 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
  }
  .modal-overlay {
    align-items: flex-end !important;
  }

  /* Allergen grid: 2 columns on narrow screens */
  .allergen-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Form inputs: prevent iOS zoom */
  .form-input {
    font-size: 16px;
  }

  /* Buttons: taller tap targets */
  .btn-primary, .btn-secondary, .btn-danger {
    padding: 12px 20px;
    font-size: 15px;
  }

  /* Toast: bottom-center on mobile */
  #toast-container {
    bottom: 72px;
    right: 12px;
    left: 12px;
  }
  .toast {
    max-width: 100%;
  }
}

/* ── RESPONSIVE LAYOUT BREAKPOINTS ────────────────────────── */
@media (max-width: 768px) {
  /* Show top nav and bottom nav, hide sidebar */
  #top-nav { display: flex; }
  #bottom-nav { display: flex; }

  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    z-index: 160;
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }

  #main-content {
    margin-left: 0 !important;
    padding: 72px 16px 76px !important; /* top: below top-nav, bottom: above bottom-nav */
  }

  /* Dashboard cards: single column */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  #sidebar-close-btn { display: block !important; }
}

/* ── PRINT: always hide mobile chrome ──────────────────────── */
/* (covered by the consolidated @media print block above) */

/* ── Mobile: FAB replaces the header Add buttons ─────────────── */
@media (max-width: 768px) {
  .admin-add-btn { display: none !important; }
}

/* ════════════════════════════════════════════════════════════
   ADMIN PANEL — MOBILE-OPTIMISED COMPONENTS
   ════════════════════════════════════════════════════════════ */

/* ── Utensils page: grouped section headers ────────────────── */
.utensil-admin-group {
  margin-bottom: 20px;
}
.utensil-admin-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--wonder-green);
  padding: 6px 4px 6px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--wonder-sage-mid);
}
.utensil-admin-group-count {
  background: var(--wonder-sage);
  color: var(--wonder-green);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--wonder-sage-mid);
}

/* ── Admin item card: full row on every screen ─────────────── */
.admin-item-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Top row: name + badge(s) */
.admin-item-card .card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-item-card .card-header .item-name {
  font-weight: 700;
  font-size: 15px;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.admin-item-card .card-header .item-id-badge {
  font-size: 11px;
  color: #666;
  background: #f3f4f6;
  border-radius: 5px;
  padding: 2px 8px;
  font-family: monospace;
  white-space: nowrap;
  align-self: flex-start;
}
.admin-item-card .allergen-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.admin-item-card .allergen-badge-row .ab {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 5px;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

/* Utensil chip row */
.admin-item-card .utensil-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Action buttons row — visible on ALL screens */
.admin-item-card .card-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid #f3f4f6;
}
.admin-item-card .card-actions .action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1.5px solid #e5e7eb;
  background: white;
  cursor: pointer;
  transition: all 0.15s;
}
.admin-item-card .card-actions .action-btn.edit-btn {
  color: var(--wonder-green);
  border-color: var(--wonder-sage-mid);
}
.admin-item-card .card-actions .action-btn.edit-btn:hover,
.admin-item-card .card-actions .action-btn.edit-btn:active {
  background: var(--wonder-sage);
}
.admin-item-card .card-actions .action-btn.delete-btn {
  color: #dc2626;
  border-color: #fca5a5;
}
.admin-item-card .card-actions .action-btn.delete-btn:hover,
.admin-item-card .card-actions .action-btn.delete-btn:active {
  background: #fee2e2;
}

/* ── Admin utensil / station card ─────────────────────────── */
.admin-utensil-card,
.admin-station-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.admin-utensil-card .card-name,
.admin-station-card .card-name {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
}
.admin-utensil-card .icon-btn,
.admin-station-card .icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1.5px solid #e5e7eb;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.admin-utensil-card .icon-btn.edit-btn { color: var(--wonder-green); }
.admin-utensil-card .icon-btn.edit-btn:hover { background: var(--wonder-sage); border-color: var(--wonder-sage-mid); }
.admin-utensil-card .icon-btn.delete-btn,
.admin-station-card .icon-btn.delete-btn { color: #dc2626; border-color: #fca5a5; }
.admin-utensil-card .icon-btn.delete-btn:hover,
.admin-station-card .icon-btn.delete-btn:hover { background: #fee2e2; }

/* ── Floating Action Button (FAB) ─────────────────────────── */
.admin-fab {
  position: fixed;
  bottom: 76px;   /* above bottom-nav */
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--wonder-green);
  color: white;
  border: none;
  box-shadow: 0 4px 16px rgba(28,79,42,0.45);
  display: none;  /* shown only on mobile via media query */
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  z-index: 120;
  transition: all 0.2s;
}
.admin-fab:hover, .admin-fab:active {
  background: var(--wonder-green-light);
  box-shadow: 0 6px 20px rgba(28,79,42,0.55);
  transform: scale(1.07);
}

/* ── Mobile-specific overrides ────────────────────────────── */
@media (max-width: 768px) {
  /* Show FAB only on mobile when on admin page */
  .admin-fab { display: flex; }

  /* Bigger utensil tag touch targets */
  .utensil-tag {
    padding: 8px 14px;
    font-size: 13px;
  }

  /* Utensil option rows: taller tap area */
  .utensil-option {
    padding: 14px 16px;
    font-size: 15px;
  }

  /* Allergen checkboxes: bigger */
  .allergen-checkbox {
    padding: 10px 12px;
    font-size: 14px;
  }

  /* Utensil search inside modal: no zoom on iOS */
  #utensil-tag-list { max-height: none; }

  /* Station add button */
  #admin-tabs {
    position: sticky;
    top: 56px;
    background: var(--wonder-sage);
    z-index: 50;
    margin: 0 -16px 16px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--wonder-sage-mid);
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #admin-tabs::-webkit-scrollbar { display: none; }
  #admin-tabs button {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 13px;
    padding: 9px 16px;
  }
}

/* ── Storage-type badge (item cards) ─────────────────────────── */
.storage-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.storage-badge.chilled {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}
.storage-badge.ambient {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* ── Storage-type toggle (add/edit item modals) ───────────────── */
.storage-toggle-row {
  display: flex;
  gap: 8px;
}
.storage-toggle-btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  background: #f9fafb;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
  color: #6b7280;
}
.storage-toggle-btn:hover {
  border-color: #9ca3af;
  background: #f3f4f6;
}
.storage-toggle-btn.active-chilled {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1d4ed8;
}
.storage-toggle-btn.active-ambient {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

/* ── Utensil Summary Panel ─────────────────────────────────── */
#utensil-summary-panel {
  animation: fadeIn 0.2s ease;
}
#utensil-summary-panel .utensil-row {
  transition: background 0.15s;
}
#utensil-summary-panel .utensil-row:hover {
  background: #e6f2e9 !important;
}

/* ── Searchable Item Dropdown ──────────────────────────────── */
.item-dd-option {
  transition: background 0.1s;
  border-radius: 4px;
  margin: 1px 4px;
}
.item-dd-option:hover,
.item-dd-option.item-dd-focused {
  background: #f0f7eb !important;
  color: #1C4F2A;
}
.item-dd-option.item-dd-empty {
  color: #9ca3af;
  font-style: italic;
}

/* ── Divider drag-and-drop ─────────────────────────────────── */
.divider-zone-draggable {
  /* wider hit target, centred on edge — visual bar is child div */
}
.divider-zone-draggable:hover > div {
  background: rgba(124,58,237,1) !important;
  width: 7px !important;
  box-shadow: 0 0 6px rgba(124,58,237,0.5);
}
.divider-toggle.drag-over {
  background: rgba(28, 79, 42, 0.18) !important;
  outline: 2px dashed var(--wonder-green);
}

/* ── Utensil summary — screen ──────────────────────────────── */
.utensil-summary-row:hover {
  background: #e6f2e9;
}

/* ── Utensil summary — print ───────────────────────────────── */
@media print {
  #utensil-summary-panel {
    display: block !important;
    page-break-inside: avoid;
    margin-top: 8px;
  }
  .utensil-summary-block {
    border: 1.5pt solid #1C4F2A !important;
    background: #fff !important;
    padding: 6pt !important;
    border-radius: 4pt !important;
  }
  .utensil-summary-row {
    background: transparent !important;
  }
}

/* ── ADMIN: FILTER CHIPS ───────────────────────────────────── */
.filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}
.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  margin-right: 2px;
}
.filter-chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px solid #d1d5db;
  background: white;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}
.filter-chip:hover {
  border-color: var(--wonder-green);
  color: var(--wonder-green);
}
.filter-chip.active {
  background: var(--wonder-green);
  border-color: var(--wonder-green);
  color: white;
  font-weight: 600;
}

/* ── ADMIN: MULTI-SELECT UTENSIL CHIPS ─────────────────────── */
.utensil-multi-chip {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1.5px solid #d1d5db;
  background: white;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.utensil-multi-chip:hover {
  border-color: var(--wonder-green);
  color: var(--wonder-green);
  background: var(--wonder-sage);
}
.utensil-multi-chip.selected {
  background: var(--wonder-green);
  border-color: var(--wonder-green);
  color: white;
  font-weight: 600;
}

/* ── ADMIN: INSIGHTS ───────────────────────────────────────── */
.insight-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}
.insight-stat-card {
  background: white;
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.insight-stat-val {
  font-size: 24px;
  font-weight: 800;
  color: #111;
  line-height: 1;
}
.insight-stat-label {
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.insight-section {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  overflow: hidden;
}
.insight-section-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 14px;
  background: var(--wonder-sage);
  border-bottom: 1px solid var(--wonder-sage-dark);
}
.insight-section-count {
  margin-left: auto;
  font-size: 11px;
  background: white;
  border: 1px solid var(--wonder-sage-mid);
  border-radius: 999px;
  padding: 2px 10px;
  color: #555;
  font-weight: 600;
}
.insight-section-body {
  padding: 14px 16px;
}
.insight-row {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fafafa;
  border: 1px solid #f0f0f0;
  margin-bottom: 6px;
}
.insight-row:last-child { margin-bottom: 0; }
.insight-row-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.insight-count-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  background: #dcfce7;
  color: #15803d;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.insight-tag {
  display: inline-block;
  background: var(--wonder-sage);
  border: 1px solid var(--wonder-sage-mid);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  color: #374151;
  margin-right: 3px;
  margin-top: 2px;
}

/* ── CLEANING SCHEDULE ─────────────────────────────────────── */
.cleaning-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.cleaning-day-col {
  background: white;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  min-height: 200px;
}
.cleaning-day-header {
  background: #eff6ff;
  border-bottom: 1.5px solid #bfdbfe;
  border-radius: 10px 10px 0 0;
  padding: 8px 12px;
  font-size: 13px;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cleaning-day-body {
  padding: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cleaning-day-footer {
  padding: 6px 8px 8px;
}
.cleaning-task-chip {
  background: #f0f9ff;
  border: 1.5px solid #bae6fd;
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: grab;
  transition: box-shadow 0.15s;
  font-size: 12px;
  color: #0369a1;
}
.cleaning-task-chip:hover {
  box-shadow: 0 2px 8px rgba(3,105,161,0.15);
  border-color: #7dd3fc;
}
.cleaning-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #93c5fd;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
}
.cleaning-chip-remove:hover { color: #ef4444; }

.task-pick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid #f1f5f9;
}
.task-pick-row:hover { background: #eff6ff; border-color: #bfdbfe; }

@media print {
  .cleaning-week-grid { display: none; }
}

/* ── MANAGER SCHEDULE ──────────────────────────────────────── */

/* Week block wrapper */
.mgr-week-block {
  background: white;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
.mgr-week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
  background: #faf5ff;
  border-bottom: 2px solid #e9d5ff;
}
.mgr-week-label {
  font-size: 14px;
  font-weight: 700;
  color: #7e22ce;
}
.mgr-week-remove {
  background: none;
  border: none;
  color: #c4b5fd;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.mgr-week-remove:hover { color: #7e22ce; background: #ede9fe; }

.mgr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;   /* equal-width columns */
}
.mgr-th {
  padding: 10px 8px;
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  font-size: 12px;
  font-weight: 600;
  color: #7e22ce;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  /* width controlled by table-layout:fixed — all 7 day cols share space equally */
}
.mgr-name-header {
  text-align: left;
  width: 130px;    /* fixed name column; day cols split the rest equally */
}
.mgr-td {
  padding: 4px;
  border: 1px solid #f3e8ff;
  vertical-align: middle;
}
.mgr-name-cell {
  padding: 6px 10px;
  border: 1px solid #f3e8ff;
  background: #fdf4ff;
  white-space: nowrap;
  vertical-align: middle;
}
.mgr-shift-cell {
  min-height: 48px;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  gap: 2px;
}
.mgr-shift-cell:hover { box-shadow: 0 2px 8px rgba(126,34,206,0.18); }
.mgr-shift-text  { line-height: 1.3; letter-spacing: 0.2px; }
.mgr-shift-note  { font-size: 10px; font-weight: 400; opacity: 0.7; }
.mgr-empty-hint  { color: #d8b4fe; font-size: 18px; font-weight: 300; }

/* Today column highlight */
.mgr-th-today {
  background: #7e22ce !important;
  color: #fff !important;
}
.mgr-th-today .mgr-day-note-line { color: #fcd34d !important; }
.mgr-today-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #e9d5ff;
  margin-bottom: 1px;
}
.mgr-td-today {
  background: #faf5ff !important;
  border-left: 2px solid #7e22ce !important;
  border-right: 2px solid #7e22ce !important;
}
/* Keep shift cell colours on top of today bg */
.mgr-td-today .mgr-shift-cell { position: relative; z-index: 1; }

/* Shift colour coding */
.shift-open    { background: #dcfce7; color: #15803d; }
.shift-close   { background: #fce7f3; color: #be185d; }
.shift-mid     { background: #fef9c3; color: #854d0e; }   /* MID 11am–9pm  — yellow */
.shift-mid2    { background: #ffedd5; color: #c2410c; }   /* MID 12pm–10pm — orange */
.shift-off     { background: #f1f5f9; color: #94a3b8; }
.shift-sick    { background: #fff7ed; color: #c2410c; }   /* orange — sick/PTO */
.shift-sumit   { background: #ede9fe; color: #6d28d9; }   /* purple */
.shift-custom  { background: #eff6ff; color: #1d4ed8; }

/* Legend swatches — now use class names matching shift-* */
.mgr-legend {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
  border: 1px solid rgba(0,0,0,0.08);
}
.mgr-legend.shift-open    { background: #dcfce7; }
.mgr-legend.shift-close   { background: #fce7f3; }
.mgr-legend.shift-mid     { background: #fef9c3; }
.mgr-legend.shift-mid2    { background: #ffedd5; }
.mgr-legend.shift-off     { background: #f1f5f9; }
.mgr-legend.shift-sick    { background: #fff7ed; }
.mgr-legend.shift-sumit   { background: #ede9fe; }

/* Preset shift picker grid */
.mgr-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.mgr-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  background: white;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 52px;
  gap: 2px;
}
.mgr-preset-btn:hover { border-color: #a78bfa; background: #faf5ff; }
.mgr-preset-btn.active { border-color: #7e22ce; background: #f3e8ff; }
.mgr-preset-label {
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  letter-spacing: 0.3px;
}
.mgr-preset-btn.active .mgr-preset-label { color: #7e22ce; }
.mgr-preset-hours {
  font-size: 10px;
  color: #9ca3af;
  white-space: nowrap;
}
.mgr-preset-btn.active .mgr-preset-hours { color: #a78bfa; }

@media (max-width: 480px) {
  .mgr-preset-grid { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  .mgr-week-header .mgr-week-remove { display: none; }
  .mgr-week-block { box-shadow: none; border: 1px solid #e9d5ff; page-break-inside: avoid; }
  .no-print { display: none !important; }
}

/* Name-row drag-to-reorder */
.mgr-drag-handle {
  color: #d8b4fe;
  cursor: grab;
  padding: 0 6px 0 0;
  font-size: 13px;
  flex-shrink: 0;
  user-select: none;
}
.mgr-drag-handle:active { cursor: grabbing; }
.mgr-name-row-dragging  { opacity: 0.4; }
.mgr-name-row-over      { box-shadow: inset 0 2px 0 0 #7e22ce; }

/* Day-header note (shown below the date in the <th>) */
/* Day-header note display — inline lines shown directly in the <th> */
.mgr-day-notes-display {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mgr-day-note-line {
  font-size: 10px;
  font-weight: 400;
  color: #f59e0b;
  line-height: 1.3;
  white-space: normal;
  word-break: break-word;
  text-align: center;
}
/* Faint pencil hint when no note exists — visible on hover */
.mgr-note-add-hint {
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.mgr-th:hover .mgr-note-add-hint { opacity: 1; }
