/* ============================================================
   BULK SMS PRO — Global Design System
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");

/* ─── CSS Custom Properties ──────────────────────────────── */
:root {
  /* Brand Colors - Stable across themes */
  --primary: #00c896;
  --primary-dark: #00a87e;
  --primary-light: #e6faf5;
  --accent: #1de9b6;
  --danger: #ff4d6d;
  --warning: #ffa726;
  --info: #29b6f6;
  --success: #00c896;

  /* Theme-Dependent Variables (Light Mode Default) */
  --bg-body: #f0f4f8;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fbff;
  --bg-muted: #f5f7fa;
  --bg-dark: #0b1524;
  
  --text-primary: #1a2340;
  --text-secondary: #6b7a99;
  --text-muted: #9baabf;
  --text-on-primary: #ffffff;
  
  --border: #e2e8f0;
  --border-muted: #f1f5f9;
  
  --sidebar-bg: #0e1726;
  --sidebar-hover: #1a2740;
  --sidebar-active: rgba(0, 200, 150, 0.15);
  --sidebar-border: rgba(255, 255, 255, 0.06);

  /* Shared Properties */
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.07);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.14s ease;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ─── Dark Mode Overrides ─────────────────────────────────── */
html.dark-mode body {
  --bg-body: #0b121f;
  --bg-card: #141d2e;
  --bg-card-hover: #1b273d;
  --bg-muted: #1c273c;
  
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border: #232d42;
  --border-muted: #1e293b;
  
  --sidebar-bg: #0b121f;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
  --primary-light: rgba(0, 200, 150, 0.1);
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}
a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  display: block;
}

ul,
ol {
  list-style: none;
}

/* ─── Layout ─────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

.main-content.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed);
}

.page-content {
  flex: 1;
  padding: 28px 30px;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width 0.3s ease;
  overflow: hidden;
}

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

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: 72px;
}

.sidebar-brand .logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
}

.sidebar-brand .logo-text {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--transition);
}
.sidebar-brand .logo-sub {
  font-size: 10px;
  font-weight: 400;
  color: var(--primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #0097a7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-user .user-info {
  overflow: hidden;
}
.sidebar-user .user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .user-role {
  font-size: 10px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.sidebar-units {
  margin: 12px 16px;
  background: rgba(0, 200, 150, 0.12);
  border: 1px solid rgba(0, 200, 150, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: var(--transition);
}
.sidebar-units:hover {
  background: rgba(0, 200, 150, 0.2);
}
.sidebar-units .units-icon {
  font-size: 18px;
}
.sidebar-units .units-label {
  font-size: 10px;
  color: var(--text-muted);
}
.sidebar-units .units-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.nav-section-title {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
  padding: 16px 22px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  transition: var(--transition);
  white-space: nowrap;
  cursor: pointer;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.nav-link:hover {
  color: #fff;
  background: var(--sidebar-hover);
  border-left-color: rgba(0, 200, 150, 0.4);
}

.nav-link.active {
  color: var(--primary);
  background: var(--sidebar-active);
  border-left-color: var(--primary);
  font-weight: 600;
}

.nav-link .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 17px;
}

.nav-link .nav-text {
  flex: 1;
}
.nav-link .nav-badge {
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.nav-link .nav-arrow {
  font-size: 11px;
  transition: transform 0.2s ease;
  color: rgba(255, 255, 255, 0.3);
}
.nav-link[aria-expanded="true"] .nav-arrow {
  transform: rotate(90deg);
}

.nav-sub {
  background: rgba(0, 0, 0, 0.2);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}
.nav-sub.open {
  max-height: 400px;
}
.nav-sub .nav-link {
  padding-left: 52px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}
.nav-sub .nav-link:hover {
  color: rgba(255, 255, 255, 0.85);
}
.nav-sub .nav-link.active {
  color: var(--primary);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-toggle {
  position: absolute;
  top: 50%;
  right: -14px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 200, 150, 0.4);
  z-index: 10;
  transition: var(--transition);
}
.sidebar-toggle:hover {
  background: var(--primary-dark);
  transform: translateY(-50%) scale(1.1);
}

/* ─── Top Bar ────────────────────────────────────────────── */
.topbar {
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar .page-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar .breadcrumb {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar .breadcrumb span {
  color: var(--text-muted);
}

.topbar-search {
  position: relative;
  max-width: 280px;
  width: 100%;
}
.topbar-search input {
  width: 100%;
  padding: 8px 14px 8px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-size: 13px;
  background: var(--bg-muted);
  color: var(--text-primary);
  transition: var(--transition);
}
.topbar-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 200, 150, 0.1);
}
.topbar-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 17px;
  transition: var(--transition);
  position: relative;
}
.icon-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
.icon-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--danger);
  color: #fff;
  border-radius: 50%;
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
}

.topbar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #0097a7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}
.topbar-avatar:hover {
  border-color: var(--primary);
}

.dropdown {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: var(--transition-fast);
}
.dropdown.open .dropdown-menu {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.dropdown-item:hover {
  background: var(--bg-muted);
  color: var(--primary);
}
.dropdown-item.danger:hover {
  background: #fff1f3;
  color: var(--danger);
}
.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

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

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(135deg, rgba(0, 200, 150, 0.04), transparent);
  transition: var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-card:hover::before {
  opacity: 1;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.green {
  background: rgba(0, 200, 150, 0.12);
  color: var(--primary);
}
.stat-icon.blue {
  background: rgba(41, 182, 246, 0.12);
  color: var(--info);
}
.stat-icon.orange {
  background: rgba(255, 167, 38, 0.12);
  color: var(--warning);
}
.stat-icon.red {
  background: rgba(255, 77, 109, 0.12);
  color: var(--danger);
}
.stat-icon.purple {
  background: rgba(156, 39, 176, 0.12);
  color: #9c27b0;
}

.stat-info {
  flex: 1;
  min-width: 0;
}
.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.stat-trend {
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-trend.up {
  color: var(--success);
}
.stat-trend.down {
  color: var(--danger);
}

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

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

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px 22px;
}
.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg-muted);
  font-size: 12px;
  color: var(--text-secondary);
}

/* ─── Data Table ─────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tbody tr:hover td {
  background: var(--bg-muted);
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ─── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.badge-success {
  background: rgba(0, 200, 150, 0.12);
  color: var(--success);
}
.badge-danger {
  background: rgba(255, 77, 109, 0.12);
  color: var(--danger);
}
.badge-warning {
  background: rgba(255, 167, 38, 0.12);
  color: var(--warning);
}
.badge-info {
  background: rgba(41, 182, 246, 0.12);
  color: var(--info);
}
.badge-muted {
  background: rgba(107, 122, 153, 0.12);
  color: var(--text-secondary);
}
.badge-purple {
  background: rgba(156, 39, 176, 0.12);
  color: #9c27b0;
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 20px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ─── Alerts ─────────────────────────────────────────────── */
.alert {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideDown 0.3s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.alert-danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}
.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}
.btn:focus {
  outline: 3px solid rgba(0, 200, 150, 0.3);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 200, 150, 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 200, 150, 0.45);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-muted);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: #e8ecf2;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #e03155;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary-light);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}
.btn-lg {
  padding: 13px 28px;
  font-size: 15px;
}
.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}
.btn-full {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Forms ──────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.form-label .required {
  color: var(--danger);
  margin-left: 3px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: var(--transition);
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 200, 150, 0.12);
}
.form-control.error {
  border-color: var(--danger);
}
.form-control::placeholder {
  color: var(--text-muted);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  font-weight: 500;
}

.input-group {
  position: relative;
  display: flex;
  align-items: stretch;
}
.input-group .form-control {
  flex: 1;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.input-group .input-group-text {
  padding: 10px 14px;
  background: var(--bg-muted);
  border: 1.5px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
}
.input-group .input-addon-left {
  border-right: none;
  border-left: 1.5px solid var(--border);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.input-group .form-control.with-left {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

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

/* ─── Modal ──────────────────────────────────────────────── */
/* ─── Modal & Overlay ─────────────────────────────────────── */
.modal-overlay {
  position: fixed !important;
  inset: 0 !important; /* Replaces top, left, right, bottom */
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(10, 15, 28, 0.75) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  backdrop-filter: blur(12px) !important;
  z-index: 9999 !important;
  display: none;
  justify-content: center !important;
  align-items: center !important;
  padding: 20px !important;
  overflow-y: auto !important;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  display: flex !important;
  opacity: 1 !important;
}

.modal {
  margin: auto !important; /* The secret weapon for perfect centering in Flex/Grid */
  background: var(--bg-card) !important;
  border-radius: var(--radius-xl) !important;
  width: 95% !important;
  max-width: 520px !important;
  max-height: 85vh !important; /* Force a max height for height-centering */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
  border: 1px solid var(--border) !important;
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}


.modal-md {
  max-width: 600px;
}

/* Ensure body is the one scrolling if modal is too tall */
.modal-body {
  padding: 22px 26px;
  overflow-y: auto !important;
  flex: 1 !important;
}

.modal-header, .modal-footer {
  flex-shrink: 0;
}


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

/* Handle forms inside modals */
.modal form {
  display: block; /* Change from flex to allow natural growth */
  width: 100%;
}

.modal-header {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 17px;
  font-weight: 700;
}
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}
.modal-close:hover {
  background: #ffe0e6;
  color: var(--danger);
}
.modal-body {
  padding: 22px 26px;
}
.modal-footer {
  padding: 16px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── Welcome Banner ─────────────────────────────────────── */
.welcome-banner {
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #0e1726 0%, #0d3d35 50%, #063a30 100%);
  padding: 40px 48px;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 28px;
}
.welcome-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/assets/images/banner-bg.svg") right center / auto 100%
    no-repeat;
  opacity: 0.08;
}
.welcome-banner .banner-content {
  position: relative;
  z-index: 1;
  max-width: 60%;
}
.welcome-banner h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
}
.welcome-banner p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 20px;
}
.welcome-banner .banner-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.banner-img {
  position: absolute;
  right: 0;
  bottom: 0;
  top: 0;
  width: 45%;
  object-fit: cover;
  object-position: left center;
  opacity: 0.7;
}

.banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.banner-btn.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 200, 150, 0.4);
}
.banner-btn.primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}
.banner-btn.outline {
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.banner-btn.outline:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ─── Page Header ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
}
.page-header h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}
.page-header .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ─── SMS Composer ───────────────────────────────────────── */
.sms-composer {
  position: relative;
}
.sms-composer textarea {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  padding-bottom: 36px;
}
.sms-counter {
  position: absolute;
  bottom: 12px;
  right: 14px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── Charts ─────────────────────────────────────────────── */
.chart-container {
  position: relative;
  padding: 0 4px;
}

/* ─── Tabs ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}
.tab-btn {
  padding: 8px 18px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}
.tab-btn:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}
.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(0, 200, 150, 0.3);
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* ─── Alerts / Flash Messages ────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-success {
  background: rgba(0, 200, 150, 0.1);
  color: #00704f;
  border: 1px solid rgba(0, 200, 150, 0.3);
}
.alert-error {
  background: rgba(255, 77, 109, 0.1);
  color: #b31735;
  border: 1px solid rgba(255, 77, 109, 0.3);
}
.alert-warning {
  background: rgba(255, 167, 38, 0.1);
  color: #b27200;
  border: 1px solid rgba(255, 167, 38, 0.3);
}
.alert-info {
  background: rgba(41, 182, 246, 0.1);
  color: #0277bd;
  border: 1px solid rgba(41, 182, 246, 0.3);
}

/* ─── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  padding: 16px 0;
}
.page-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.page-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state h3 {
  font-size: 17px;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ─── Login Page ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--bg-dark);
}
.login-left {
  flex: 1;
  background: linear-gradient(145deg, #0a1628 0%, #063a30 60%, #0e1726 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}
.login-left::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 30% 70%,
    rgba(0, 200, 150, 0.15) 0%,
    transparent 60%
  );
}
.login-right {
  width: 460px;
  flex-shrink: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}
.login-box {
  width: 100%;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}
.login-logo .logo-icon {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  font-weight: 800;
}
.login-logo .logo-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}
.login-logo .logo-tag {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.login-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.login-features {
  position: relative;
  z-index: 1;
  color: #fff;
}
.login-features h2 {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 12px;
}
.login-features p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 32px;
}
.feature-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}
.feature-item .fi {
  font-size: 18px;
}

/* ─── Upload Zone ────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-muted);
}
.upload-zone:hover,
.upload-zone.dragging {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-icon {
  font-size: 36px;
  margin-bottom: 8px;
  opacity: 0.5;
}
.upload-zone p {
  font-size: 13.5px;
  color: var(--text-secondary);
}
.upload-zone strong {
  color: var(--primary);
}

/* ─── Progress Bar ───────────────────────────────────────── */
.progress {
  height: 8px;
  background: var(--bg-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

/* ─── Utilities ──────────────────────────────────────────── */
.d-flex {
  display: flex;
}
.d-grid {
  display: grid;
}
.align-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-8 {
  gap: 8px;
}
.gap-12 {
  gap: 12px;
}
.gap-16 {
  gap: 16px;
}
.gap-20 {
  gap: 20px;
}
.mb-0 {
  margin-bottom: 0;
}
.mb-8 {
  margin-bottom: 8px;
}
.mb-16 {
  margin-bottom: 16px;
}
.mb-24 {
  margin-bottom: 24px;
}
.mt-20 {
  margin-top: 20px;
}
.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}
.text-muted {
  color: var(--text-secondary);
  font-size: 13px;
}
.text-sm {
  font-size: 12px;
}
.fw-700 {
  font-weight: 700;
}
.fw-600 {
  font-weight: 600;
}
.text-primary-color {
  color: var(--primary);
}
.text-danger {
  color: var(--danger);
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .login-left {
    display: none;
  }
  .login-right {
    width: 100%;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0 !important;
  }
  .page-content {
    padding: 20px 16px;
  }
  .welcome-banner {
    padding: 28px 24px;
  }
  .welcome-banner .banner-content {
    max-width: 100%;
  }
  .banner-img {
    display: none;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .topbar {
    padding: 0 16px;
  }
  .topbar-search {
    display: none;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ─── Animations ─────────────────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-in {
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Fix for fixed positioning when modals are open */
body.modal-open .page-content {
  transform: none !important;
  animation: none !important;
}

/* ─── Page Loader Bar ────────────────────────────────────── */
#page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  z-index: 9999;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(0, 200, 150, 0.5);
  display: none;
}
#page-loader.loading {
  display: block;
  animation: loaderProgress 2s ease-out forwards;
}
@keyframes loaderProgress {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 90%; }
}

/* ─── View Transitions API ───────────────────────────────── */
@supports (view-transition-name: sidebar) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.4s;
  }

  .sidebar {
    view-transition-name: sidebar;
  }
  .topbar {
    view-transition-name: topbar;
  }
  .page-content {
    view-transition-name: page-content;
  }
}

/* ─── Banner Carousel ─────────────────────────────────────── */
.banner-carousel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  background: #0a1f2c;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  height: 180px; /* Increased height for better proportions */
}
.banner-container {
  display: flex;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  height: 100%;
}
.banner-slide {
  min-width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 0 0 45px; /* Removed right padding to allow image to bleed to edge */
  gap: 0; /* Gap handled by margin-left on image */
  position: relative;
  background: linear-gradient(135deg, #0a1f2c 0%, #063a30 100%);
  color: #fff;
  overflow: hidden;
}
.banner-slide::before {
  content: '';
  position: absolute;
  left: 0; top: 0; width: 6px; height: 100%;
  background: var(--primary);
  box-shadow: 0 0 15px var(--primary);
}
.banner-slide.info::before { background: #3b82f6; }
.banner-slide.success::before { background: #10b981; }
.banner-slide.warning::before { background: #f59e0b; }
.banner-slide.danger::before { background: #ef4444; }

.banner-icon {
  font-size: 38px;
  opacity: 0.8;
}
.banner-text {
  flex: 1;
}
.banner-title {
  font-weight: 800;
  font-size: 22px;
  margin-bottom: 6px;
  color: #ffffff;
  letter-spacing: -0.01em;
}
.banner-msg {
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
  max-width: 600px;
}

.banner-actions {
  display: flex;
  gap: 12px;
  margin-top: 15px;
}
.banner-action-link {
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.25s ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.banner-action-link:hover {
  background: var(--primary);
  color: #000;
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 5px 15px rgba(0, 200, 150, 0.3);
}

.banner-img {
  height: 180px !important; /* Exactly match banner-carousel height */
  width: 40% !important;   /* Take up a proportional 'half' of the banner */
  flex-shrink: 0;
  box-shadow: -10px 0 30px rgba(0,0,0,0.3);
  border-left: 1px solid rgba(255,255,255,0.1);
  object-fit: cover;
  margin-left: 30px;
}

.banner-nav {
  position: absolute;
  right: 15px;
  bottom: 12px;
  display: flex;
  gap: 8px;
}
.banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
}
.banner-dot.active {
  background: var(--primary);
  width: 20px;
  border-radius: 4px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(0, 200, 150, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}


/* Fix for legacy/inline display styles */
.modal-overlay.open,
.modal-overlay[style*="display: flex"],
.modal-overlay[style*="display:flex"] {
  display: flex !important;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
