/* ===== PLATFORM ADMIN - TEAL THEME ===== */
:root {
  --primary: #0F766E;
  --primary-light: #14B8A6;
  --primary-dark: #0D5F59;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --orange: #F97316;
  --dark: #0F172A;
  --gray-900: #1E293B;
  --gray-800: #334155;
  --gray-700: #475569;
  --gray-600: #64748B;
  --gray-500: #94A3B8;
  --gray-400: #CBD5E1;
  --gray-300: #E2E8F0;
  --gray-200: #F1F5F9;
  --gray-100: #F8FAFC;
  --white: #FFFFFF;
  --sidebar-w: 256px;
  --topbar-h: 56px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
  --transition: all 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--dark);
  background: var(--gray-100);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--gray-900);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform 0.3s ease;
}
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
}
.sidebar-logo svg { color: var(--primary-light); flex-shrink: 0; }
.sidebar-logo .accent { color: var(--primary-light); }

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-label {
  padding: 16px 20px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.nav-item:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.05);
}
.nav-item.active {
  color: #fff;
  background: rgba(15,118,110,0.25);
  border-left-color: var(--primary-light);
}
.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 8px 0;
}

/* ===== TOPBAR ===== */
.topbar {
  display: flex;
  position: fixed;
  top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-300);
  padding: 0 28px;
  align-items: center;
  justify-content: space-between;
  z-index: 150;
}
.menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--dark);
  padding: 4px;
}
.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-date {
  font-size: 0.78rem;
  color: var(--gray-500);
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px 5px 5px;
  background: var(--gray-200);
  border-radius: 50px;
}
.topbar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}
.topbar-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-800);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 190;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 28px;
  padding-top: calc(var(--topbar-h) + 28px);
}

/* ===== SECTIONS ===== */
.section { display: none; }
.section.active { display: block; }
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark);
}
.section-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== KPI CARDS ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-card {
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s ease;
  border: none;
  color: #fff;
}
.kpi-card:hover { transform: translateY(-3px); }
.kpi-teal { background: linear-gradient(135deg, #0F766E, #14B8A6); box-shadow: 0 8px 24px rgba(15,118,110,0.3); }
.kpi-green { background: linear-gradient(135deg, #059669, #10B981); box-shadow: 0 8px 24px rgba(16,185,129,0.3); }
.kpi-orange { background: linear-gradient(135deg, #EA580C, #F97316); box-shadow: 0 8px 24px rgba(249,115,22,0.3); }
.kpi-blue { background: linear-gradient(135deg, #2563EB, #3B82F6); box-shadow: 0 8px 24px rgba(59,130,246,0.3); }
.kpi-teal:hover { box-shadow: 0 12px 32px rgba(15,118,110,0.4); }
.kpi-green:hover { box-shadow: 0 12px 32px rgba(16,185,129,0.4); }
.kpi-orange:hover { box-shadow: 0 12px 32px rgba(249,115,22,0.4); }
.kpi-blue:hover { box-shadow: 0 12px 32px rgba(59,130,246,0.4); }

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.kpi-content { display: flex; flex-direction: column; min-width: 0; }
.kpi-label {
  font-size: 0.76rem;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  margin-bottom: 4px;
}
.kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.kpi-sub {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
  margin-top: 2px;
}

/* ===== STATS ROW ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-mini {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stat-mini-label {
  font-size: 0.78rem;
  color: var(--gray-600);
  font-weight: 500;
}
.stat-mini-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dark);
}

/* ===== OVERVIEW GRID ===== */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
}
.card-header h3 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--dark);
}
.card-link {
  font-size: 0.78rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.card-link:hover { text-decoration: underline; }

/* ===== TABLES ===== */
.table-container { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
thead { background: var(--gray-100); }
th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  font-size: 0.84rem;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
  color: var(--gray-700);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-100); }
td strong { color: var(--dark); font-weight: 600; }
td code {
  font-size: 0.78rem;
  background: var(--gray-200);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Consolas, monospace;
}
td small { color: var(--gray-500); }

.table-compact { box-shadow: none; border-radius: 0; }
.table-compact th { padding: 8px 16px; font-size: 0.7rem; }
.table-compact td { padding: 8px 16px; font-size: 0.82rem; }

/* ===== SEARCH BOX ===== */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: var(--transition);
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,0.1); }
.search-box svg { color: var(--gray-400); flex-shrink: 0; }
.search-box input {
  border: none;
  outline: none;
  padding: 9px 0;
  font-size: 0.84rem;
  font-family: inherit;
  background: transparent;
  min-width: 180px;
  color: var(--dark);
}
.search-box input::placeholder { color: var(--gray-400); }

.section-tools select {
  padding: 9px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-family: inherit;
  color: var(--gray-700);
  background: var(--white);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.section-tools select:focus { border-color: var(--primary); }

/* ===== TAB BAR ===== */
.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 16px;
  width: fit-content;
}
.tab-btn {
  padding: 8px 20px;
  border: none;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--gray-600);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--dark); }
.tab-btn.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.revenue-tab { display: none; }
.revenue-tab.active { display: block; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 20px;
  padding: 12px 0;
}
.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--gray-300);
  background: var(--white);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--gray-700);
  cursor: pointer;
  transition: var(--transition);
}
.pagination button:hover { background: var(--gray-100); border-color: var(--gray-400); }
.pagination button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-info {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin: 0 8px;
}

/* ===== CLIENTS LIST ===== */
.clients-list {
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.client-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  min-width: 200px;
}
.client-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.client-info { display: flex; flex-direction: column; min-width: 0; }
.client-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.client-date {
  font-size: 0.72rem;
  color: var(--gray-500);
}

/* ===== PLANS GRID ===== */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.plan-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
  border-top: 3px solid var(--primary);
  transition: var(--transition);
}
.plan-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.plan-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 8px;
}
.plan-price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}
.plan-period {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-bottom: 16px;
}
.plan-details {
  font-size: 0.85rem;
  color: var(--gray-600);
  line-height: 1.8;
}
.plan-details strong { color: var(--dark); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.84rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; }

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-active { background: rgba(16,185,129,0.1); color: #059669; }
.status-suspended { background: rgba(239,68,68,0.1); color: #DC2626; }
.status-pending { background: rgba(245,158,11,0.12); color: #D97706; }
.status-paid { background: rgba(16,185,129,0.1); color: #059669; }
.status-processing { background: rgba(59,130,246,0.1); color: #2563EB; }
.status-shipped { background: rgba(139,92,246,0.1); color: #7C3AED; }
.status-delivered { background: rgba(16,185,129,0.1); color: #059669; }
.status-cancelled { background: rgba(239,68,68,0.1); color: #DC2626; }
.status-unpaid { background: rgba(239,68,68,0.1); color: #DC2626; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
}
.modal-overlay.active { display: block; }
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--white);
  border-radius: var(--radius);
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 310;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
}
.modal-close {
  background: var(--gray-200);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  transition: var(--transition);
}
.modal-close:hover { background: var(--gray-300); }

.form-group { padding: 0 24px; margin-bottom: 14px; }
.form-group:first-child { margin-top: 20px; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.78rem;
  margin-bottom: 6px;
  color: var(--gray-700);
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  color: var(--dark);
}
.form-group input:focus,
.form-group select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,0.08); }

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

/* ===== EMPTY STATE ===== */
.empty-row td {
  text-align: center;
  padding: 32px 14px;
  color: var(--gray-500);
  font-size: 0.85rem;
}
.empty-row td:hover { background: transparent; }

/* ===== ACTION BUTTONS ===== */
.action-buttons { display: flex; gap: 4px; flex-wrap: nowrap; }
.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

/* ===== PLAN BADGES ===== */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 12px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.plan-gratuit { background: rgba(148,163,184,0.15); color: #64748B; }
.plan-site { background: rgba(59,130,246,0.12); color: #2563EB; }
.plan-pwa { background: rgba(139,92,246,0.12); color: #7C3AED; }
.plan-native { background: rgba(234,179,8,0.12); color: #B45309; }
.plan-owner { background: rgba(15,118,110,0.12); color: #0F766E; }

/* ===== CLIENT ROW AVATAR ===== */
.client-row-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.client-row-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.client-row-info { display: flex; flex-direction: column; }
.client-row-info strong { font-size: 0.84rem; }
.client-row-info small { color: var(--gray-500); font-size: 0.75rem; }

/* ===== SUSPENDED ROW ===== */
tr.row-suspended td { background: rgba(239,68,68,0.03); }
tr.row-suspended td:first-child { border-left: 3px solid var(--danger); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 500;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

/* ===== TEXTAREA ===== */
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  color: var(--dark);
  min-height: 140px;
  resize: vertical;
  line-height: 1.6;
}
.form-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,0.08); }

/* ===== CONFIRM MODAL ===== */
.modal-confirm { max-width: 420px; }
.modal-email { max-width: 560px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .topbar { left: 0; padding: 0 16px; }
  .menu-btn { display: block; }
  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-top: calc(var(--topbar-h) + 16px);
  }
  .topbar-user-name { display: none; }
}

@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .section-tools { width: 100%; }
  .search-box { width: 100%; }
  .search-box input { min-width: 0; flex: 1; }
  .section-tools select { flex: 1; min-width: 0; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .main-content { padding: 10px; padding-top: calc(var(--topbar-h) + 10px); }
  .clients-list { flex-direction: column; }
  .client-item { min-width: 0; }
}
