/* ===== CSS Variables ===== */
:root {
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-light: rgba(124, 58, 237, 0.15);
  --accent: #06b6d4;
  --bg: #0a0f1e;
  --bg-secondary: #111827;
  --bg-tertiary: #1e293b;
  --glass-bg: rgba(15, 23, 42, 0.6);
  --glass-blur: 16px;
  --glass-border: rgba(255, 255, 255, 0.06);
  --card: rgba(30, 41, 59, 0.6);
  --card-hover: #263548;
  --border: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-heading: #f8fafc;
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.15);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.15);
  --warning: #eab308;
  --warning-bg: rgba(234, 179, 8, 0.15);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.15);
  --orange: #f97316;
  --orange-bg: rgba(249, 115, 22, 0.15);
  --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  --success-gradient: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
  --error-gradient: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
  --warning-gradient: linear-gradient(135deg, #eab308 0%, #f59e0b 100%);
  --info-gradient: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  --orange-gradient: linear-gradient(135deg, #f97316 0%, #eab308 100%);
  --primary-glow: rgba(124, 58, 237, 0.25);
  --border-glow: rgba(124, 58, 237, 0.3);
  --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.15);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
  --sidebar-width: 260px;
  --sidebar-collapsed: 0px;
  --topbar-height: 0px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: 0.2s ease;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
}

/* ===== Keyframes ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  from { background-position: -200% 0; }
  to { background-position: 200% 0; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 8px var(--primary-glow); }
  50% { box-shadow: 0 0 18px var(--primary-glow), 0 0 28px rgba(124, 58, 237, 0.1); }
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, -20px); }
}

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

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

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

@keyframes toastCountdown {
  from { width: 100%; }
  to { width: 0%; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-heading);
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-primary { color: var(--primary); }

/* ===== Layout ===== */
.layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--sp-6);
  min-height: 100vh;
  transition: margin-left var(--transition);
  position: relative;
}

/* Link underline micro-interaction */
.main-content a:not(.btn):not(.badge):not(.sidebar-nav a):not(.tab):not(.pagination button) {
  position: relative;
}

.main-content a:not(.btn):not(.badge):not(.sidebar-nav a):not(.tab):not(.pagination button)::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.25s ease;
}

.main-content a:not(.btn):not(.badge):not(.sidebar-nav a):not(.tab):not(.pagination button):hover::after {
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.page-header h1 {
  font-size: 1.5rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-heading);
}

.sidebar-brand i {
  color: var(--primary);
  font-size: 1.5rem;
}

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

.sidebar-profile .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--glass-bg), 0 0 0 4px var(--primary);
}

.sidebar-profile .user-info {
  overflow: hidden;
}

.sidebar-profile .user-name {
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-profile .user-balance {
  font-size: 0.85rem;
  color: var(--success);
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-nav .nav-section {
  padding: 8px 20px 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-muted);
  transition: all var(--transition);
  font-size: 0.9rem;
  border-radius: var(--radius);
  margin: 2px 12px;
}

.sidebar-nav a:hover:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav a.active {
  color: #fff;
  background: var(--gradient-primary);
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.3);
}

.sidebar-nav a i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--error);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 50px;
  min-width: 18px;
  text-align: center;
}

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

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  padding: 8px 0;
  font-size: 0.9rem;
}

.sidebar-footer a:hover {
  color: var(--error);
}

/* Sidebar toggle button */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1100;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
}

/* ===== Cards ===== */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: box-shadow var(--transition), border-color var(--transition);
  animation: fadeInUp 0.4s ease-out both;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-glow);
}

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

.card-header h3 {
  font-size: 1rem;
}

.card-body {
  /* content area */
}

/* ===== Stat Cards ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0.06;
  border-radius: inherit;
  transition: opacity var(--transition);
  pointer-events: none;
}

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

.stat-card:hover::before {
  opacity: 0.1;
}

.stat-card:nth-child(1) { animation: fadeInUp 0.4s ease-out 0.05s both; }
.stat-card:nth-child(2) { animation: fadeInUp 0.4s ease-out 0.1s both; }
.stat-card:nth-child(3) { animation: fadeInUp 0.4s ease-out 0.15s both; }
.stat-card:nth-child(4) { animation: fadeInUp 0.4s ease-out 0.2s both; }
.stat-card:nth-child(5) { animation: fadeInUp 0.4s ease-out 0.25s both; }
.stat-card:nth-child(6) { animation: fadeInUp 0.4s ease-out 0.3s both; }

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.stat-card .stat-icon.purple { background: var(--gradient-primary); color: #fff; }
.stat-card .stat-icon.green { background: var(--success-gradient); color: #fff; }
.stat-card .stat-icon.blue { background: var(--info-gradient); color: #fff; }
.stat-card .stat-icon.orange { background: var(--orange-gradient); color: #fff; }
.stat-card .stat-icon.red { background: var(--error-gradient); color: #fff; }
.stat-card .stat-icon.yellow { background: var(--warning-gradient); color: #fff; }

.stat-card .stat-info {
  position: relative;
  z-index: 1;
}

.stat-card .stat-info h4 {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .stat-info .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  animation: countUp 0.4s ease-out;
}

/* ===== Tables ===== */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
}

table thead th {
  background: rgba(124, 58, 237, 0.08);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--glass-border);
}

table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
  vertical-align: middle;
}

table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

table tbody tr:hover {
  background: rgba(124, 58, 237, 0.06);
}

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

.table-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
}

.table-empty i {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
}

.form-control:hover:not(:focus) {
  border-color: rgba(124, 58, 237, 0.3);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow), var(--shadow-glow);
  background: rgba(15, 23, 42, 0.8);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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

.form-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

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

.input-group {
  display: flex;
  gap: 0;
}

.input-group .form-control {
  border-radius: var(--radius) 0 0 var(--radius);
}

.input-group .btn {
  border-radius: 0 var(--radius) var(--radius) 0;
  white-space: nowrap;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
  position: relative;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:active:not(:disabled) {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.25);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
  transform: translateY(-1px);
  color: #fff;
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.96);
}

.btn-success {
  background: var(--success-gradient);
  color: #fff;
  box-shadow: 0 2px 12px rgba(34, 197, 94, 0.25);
}

.btn-success:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
  transform: translateY(-1px);
  color: #fff;
}

.btn-danger {
  background: var(--error-gradient);
  color: #fff;
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
  color: #fff;
}

.btn-warning {
  background: var(--warning-gradient);
  color: #000;
  box-shadow: 0 2px 12px rgba(234, 179, 8, 0.25);
}

.btn-info {
  background: var(--info-gradient);
  color: #fff;
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.25);
}

.btn-info:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

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

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-pending {
  background: var(--warning-bg);
  color: var(--warning);
  box-shadow: 0 0 8px rgba(234, 179, 8, 0.15);
}

.badge-processing, .badge-in_progress {
  background: var(--info-bg);
  color: var(--info);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.15);
  animation: pulseGlow 2s infinite;
}

.badge-completed {
  background: var(--success-bg);
  color: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.15);
}

.badge-error, .badge-cancelled, .badge-canceled {
  background: var(--error-bg);
  color: var(--error);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.15);
}

.badge-partial {
  background: var(--orange-bg);
  color: var(--orange);
  box-shadow: 0 0 8px rgba(249, 115, 22, 0.15);
}

.badge-active {
  background: var(--success-bg);
  color: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.15);
}

.badge-inactive, .badge-disabled {
  background: var(--error-bg);
  color: var(--error);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.15);
}

.badge-open {
  background: var(--info-bg);
  color: var(--info);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.15);
}

.badge-closed {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.15);
}

/* ===== Modals ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s ease;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

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

.modal-header h3 {
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--glass-border);
}

/* ===== Toast/Alerts ===== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  min-width: 280px;
  position: relative;
  overflow: hidden;
}

.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: currentColor;
  opacity: 0.3;
  animation: toastCountdown var(--toast-duration, 4s) linear forwards;
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

.toast i {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: 0.9rem;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  font-size: 1rem;
  transition: color var(--transition);
}

.toast-close:hover {
  color: var(--text);
}

.toast.toast-success { border-left: 4px solid var(--success); color: var(--success); }
.toast.toast-success i { color: var(--success); }

.toast.toast-error { border-left: 4px solid var(--error); color: var(--error); }
.toast.toast-error i { color: var(--error); }

.toast.toast-info { border-left: 4px solid var(--info); color: var(--info); }
.toast.toast-info i { color: var(--info); }

.toast.toast-warning { border-left: 4px solid var(--warning); color: var(--warning); }
.toast.toast-warning i { color: var(--warning); }

/* Reset text color in toast message */
.toast .toast-message, .toast .toast-close {
  color: var(--text);
}

/* Alert boxes */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.alert i { margin-top: 2px; flex-shrink: 0; }

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.3); }
.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid rgba(239, 68, 68, 0.3); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(59, 130, 246, 0.3); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(234, 179, 8, 0.3); }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
}

.pagination button, .pagination .page-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
}

.pagination button:hover, .pagination .page-item:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

.pagination button.active, .pagination .page-item.active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== Login / Signup Pages ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.1) 0%, transparent 70%);
  border-radius: 50%;
  animation: float 8s ease-in-out infinite;
  pointer-events: none;
}

.auth-page::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.06) 0%, transparent 70%);
  border-radius: 50%;
  animation: float 8s ease-in-out 2s infinite reverse;
  pointer-events: none;
}

.auth-card {
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.5s ease-out;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo i {
  font-size: 2.5rem;
  color: var(--primary);
}

.auth-logo h1 {
  font-size: 1.5rem;
  margin-top: 8px;
}

.auth-logo p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.auth-card .form-group {
  margin-bottom: 20px;
}

.auth-card .btn-primary {
  margin-top: 8px;
}

.auth-links {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-links a {
  color: var(--primary);
  font-weight: 500;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

/* ===== Quick Actions ===== */
.quick-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* ===== Filters Bar ===== */
.filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.filters-bar .form-control {
  width: auto;
  min-width: 180px;
}

.filters-bar .search-input {
  flex: 1;
  min-width: 200px;
  max-width: 300px;
}

/* ===== Service Details Card ===== */
.service-details {
  background: rgba(10, 15, 30, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}

.service-details .detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.9rem;
}

.service-details .detail-row span:first-child {
  color: var(--text-muted);
}

.service-details .detail-row span:last-child {
  font-weight: 600;
}

/* ===== Charge Display ===== */
.charge-display {
  background: var(--primary-light);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin: 16px 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.charge-display .charge-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.charge-display .charge-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

/* ===== API Docs ===== */
.api-section {
  margin-bottom: 24px;
}

.api-key-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 12px 0;
}

.api-key-box code {
  flex: 1;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--success);
  word-break: break-all;
}

pre, code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

pre {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}

pre.code-block {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
  margin: 8px 0;
}

/* ===== Ticket Messages ===== */
.ticket-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 500px;
  overflow-y: auto;
  padding: 16px;
  margin-bottom: 16px;
}

.ticket-message {
  padding: 12px 16px;
  border-radius: var(--radius);
  max-width: 80%;
}

.ticket-message.user {
  background: var(--primary-light);
  border: 1px solid rgba(124, 58, 237, 0.3);
  align-self: flex-end;
}

.ticket-message.admin {
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  align-self: flex-start;
}

.ticket-message .msg-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ticket-message .msg-body {
  font-size: 0.9rem;
  white-space: pre-wrap;
}

/* ===== Updates List ===== */
.update-item {
  padding: 16px;
  border-bottom: 1px solid var(--glass-border);
}

.update-item:last-child {
  border-bottom: none;
}

.update-item .update-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.update-item .update-title {
  font-weight: 600;
  margin: 4px 0;
}

.update-item .update-body {
  font-size: 0.9rem;
  color: var(--text);
}

/* ===== Chart (CSS Simple Bar) ===== */
.chart-bar {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 200px;
  padding: 12px 0;
}

.chart-bar .bar {
  flex: 1;
  background: var(--gradient-primary);
  border-radius: 4px 4px 0 0;
  min-width: 20px;
  position: relative;
  transition: height 0.5s ease, opacity var(--transition);
}

.chart-bar .bar:hover {
  opacity: 0.85;
}

.chart-bar .bar .bar-label {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.chart-bar .bar .bar-value {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

/* ===== Category Service Table ===== */
.category-block {
  margin-bottom: 24px;
}

.category-block h3 {
  padding: 12px 16px;
  background: rgba(124, 58, 237, 0.08);
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-block table {
  border: 1px solid var(--glass-border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--glass-border);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 20px;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===== Loading Spinner ===== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--glass-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  gap: 10px;
}

/* ===== Glass Utility ===== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

/* ===== Skeleton Loaders ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, rgba(38, 53, 72, 0.8) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-heading {
  height: 24px;
  width: 40%;
  margin-bottom: 12px;
  border-radius: 4px;
}

.skeleton-card {
  height: 80px;
  border-radius: var(--radius-lg);
}

.skeleton-stat {
  height: 100px;
  border-radius: var(--radius-lg);
}

/* ===== Empty States ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
  display: block;
}

.empty-state .empty-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state .empty-desc {
  font-size: 0.9rem;
  max-width: 320px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

/* ===== Utilities ===== */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.p-0 { padding: 0; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.85rem; }
.fw-600 { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.hidden { display: none !important; }
.w-100 { width: 100%; }
.cursor-pointer { cursor: pointer; }
.no-wrap { white-space: nowrap; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-top: 60px;
  }

  .stat-cards {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filters-bar .form-control,
  .filters-bar .search-input {
    width: 100%;
    max-width: none;
    min-width: unset;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-card {
    padding: 24px;
  }

  .auth-page::before {
    width: 300px;
    height: 300px;
  }

  .auth-page::after {
    width: 250px;
    height: 250px;
  }

  .modal {
    max-width: 100%;
    border-radius: var(--radius-lg);
  }

  table {
    font-size: 0.85rem;
  }

  table thead th, table tbody td {
    padding: 8px 10px;
  }

  .ticket-message {
    max-width: 95%;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 13px;
  }

  .auth-card {
    padding: 20px;
  }

  .quick-actions {
    flex-direction: column;
  }

  .btn-group {
    flex-direction: column;
  }

  .stat-card {
    padding: 16px;
  }
}
