:root {
  --primary-blue: #1e40af;
  --sidebar-bg: #1e3a8a;
  --sidebar-hover: #1d4ed8;
  --sidebar-active: #2563eb;
  --sidebar-text: #e0e7ff;
  --sidebar-muted: #93c5fd;
  
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-sky: #0ea5e9;
  
  --shadow-flat: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
}

/* Auth Modal Overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-overlay.hidden {
  display: none !important;
}

.auth-box {
  background: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  padding: 32px 28px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-color);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: var(--sidebar-bg);
  color: #fff;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.auth-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.input-group input {
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.input-group input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15);
}

.btn-primary {
  background: var(--sidebar-bg);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary:hover {
  background: var(--sidebar-hover);
}

.auth-error {
  background: #fef2f2;
  color: var(--accent-red);
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid #fecaca;
  display: none;
}

/* Sidebar Layout */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 250px;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-badge {
  background: #2563eb;
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand-text h2 {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
}

.brand-text span {
  font-size: 11px;
  color: var(--sidebar-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.sidebar-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  padding: 8px 12px 4px 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
  opacity: 0.85;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background-color: var(--sidebar-active);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: #3b82f6;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
}

.user-meta {
  overflow: hidden;
}

.user-meta .name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  color: #ffffff;
}

.user-meta .role {
  font-size: 11px;
  color: var(--sidebar-muted);
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--sidebar-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-main);
}

.topbar {
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title h1 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: #ecfdf5;
  color: #065f46;
}

.badge-status .dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
}

.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* Flat UI Section & Cards */
.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

/* Stats Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-flat);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-info h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-info .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: #0f172a;
}

.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.stat-icon-blue { background: #eff6ff; color: #2563eb; }
.stat-icon-emerald { background: #ecfdf5; color: #10b981; }
.stat-icon-amber { background: #fffbeb; color: #f59e0b; }
.stat-icon-purple { background: #faf5ff; color: #9333ea; }

/* Flat Panel & Tables */
.panel {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-flat);
  margin-bottom: 24px;
}

.panel-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.search-input {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  width: 240px;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--primary-blue);
}

.table-responsive {
  overflow-x: auto;
}

.flat-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.flat-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
}

.flat-table td {
  padding: 14px 20px;
  font-size: 14px;
  color: #334155;
  border-bottom: 1px solid var(--border-color);
}

.flat-table tbody tr:hover {
  background-color: #f8fafc;
}

.tag-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.tag-blue { background: #e0e7ff; color: #3730a3; }
.tag-green { background: #dcfce7; color: #166534; }
.tag-amber { background: #fef3c7; color: #92400e; }

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

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

.chart-panel {
  display: flex;
  flex-direction: column;
}

.chart-legend-badge {
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
  background: #eff6ff;
  padding: 3px 8px;
  border-radius: 6px;
}

.chart-container {
  padding: 16px 20px 20px 20px;
  position: relative;
  height: 280px;
  width: 100%;
}

.chart-container.pie-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Panel Actions & Export */
.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-export:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-delete-user {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-delete-user:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

/* Order Filter Tabs */
.filter-tabs-container {
  margin-bottom: 20px;
}

.filter-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-flat);
}

.filter-tab:hover {
  background: #f8fafc;
  color: var(--text-main);
  border-color: #cbd5e1;
}

.filter-tab.active {
  background: var(--sidebar-bg);
  color: #ffffff;
  border-color: var(--sidebar-bg);
}

.tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-pending { background: #f59e0b; }
.dot-completed { background: #10b981; }
.dot-failed { background: #ef4444; }

.status-select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.2s;
}

.status-select:focus {
  border-color: var(--primary-blue);
}

.tag-red { background: #fee2e2; color: #991b1b; }

/* Service Modal & Form Elements */
.service-modal-box {
  max-width: 520px;
  width: 95%;
  max-height: 85vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.btn-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s;
}

.btn-modal-close:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-select {
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background-color: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.2s;
}

.form-select:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15);
}

.input-group textarea {
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  resize: vertical;
  min-height: 72px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.input-group textarea:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15);
}

.modal-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.btn-cancel {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-primary-action {
  background: var(--sidebar-bg);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s, transform 0.1s;
}

.btn-primary-action:hover {
  background: var(--sidebar-hover);
}

.btn-primary-action:active {
  transform: scale(0.98);
}

/* Service Actions */
.service-actions-cell {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-action-edit {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-action-edit:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.btn-action-delete {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-action-delete:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

/* Service Category Badges */
.badge-cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-cat-residential { background: #e0f2fe; color: #0369a1; }
.badge-cat-commercial { background: #ede9fe; color: #5b21b6; }
.badge-cat-deepclean { background: #dcfce7; color: #166534; }
.badge-cat-robotic { background: #f3e8ff; color: #7e22ce; }
.badge-cat-inspection { background: #fef3c7; color: #92400e; }
.badge-cat-amc { background: #ffe4e6; color: #be123c; }
.badge-cat-general { background: #f1f5f9; color: #334155; }

/* Interactive Status Switch / Pill */
.status-toggle-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  user-select: none;
}

.status-toggle-badge.active {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.status-toggle-badge.active:hover {
  background: #d1fae5;
}

.status-toggle-badge.inactive {
  background: #f1f5f9;
  color: #64748b;
  border-color: #cbd5e1;
}

.status-toggle-badge.inactive:hover {
  background: #e2e8f0;
}

.status-toggle-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-toggle-badge.active .dot { background: #10b981; }
.status-toggle-badge.inactive .dot { background: #94a3b8; }

.service-price-text {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.service-unit-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Floating Admin Toast Notification System */
.admin-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.admin-toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  animation: slideInRight 0.25s ease-out forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.admin-toast.success {
  background: #065f46;
  color: #ecfdf5;
  border: 1px solid #059669;
}

.admin-toast.error {
  background: #991b1b;
  color: #fef2f2;
  border: 1px solid #dc2626;
}

.admin-toast.info {
  background: #1e3a8a;
  color: #eff6ff;
  border: 1px solid #2563eb;
}

.admin-toast.warning {
  background: #92400e;
  color: #fffbeb;
  border: 1px solid #d97706;
}

.admin-toast-retry-btn {
  background: #ffffff;
  color: #0f172a;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
