.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #1a1f2b;
  color: #cbd2de;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; background: var(--primary, #e0512c); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: .85rem; }
.brand-mark.large { width: 56px; height: 56px; font-size: 1.1rem; margin: 0 auto 1rem; }
.brand-name { font-weight: 700; color: #fff; font-size: .95rem; }
.brand-sub { font-size: .75rem; color: #8b93a3; }

.sidebar-nav { padding: .75rem .6rem; display: flex; flex-direction: column; }
.nav-group-label { text-transform: uppercase; font-size: .68rem; letter-spacing: .06em; color: #6b7280; margin: 1rem .6rem .35rem; font-weight: 700; }
.nav-link { padding: .5rem .6rem; border-radius: 8px; font-size: .87rem; color: #cbd2de; margin-bottom: .1rem; }
.nav-link:hover { background: rgba(255,255,255,.06); }
.nav-link.active { background: var(--primary, #e0512c); color: #fff; }
.nav-parent { padding: .5rem .6rem 0; font-size: .87rem; font-weight: 700; color: #fff; display: flex; align-items: center; gap: .4rem; }
.nav-sub { margin-left: .9rem; font-size: .82rem; }

.admin-main { flex: 1; min-width: 0; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.75rem; background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 5; }

.impersonation-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: #fef3c7; color: #92400e; padding: .55rem 1.75rem; font-size: .85rem; font-weight: 600;
  position: sticky; top: 0; z-index: 6;
}
.impersonation-banner a { color: #92400e; text-decoration: underline; }
.admin-topbar h1 { font-size: 1.15rem; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-user { font-size: .85rem; color: #374151; display: flex; align-items: center; gap: .5rem; }
.role-badge { background: #f1f2f4; padding: .1rem .5rem; border-radius: 999px; font-size: .7rem; text-transform: uppercase; font-weight: 700; color: #6b7280; }

.admin-content { padding: 1.5rem 1.75rem 3rem; max-width: 1200px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 1.1rem 1.25rem; }
.stat-label { font-size: .78rem; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .35rem; }
.stat-value { font-size: 1.6rem; font-weight: 800; }

.panel { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; }
.panel h2 { font-size: 1rem; }

.quick-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; padding: .5rem; border-bottom: 1px solid #e5e7eb; }
.data-table td { padding: .55rem .5rem; border-bottom: 1px solid #f1f2f4; }

.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.inline-form input[type=text], .inline-form input[type=number] { width: auto; min-width: 160px; }
.inline-form select { width: auto; }
.small-label { font-size: .78rem; display: flex; align-items: center; gap: .3rem; font-weight: 500; }
.small-label input { margin-top: 0; width: auto; }

.checkbox-group { display: flex; flex-wrap: wrap; }

.drag-list { list-style: none; margin: 0; padding: 0; }
.drag-item { display: flex; align-items: center; gap: .6rem; padding: .6rem .4rem; border-bottom: 1px solid #f1f2f4; }
.drag-item.dragging { opacity: .4; }
.drag-handle { cursor: grab; color: #9aa1ac; font-size: 1.1rem; }
.section-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; flex: 1; }
.section-row .name-input { width: 160px; }

.item-thumb { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; }
.item-thumb-lg { width: 120px; border-radius: 8px; margin-top: .4rem; }
.banner-preview { width: 100%; max-width: 320px; border-radius: 8px; margin-top: .4rem; }
.item-name { font-weight: 600; min-width: 140px; }
.item-price { color: #374151; }

.veg-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; border: 2px solid; }
.veg-veg { border-color: #146c2e; }
.veg-veg::after { content: ''; display: block; width: 4px; height: 4px; background: #146c2e; border-radius: 2px; margin: 1px; }
.veg-non_veg { border-color: #b3261e; }
.veg-non_veg::after { content: ''; display: block; width: 4px; height: 4px; background: #b3261e; border-radius: 2px; margin: 1px; }
.veg-eggetarian { border-color: #b7791f; }
.veg-eggetarian::after { content: ''; display: block; width: 4px; height: 4px; background: #b7791f; border-radius: 2px; margin: 1px; }
.veg-not_applicable { border-color: #9aa1ac; }
.veg-not_applicable::after { content: ''; display: block; width: 4px; height: 4px; background: #9aa1ac; border-radius: 2px; margin: 1px; }

.stacked-form label { max-width: 480px; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row label { flex: 1; min-width: 140px; }
fieldset { border: 1px solid #e5e7eb; border-radius: 10px; padding: .9rem 1rem; margin-bottom: 1rem; }
legend { font-size: .82rem; font-weight: 700; padding: 0 .3rem; }
.repeat-row { display: flex; gap: .5rem; margin-bottom: .5rem; }
.checkbox-inline { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.checkbox-inline input { width: auto; }

.bulk-bar { display: flex; gap: .5rem; margin-bottom: .75rem; }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #d7dbe0; border-radius: 999px; cursor: pointer; transition: .15s; }
.slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + .slider { background: #146c2e; }
.switch input:checked + .slider::before { transform: translateX(18px); }

.stub-panel { text-align: center; padding: 3rem 1.5rem; }
.stub-panel h2 { margin-top: .5rem; }

/* ---- Menu builder: toolbar, section cards, kebab menus ---- */
.menu-toolbar { display: flex; align-items: center; gap: .85rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab-pill { background: var(--primary, #6d5ce8); color: #fff; font-weight: 700; padding: .4rem 1rem; border-radius: 8px; font-size: .85rem; }

.card-list, .miller-list { list-style: none; margin: 0; padding: 0; }

.section-card, .miller-row {
  display: flex; align-items: center; gap: .6rem;
  padding: .8rem .9rem; border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: .6rem; background: #fff;
}
.section-card.dragging, .miller-row.dragging { opacity: .4; }

.section-card-link, .miller-row-link {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: .5rem;
  color: inherit; overflow: hidden;
}
.section-card-name, .miller-row-name {
  font-weight: 800; color: var(--primary, #d9642c); letter-spacing: .01em; font-size: .92rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.badge-text { font-size: .72rem; font-weight: 700; text-transform: lowercase; }
.badge-text.is-active { color: #146c2e; }
.badge-text.is-inactive { color: #9aa1ac; }

.service-tag-row { display: flex; gap: .3rem; flex-shrink: 0; }
.service-tag { background: #f1f2f4; color: #374151; font-size: .68rem; font-weight: 700; padding: .15rem .4rem; border-radius: 5px; }

.miller-row.selected { background: var(--primary, #e0512c); border-color: var(--primary, #e0512c); }
.miller-row.selected .miller-row-name,
.miller-row.selected .badge-text,
.miller-row.selected .drag-handle,
.miller-row.selected .muted { color: #fff; }
.miller-row.selected .service-tag { background: rgba(255,255,255,.25); color: #fff; }

.kebab-wrap { position: relative; flex-shrink: 0; }
.kebab-btn { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: inherit; padding: .2rem .4rem; border-radius: 6px; line-height: 1; }
.kebab-btn:hover { background: rgba(0,0,0,.06); }
.dropdown-menu {
  display: none; position: absolute; right: 0; top: 100%; z-index: 20;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.12);
  min-width: 150px; padding: .3rem; margin-top: .25rem;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: block; width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  padding: .45rem .6rem; border-radius: 6px; font-size: .85rem; color: #1f2733;
}
.dropdown-item:hover { background: #f1f2f4; }
.dropdown-item-danger { color: #b3261e; }

.btn-pill {
  display: inline-flex; align-items: center; gap: .4rem; padding: .6rem 1.4rem; border-radius: 999px;
  border: 2px solid #146c2e; color: #146c2e; background: #fff; font-weight: 700; cursor: pointer; font-size: .85rem;
}
.btn-pill:hover { background: #e6f6ec; }

.add-link { background: none; border: none; color: #146c2e; font-weight: 700; font-size: .82rem; cursor: pointer; }
.add-link.is-disabled { color: #b7bcc4; cursor: not-allowed; }

/* ---- Miller (3-column) browser ---- */
.miller-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-items: start; }
.miller-col { background: #fafbfc; border: 1px solid #eceef1; border-radius: 10px; overflow: hidden; }
.miller-col-head {
  display: flex; justify-content: space-between; align-items: center;
  background: #eef0f3; padding: .6rem .8rem; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: #374151;
}
.miller-col .miller-list { padding: .6rem; max-height: 480px; overflow-y: auto; }
.miller-row { margin-bottom: .5rem; padding: .55rem .65rem; }
.miller-row-name { font-size: .82rem; }

/* ---- Modal ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(17,20,26,.5);
  align-items: center; justify-content: center; z-index: 100; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 14px; padding: 1.5rem; width: 100%; max-width: 440px; position: relative; max-height: 90vh; overflow-y: auto; }
.modal-close { position: absolute; top: .75rem; right: .9rem; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: #6b7280; }
.modal-wide { max-width: 640px; }

/* ---- Copy modal (category -> other sections, item -> other categories) ---- */
.copy-modal-title { text-align: center; font-size: 1.1rem; margin: 0 1.5rem .5rem; }
.copy-search { width: 100%; margin-bottom: .75rem; }
.copy-table { margin-top: .5rem; }
.copy-table thead th { position: sticky; top: 0; background: #f9fafb; }
.copy-select-col { width: 90px; text-align: right; }
.copy-select-col input { width: auto; }
.copy-row-hidden { display: none; }
.copy-modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.25rem; }

@media (max-width: 900px) {
  .miller-columns { grid-template-columns: 1fr; }
}

/* ---- Item form: toggle rows, radio rows, stub controls ---- */
.item-form hr { border: none; border-top: 1px solid #eceef1; margin: 1.1rem 0; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: .5rem 0; font-size: .88rem; font-weight: 600; color: #374151; max-width: 480px; }
.toggle-row.stub-toggle { color: #9aa1ac; cursor: not-allowed; }
.toggle-row.stub-toggle .switch { opacity: .6; cursor: not-allowed; }

.radio-row { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-bottom: 1rem; }
.radio-inline { display: flex; align-items: center; gap: .4rem; font-weight: 500; color: #1f2733; }
.radio-inline input { width: auto; margin: 0; }

.btn-add { text-transform: uppercase; letter-spacing: .03em; margin-top: 1rem; }

/* ---- Item Details slide-in drawer ---- */
.drawer-overlay {
  display: none; position: fixed; inset: 0; background: rgba(17,20,26,.5); z-index: 150;
}
.drawer-overlay.open { display: block; }
.drawer-panel {
  position: absolute; top: 0; right: 0; height: 100vh; width: min(640px, 94vw);
  background: #fff; box-shadow: -12px 0 32px rgba(0,0,0,.2);
  overflow-y: auto; transform: translateX(100%); transition: transform .25s ease;
}
.drawer-overlay.open .drawer-panel { transform: translateX(0); }
.drawer-head {
  position: sticky; top: 0; z-index: 2; background: #f3f4f6; border-bottom: 1px solid #e5e7eb;
  padding: 1rem 3rem; text-align: center;
}
.drawer-head h2 { font-size: 1.05rem; margin: 0; }
.drawer-close {
  position: absolute; top: .6rem; right: .9rem; width: 30px; height: 30px; border-radius: 50%;
  background: #fff; border: 1px solid #e5e7eb; color: #374151; font-size: 1.1rem; cursor: pointer; line-height: 1;
}
.drawer-close:hover { background: #f1f2f4; }
.drawer-body { padding: 1.25rem 1.5rem 2rem; }

/* Fallback panel styling when the form is opened via direct URL (no JS/drawer) */
.drawer-fallback .drawer-head { position: static; margin: -1.4rem -1.4rem 1rem; border-radius: 12px 12px 0 0; }
.drawer-fallback .drawer-body { padding: 0; }

@media (max-width: 600px) {
  .drawer-panel { width: 100vw; }
}

.order-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.order-column h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; }
.order-cards { display: flex; flex-direction: column; gap: .6rem; min-height: 60px; }
.order-card { border: 1px solid #e5e7eb; border-radius: 10px; padding: .75rem .85rem; background: #fafbfc; }
.order-card-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: .25rem; }
.service-badge { font-size: .68rem; text-transform: uppercase; background: #f1f2f4; padding: .1rem .45rem; border-radius: 999px; }
.order-table { font-size: .78rem; color: #6b7280; margin-bottom: .35rem; }
.order-items { list-style: none; padding: 0; margin: 0 0 .5rem; font-size: .82rem; }
.order-total { font-weight: 700; margin-bottom: .5rem; }
.order-actions { display: flex; gap: .4rem; }

@media (max-width: 900px) {
  .admin-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .order-columns { grid-template-columns: 1fr; }
}

.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f5f6f8; padding: 1rem; }
.auth-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 2rem; max-width: 380px; width: 100%; text-align: center; }
.auth-card form { text-align: left; margin-top: 1.25rem; }

/* ---- Super Admin console ---- */
.superadmin-shell { min-height: 100vh; background: #f5f6f8; }
.superadmin-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.75rem; background: #1a1f2b; color: #fff;
}
.superadmin-brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: #fff; }
.superadmin-nav { display: flex; align-items: center; gap: 1.25rem; font-size: .88rem; }
.superadmin-nav a { color: #cbd2de; }
.superadmin-nav a:hover { color: #fff; }
.superadmin-content { padding: 1.5rem 1.75rem 3rem; max-width: 1100px; margin: 0 auto; }
.superadmin-content h1 { font-size: 1.3rem; margin-bottom: 1rem; }

.star-display { color: #f5a623; letter-spacing: 1px; }

.hidden { display: none !important; }
.toggle-reveal { margin: -.3rem 0 1rem; }
