:root {
  --bg-main: #090d16;
  --bg-sidebar: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.95);
  --bg-input: #131d31;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #10b981;
  
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-glow: rgba(16, 185, 129, 0.25);
  
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.2);
  
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(56, 189, 248, 0.06) 0px, transparent 50%);
  background-attachment: fixed;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

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

/* ==========================================
   LOGIN OVERLAY SCREEN
   ========================================== */
html.has-auth-token #login-overlay {
  display: none !important;
}

.login-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(9, 13, 22, 0.92);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px var(--primary-glow);
  animation: fadeIn 0.4s ease;
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.login-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

.login-error {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

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

.form-group label i {
  color: var(--primary);
  margin-right: 4px;
}

.login-credentials-hint {
  margin-top: 24px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-subtle);
}

.login-credentials-hint h6 {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.login-credentials-hint p {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-muted);
}

.login-credentials-hint code {
  background: #1e293b;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
  font-family: var(--font-mono);
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #10b981 0%, #065f46 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.brand-info h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
}

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

.nav-menu {
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item i {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  color: #fff;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  font-weight: 600;
}

.nav-item.active i {
  color: var(--primary);
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.wa-status-widget {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-pill.connected {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.disconnected {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-pill.qr_ready {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-pill.connecting {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.account-preview {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-preview strong {
  color: #fff;
  display: block;
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
}

.top-bar {
  height: 72px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.page-title h2 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.page-title p {
  font-size: 13px;
  color: var(--text-muted);
}

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

.user-quota-badge {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-profile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 8px;
  border-left: 1px solid var(--border-color);
}

.avatar-circle {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #38bdf8 0%, #1e40af 100%);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.user-info-text strong {
  display: block;
  font-size: 13px;
  color: #fff;
  line-height: 1.2;
}

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

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

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

/* Grid Layouts */
.studio-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
}

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

/* Glass Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

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

.card-header h3 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header h3 i {
  color: var(--primary);
  font-size: 18px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

/* QR Code Connection Card */
.qr-container {
  display: flex;
  align-items: center;
  gap: 24px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 20px;
}

.qr-box {
  width: 170px;
  height: 170px;
  background: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.qr-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #64748b;
  font-size: 12px;
  gap: 8px;
}

.qr-instructions {
  flex: 1;
}

.qr-instructions h4 {
  font-size: 15px;
  color: #fff;
  margin-bottom: 8px;
}

.qr-instructions ol {
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.connected-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-icon {
  width: 46px;
  height: 46px;
  background: rgba(16, 185, 129, 0.2);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.user-meta h4 {
  font-size: 15px;
  color: #fff;
}

.user-meta p {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-family: var(--font-sans);
}

.btn-primary {
  background: var(--primary);
  color: #064e3b;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn-primary:hover {
  background: #34d399;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.1);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: var(--danger-bg);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-warning {
  background: var(--warning-bg);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

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

.btn-lg {
  padding: 14px 28px;
  font-size: 15px;
  border-radius: var(--radius-md);
}

/* Upload & Contact Section */
.upload-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.4);
  transition: all 0.2s;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.04);
}

.drop-icon {
  font-size: 32px;
  color: var(--primary);
  margin-bottom: 10px;
}

.drop-zone p {
  font-size: 14px;
  color: #fff;
  margin-bottom: 4px;
}

.drop-zone span {
  font-size: 12px;
  color: var(--text-subtle);
}

.textarea-custom {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #fff;
  padding: 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s;
}

.textarea-custom:focus {
  outline: none;
  border-color: var(--primary);
}

.input-custom {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: #fff;
  padding: 10px 14px;
  font-size: 13px;
  transition: border-color 0.2s;
}

.input-custom:focus {
  outline: none;
  border-color: var(--primary);
}

/* Contact List Preview */
.contact-preview-box {
  margin-top: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.5);
  overflow: hidden;
}

.contact-preview-header {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.table-scroll {
  max-height: 220px;
  overflow-y: auto;
}

.table-custom {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.table-custom th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.25);
}

.table-custom td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

/* Variable Insertion Pills */
.variable-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.var-pill {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.var-pill:hover {
  background: rgba(56, 189, 248, 0.25);
}

.spintax-pill {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.25);
}
.spintax-pill:hover {
  background: rgba(168, 85, 247, 0.25);
}

.link-pill {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.link-pill:hover {
  background: rgba(16, 185, 129, 0.25);
}

.input-inline-link {
  padding: 4px 8px !important;
  font-size: 11px !important;
  height: 28px !important;
  min-width: 170px !important;
  background: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}
.input-inline-link:focus {
  border-color: var(--accent) !important;
}

/* Media Attachment Upload */
.media-uploader-box {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.media-preview-thumb {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 20px;
  color: var(--text-muted);
}

.media-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-info {
  flex: 1;
}

.media-info p {
  font-size: 13px;
  color: #fff;
  font-weight: 500;
}

.media-info span {
  font-size: 11px;
  color: var(--text-subtle);
}

/* WhatsApp Phone Mockup */
.phone-mockup-wrapper {
  margin-bottom: 24px;
}

.phone-frame {
  background: #111b21;
  border: 8px solid #2a3942;
  border-radius: 36px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  max-width: 360px;
  margin: 0 auto;
}

.phone-notch {
  height: 20px;
  background: #2a3942;
  display: flex;
  justify-content: center;
  align-items: center;
}

.notch-speaker {
  width: 40px;
  height: 4px;
  background: #111b21;
  border-radius: 4px;
}

.wa-header {
  background: #202c33;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wa-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
}

.wa-title {
  flex: 1;
}

.wa-title h5 {
  color: #e9edef;
  font-size: 14px;
  font-weight: 600;
}

.wa-title span {
  color: #8696a0;
  font-size: 11px;
}

.wa-chat-bg {
  background-color: #0b141a;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 0);
  background-size: 20px 20px;
  padding: 16px 12px;
  min-height: 300px;
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.wa-bubble {
  background: #005c4b;
  color: #e9edef;
  padding: 8px 12px 6px 12px;
  border-radius: 8px 8px 2px 8px;
  max-width: 88%;
  align-self: flex-end;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}

.wa-bubble-media {
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 6px;
  max-height: 160px;
}

.wa-bubble-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wa-time {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px;
}

.wa-time i {
  color: #53bdeb;
  font-size: 12px;
}

/* Progress & Live Logs */
.progress-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(16, 185, 129, 0.3);
}

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

.progress-bar-track {
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #38bdf8 100%);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 6px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.stat-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.stat-box h6 {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stat-box .stat-val {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.stat-box.sent .stat-val { color: var(--success); }
.stat-box.failed .stat-val { color: var(--danger); }
.stat-box.pending .stat-val { color: var(--warning); }
.stat-box.total .stat-val { color: var(--accent); }

/* Live Log Console */
.log-console {
  background: #090e17;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 14px;
}

.log-entry {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  gap: 8px;
}

.log-time {
  color: var(--text-subtle);
  font-size: 11px;
}

.log-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.log-tag.SUCCESS { background: var(--success-bg); color: var(--success); }
.log-tag.FAILED { background: var(--danger-bg); color: var(--danger); }
.log-tag.INFO { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }

/* ==========================================
   ADMIN PANEL STYLES
   ========================================== */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

@media (max-width: 1024px) {
  .admin-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-data .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
}

.stat-data h3 {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* ==========================================
   MODAL DIALOGS
   ========================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-dialog {
  width: 100%;
  max-width: 480px;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.25s ease;
}

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

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}
.btn-close-modal:hover { color: #fff; }

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999999;
}

.toast {
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.25s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--accent); }

/* ==========================================
   TEMPLATES VIEW STYLES
   ========================================== */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.template-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s ease;
  position: relative;
}

.template-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.template-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.template-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.template-card-title i {
  color: var(--primary);
  font-size: 14px;
}

.template-preview-text {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 140px;
  overflow-y: auto;
  margin-bottom: 16px;
  flex: 1;
}

.template-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 14px;
}

.template-category-filters {
  display: flex;
  gap: 6px;
  background: rgba(15, 23, 42, 0.5);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.template-cat-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.template-cat-badge.Promo { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.template-cat-badge.Follow-up { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.template-cat-badge.Pengingat { background: var(--warning-bg); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.template-cat-badge.Ucapan { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.template-cat-badge.Informasi { background: rgba(255, 255, 255, 0.1); color: var(--text-main); border: 1px solid rgba(255, 255, 255, 0.2); }

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

/* ==================== Topup & QRIS Styles ==================== */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.25s ease;
}

.pricing-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.pricing-card.popular {
  border-color: #f59e0b;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-card) 100%);
}

.pricing-badge-popular {
  position: absolute;
  top: -10px;
  right: 14px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pricing-card-header {
  margin-bottom: 12px;
}

.pricing-pkg-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.pricing-pkg-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  min-height: 32px;
}

.pricing-quota-val {
  font-size: 26px;
  font-weight: 800;
  color: #10b981;
  font-family: var(--font-mono);
  margin: 10px 0;
}

.pricing-quota-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.pricing-price-val {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-mono);
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

/* Modal Segmented Tabs */
.modal-segmented-tabs {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.7);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  gap: 6px;
  margin-bottom: 20px;
}

.segmented-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.segmented-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.segmented-tab-btn.active {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #fff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

/* Table Card Container & Modern Rows */
.table-container-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
}

.topup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.topup-table th {
  padding: 13px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-subtle);
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.topup-table td {
  padding: 13px 16px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.topup-table tbody tr {
  transition: background 0.15s ease;
}

.topup-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

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

/* Chips & Formats */
.invoice-code-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  display: inline-block;
  letter-spacing: 0.3px;
}

.table-pkg-name {
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
}

.quota-highlight {
  color: #10b981;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.price-highlight {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #f8fafc;
  font-size: 13px;
  white-space: nowrap;
}

.table-date-text {
  font-size: 11.5px;
  color: var(--text-subtle);
  white-space: nowrap;
}

.proof-empty-text {
  font-size: 11.5px;
  color: var(--text-subtle);
  font-style: italic;
  white-space: nowrap;
}

/* Badges */
.invoice-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.invoice-badge.pending {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.invoice-badge.approved {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.invoice-badge.rejected {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* ==========================================
 * Modern Category Pills & Tab Switchers
 * ========================================== */
/* ==========================================
 * Anti-Ban Preset Modes Grid & Cards
 * ========================================== */
.preset-modes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.btn-preset-mode {
  appearance: none;
  background: rgba(15, 23, 42, 0.75) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
  padding: 14px 16px !important;
  cursor: pointer;
  text-align: left !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  gap: 8px;
  min-height: 95px;
  position: relative;
  font-family: var(--font-sans) !important;
  width: 100%;
  box-sizing: border-box;
}

.btn-preset-mode:hover {
  background: rgba(30, 41, 59, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  transform: translateY(-2px);
}

.btn-preset-mode.active,
.btn-preset-mode.active-preset {
  background: rgba(56, 189, 248, 0.1) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.15) !important;
}

.preset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.preset-title {
  font-size: 13.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.preset-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.preset-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.template-categories {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.8);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.category-pill {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.category-pill:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.05);
}

.category-pill.active {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
  font-weight: 600;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

/* Form Controls and Inputs */
.form-control {
  width: 100%;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #f8fafc;
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
  background: #0b1329;
}

.form-control::placeholder {
  color: #64748b;
}

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

/* API Playground Code Boxes */
#api-test-response, #api-code-snippet, #thirdparty-guide-content pre {
  scrollbar-width: thin;
  scrollbar-color: #334155 #090d16;
}

#api-test-response::-webkit-scrollbar, #api-code-snippet::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

#api-test-response::-webkit-scrollbar-thumb, #api-code-snippet::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

#btn-execute-api-test {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25) !important;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
}

#btn-execute-api-test:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4) !important;
  filter: brightness(1.08);
}

@media (max-width: 768px) {
  .template-categories {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .qris-payment-layout {
    grid-template-columns: 1fr !important;
  }
}


