:root {
  --brand-50: #eef4ff;
  --brand-100: #dbe8ff;
  --brand-500: #2563eb;
  --brand-600: #1d4ed8;
  --brand-700: #1e40af;
  --success-500: #16a34a;
  --success-600: #15803d;
  --warning-500: #d97706;
  --warning-600: #b45309;
  --danger-500: #dc2626;
  --danger-600: #b91c1c;
  --info-500: #0891b2;
  --surface-soft: #f8fafc;
  --surface-highlight: rgba(37, 99, 235, 0.08);
  --text-strong: #0f172a;
  --muted-strong: #64748b;
  --ring: 0 0 0 4px rgba(37, 99, 235, 0.16);
  --page-max: 1560px;
  --admin-sidebar-width: 272px;
  --admin-sidebar-collapsed-width: 92px;
}

body {
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(22, 163, 74, 0.08), transparent 22%),
    linear-gradient(180deg, #f8fbff 0%, #f3f7fb 45%, #eef3f8 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 80%);
}

.topbar-progress {
  position: fixed;
  inset: 0 auto auto 0;
  height: 3px;
  width: 0;
  z-index: 2000;
  background: linear-gradient(90deg, var(--brand-500), #60a5fa, #22c55e);
  box-shadow: 0 0 24px rgba(37, 99, 235, 0.35);
  transition: width 0.28s ease, opacity 0.28s ease;
  opacity: 0;
}

body.is-routing .topbar-progress,
body.is-booting .topbar-progress {
  width: 78%;
  opacity: 1;
}

body.is-ready .topbar-progress {
  width: 100%;
  opacity: 0;
}

.layout {
  position: relative;
  display: block;
  min-height: 100vh;
  padding-left: var(--admin-sidebar-width);
  transition: padding-left 0.24s ease;
}

.main {
  width: min(100%, var(--page-max));
  padding: 28px;
  margin: 0 auto;
  transition: width 0.24s ease, margin 0.24s ease;
}

.page-header-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 24px 28px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}

.page-header-main h2,
#viewTitle {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.03em;
}

.page-header-main p,
#viewDesc {
  margin: 8px 0 0;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.65;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.card,
.toolbar,
.table-shell,
.order-list-shell,
.dashboard-panel,
.settings-form {
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.06);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card:hover,
.dashboard-panel:hover,
.table-shell:hover,
.order-list-shell:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
  border-color: rgba(37, 99, 235, 0.16);
}

.btn {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    transform 0.16s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px) scale(0.985);
}

.btn.is-loading {
  pointer-events: none;
  opacity: 0.88;
}

.btn.is-loading::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  vertical-align: -2px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-top-color: rgba(255, 255, 255, 1);
  animation: admin-spin 0.8s linear infinite;
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.24);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
}

.btn-success {
  background: linear-gradient(135deg, var(--success-500), var(--success-600));
  color: #fff;
  box-shadow: 0 10px 20px rgba(22, 163, 74, 0.22);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-500), var(--danger-600));
  color: #fff;
  box-shadow: 0 10px 20px rgba(220, 38, 38, 0.2);
}

.btn-light {
  background: #fff;
  border-color: rgba(148, 163, 184, 0.2);
  color: var(--text-strong);
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning-500), var(--warning-600));
  color: #fff;
}

.btn-info {
  background: linear-gradient(135deg, var(--info-500), #0f766e);
  color: #fff;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--admin-sidebar-width);
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
  z-index: 1180;
  transition: width 0.24s ease, padding 0.24s ease, transform 0.26s ease, box-shadow 0.26s ease;
}

body.is-sidebar-collapsed .layout {
  padding-left: var(--admin-sidebar-collapsed-width);
}

body.is-sidebar-collapsed .sidebar {
  width: var(--admin-sidebar-collapsed-width);
}

.brand {
  align-items: center;
}

.brand-text {
  min-width: 0;
  flex: 1;
}

.sidebar-close-btn,
.sidebar-collapse-btn,
.mobile-sidebar-toggle {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-strong);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.sidebar-close-btn:hover,
.sidebar-collapse-btn:hover,
.mobile-sidebar-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
}

.sidebar-close-btn:active,
.sidebar-collapse-btn:active,
.mobile-sidebar-toggle:active {
  transform: scale(0.97);
}

.sidebar-close-btn,
.sidebar-collapse-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
}

.mobile-sidebar-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1300;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 700;
  touch-action: manipulation;
  user-select: none;
}

.mobile-sidebar-toggle i {
  font-size: 16px;
}

.mobile-sidebar-toggle span {
  font-size: 13px;
  letter-spacing: 0.02em;
}

.sidebar-collapse-btn {
  display: inline-flex;
}

body.is-sidebar-collapsed .sidebar {
  padding-left: 12px;
  padding-right: 12px;
}

body.is-sidebar-collapsed .brand {
  justify-content: center;
  gap: 0;
  padding-inline: 8px;
}

body.is-sidebar-collapsed .brand-logo {
  display: none;
}

body.is-sidebar-collapsed .brand-text,
body.is-sidebar-collapsed .menu-section-title,
body.is-sidebar-collapsed .sidebar-user,
body.is-sidebar-collapsed .sidebar-actions .btn-sm {
  display: none;
}

body.is-sidebar-collapsed .menu {
  gap: 8px;
}

body.is-sidebar-collapsed .menu-item {
  justify-content: center;
  padding: 12px;
  min-height: 48px;
  border-radius: 14px;
}

body.is-sidebar-collapsed .menu-item-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

body.is-sidebar-collapsed .menu-item-icon i {
  font-size: 15px;
}

body.is-sidebar-collapsed .menu-item-label {
  display: none;
}

body.is-sidebar-collapsed .sidebar-footer {
  padding-inline: 8px;
}

body.is-sidebar-collapsed .sidebar-actions {
  justify-content: center;
}

body.is-sidebar-collapsed .sidebar-collapse-btn {
  margin-left: 0;
}

body.is-sidebar-collapsed .sidebar-collapse-btn i {
  transform: rotate(180deg);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 1190;
  opacity: 0;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  transition: opacity 0.24s ease;
}

body.is-sidebar-open .sidebar-overlay {
  opacity: 1;
  pointer-events: auto;
}

.menu-item.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(34, 197, 94, 0.08));
  border-color: rgba(96, 165, 250, 0.24);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.menu-item.active::before {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}

.menu-item::before {
  content: none;
}

.menu-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
  flex-shrink: 0;
  transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.menu-item-icon i {
  font-size: 13px;
}

.menu-item-label {
  min-width: 0;
  flex: 1;
}

.menu-item:hover .menu-item-icon {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.96);
}

.menu-item.active .menu-item-icon {
  background: #0a0a0a;
  border-color: #0a0a0a;
  color: #ffffff;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

input,
select,
textarea {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-strong);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(37, 99, 235, 0.22);
}

.toast {
  right: 24px;
  bottom: 24px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
  animation: toast-in 0.22s ease;
}

.toast.is-success {
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.96), rgba(21, 128, 61, 0.96));
}

.toast.is-error {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.96), rgba(185, 28, 28, 0.96));
}

.toast.is-warning {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.96), rgba(180, 83, 9, 0.96));
}

.toast.is-info {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(37, 99, 235, 0.9));
}

.admin-confirm-mask {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(6px);
}

.admin-confirm {
  width: min(100%, 460px);
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.26);
  animation: toast-in 0.22s ease;
}

.admin-confirm-eyebrow {
  color: var(--brand-600);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-confirm-title {
  margin: 10px 0 0;
  color: var(--text-strong);
  font-size: 24px;
  line-height: 1.3;
}

.admin-confirm-body {
  margin-top: 14px;
  color: var(--muted-strong);
  line-height: 1.75;
}

.admin-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.admin-empty-state {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 28px 20px;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.9);
  text-align: center;
}

.admin-empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand-600);
  font-size: 28px;
  font-weight: 700;
}

.admin-empty-title {
  margin: 0;
  color: var(--text-strong);
  font-size: 18px;
}

.admin-empty-desc {
  margin: 0;
  color: var(--muted-strong);
  line-height: 1.7;
}

.admin-skeleton-group {
  display: grid;
  gap: 14px;
}

.admin-skeleton-stats {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.admin-skeleton-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.admin-skeleton-card {
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.admin-skeleton-card-grid,
.admin-skeleton-card-stat,
.admin-skeleton-card-list {
  display: grid;
  gap: 12px;
}

.admin-skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
}

.admin-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  animation: admin-skeleton-shimmer 1.4s ease infinite;
}

.admin-skeleton-line {
  height: 12px;
}

.admin-skeleton-pill {
  width: 72px;
  height: 26px;
}

.admin-skeleton-media {
  width: 100%;
  height: 150px;
  border-radius: 16px;
}

.admin-skeleton-line.w-90 { width: 90%; }
.admin-skeleton-line.w-70 { width: 70%; }
.admin-skeleton-line.w-55 { width: 55%; }
.admin-skeleton-line.w-45 { width: 45%; }
.admin-skeleton-line.w-35 { width: 35%; }

.admin-retry-state {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.admin-retry-state .btn {
  min-width: 140px;
}

body.is-confirm-open {
  overflow: hidden;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes admin-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes admin-skeleton-shimmer {
  to {
    transform: translateX(100%);
  }
}

[data-page-enter] {
  opacity: 0;
  transform: translateY(12px);
  animation: page-enter 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

[data-page-enter][data-enter-delay="1"] { animation-delay: 0.04s; }
[data-page-enter][data-enter-delay="2"] { animation-delay: 0.08s; }
[data-page-enter][data-enter-delay="3"] { animation-delay: 0.12s; }
[data-page-enter][data-enter-delay="4"] { animation-delay: 0.16s; }
[data-page-enter][data-enter-delay="5"] { animation-delay: 0.2s; }

@keyframes page-enter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-surface {
  display: grid;
  gap: 16px;
}

.dashboard-hero,
.dashboard-grid,
.stats-grid,
.table-grid,
.dish-grid,
.order-card-grid {
  position: relative;
}

@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .main {
    padding: 20px;
  }
}

@media (max-width: 960px) {
  .layout {
    display: block;
    padding-left: 0;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(82vw, 300px);
    height: 100vh;
    max-height: none;
    z-index: 1250;
    padding-top: max(20px, env(safe-area-inset-top));
    transform: translateX(calc(-100% - 18px));
    transition: transform 0.26s ease, box-shadow 0.26s ease;
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.3);
  }

  body.is-sidebar-collapsed .layout {
    grid-template-columns: 1fr;
    padding-left: 0;
  }

  body.is-sidebar-open .layout {
    padding-left: 0;
  }

  body.is-sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-close-btn,
  .mobile-sidebar-toggle {
    display: inline-flex;
  }

  .sidebar-collapse-btn {
    display: none;
  }

  body.is-sidebar-collapsed .brand,
  body.is-sidebar-collapsed .menu-item,
  body.is-sidebar-collapsed .sidebar-footer {
    all: unset;
  }

  body.is-sidebar-collapsed .brand {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  body.is-sidebar-collapsed .brand-text {
    display: block;
    min-width: 0;
    flex: 1;
  }

  body.is-sidebar-collapsed .menu-section-title {
    display: block;
  }

  body.is-sidebar-collapsed .sidebar-user {
    display: block;
  }

  body.is-sidebar-collapsed .sidebar-actions .btn-sm {
    display: inline-flex;
  }

  body.is-sidebar-collapsed .menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    padding: 10px 14px;
    min-height: 0;
    border-radius: 8px;
    justify-content: flex-start;
  }

  body.is-sidebar-collapsed .menu-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
  }

  body.is-sidebar-collapsed .menu-item-icon i {
    font-size: 13px;
  }

  body.is-sidebar-collapsed .menu-item-label {
    display: block;
  }

  body.is-sidebar-collapsed .sidebar-footer {
    display: block;
    padding: 16px 12px;
  }

  .main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 72px 16px 18px;
  }

  .admin-confirm {
    padding: 20px;
    border-radius: 20px;
  }

  .admin-confirm-actions {
    flex-direction: column-reverse;
  }


  .page-header-bar {
    padding: 18px;
    border-radius: 18px;
    flex-direction: column;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar > * {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .mobile-sidebar-toggle {
    top: 12px;
    left: 12px;
    padding: 9px 12px;
    border-radius: 12px;
  }

  .mobile-sidebar-toggle span {
    display: none;
  }

  .auth-card {
    padding: 28px 22px;
  }

  .btn,
  input,
  select,
  textarea {
    width: 100%;
  }

  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
}
