:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --bg-app: #090d16;
  --bg-card: rgba(17, 24, 39, 0.92);
  --bg-card-hover: rgba(26, 36, 56, 0.96);
  --bg-input: #111827;
  --bg-pill: rgba(255, 255, 255, 0.05);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.14);
  --border-focus: #0068ff;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --zalo-blue: #0068ff;
  --zalo-blue-hover: #0056d6;
  --zalo-glow: rgba(0, 104, 255, 0.28);

  --accent-cyan: #06b6d4;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.35);

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.35);

  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.35);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border-subtle);
  --shadow-glow: 0 0 24px var(--zalo-glow);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 70px;
}

/* Background Atmosphere Glow */
.background-glow {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 520px;
  background: radial-gradient(circle at 15% 0%, rgba(0, 104, 255, 0.22) 0%, transparent 55%),
              radial-gradient(circle at 85% 15%, rgba(6, 182, 212, 0.15) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ------------------- HEADER & NAVIGATION ------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(9, 13, 22, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #0068ff 0%, #00b4d8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 16px var(--zalo-glow);
  flex-shrink: 0;
}

.nav-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
  line-height: 1.2;
}

.nav-subtitle {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Zalo Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.status-badge:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
  transition: background-color 0.3s ease;
}

.status-badge.ready {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success);
}
.status-badge.ready .status-dot {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-badge.waiting {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning);
}
.status-badge.waiting .status-dot {
  background-color: var(--warning);
}

.status-badge.offline .status-dot {
  background-color: var(--danger);
}

/* Tabs Navigation Bar (Responsive Scrolling on Mobile) */
.nav-tabs-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-tabs-wrapper::-webkit-scrollbar {
  display: none;
}

.nav-tabs {
  display: flex;
  gap: 6px;
  padding: 6px 0 10px;
  min-width: max-content;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 40px;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-pill);
}

.nav-tab.active {
  background: var(--zalo-blue);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 16px var(--zalo-glow);
}

.nav-tab .tab-icon {
  font-size: 15px;
}

.nav-tab .tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
}

.nav-tab:not(.active) .tab-badge {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

/* ------------------- MAIN CONTAINER ------------------- */
.content-container {
  max-width: 960px;
  margin: 18px auto;
  padding: 0 16px;
  position: relative;
  z-index: 1;
}

.view-panel {
  display: none;
  animation: fadeIn 0.2s ease;
}

.view-panel.active {
  display: block;
}

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

/* Cards */
.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-header.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.panel-header h2 {
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.panel-header p {
  font-size: 13px;
  color: var(--text-secondary);
}

.panel-header code {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  font-size: 12px;
}

/* Segmented Control (Sub-tabs) */
.segmented-control {
  display: flex;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 4px;
  margin-bottom: 18px;
}

.seg-btn {
  flex: 1;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.seg-btn.active {
  background: var(--bg-card-hover);
  color: #fff;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

/* Form Fields */
.input-mode-pane {
  display: none;
}

.input-mode-pane.active {
  display: block;
}

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

.field-header label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.action-link {
  background: transparent;
  border: none;
  color: var(--accent-cyan);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.action-link:hover {
  text-decoration: underline;
}

textarea#phone-text {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: #fff;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  min-height: 130px;
  transition: border-color 0.2s;
}

textarea#phone-text:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--zalo-glow);
}

.field-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  margin-bottom: 16px;
  font-size: 12px;
}

.tip-text {
  color: var(--text-muted);
}

.counter-text {
  font-weight: 600;
  color: var(--accent-cyan);
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-md);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-input);
  position: relative;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.dropzone:hover {
  border-color: var(--zalo-blue);
  background: rgba(0, 104, 255, 0.04);
}

.drop-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.dropzone strong {
  display: block;
  font-size: 14px;
  color: #fff;
  margin-bottom: 4px;
}

.dropzone span {
  font-size: 12px;
  color: var(--text-muted);
}

.dropzone input[type="file"] {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 5px 12px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
}

/* Settings Row */
.settings-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.setting-col label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.setting-col select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.setting-col select:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--zalo-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px var(--zalo-glow);
  text-decoration: none;
  min-height: 44px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--zalo-blue-hover);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary.full-width {
  width: 100%;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  background: var(--bg-pill);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  min-height: 40px;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #fff;
}

.btn-outline.full-width {
  width: 100%;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 40px;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.22);
}

.btn-danger-outline {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ------------------- PROGRESS & STATS ------------------- */
.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.progress-info h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.progress-info p {
  font-size: 12px;
  color: var(--text-muted);
}

.badge-count {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--accent-cyan);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0068ff 0%, #06b6d4 100%);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

/* 3 Metrics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-box.public {
  background: var(--success-bg);
  border-color: var(--success-border);
}
.stat-box.public .stat-number {
  color: var(--success);
}
.stat-box.public .stat-label {
  color: #34d399;
}

.stat-box.neutral .stat-number {
  color: var(--text-secondary);
}

.stat-box.total .stat-number {
  color: #fff;
}

/* Download Bar */
.download-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Results Section Header */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.results-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.badge-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  background: var(--success-bg);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

/* ------------------- CONTACTS LIST & CARDS ------------------- */
.contacts-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.contact-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.2s ease;
}

.contact-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.contact-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.contact-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #1e293b;
  border: 2px solid rgba(0, 104, 255, 0.4);
  flex-shrink: 0;
}

.avatar-fallback-mini {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0068ff 0%, #06b6d4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.contact-meta {
  min-width: 0;
  flex: 1;
}

.contact-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.contact-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.contact-badge-mini {
  font-size: 10px;
  font-weight: 700;
  background: var(--success-bg);
  color: var(--success);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

.contact-phone-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
}

.contact-phone {
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.02em;
}

.contact-orig-phone {
  font-size: 11px;
  color: var(--text-muted);
}

.contact-extra-info {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-pill);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-icon-action:hover {
  background: var(--zalo-blue);
  color: #fff;
  border-color: transparent;
}

.empty-placeholder {
  padding: 36px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-subtle);
}

/* ------------------- SINGLE LOOKUP ------------------- */
.single-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.single-input-row input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.single-input-row input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--zalo-glow);
}

.quick-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  font-size: 12px;
  color: var(--text-muted);
}

.chip {
  padding: 4px 10px;
  background: var(--bg-pill);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.single-result-box {
  margin-top: 16px;
}

.spinner-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 30px;
  color: var(--text-secondary);
  font-size: 13.5px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--zalo-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.profile-avatar-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--zalo-blue);
}

.avatar-fallback {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #0068ff 0%, #06b6d4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
}

.profile-info {
  min-width: 0;
  flex: 1;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-name-row h3 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.badge-found {
  font-size: 11px;
  font-weight: 700;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.profile-phone-row {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.phone-highlight {
  font-size: 16px;
  color: #38bdf8;
  font-weight: 700;
}

.phone-orig {
  font-size: 12px;
  color: var(--text-muted);
}

.profile-details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.detail-item {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.detail-item.full-col {
  grid-column: 1 / -1;
}

.d-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.d-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

.font-mono {
  font-family: Consolas, monospace;
}

.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.error-box {
  padding: 16px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  color: #fca5a5;
  font-size: 13.5px;
  text-align: center;
}

/* ------------------- CACHE VIEW ------------------- */
.cache-toolbar {
  margin-bottom: 12px;
}

#cache-search {
  width: 100%;
  padding: 11px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 14px;
}

#cache-search:focus {
  outline: none;
  border-color: var(--border-focus);
}

.cache-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

/* ------------------- QR AUTH VIEW ------------------- */
.auth-box {
  padding: 10px 0;
}

.connected-card {
  display: block;
  background: var(--bg-input);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 540px;
  margin: 0 auto;
  text-align: left;
  box-shadow: 0 10px 30px -10px rgba(16, 185, 129, 0.15);
}

.auth-profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.auth-avatar-wrap {
  width: 64px;
  height: 64px;
  position: relative;
  flex-shrink: 0;
}

.auth-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--success);
}

.auth-avatar-fallback {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-profile-meta {
  min-width: 0;
  flex: 1;
}

.auth-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.auth-name-row h3 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.auth-uid-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.cache-saved-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.auth-status-desc {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.auth-action-row {
  display: flex;
  justify-content: flex-end;
}

.disconnected-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 460px;
  margin: 0 auto;
}

.qr-notice-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: left;
  margin-bottom: 4px;
}

.notice-icon {
  font-size: 26px;
  flex-shrink: 0;
}

.qr-notice-box strong {
  display: block;
  font-size: 14px;
  color: #fff;
  margin-bottom: 2px;
}

.qr-notice-box p {
  font-size: 12px;
  color: var(--text-muted);
}

.status-msg {
  font-size: 13px;
  color: var(--text-secondary);
}

.qr-wrapper {
  background: #ffffff;
  padding: 16px;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  max-width: 320px;
  width: 100%;
}

.qr-code-img {
  width: 240px;
  height: 240px;
  object-fit: contain;
}

.qr-guide {
  font-size: 12px;
  color: #334155;
  margin-top: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

/* ------------------- TOAST POPUP ------------------- */
.toast-popup {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-light);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 999;
  animation: slideUp 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ------------------- MOBILE RESPONSIVENESS (< 640px) ------------------- */
@media (max-width: 640px) {
  body {
    padding-bottom: 80px;
  }

  .nav-container {
    padding: 10px 14px;
  }

  .nav-title {
    font-size: 16px;
  }

  .nav-subtitle {
    display: none;
  }

  .panel-card {
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .panel-header h2 {
    font-size: 17px;
  }

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

  .stats-grid {
    gap: 6px;
  }

  .stat-box {
    padding: 10px 6px;
  }

  .stat-number {
    font-size: 17px;
  }

  .stat-label {
    font-size: 9.5px;
  }

  .contact-card {
    padding: 12px;
    gap: 10px;
  }

  .contact-avatar,
  .avatar-fallback-mini {
    width: 42px;
    height: 42px;
    font-size: 16px;
  }

  .contact-name {
    font-size: 14px;
    max-width: 140px;
  }

  .contact-phone-row {
    font-size: 12.5px;
  }

  .profile-details-grid {
    grid-template-columns: 1fr 1fr;
  }

  .profile-actions {
    grid-template-columns: 1fr;
  }

  .cache-actions-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .download-bar {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* Nav Actions Container */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Modal Overlay & Dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  max-width: 520px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

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

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

.modal-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Pages Banner */
.pages-banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid #3b82f6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  z-index: 999;
  animation: bannerSlideUp 0.3s ease-out;
  max-width: 90vw;
}

@keyframes bannerSlideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.pages-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #f8fafc;
}

.btn-banner {
  background: var(--zalo-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-banner:hover {
  background: var(--zalo-blue-hover);
}

