/* ═══════════════════════════════════════════════════════════════
   Restaurant CMS — Admin Stylesheet
   Warm-light theme, mobile-friendly, no external dependencies
   ═══════════════════════════════════════════════════════════════ */

/* ── Custom Properties ───────────────────────────────────────── */
:root {
  /* Theme injection bridge — overridden by layout.php from the CMS theme DB */
  --brand:       var(--cms-brand, #b5390f);
  --brand-soft:  rgba(181,57,15,.12);
  --accent:      var(--cms-accent, #c8892a);
  --accent-soft: rgba(200,137,42,.12);

  /* Warm light palette */
  --bg:          #fdf8f5;
  --bg2:         #ffffff;
  --bg3:         #f5ede8;
  --border:      #e4cfc7;
  --text:        #2c1810;
  --text-muted:  #7a5a50;
  --accent2:     #1d6fa4;
  --green:       #15803d;
  --red:         #c0392b;
  --yellow:      #b45309;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 4px 24px rgba(44,24,16,.10);
  --sidebar-w:   240px;
  --topbar-h:    56px;
  --font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:   'SF Mono', 'Fira Code', Consolas, monospace;
  --transition:  .18s ease;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
input, textarea, select, button { font-family: inherit; font-size: 1rem; }

/* ── Shell layout ────────────────────────────────────────────── */
.cms-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.cms-sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  border-top: 3px solid var(--brand);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform var(--transition);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-close { display: none; }
.brand-icon { font-size: 1.6rem; }
.brand-text strong { display: block; font-size: .9rem; line-height: 1.2; }
.brand-text small { color: var(--text-muted); font-size: .72rem; }

.open-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 14px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .03em;
}
.open-badge.open  { background: var(--brand-soft); color: var(--brand); }
.open-badge.closed{ background: rgba(239,68,68,.12); color: var(--red); }
.open-badge .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: .4; }
}

.sidebar-nav { padding: 8px 0; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .88rem;
  border-radius: 0;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.nav-item:hover {
  color: var(--text);
  background: var(--bg3);
  text-decoration: none;
}
.nav-item.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
}
/* ── Primary vs secondary nav ────────────────────────────── */
.nav-section-label {
  padding: 14px 16px 4px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  opacity: .55;
}
.nav-item.nav-secondary {
  font-size: .82rem;
  padding: 8px 16px;
  opacity: .8;
}
.nav-item.nav-secondary:hover,
.nav-item.nav-secondary.active { opacity: 1; }
/* Primary nav items slightly more prominent */
.nav-item:not(.nav-secondary) {
  font-size: .92rem;
  font-weight: 500;
}
.nav-item:not(.nav-secondary).active {
  font-weight: 700;
}
.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  flex-shrink: 0;
  opacity: .6;
  transition: opacity .15s;
}
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon { opacity: 1; }
.nav-svg { display: block; }
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 8px 0;
}
.view-site-link { color: var(--brand) !important; }
.view-site-link:hover { background: rgba(var(--brand-rgb, 42,138,106),.12) !important; }
.logout-link { color: var(--red) !important; }
.logout-link:hover { background: rgba(239,68,68,.1) !important; }

/* ── Mobile top bar ──────────────────────────────────────────── */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 14px;
  gap: 12px;
  z-index: 200;
}
.mobile-title { flex: 1; font-weight: 600; font-size: .95rem; color: var(--brand); }
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
  width: 32px;
}
.sidebar-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

/* ── Main content area ───────────────────────────────────────── */
.cms-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;     /* Critical: prevents flex blowout — flex items default to min-width:auto */
  padding: 28px 32px 60px;
  max-width: 1100px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Save indicator ──────────────────────────────────────────── */
.save-indicator {
  font-size: .8rem;
  padding: 4px 10px;
  border-radius: 20px;
  transition: all .3s;
  opacity: 0;
}
.save-indicator.saving {
  opacity: 1;
  background: rgba(59,130,246,.15);
  color: var(--accent2);
}
.save-indicator.saved {
  opacity: 1;
  background: rgba(34,197,94,.15);
  color: var(--green);
}
.save-indicator.error {
  opacity: 1;
  background: rgba(239,68,68,.12);
  color: var(--red);
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title small {
  font-size: .75rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* ── Form elements ───────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.help-text {
  font-size: .76rem;
  color: var(--text-muted);
  margin-top: 5px;
}
input[type=text],
input[type=email],
input[type=tel],
input[type=url],
input[type=number],
input[type=date],
input[type=time],
input[type=password],
select,
textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input.invalid,
select.invalid,
textarea.invalid {
  border-color: var(--red);
}
textarea { resize: vertical; min-height: 100px; }
select option { background: var(--bg3); }

/* Toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toggle {
  position: relative;
  width: 44px; height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: .2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: #fff;
}
.toggle-label { font-size: .88rem; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { filter: brightness(.9); text-decoration: none; }
.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--accent); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); text-decoration: none; }
.btn-danger {
  background: rgba(239,68,68,.12);
  color: var(--red);
  border-color: rgba(239,68,68,.3);
}
.btn-danger:hover { background: rgba(239,68,68,.22); }
.btn-sm { padding: 5px 11px; font-size: .8rem; min-height: 36px; }
.btn-icon { padding: 7px; }

/* ── Alerts / Flash ──────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: .88rem;
}
.alert-success { background: rgba(34,197,94,.12); color: var(--green); border: 1px solid rgba(34,197,94,.25); }
.alert-error   { background: rgba(239,68,68,.12);  color: var(--red);   border: 1px solid rgba(239,68,68,.25); }
.alert-info    { background: rgba(59,130,246,.12); color: var(--accent2);border: 1px solid rgba(59,130,246,.25); }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
}
th {
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  background: var(--bg3);
}
tr:hover td { background: var(--bg3); }

/* ── Dashboard grid ──────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.dash-stat {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.dash-stat .stat-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
}
.dash-stat .stat-label {
  font-size: .76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.quick-link {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  transition: all var(--transition);
}
.quick-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}
.ql-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--brand-soft);
  border-radius: 8px;
  flex-shrink: 0;
  color: var(--brand);
}
.quick-link strong { display: block; font-size: .9rem; }
.quick-link small { color: var(--text-muted); font-size: .76rem; }

/* ── Hours editor ────────────────────────────────────────────── */
.hours-grid { display: flex; flex-direction: column; gap: 8px; }
.hours-row {
  display: grid;
  grid-template-columns: 110px 1fr 1fr 120px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.hours-row.is-closed {
  opacity: .55;
}
.hours-row .day-name { font-weight: 600; font-size: .9rem; }
.hours-row input[type=time] { max-width: 130px; }

/* ── Menu editor ─────────────────────────────────────────────── */
.category-block {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  width: 100%;
  min-width: 0;
}
.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--bg3);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.category-header .move-btn {
  font-size: 1.1rem;
  padding: 4px 6px;
  min-width: 32px;
  min-height: 32px;
}
.category-name { font-weight: 700; flex: 1; min-width: 0; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-count { color: var(--text-muted); font-size: .8rem; flex-shrink: 0; }
.category-body { padding: 16px; overflow: hidden; word-break: break-word; overflow-wrap: break-word; }

.menu-item-row {
  display: grid;
  grid-template-columns: 30px 70px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg3);
  transition: opacity var(--transition);
}
.menu-item-row.unavailable { opacity: .5; }
.item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.item-thumb {
  width: 60px; height: 45px;
  object-fit: cover;
  border-radius: 5px;
  background: var(--border);
  flex-shrink: 0;
}
/* No-image placeholder — styles formerly inline on the div */
.item-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  color: var(--text-muted);
}
.item-info strong { display: block; font-size: .88rem; }
.item-info small  { display: block; color: var(--text-muted); font-size: .76rem; }
.item-price { font-weight: 700; color: var(--accent); font-size: .9rem; }

/* Dietary tags */
.diet-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.diet-tag {
  font-size: .68rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: .04em;
}
.tag-v  { background: rgba(34,197,94,.15); color: var(--green); }
.tag-vg { background: rgba(34,197,94,.25); color: #16a34a; }
.tag-gf { background: rgba(234,179,8,.15); color: var(--yellow); }
.tag-df { background: rgba(59,130,246,.15); color: var(--accent2); }
.tag-sp { background: rgba(239,68,68,.15); color: var(--red); }

/* ── Gallery grid ────────────────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}
.gallery-item {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  cursor: grab;
}
.gallery-item.hidden-photo { opacity: .45; }
.gallery-item img {
  width: 100%; height: 130px;
  object-fit: cover;
}
.gallery-item-body { padding: 10px; }
.gallery-item-body input {
  font-size: .78rem;
  padding: 5px 8px;
  background: var(--bg2);
}
.gallery-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}

/* ── Upload zones ────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
  user-select: none;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}
.upload-zone .upload-icon { font-size: 2.5rem; margin-bottom: 8px; }
.upload-zone p { font-size: .88rem; margin-bottom: 14px; }
.upload-zone small { font-size: .76rem; display: block; margin-top: 10px; }

/* Browse button — always interactive; its click handler calls e.stopPropagation()
   so the zone's own click handler doesn't also fire and open a second dialog */
.upload-browse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 26px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter var(--transition), transform var(--transition);
  box-shadow: 0 2px 10px rgba(181,57,15,.28);
  position: relative; /* ensures it sits above zone pseudo-elements */
  z-index: 1;
}
.upload-browse-btn:hover  { filter: brightness(.92); }
.upload-browse-btn:active { transform: scale(.97); }
.upload-drag-hint { font-size: .78rem; color: var(--text-muted); margin-top: 10px; }

/* On mobile: hide drag hint, enlarge button for easier tapping */
@media (max-width: 768px) {
  .upload-drag-hint { display: none; }
  .upload-zone { padding: 24px 16px; }
  .upload-browse-btn {
    padding: 13px 32px;
    font-size: .95rem;
    min-height: 48px;
  }
}

/* ── Rich text editor ────────────────────────────────────────── */
.rte-toolbar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.rte-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-muted);
  padding: 4px 8px;
  cursor: pointer;
  font-size: .85rem;
  transition: all var(--transition);
}
.rte-btn:hover, .rte-btn.active {
  background: var(--bg3);
  border-color: var(--border);
  color: var(--text);
}
.rte-content {
  min-height: 180px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 14px;
  outline: none;
  line-height: 1.7;
}
.rte-content:focus { border-color: var(--accent); }

/* ── Image preview ───────────────────────────────────────────── */
.img-preview-wrap {
  position: relative;
  display: inline-block;
  margin-top: 10px;
}
.img-preview {
  max-width: 280px;
  max-height: 180px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.img-preview-wrap .btn-danger {
  position: absolute;
  top: 6px; right: 6px;
  padding: 3px 8px;
  font-size: .75rem;
}

/* ── Move button (pick-and-place trigger) ────────────────────── */
/* Replaces the old ⠿ drag handle with an explicit tap button.
   Works on both desktop and mobile — no touch-drag required.    */
.move-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
  touch-action: manipulation;   /* no double-tap zoom; no scroll-block */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.move-btn:hover {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: var(--brand);
}
/* The move button when its row is selected/moving — becomes a cancel indicator */
.move-btn.active-handle {
  color: #fff !important;
  background: var(--brand) !important;
  border-color: var(--brand) !important;
}

/* ── Pick-and-place reorder ──────────────────────────────────── */
/* The item row / category block selected for moving */
.menu-item-row.moving,
.category-block.moving {
  outline: 2px solid var(--brand) !important;
  outline-offset: -2px;
  background: var(--brand-soft) !important;
  opacity: .8;
}
/* Insertion slots that appear between items when one is selected */
.drop-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  margin: 4px 0;
  border: 2px dashed var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
  cursor: pointer;
  font-weight: 600;
  font-size: .85rem;
  gap: 8px;
  transition: background var(--transition), transform var(--transition);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.drop-slot:hover  { background: rgba(181,57,15,.20); }
.drop-slot:active { transform: scale(.99); background: rgba(181,57,15,.30); }
.drop-slot-label {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

/* Desktop HTML5 drag still works for non-menu pages (gallery etc.) */
[draggable=true] { cursor: grab; }
[draggable=true]:active { cursor: grabbing; }
[draggable=true] { touch-action: pan-y; }
.drag-over-target {
  border-color: var(--accent) !important;
  background: var(--accent-soft) !important;
}
.dragging { opacity: .4; }

/* ── Specials ────────────────────────────────────────────────── */
.specials-list { display: flex; flex-direction: column; gap: 12px; }
.special-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.special-card.expired { opacity: .5; }
.special-title { font-weight: 700; margin-bottom: 4px; }
.special-meta { font-size: .78rem; color: var(--text-muted); }

/* ── Content blocks ──────────────────────────────────────────── */
.content-block {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.block-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.block-body { padding: 20px; }

/* ── Login page ──────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.login-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.login-logo { display: none; }
.login-brand {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 4px;
}
.login-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: .82rem;
  margin-bottom: 24px;
}
.sidebar-support {
  padding: 10px 14px 8px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.support-label {
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.support-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  color: var(--text-muted);
  padding: 3px 0;
  text-decoration: none;
  transition: color .15s;
}
.support-link:hover { color: var(--brand); }
.demo-notice {
  background: rgba(var(--accent-rgb, 245,158,11), .12);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 9px 14px;
  border-radius: var(--radius);
  font-size: .84rem;
  margin-bottom: 18px;
  text-align: center;
}

/* ── Hero position preview ───────────────────────────────────── */
.hero-preview {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 200px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 14px;
}
.hero-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.hero-preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
}
.hero-preview-overlay h2 { font-size: 1.2rem; text-shadow: 0 1px 4px rgba(0,0,0,.8); }
.hero-preview-overlay p  { font-size: .82rem; opacity: .85; }

/* ── Bulk import area ────────────────────────────────────────── */
.import-area {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.import-area textarea {
  font-family: var(--font-mono);
  font-size: .78rem;
  min-height: 140px;
}

/* ── Badge ───────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 700;
}
.badge-green { background: rgba(34,197,94,.15); color: var(--green); }
.badge-red   { background: rgba(239,68,68,.12); color: var(--red); }
.badge-gray  { background: var(--bg3); color: var(--text-muted); }

/* ── Collapsible ─────────────────────────────────────────────── */
.collapse-icon { transition: transform .2s; font-size: .8rem; color: var(--text-muted); }
.collapsed .collapse-icon { transform: rotate(-90deg); }
.collapsible-body { overflow: hidden; }
.collapsible-body.hidden { display: none; }

/* Edit Category button — desktop: hidden (header already has one); mobile: visible in body */
.cat-edit-mobile { display: none; }
/* Category body actions row — desktop: simple bottom row */
.category-body-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.4rem; cursor: pointer; min-width: 44px; min-height: 44px; }
.modal-body { padding: 22px; }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}

/* ── Progress bar ────────────────────────────────────────────── */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width .3s;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .cms-sidebar {
    position: fixed;
    right: 0; left: auto; top: 0; bottom: 0;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 250;
    width: 280px;
    border-right: none;
    border-left: 3px solid var(--brand);
    border-top: none;
  }
  .cms-sidebar.open {
    transform: translateX(0);
    box-shadow: -4px 0 24px rgba(0,0,0,.45);
  }
  /* Close button: visible inside sidebar on mobile */
  .sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    width: 36px;
    height: 36px;
    margin-left: auto;
    flex-shrink: 0;
    border-radius: var(--radius);
  }
  .sidebar-close:hover { color: var(--text); background: var(--bg3); }
  /* Nav items: larger, more readable touch targets */
  .cms-sidebar .nav-item {
    padding: 14px 20px;
    font-size: .98rem;
    color: var(--text);
    gap: 12px;
  }
  .cms-sidebar .nav-item.active {
    color: var(--brand);
    background: var(--brand-soft);
  }
  .cms-sidebar .nav-item .nav-icon { color: inherit; }
  .mobile-topbar { display: flex; }
  .sidebar-toggle { display: flex; }
  .cms-main {
    margin-left: 0;
    padding: 80px 16px 60px;
  }
  /* ── Weekly hours: day + toggle on row 1, time inputs on row 2 ── */
  .hours-row {
    grid-template-columns: 1fr 1fr auto;
    grid-template-rows: auto auto;
    gap: 6px 8px;
    padding: 10px 12px;
  }
  .hours-row .day-name {
    grid-column: 1 / 3;
    grid-row: 1;
    font-size: .9rem;
  }
  .hours-row .form-group {
    margin: 0;
    grid-row: 2;
  }
  .hours-row .form-group:first-of-type { grid-column: 1; }
  .hours-row .form-group:nth-of-type(2) { grid-column: 2; }
  .hours-row input[type=time] { font-size: .82rem; padding: 6px 4px; }
  /* Toggle spans col 3 both rows — hide label text, knob colour is enough */
  .hours-row .toggle-wrap {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
  }
  .hours-row .toggle-label { display: none; }

  /* ── Responsive tables: card-list on mobile ── */
  /* Hides the thead and turns each tbody row into a 2-col card */
  .table-wrap thead { display: none; }
  .table-wrap tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px 10px;
    padding: 10px 2px;
    border-bottom: 1px solid var(--border);
  }
  .table-wrap td {
    padding: 0;
    border: none;
    font-size: .85rem;
  }
  /* Date cell — bold, top-left */
  .table-wrap td:nth-child(1) {
    grid-column: 1; grid-row: 1;
    font-weight: 700;
    align-self: center;
  }
  /* Label cell — muted, bottom-left */
  .table-wrap td:nth-child(2) {
    grid-column: 1; grid-row: 2;
    color: var(--text-muted);
  }
  /* Hours cell — top-right */
  .table-wrap td:nth-child(3) {
    grid-column: 2; grid-row: 1;
    align-self: center;
    text-align: right;
  }
  /* Actions cell — bottom-right */
  .table-wrap td:nth-child(4) {
    grid-column: 2; grid-row: 2;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    align-self: center;
    white-space: nowrap;
  }
  /* ── Compact menu item rows on mobile ── */
  /* Single tight row: [↕] [Name …] [Edit] [×]  ~52px tall */
  .menu-item-row {
    display: flex !important;
    align-items: stretch;
    gap: 0;
    padding: 0;
    min-height: 52px;
  }
  /* Move button: full-height tap target on the left, wide enough to hit easily */
  .menu-item-row > .move-btn {
    width: 44px;
    min-width: 44px;
    height: auto;
    align-self: stretch;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border);
    font-size: 1.1rem;
    padding: 0;
  }
  /* Hide thumbnail — details belong in the Edit modal */
  .menu-item-row .item-thumb,
  .menu-item-row .item-thumb-placeholder { display: none !important; }
  /* Name column: takes all remaining space, ellipsis on overflow */
  .menu-item-row .item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    padding: 0 10px;
    overflow: hidden;
  }
  .menu-item-row .item-info strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .88rem;
  }
  /* Hide description, dietary tags, AND price in the row — prices can be
     complex multi-size strings that blow out the layout. Full details in Edit modal. */
  .menu-item-row .item-info small { display: none !important; }
  .menu-item-row .diet-tags       { display: none !important; }
  .menu-item-row .item-price      { display: none !important; }
  .menu-item-row .badge           { display: none !important; }
  /* Right column: just Edit + × buttons, no layout-breaking price */
  .item-right {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    flex-shrink: 0;
  }
  /* Buttons: comfortable tap targets */
  .menu-item-row .btn-sm {
    min-height: 38px;
    padding: 0 14px;
    font-size: .82rem;
  }
  /* ── Category header: strip down to just Name + Toggle + ▾ ── */
  .category-header .btn-danger    { display: none; }
  .category-header .btn-secondary { display: none; }   /* Edit moves to category body */
  .category-header .toggle-label  { display: none; }   /* hide "VISIBLE" text, keep toggle knob */
  .category-count { display: none; }
  /* Edit Category button: only show on mobile (hidden on desktop) */
  .cat-edit-mobile { display: inline-flex; }
  /* Show actions row inside expanded body */
  .category-body-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

  .dash-grid { grid-template-columns: 1fr 1fr; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .page-header h1 { font-size: 1.2rem; }
  .btn-sm { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
}

@media (max-width: 480px) {
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Utility ─────────────────────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-accent  { color: var(--accent); }
.text-green   { color: var(--green); }
.text-red     { color: var(--red); }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 14px; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

/* ── Variation pills ─────────────────────────────────────────── */
.variations-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.variation-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: .8rem;
}
.variation-pill button {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer; font-size: .9rem;
  line-height: 1; padding: 0;
}

/* ── Sidebar overlay for mobile ──────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 240;
}
.sidebar-overlay.open { display: block; }

/* ── Gallery Picker Modal ─────────────────────────────────────── */
.gallery-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding: 4px;
}
.gallery-picker-item {
  position: relative;
  aspect-ratio: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color var(--transition);
}
.gallery-picker-item:hover { border-color: var(--brand); }
.gallery-picker-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-picker-empty { padding: 32px 16px; text-align: center; color: var(--text-muted); font-size: .88rem; }

/* ── From-gallery button (small link under upload zones) ─────── */
.from-gallery-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: none; color: var(--accent2);
  font-size: .78rem; cursor: pointer; padding: 4px 0; margin-top: 4px;
  text-decoration: underline; text-underline-offset: 2px;
}
.from-gallery-btn:hover { color: var(--brand); }

/* ── Special hours collapsible (in home.php hours card) ────────── */
.special-hours-toggle {
  display: flex; align-items: center; gap: 8px;
  width: 100%; background: none; border: none;
  color: var(--text-muted); font-size: .84rem; font-weight: 600;
  cursor: pointer; padding: 10px 0; text-align: left;
  border-top: 1px solid var(--border); margin-top: 12px;
  transition: color var(--transition);
}
.special-hours-toggle:hover { color: var(--text); }
.special-hours-toggle .sh-arrow { font-size: .7rem; transition: transform .18s; }
.special-hours-toggle.open .sh-arrow { transform: rotate(90deg); }
#specialHoursPanel { display: none; padding-top: 12px; }
#specialHoursPanel.open { display: block; }

/* ── Upcoming special hours table in panel ──────────────────── */
.special-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.special-table th { text-align: left; padding: 6px 8px; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.special-table td { padding: 8px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.special-table tr:last-child td { border-bottom: none; }

/* ── Holiday library rows (in home.php) ─────────────────────── */
.holiday-lib2 { display: flex; flex-direction: column; gap: 0; margin-top: 8px; }
.holiday-lib2-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.holiday-lib2-row:last-child { border-bottom: none; }
.holiday-lib2-icon { font-size: 1.1rem; flex-shrink: 0; width: 24px; text-align: center; }
.holiday-lib2-name { flex: 1; min-width: 120px; font-size: .85rem; font-weight: 600; }
.holiday-lib2-action { flex-shrink: 0; display: flex; align-items: center; gap: 6px; }
