.admin-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100dvh;
}
@media (min-width: 920px) {
  .admin-shell { grid-template-columns: 260px 1fr; }
}

.admin-sidebar {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
@media (max-width: 919px) {
  .admin-sidebar {
    position: fixed;
    top: 0;
    right: -280px;
    bottom: 0;
    width: 265px;
    z-index: 500;
    transition: right 0.25s ease;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
  }
  .admin-sidebar.open { right: 0; }
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 450;
}
.sidebar-overlay.open { display: block; }

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 16px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
}
.admin-brand img { width: 38px; height: 38px; border-radius: 10px; }
.admin-brand h2 { margin: 0; font-size: 1rem; }
.admin-brand small { color: var(--text-muted); font-size: 0.74rem; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: right;
  width: 100%;
}
.nav-item:hover { background: var(--bg-surface-alt); color: var(--text-main); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-item .pill-count {
  margin-right: auto;
  background: var(--accent-sale);
  color: #fff;
  border-radius: 99px;
  padding: 1px 8px;
  font-size: 0.72rem;
}

.admin-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.admin-topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.menu-toggle { display: inline-flex; }
@media (min-width: 920px) { .menu-toggle { display: none; } }

.admin-content {
  padding: 18px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-xs);
}
.kpi-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 700; }
.kpi-val { font-size: 1.5rem; font-weight: 800; margin: 4px 0 2px; direction: ltr; text-align: right; }
.kpi-sub { font-size: 0.78rem; color: var(--text-subtle); }

/* Panel & Tables */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.panel-head h3 { margin: 0; font-size: 1.08rem; }

.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th, .data-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border-color);
  text-align: right;
  vertical-align: middle;
}
.data-table th {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-surface-alt);
  white-space: nowrap;
}
.data-table tr:hover td { background: rgba(154, 91, 62, 0.04); }

.thumb-sm {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-surface-alt);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) { .form-grid-2 { grid-template-columns: 1fr 1fr; } }

.alert-box {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert-warning { background: var(--warning-soft); border-color: var(--warning); color: var(--text-main); }
.alert-info { background: var(--info-soft); border-color: var(--info); color: var(--text-main); }

.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px 22px;
  box-shadow: var(--shadow-md);
}

.img-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.img-preview-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.img-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.img-preview-item button {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 0.72rem;
}

#quickRateChip {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Printable Invoice */
@media print {
  .no-print,
  .admin-shell,
  .toast-container {
    display: none !important;
  }
  body {
    background: #fff !important;
    color: #000 !important;
    overflow: visible !important;
  }
  .modal-backdrop.open {
    position: static !important;
    display: block !important;
    background: #fff !important;
    padding: 0 !important;
    backdrop-filter: none !important;
  }
  .modal-dialog {
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    animation: none !important;
  }
  .invoice-print {
    box-shadow: none !important;
    border: none !important;
  }
}
