/* ============================================
   MENU ADMIN — Dashboard v2
   Uber Eats / DoorDash merchant style
   Sidebar + Stats + Enhanced Cards
   ============================================ */

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

:root {
  /* Layered backgrounds */
  --bg: #09090b;
  --bg-raised: #0f0f12;
  --bg-card: #141417;
  --bg-input: #1a1a1f;
  --bg-hover: #1f1f25;
  --bg-active: #26262e;

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.10);
  --border-accent: rgba(99, 102, 241, 0.4);

  /* Text */
  --text: #eeeef0;
  --text-secondary: #9d9daa;
  --text-dim: #55555f;
  --text-inverse: #ffffff;

  /* Accent — Indigo */
  --accent: #6366f1;
  --accent-hover: #7577f5;
  --accent-muted: rgba(99, 102, 241, 0.1);
  --accent-glow: rgba(99, 102, 241, 0.2);

  /* Semantic */
  --green: #22c55e;
  --green-muted: rgba(34, 197, 94, 0.1);
  --green-strong: rgba(34, 197, 94, 0.15);
  --red: #ef4444;
  --red-hover: #dc2626;
  --red-muted: rgba(239, 68, 68, 0.08);
  --orange: #f59e0b;
  --orange-muted: rgba(245, 158, 11, 0.1);
  --blue: #3b82f6;
  --blue-muted: rgba(59, 130, 246, 0.1);

  /* Radii */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-glow), 0 0 0 1px var(--border-accent);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 1.5rem;
  --space-2xl: 2rem;
  --space-3xl: 4rem;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 350ms;

  /* Layout */
  --sidebar-width: 240px;
  --topbar-height: 56px;
}

html { font-size: 15px; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

::selection { background: var(--accent-glow); color: var(--text); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.06); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.12); }

/* ── LOGIN ── */
.login-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 1rem;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(99, 102, 241, 0.06) 0%, transparent 100%),
    var(--bg);
}
.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.login-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
  opacity: 0.5;
}
.login-box__icon {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-muted);
  border-radius: var(--radius-lg);
  color: var(--accent);
  margin-bottom: 1.25rem;
}
.login-box h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: .35rem;
  letter-spacing: -0.03em;
}
.login-box p {
  color: var(--text-dim);
  margin-bottom: 1.75rem;
  font-size: .85rem;
  line-height: 1.5;
}
.login-error {
  color: var(--red);
  font-size: .8rem;
  min-height: 1.2em;
  margin-bottom: .5rem;
  font-weight: 500;
}

/* ── FORMS ── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: .7rem;
  color: var(--text-dim);
  margin-bottom: .4rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
}
input, textarea, select {
  width: 100%;
  padding: .6rem .8rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .875rem;
  font-family: inherit;
  outline: none;
  transition:
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    background var(--duration-fast) ease;
}
input:hover, textarea:hover, select:hover { border-color: var(--border-strong); }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted), inset 0 0 0 1px var(--accent);
  background: var(--bg-hover);
}
input::placeholder, textarea::placeholder { color: var(--text-dim); opacity: 0.6; }
textarea { resize: vertical; min-height: 80px; }
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2355555f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  font-family: inherit;
  min-height: 38px;
  letter-spacing: -0.01em;
  position: relative;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-danger {
  background: var(--red-muted);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.15);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-sm { min-height: 32px; padding: .3rem .65rem; font-size: .78rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ── TOP BAR ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: var(--topbar-height);
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar__left {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.topbar__brand {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.topbar__logo {
  color: var(--accent);
}
.topbar__title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.topbar__actions { display: flex; gap: .5rem; align-items: center; }
.topbar__restaurant {
  font-size: .7rem;
  color: var(--accent);
  background: var(--accent-muted);
  padding: .2rem .6rem;
  border-radius: 100px;
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.15);
}
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text); }

/* ── DASHBOARD LAYOUT ── */
.dashboard-layout {
  display: flex;
  min-height: calc(100dvh - var(--topbar-height));
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--topbar-height);
  height: calc(100dvh - var(--topbar-height));
  overflow-y: auto;
  padding: var(--space-lg) 0;
}
.sidebar__section-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-dim);
  padding: .5rem 1.25rem .4rem;
}
.sidebar__footer {
  margin-top: auto;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}
.sidebar__version {
  font-size: .7rem;
  color: var(--text-dim);
  padding: .25rem 1.25rem;
}

/* ── SIDEBAR TABS (vertical navigation) ── */
.tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: .25rem .75rem;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .75rem;
  background: none;
  border: none;
  border-bottom: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: .82rem;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all var(--duration-fast) ease;
  position: relative;
  letter-spacing: -0.01em;
  text-align: left;
  width: 100%;
}
.tab-btn svg {
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity var(--duration-fast) ease;
}
.tab-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.tab-btn:hover svg { opacity: 0.9; }
.tab-btn.active {
  background: var(--accent-muted);
  color: var(--text);
  border-bottom-color: transparent;
}
.tab-btn.active svg {
  opacity: 1;
  color: var(--accent);
}
.tab-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

/* ── MAIN CONTENT AREA ── */
.main-wrap {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

/* ── PANEL HEADER ── */
.panel-header {
  padding: 1.5rem 1.5rem 0;
}
.panel-header__title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: .25rem;
}
.panel-header__desc {
  color: var(--text-dim);
  font-size: .85rem;
}

/* ── DASHBOARD STATS ── */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  padding: 1.25rem 1.5rem;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1rem;
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-normal) ease;
}
.stat-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.stat-card__icon {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  flex-shrink: 0;
}
.stat-card__icon--items { background: var(--accent-muted); color: var(--accent); }
.stat-card__icon--active { background: var(--green-muted); color: var(--green); }
.stat-card__icon--cats { background: var(--blue-muted); color: var(--blue); }
.stat-card__icon--inactive { background: var(--orange-muted); color: var(--orange); }
.stat-card__value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.stat-card__label {
  font-size: .72rem;
  color: var(--text-dim);
  font-weight: 500;
  margin-top: .15rem;
}

/* ── TOOLBAR ── */
.toolbar {
  display: flex;
  gap: .6rem;
  padding: .875rem 1.5rem;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}
.search-input {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2355555f' stroke-width='2' stroke-linecap='round' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: .75rem center;
  padding-left: 2.1rem;
}

/* ── ITEM CARDS ── */
.category-group { margin-bottom: .25rem; }
.category-group__title {
  font-family: 'Outfit', sans-serif;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-dim);
  padding: .75rem 1.5rem .5rem;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.category-group__title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.items-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  padding: 0 1.5rem .75rem;
}
@media (min-width: 640px) {
  .items-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}
@media (min-width: 1280px) {
  .items-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}
@media (min-width: 1600px) {
  .items-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
}

.item-card {
  display: flex;
  align-items: center;
  gap: .85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: .75rem .85rem;
  cursor: pointer;
  transition:
    background var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-normal) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.item-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.03) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--duration-normal) ease;
  pointer-events: none;
}
.item-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}
.item-card:hover::before { opacity: 1; }
.item-card:active { transform: scale(0.995) translateY(0); }
.item-card.dragging { opacity: .35; }
.item-card.drag-over {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.item-card__img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--bg-input);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.item-card__emoji {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: var(--bg-input);
  border-radius: var(--radius);
  flex-shrink: 0;
}
.item-card__info { flex: 1; min-width: 0; }
.item-card__name {
  font-size: .88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.015em;
  margin-bottom: .3rem;
}
.item-card__meta {
  font-size: .75rem;
  color: var(--text-dim);
  display: flex;
  gap: .5rem;
  align-items: center;
}
.item-card__price {
  font-weight: 700;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  font-size: .8rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .5rem;
  border-radius: 100px;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  line-height: 1.4;
}
.badge-available {
  background: var(--green-strong);
  color: var(--green);
}
.badge-unavailable {
  background: var(--red-muted);
  color: var(--red);
}

.item-card__actions {
  display: flex;
  gap: .15rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--duration-fast) ease;
}
.item-card:hover .item-card__actions { opacity: 1; }

.icon-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  transition:
    background var(--duration-fast) ease,
    color var(--duration-fast) ease;
}
.icon-btn:hover { background: var(--bg-active); color: var(--text); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn.toggle-on { color: var(--green); }
.icon-btn.toggle-off { color: var(--red); opacity: 0.7; }

/* ── EDITOR OVERLAY ── */
.editor-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  overflow-y: auto;
  display: none;
  opacity: 0;
  transform: translateX(12px);
}
.editor-overlay.open {
  display: block;
  animation: editorSlideIn var(--duration-slow) var(--ease-out) forwards;
}
@keyframes editorSlideIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

.editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: var(--topbar-height);
  background: rgba(9, 9, 11, 0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.editor-bar__left {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.editor-bar__back {
  border: none !important;
  padding: .3rem !important;
}
.editor-bar__actions {
  display: flex;
  gap: .5rem;
}
.editor-bar__title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.editor-body {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Editor two-column grid */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
@media (max-width: 768px) {
  .editor-grid { grid-template-columns: 1fr; }
}

.editor-section {
  margin-bottom: 1.75rem;
}
.editor-section__title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-dim);
  margin-bottom: .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.editor-section__title svg {
  opacity: 0.5;
}

.lang-fields { display: flex; flex-direction: column; gap: .6rem; }
.lang-field__label {
  display: inline-block;
  font-size: .62rem;
  font-weight: 700;
  background: var(--accent-muted);
  color: var(--accent);
  padding: .15rem .5rem;
  border-radius: 4px;
  margin-bottom: .25rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.availability-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
  padding: .75rem;
  background: var(--bg-input);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* Image upload */
.image-upload {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition:
    border-color var(--duration-normal) ease,
    background var(--duration-normal) ease;
  position: relative;
  background: var(--bg-input);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.image-upload:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}
.image-upload__preview {
  max-width: 200px;
  max-height: 200px;
  border-radius: var(--radius);
  margin-bottom: .5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.image-upload__text {
  color: var(--text-dim);
  font-size: .8rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
}
.image-upload__text svg { opacity: 0.4; }
.image-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Sub-rows (sizes, options) */
/* Meal config */
.meal-config-section { margin-top: .75rem; }
.meal-item-row {
  justify-content: space-between;
  cursor: default;
}
.meal-item-name {
  font-size: .85rem;
  font-weight: 550;
}
.meal-item-extra {
  font-size: .75rem;
  color: var(--green);
  font-weight: 600;
}

.sub-rows { display: flex; flex-direction: column; gap: .4rem; }
.sub-row {
  display: flex;
  gap: .4rem;
  align-items: center;
  background: var(--bg-input);
  padding: .5rem .6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: border-color var(--duration-fast) ease;
}
.sub-row:hover { border-color: var(--border-strong); }
.sub-row input, .sub-row select { flex: 1; background: var(--bg-hover); }
.sub-row .icon-btn { flex-shrink: 0; }

.editor-footer {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ── TOGGLE SWITCH ── */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-active);
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  border: 1px solid var(--border);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: all var(--duration-normal) var(--ease-spring);
}
.toggle input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--text-inverse);
}

/* ── CATEGORIES TAB ── */
.cat-list {
  padding: var(--space-md) var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.cat-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: .75rem 1rem;
  cursor: grab;
  transition:
    background var(--duration-fast) ease,
    border-color var(--duration-fast) ease;
}
.cat-row:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}
.cat-row.dragging { opacity: .35; }
.cat-row.drag-over { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.cat-row__label {
  flex: 1;
  font-weight: 600;
  font-size: .9rem;
  letter-spacing: -0.01em;
}
.cat-row__slug {
  color: var(--text-dim);
  font-size: .75rem;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* ── BULK EDIT ── */
.bulk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.bulk-table th {
  text-align: left;
  padding: .6rem .75rem;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-dim);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}
.bulk-table td {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.bulk-table input {
  width: 100px;
  padding: .35rem .5rem;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.bulk-table tr { transition: background var(--duration-fast) ease; }
.bulk-table tr:hover { background: var(--bg-card); }
.bulk-changed {
  background: var(--accent-muted) !important;
  border-left: 3px solid var(--accent);
}
.bulk-wrapper { padding: var(--space-md) var(--space-xl); overflow-x: auto; }

/* ── MEAL COMBOS TAB ── */
.combo-section { padding: 1.25rem 1.5rem; }
.combo-section h3 {
  font-family: 'Outfit', sans-serif;
  font-size: .8rem;
  margin-bottom: .75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 700;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 40px));
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: .65rem 1.25rem;
  border-radius: 100px;
  font-weight: 600;
  font-size: .82rem;
  z-index: 999;
  transition: transform var(--duration-slow) var(--ease-out);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  letter-spacing: -0.01em;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error {
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--red);
  background: linear-gradient(135deg, var(--bg-card), rgba(239, 68, 68, 0.05));
}
.toast.success {
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--green);
  background: linear-gradient(135deg, var(--bg-card), rgba(34, 197, 94, 0.05));
}

/* ── CONFIRM DIALOG ── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn var(--duration-fast) ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.confirm-box {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: confirmPop var(--duration-slow) var(--ease-out);
  text-align: center;
}
@keyframes confirmPop {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.confirm-box__icon {
  width: 48px; height: 48px;
  margin: 0 auto .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--orange-muted);
  color: var(--orange);
  border-radius: 50%;
}
.confirm-box h3 {
  margin-bottom: .4rem;
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.confirm-box p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: .85rem;
  line-height: 1.5;
}
.confirm-box__actions { display: flex; gap: .5rem; justify-content: center; }

/* ── LOADING ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TAB PANELS ── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 5rem 1rem;
  color: var(--text-dim);
}
.empty-state__icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: 0.5; }
.empty-state__text { font-size: .9rem; font-weight: 500; }

/* ── REORDER MODE ── */
.reorder-mode-active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.3) !important;
}
.reorder-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--space-xl);
}
.reorder-group { margin-bottom: 1.25rem; }
.reorder-group__title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-dim);
  padding: .5rem 1.5rem;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.reorder-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .45rem .7rem;
  transition:
    background var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-normal) var(--ease-out);
  user-select: none;
}
.reorder-row:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.reorder-row.dragging { opacity: .35; }
.reorder-row.drag-over { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.reorder-row__grip {
  cursor: grab;
  color: var(--text-dim);
  font-size: 1rem;
  flex-shrink: 0;
  padding: .2rem;
  line-height: 1;
  transition: color var(--duration-fast) ease;
}
.reorder-row:hover .reorder-row__grip { color: var(--text-secondary); }
.reorder-row__grip:active { cursor: grabbing; }
.reorder-row__num {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-muted);
  border-radius: 50%;
  font-size: .65rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.reorder-row__name {
  flex: 1;
  font-size: .85rem;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.reorder-row__meta {
  color: var(--text-dim);
  font-size: .75rem;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.reorder-arrows { display: flex; gap: .2rem; flex-shrink: 0; }
.reorder-arrow {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: .75rem;
  transition: all var(--duration-fast) var(--ease-out);
  line-height: 1;
}
.reorder-arrow:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-inverse);
  box-shadow: 0 0 8px var(--accent-glow);
}
.reorder-arrow:active { transform: scale(0.9); }
.reorder-arrow:disabled { opacity: .2; cursor: not-allowed; pointer-events: none; }

/* ── UTILITIES ── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--accent);
  color: var(--text-inverse);
  padding: .75rem 1.5rem;
  border-radius: var(--radius-sm);
  z-index: 1000;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.flex-row { display: flex; align-items: center; }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.mb-lg { margin-bottom: var(--space-lg); }
.ml-auto { margin-left: auto; }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: .8rem; }
.toolbar--flush { padding-left: 0; }
.form-group__inline-label { font-size: .88rem; font-weight: 600; cursor: pointer; }

.btn-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

.image-upload.drag-active {
  border-color: var(--accent);
  background: var(--accent-muted);
  animation: dropPulse 1s ease infinite;
}
@keyframes dropPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, .15); }
  50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
}

.item-card.toggle-flash { animation: toggleFlash .4s ease; }
@keyframes toggleFlash {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .4); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: none; }
}
.item-card.toggle-flash-off { animation: toggleFlashOff .4s ease; }
@keyframes toggleFlashOff {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .4); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: none; }
}

.panel-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl) 0;
}

.toast__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  margin-right: 2px;
}

/* ── Focus Visible ── */
.btn:focus-visible,
.icon-btn:focus-visible,
.reorder-arrow:focus-visible,
.tab-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.item-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.toggle:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 100px;
}

/* ── RESPONSIVE ── */

/* Tablet & below: collapse sidebar */
@media (max-width: 1023px) {
  .sidebar-toggle { display: flex; }

  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform var(--duration-slow) var(--ease-out);
    box-shadow: none;
  }
  .sidebar--open {
    transform: translateX(0);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.5);
  }

  .dash-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 639px) {
  .topbar__title { font-size: .9rem; }
  .topbar__restaurant { display: none; }
  .editor-body { padding: 1rem .75rem 3rem; }
  .row-2 { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; padding: .75rem 1rem; }
  .search-input { max-width: 100%; min-width: 0; }
  .item-card__actions { opacity: 1; }
  .sub-row { flex-wrap: wrap; }
  .sub-row input, .sub-row select { min-width: calc(50% - .5rem); }
  .dash-stats { grid-template-columns: 1fr 1fr; gap: .5rem; padding: 1rem; }
  .stat-card { padding: .75rem; }
  .stat-card__value { font-size: 1.2rem; }
  .items-grid { padding: 0 1rem .75rem; }
  .category-group__title { padding-left: 1rem; padding-right: 1rem; }
  .toast {
    left: var(--space-lg);
    right: var(--space-lg);
    transform: translateY(calc(100% + 40px));
    text-align: center;
    border-radius: var(--radius);
  }
  .toast.show { transform: translateY(0); }
  .editor-grid { grid-template-columns: 1fr; gap: 0; }
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
