:root {
  --bg-dark: #0b0f17;
  --card-bg: rgba(18, 26, 41, 0.75);
  --card-border: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(10, 15, 26, 0.6);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  
  --primary-accent: #25d366;
  --primary-hover: #1ebd56;
  --primary-glow: rgba(37, 211, 102, 0.25);
  
  --info-color: #3b82f6;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(37, 211, 102, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
}

/* Container */
.app-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--card-border);
  flex-wrap: wrap;
  gap: 1rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #25d366, #128c7e);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: #fff;
  box-shadow: 0 0 20px var(--primary-glow);
}

.header-brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Connection Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: var(--transition);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-initializing {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}
.status-initializing .status-dot {
  background: #fbbf24;
  box-shadow: 0 0 8px #fbbf24;
  animation: pulse 1.5s infinite;
}

.status-qr {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}
.status-qr .status-dot {
  background: #60a5fa;
  box-shadow: 0 0 8px #60a5fa;
  animation: pulse 1.5s infinite;
}

.status-connected {
  background: rgba(37, 211, 102, 0.12);
  border-color: rgba(37, 211, 102, 0.3);
  color: #4ade80;
}
.status-connected .status-dot {
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
}

.status-disconnected {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}
.status-disconnected .status-dot {
  background: #f87171;
}

@keyframes pulse {
  0% { opacity: 0.4; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0.4; transform: scale(0.95); }
}

/* Dashboard Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.full-width {
  grid-column: 1 / -1;
}

/* Card Styling */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
}

.card-header h2 i {
  color: var(--primary-accent);
}

.card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.padding-0 {
  padding: 0 !important;
}

/* Connection / QR Card */
.qr-container {
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  text-align: center;
  position: relative;
}

.qrcode-wrapper {
  background: #ffffff;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  margin-bottom: 1rem;
}

.qrcode-wrapper img, .qrcode-wrapper canvas {
  display: block;
}

.qr-message {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Spinner */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary-accent);
  animation: spin 1s linear infinite;
  margin-bottom: 0.75rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Device Info */
.device-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(37, 211, 102, 0.05);
  border: 1px solid rgba(37, 211, 102, 0.2);
  padding: 1.25rem;
  border-radius: var(--radius-md);
}

.device-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(37, 211, 102, 0.15);
  color: var(--primary-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.device-details h3 {
  font-size: 1rem;
  font-weight: 600;
}

.phone-number {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 0.4rem;
}

.info-box {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--info-color);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.825rem;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

/* Form Styling */
.quick-templates {
  display: flex;
  gap: 0.4rem;
}

.btn-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-chip:hover {
  background: rgba(255, 255, 255, 0.15);
}

.chip-success { border-color: rgba(16, 185, 129, 0.3); color: #34d399; }
.chip-warning { border-color: rgba(245, 158, 11, 0.3); color: #fbbf24; }
.chip-error { border-color: rgba(239, 68, 68, 0.3); color: #f87171; }

.form-row {
  display: flex;
  gap: 1rem;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.form-group label i {
  color: var(--text-muted);
}

input[type="text"], input[type="number"], select, textarea {
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  height: 46px;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

textarea {
  height: auto;
}

select option {
  background-color: #0f172a;
  color: #f1f5f9;
  padding: 0.5rem;
}

input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.code-font {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-primary {
  background: var(--primary-accent);
  color: #0b0f17;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

/* Alert Notification */
.alert {
  padding: 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* Log Table */
.history-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-input {
  padding: 0.4rem 0.8rem !important;
  font-size: 0.8rem !important;
  width: 200px;
}

.table-responsive {
  overflow-x: auto;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.log-table th {
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--card-border);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.log-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--card-border);
  vertical-align: top;
}

.log-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.empty-state {
  padding: 3rem !important;
  color: var(--text-muted);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-info { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-warn { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-error { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

/* Details snippet in table */
.details-preview {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  max-width: 320px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 90px;
  overflow-y: auto;
}

.hidden {
  display: none !important;
}

/* Groups List Styling */
.groups-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
  border-top: 1px dashed var(--card-border);
  padding-top: 1rem;
}

.groups-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.groups-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.groups-header h3 i {
  color: var(--info-color);
}

.groups-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.group-item {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.group-item:hover {
  border-color: rgba(37, 211, 102, 0.4);
  background: rgba(37, 211, 102, 0.05);
}

.group-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow: hidden;
}

.group-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-id {
  font-family: var(--font-mono);
  font-size: 0.725rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* BGL Trade Form Custom Styles */
.type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  background: var(--input-bg);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

.type-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.type-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.active-buy {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.25), rgba(16, 185, 129, 0.35)) !important;
  border-color: rgba(37, 211, 102, 0.6) !important;
  color: #4ade80 !important;
  box-shadow: 0 0 15px rgba(37, 211, 102, 0.2);
}

.active-sold {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(245, 158, 11, 0.35)) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
  color: #f87171 !important;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;
  animation: inputShake 0.3s ease-in-out;
}

@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-unit input {
  width: 100%;
  padding-right: 3rem !important;
}

.unit-badge {
  position: absolute;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  color: var(--primary-accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  pointer-events: none;
  text-transform: lowercase;
}

.preview-box {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.preview-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.preview-content {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: #34d399;
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.6;
}

/* Footer */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 1rem 0;
  margin-top: auto;
  border-top: 1px solid var(--card-border);
}

/* Header Controls & User Session Bar */
.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-session-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
}

.user-welcome {
  font-size: 0.85rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.user-welcome i {
  color: var(--primary-accent);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  cursor: pointer;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.35);
}

/* Modal Overlay & Card */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 15, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: #0f172a;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  padding: 2rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  animation: modalScale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-icon {
  width: 54px;
  height: 54px;
  background: rgba(37, 211, 102, 0.15);
  border: 1px solid rgba(37, 211, 102, 0.3);
  color: var(--primary-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 0.75rem auto;
}

.gold-icon {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: #fbbf24 !important;
}

.gold-brand {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #000 !important;
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f1f5f9;
}

.modal-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.full-width-btn {
  width: 100%;
  justify-content: center;
  margin-top: 0.75rem;
  padding: 0.85rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Admin Tabs & Stats */
.admin-tabs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 0.75rem;
}

.tab-btn {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--primary-accent);
  color: #0b0f17;
  border-color: var(--primary-accent);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.tab-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.gold-card {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(15, 23, 42, 0.8));
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.icon-buy {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.icon-sold {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.icon-profit {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.stat-info h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #f1f5f9;

}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.text-green { color: #34d399 !important; }
.text-red { color: #f87171 !important; }

/* Progress Bar & High-Contrast Pill in Accounting Table */
.progress-bar-container {
  width: 100%;
  min-width: 140px;
  min-height: 32px;
  height: auto;
  background: rgba(10, 15, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 6px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #25d366, #3b82f6);
  border-radius: 9999px;
  transition: width 0.4s ease;
  opacity: 0.85;
}

.progress-text {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.progress-text-pill {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  height: auto;
  line-height: 1.2;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  background: rgba(11, 15, 23, 0.85);
  border: 1px solid rgba(37, 211, 102, 0.45);
  border-radius: 9999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.progress-text-pill strong {
  color: #4ade80;
  margin: 0;
}

.password-toggle-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.margin-top-15 {
  margin-top: 1.5rem;
}

/* Personal Stock Badge Styling */
.stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}

.stock-positive {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.stock-negative {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #f87171;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
  animation: pulseRed 2s infinite;
}

@keyframes pulseRed {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Responsive Layout & Mobile Ergonomics */
@media (max-width: 767px) {
  .app-container {
    padding: 1rem 0.75rem;
    gap: 1rem;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .header-brand {
    gap: 0.75rem;
  }

  .header-brand h1 {
    font-size: 1.25rem;
  }

  .header-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .user-session-bar {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }

  .dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  /* Completely hide heavy WhatsApp connection card on mobile */
  .connection-card {
    display: none !important;
  }

  /* Force BGL Trade Log form to top order on mobile */
  .form-card {
    order: -1;
    width: 100%;
  }

  .form-row {
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
  }

  .form-group {
    width: 100%;
  }

  /* Touch targets & padding optimized for ultra-fast typing on touchscreens */
  input[type="text"],
  input[type="number"],
  select,
  textarea {
    height: 52px;
    padding: 0.85rem 1rem;
    font-size: 16px !important; /* Prevents auto-zoom on mobile browsers */
    touch-action: manipulation;
    border-radius: var(--radius-md);
  }

  .type-selector {
    width: 100%;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .type-btn {
    min-height: 48px;
    font-size: 0.95rem;
    padding: 0.75rem 0.5rem;
  }

  .form-actions {
    flex-direction: column;
    width: 100%;
    gap: 0.6rem;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 50px;
    font-size: 1rem;
  }

  .preview-box {
    padding: 0.85rem;
  }

  .preview-content {
    font-size: 0.85rem;
  }

  .history-controls {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    width: 100% !important;
  }
}

/* Desktop layout (>= 768px) - Original two-column layout preserved */
@media (min-width: 768px) {
  .dashboard-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1.5rem;
  }

  .connection-card {
    display: flex !important;
  }

  .form-card {
    order: unset;
  }
}

/* Disconnect Reason Box */
.disconnect-reason-box {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: #f87171;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.disconnect-reason-box i {
  font-size: 1.1rem;
  color: #ef4444;
  margin-top: 0.1rem;
}

/* Auth Lock - Prevent background scroll & rendering lag before login */
body.auth-locked {
  overflow: hidden !important;
  height: 100vh !important;
  max-height: 100vh !important;
}

/* Clickable Stock Badge in Admin Summary Table */
.clickable-stock-badge {
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  user-select: none;
}

.clickable-stock-badge:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  filter: brightness(1.15);
}

.clickable-stock-badge:active {
  transform: translateY(0) scale(0.98);
}

/* Clickable Table Header for Trade Type Filter */
.sortable-type-th {
  cursor: pointer !important;
  user-select: none;
  transition: var(--transition);
  white-space: nowrap;
}

.sortable-type-th:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

.sortable-type-th.filter-active-buy {
  color: #34d399 !important;
  background: rgba(16, 185, 129, 0.12) !important;
}

.sortable-type-th.filter-active-sold {
  color: #fbbf24 !important;
  background: rgba(245, 158, 11, 0.12) !important;
}

/* Stock Detail Modal List Items */
.stock-lot-detail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.9rem;
  background: rgba(10, 15, 26, 0.75);
  border: 1px solid var(--card-border);
  border-left: 3px solid #34d399;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-main);
  transition: var(--transition);
}

.stock-lot-detail-item:hover {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
}

