/* ==========================================================================
   GROWUPHOST ADMIN MASTER DESIGN SYSTEM
   Professional Enterprise Cloud & Infrastructure OS Stylesheet
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-muted: #f1f5f9;
  
  /* Primary Action */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;

  /* Sidebar (Dark Navy) */
  --sidebar-bg: #0b1120;
  --sidebar-surface: #131b2e;
  --sidebar-border: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.05);
  --sidebar-active-bg: rgba(37, 99, 235, 0.18);
  --sidebar-active-border: #3b82f6;

  /* Text Colors */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Borders & Lines */
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;

  /* Status Colors */
  --status-emerald-bg: #ecfdf5;
  --status-emerald-text: #059669;
  --status-emerald-border: #a7f3d0;

  --status-amber-bg: #fffbeb;
  --status-amber-text: #d97706;
  --status-amber-border: #fde68a;

  --status-rose-bg: #fff1f2;
  --status-rose-text: #e11d48;
  --status-rose-border: #fecdd3;

  --status-indigo-bg: #eef2ff;
  --status-indigo-text: #4f46e5;
  --status-indigo-border: #c7d2fe;

  --status-cyan-bg: #ecfeff;
  --status-cyan-text: #0891b2;
  --status-cyan-border: #a5f3fc;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-drawer: -4px 0 25px rgba(0, 0, 0, 0.15);

  /* Dimensions */
  --sidebar-width: 270px;
  --topbar-height: 70px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .font-display {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Layout Shell */
.admin-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  border-right: 1px solid var(--sidebar-border);
  transition: transform 0.25s ease-in-out;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #1e293b transparent;
}

.sidebar-brand {
  height: var(--topbar-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
  background: rgba(11, 17, 32, 0.95);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 15px rgba(37, 99, 235, 0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 17px;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.brand-badge {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #38bdf8;
  font-weight: 700;
}

/* Sidebar Nav Groups */
.sidebar-nav {
  padding: 16px 12px 30px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.nav-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
  padding: 0 12px 6px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-item a .nav-link-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item a svg {
  width: 17px;
  height: 17px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

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

.nav-item a:hover svg {
  opacity: 1;
}

.nav-item.active a {
  background-color: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  font-weight: 600;
  border-left: 3px solid var(--sidebar-active-border);
  padding-left: 9px;
}

.nav-item.active a svg {
  opacity: 1;
  color: #60a5fa;
}

.nav-pill {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 9999px;
  font-weight: 700;
}

.nav-pill-info {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.nav-pill-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.nav-pill-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

/* Main Content Wrapper */
.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--bg-app);
}

/* Top Header */
.admin-topbar {
  height: var(--topbar-height);
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

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

.sidebar-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: none;
}

.sidebar-toggle-btn:hover {
  background: var(--bg-card-muted);
  color: var(--text-main);
}

.global-search-container {
  position: relative;
  width: 380px;
}

.global-search-input {
  width: 100%;
  height: 38px;
  background-color: var(--bg-card-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 14px 0 38px;
  font-size: 13px;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.global-search-input:focus {
  outline: none;
  background-color: #ffffff;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.search-icon-inside {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

/* Topbar Right Controls */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.system-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  color: #166534;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.icon-btn {
  background: none;
  border: 1px solid var(--border-color);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-card-muted);
  color: var(--text-main);
}

.notification-badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 9999px;
  border: 2px solid #ffffff;
}

/* Admin Profile */
.topbar-user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--border-color);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1e293b, #3b82f6);
  color: white;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.2;
}

.user-role-badge {
  font-size: 10px;
  color: var(--text-muted);
}

/* Page Content Container */
.page-container {
  padding: 24px 28px 48px;
  max-width: 1600px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.chart-card, .data-card, .kpi-card {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.desktop-only {
  display: inline;
}

@media (max-width: 640px) {
  .desktop-only {
    display: none !important;
  }
}

/* Breadcrumb */
.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.breadcrumb-trail a:hover {
  color: var(--primary-600);
}

.breadcrumb-separator {
  color: var(--text-light);
}

/* Page Header Pattern */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.header-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-600);
}

.page-title {
  font-size: 22px;
  line-height: 1.2;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary-600);
  color: white;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  background-color: var(--primary-700);
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background-color: #ffffff;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--bg-card-muted);
  border-color: #cbd5e1;
}

.btn-danger {
  background-color: #ef4444;
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.kpi-icon-pill {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.kpi-val {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin: 8px 0 4px;
  letter-spacing: -0.01em;
}

.kpi-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
  word-break: break-word;
}

.trend-up {
  color: #16a34a;
  font-weight: 600;
}

.trend-down {
  color: #e11d48;
  font-weight: 600;
}

/* Filter Bar */
.filter-bar-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-left-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  flex-wrap: wrap;
}

.filter-search-box {
  position: relative;
  min-width: 240px;
  flex: 1;
  max-width: 340px;
}

.filter-select {
  height: 36px;
  padding: 0 30px 0 12px;
  background-color: var(--bg-card-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-500);
}

/* Data Table Component */
.data-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table thead {
  background-color: #f8fafc;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.12s ease;
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

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

.data-table td {
  padding: 14px 16px;
  vertical-align: middle;
  color: var(--text-main);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-active, .badge-verified, .badge-paid, .badge-optimal, .badge-online {
  background-color: var(--status-emerald-bg);
  color: var(--status-emerald-text);
  border: 1px solid var(--status-emerald-border);
}

.badge-pending, .badge-under-review, .badge-warning {
  background-color: var(--status-amber-bg);
  color: var(--status-amber-text);
  border: 1px solid var(--status-amber-border);
}

.badge-suspended, .badge-rejected, .badge-critical, .badge-failed, .badge-offline {
  background-color: var(--status-rose-bg);
  color: var(--status-rose-text);
  border: 1px solid var(--status-rose-border);
}

.badge-reseller, .badge-agency, .badge-vip {
  background-color: var(--status-indigo-bg);
  color: var(--status-indigo-text);
  border: 1px solid var(--status-indigo-border);
}

.badge-enterprise {
  background-color: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}

/* Risk Score Pills */
.risk-pill {
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 11px;
  font-family: monospace;
}

.risk-low {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.risk-med {
  background: #fefce8;
  color: #a16207;
  border: 1px solid #fef08a;
}

.risk-high {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

/* Slide-over Drawer */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.slide-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 90vw;
  background: #ffffff;
  z-index: 201;
  box-shadow: var(--shadow-drawer);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.drawer-overlay.open .slide-drawer {
  transform: translateX(0);
}

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

.drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
}

/* Modal Window */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-xl);
  width: 560px;
  max-width: 94vw;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal-dialog {
  transform: scale(1);
}

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

.modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
}

/* Form Elements */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 12px;
  font-size: 13px;
  color: var(--text-main);
  background-color: #ffffff;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* Pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
}

.page-btn.active {
  background-color: var(--primary-600);
  color: white;
  border-color: var(--primary-600);
}

.page-btn:hover:not(.active) {
  background: var(--bg-card-muted);
}

/* Telemetry Grid (Dashboard) */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.chart-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

/* ==========================================================================
   MOBILE & RESPONSIVE DESIGN SYSTEM
   Adaptive Fluid Layouts for Mobile, Tablet, Laptop & Desktop
   ========================================================================== */

/* Backdrop Overlay for Mobile Sidebar */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 17, 32, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 95;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Mobile Close Button in Sidebar */
.sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  transition: all 0.15s ease;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

body.sidebar-locked {
  overflow: hidden;
}

/* Table Responsive Scrolling Improvements */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
  background: #f8fafc;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.data-table {
  min-width: 680px;
}

/* 1. Large Tablet / Small Desktop Breakpoint (1025px - 1200px) */
@media (max-width: 1200px) {
  .global-search-container {
    width: 260px;
  }

  .page-container {
    padding: 20px 22px 40px;
  }
}

/* 2. Tablet & iPad Breakpoint (769px - 1024px) */
@media (max-width: 1024px) {
  .admin-sidebar {
    transform: translateX(-100%);
    width: 280px;
    max-width: 85vw;
    z-index: 120;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.35);
  }

  .admin-sidebar.mobile-open {
    transform: translateX(0);
  }

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

  .admin-main {
    margin-left: 0;
    width: 100%;
  }

  .sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .global-search-container {
    width: 210px;
  }

  .system-status-indicator {
    padding: 4px 8px;
    font-size: 10px;
  }
}

/* 3. Phablet & Mobile Landscape Breakpoint (481px - 768px) */
@media (max-width: 768px) {
  .admin-topbar {
    height: 60px;
    padding: 0 14px;
  }

  .topbar-left {
    gap: 8px;
    flex: 1;
    min-width: 0;
  }

  .global-search-container {
    flex: 1;
    max-width: 220px;
    min-width: 0;
    width: auto;
  }

  .global-search-input {
    height: 34px;
    font-size: 12px;
    padding: 0 10px 0 30px;
  }

  .search-icon-inside {
    left: 9px;
    width: 13px;
    height: 13px;
  }

  .topbar-right {
    gap: 8px;
  }

  .system-status-indicator {
    display: none !important;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 11px;
  }

  .page-container {
    padding: 16px 12px 36px;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }

  .header-title-group {
    align-items: flex-start;
    gap: 10px;
  }

  .header-icon-box {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .page-title {
    font-size: 18px;
  }

  .page-subtitle {
    font-size: 12px;
    line-height: 1.4;
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: stretch;
  }

  .header-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
  }

  .filter-bar-card {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
    border-radius: var(--radius-md);
  }

  .filter-left-controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 8px;
  }

  .filter-search-box {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .filter-select {
    width: 100%;
    height: 38px;
  }

  .filter-bar-card > div:last-child {
    width: 100%;
  }

  .filter-bar-card > div:last-child .btn {
    width: 100%;
    justify-content: center;
  }

  .data-card {
    border-radius: var(--radius-md);
    margin-bottom: 18px;
  }

  .data-table th {
    padding: 10px 12px;
    font-size: 10px;
  }

  .data-table td {
    padding: 12px;
    font-size: 12px;
  }

  .table-pagination {
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px 14px;
  }

  .slide-drawer {
    width: 100% !important;
    max-width: 100vw !important;
  }

  .drawer-header, .drawer-body, .drawer-footer {
    padding: 16px;
  }

  .modal-dialog {
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    margin: 10px;
    border-radius: var(--radius-lg);
  }

  .modal-header, .modal-body, .modal-footer {
    padding: 16px;
  }
}

/* 4. Mobile Devices & Small Screens (<= 640px) */
@media (max-width: 640px) {
  .user-role-badge {
    display: none !important;
  }

  .user-name {
    font-size: 12px;
  }

  /* Automatically collapse 2-column inline form grids to single-column on mobile */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr;"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Horizontal swipeable tabs navigation */
  [style*="border-bottom: 1px solid var(--border-color); margin-bottom: 24px"] {
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    display: flex !important;
    flex-wrap: nowrap !important;
  }

  [style*="border-bottom: 1px solid var(--border-color); margin-bottom: 24px"] button {
    flex-shrink: 0;
  }

  /* Customer profile header actions */
  [style*="justify-content: space-between; flex-wrap: wrap; gap: 20px"] > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  [style*="justify-content: space-between; flex-wrap: wrap; gap: 20px"] > div:last-child .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  /* Stat strip inside customer profile card */
  [style*="grid-template-columns: repeat(auto-fit, minmax(140px, 1fr))"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* Migration lifecycle horizontal scroll */
  [style*="CANONICAL MIGRATION LIFECYCLE"] + div {
    overflow-x: auto !important;
    padding-bottom: 8px;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start !important;
    gap: 12px !important;
  }

  [style*="CANONICAL MIGRATION LIFECYCLE"] + div > div {
    flex-shrink: 0;
  }
}

/* 5. Extra Small Phones (<= 480px) */
@media (max-width: 480px) {
  .global-search-container {
    max-width: 150px;
  }

  .user-meta {
    display: none !important;
  }

  .topbar-user-profile {
    padding-left: 4px;
    border-left: none;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .kpi-card {
    padding: 12px;
    border-radius: var(--radius-md);
  }

  .kpi-val {
    font-size: 16px;
  }

  .kpi-label {
    font-size: 10px;
  }

  .kpi-meta {
    font-size: 10px;
    flex-wrap: wrap;
  }

  .header-actions .btn {
    width: 100%;
  }

  .modal-footer {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }

  .drawer-footer {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .drawer-footer .btn {
    width: 100%;
    justify-content: center;
  }

  .btn {
    font-size: 12px;
  }
}

