/* ==========================================================================
   Design System & Tokens
   ========================================================================== */
:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Color Palette - Dark Theme Defaults */
  --bg-app: #0b0f19;
  --bg-surface: rgba(18, 24, 38, 0.75);
  --bg-surface-hover: rgba(28, 36, 56, 0.85);
  --bg-input: rgba(12, 16, 28, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(99, 102, 241, 0.35);

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

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-cyan: #06b6d4;

  --glass-blur: blur(16px);
  --card-shadow: 0 12px 35px -5px rgba(0, 0, 0, 0.4), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
body.light-theme {
  --bg-app: #f6f8fc;
  --bg-surface: rgba(255, 255, 255, 0.94);
  --bg-surface-hover: #f8faff;
  --bg-input: #ffffff;
  --border-color: #e3e9f2;
  --border-hover: rgba(79, 70, 229, 0.4);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --card-shadow: 0 10px 30px -12px rgba(30, 52, 87, 0.14), 0 0 0 1px rgba(15, 23, 42, 0.02);
}

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

html,
body,
button,
input,
select,
textarea,
optgroup,
option,
code,
pre,
kbd,
samp {
  font-family: var(--font-main);
}

button,
input,
select,
textarea {
  font: inherit;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glowing Ambient Background Orbs */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  transition: opacity 0.5s ease;
}
.bg-glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #6366f1, #3b82f6);
  top: -150px;
  right: -100px;
}
.bg-glow-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #ec4899, #8b5cf6);
  bottom: -100px;
  left: -100px;
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 18px rgba(28, 46, 78, 0.05);
}

body.dark-theme .app-header {
  background: rgba(11, 15, 25, 0.94);
}

.header-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem 0;
  display: grid;
  grid-template-columns: auto minmax(1rem, 1fr) auto;
  align-items: center;
  column-gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(145deg, #6366f1, #8b5cf6);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  box-shadow: 0 7px 18px rgba(99, 102, 241, 0.24);
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.25;
}

.brand-subtitle {
  display: block;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 0.08rem;
}

/* Nav Tabs */
.nav-tabs {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.7rem;
  padding: 0.45rem 0;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border-color);
}

body.light-theme .nav-tabs {
  background: transparent;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.84rem;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

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

.nav-tab.active {
  background: rgba(99, 102, 241, 0.11);
  color: var(--accent-primary);
  box-shadow: none;
}

/* Header Actions */
.header-actions {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(16, 185, 129, 0.07);
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.18);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-success);
  box-shadow: 0 0 8px var(--accent-success);
}

.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Main Container */
.main-container {
  max-width: 1300px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.page-intro {
  margin-bottom: 2rem;
}

.page-intro h2 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.page-intro p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Cards & Glassmorphism */
.glass-card {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: 1.75rem;
  transition: var(--transition);
}

.input-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 920px);
  justify-content: center;
  gap: 1.75rem;
  margin-bottom: 2rem;
}

@media (max-width: 960px) {
  .input-card-grid {
    grid-template-columns: 1fr;
  }
}

/* Sub Tab Nav inside Card */
.tab-subnav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.sub-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

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

.sub-tab.active {
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

/* Input Panels */
.input-panel {
  display: none;
}
.input-panel.active {
  display: block;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(0, 0, 0, 0.1);
  margin-bottom: 1.25rem;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.06);
  transform: translateY(-2px);
}

.drop-icon {
  font-size: 2.75rem;
  color: var(--accent-primary);
  margin-bottom: 1rem;
}

.drop-zone h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.drop-zone h3 span {
  color: var(--accent-primary);
  text-decoration: underline;
}

.drop-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* File Preview Card */
.file-preview-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.2rem;
  margin-bottom: 1.25rem;
}

.file-preview-icon {
  font-size: 1.8rem;
  color: var(--accent-primary);
}

.file-preview-info {
  flex: 1;
  overflow: hidden;
}

.file-preview-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-preview-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* URL Input */
.url-input-group {
  margin-bottom: 1.5rem;
}

.url-input-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon > i {
  position: absolute;
  left: 1.1rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.input-with-icon input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  transition: var(--transition);
}

.input-with-icon input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.supported-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.supported-tags span {
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.5);
}

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

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

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-primary);
}

.btn-large {
  padding: 0.95rem 1.75rem;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--accent-danger);
  background: rgba(239, 68, 68, 0.1);
}

/* Side Info Process Steps */
.side-info-card .card-header {
  margin-bottom: 1.25rem;
}
.side-info-card .card-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.process-steps-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.step-item {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #818cf8;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-desc strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.15rem;
}

.step-desc span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Pipeline Progress Card */
.pipeline-card {
  width: min(100%, 920px);
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 2rem;
  padding: 1.5rem 1.65rem;
  border-color: rgba(99, 102, 241, 0.16);
  background: var(--bg-surface);
  box-shadow: 0 18px 42px -28px rgba(30, 41, 79, 0.38);
}

.pipeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.15rem;
}

.pipeline-heading-group { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.pipeline-heading-group h3 { margin: 0 0 .25rem; color: var(--text-primary); font-size: 1rem; }
.pipeline-heading-group p { margin: 0; color: var(--text-muted); font-size: .82rem; }
.pipeline-status-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: white;
  background: var(--accent-gradient);
  box-shadow: 0 9px 20px rgba(99, 102, 241, .2);
  animation: pipeline-icon-pulse 1.8s ease-in-out infinite;
}
.pipeline-progress-label {
  min-width: 62px;
  padding: .45rem .65rem;
  border-radius: 10px;
  color: var(--accent-primary);
  background: rgba(99, 102, 241, .09);
  text-align: center;
  font-size: .92rem;
}
@keyframes pipeline-icon-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.pipeline-progress-bar {
  position: relative;
  height: 10px;
  background: #e9edf6;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: .9rem;
}

.pipeline-progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
  box-shadow: 0 0 16px rgba(99,102,241,.22);
}
.pipeline-progress-fill::after {
  content: "";
  display: block;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
  animation: pipeline-shimmer 1.4s linear infinite;
}
@keyframes pipeline-shimmer { from { translate: -120% 0; } to { translate: 340% 0; } }
.pipeline-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-muted);
  font-size: .73rem;
}
.pipeline-footer i { margin-right: .3rem; color: var(--accent-success); }

@media (max-width: 560px) {
  .pipeline-card { padding: 1.15rem; }
  .pipeline-header { align-items: flex-start; }
  .pipeline-heading-group p { font-size: .74rem; }
  .pipeline-footer { align-items: flex-start; flex-direction: column; gap: .35rem; }
}

/* Result Section */
.result-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 3rem;
  animation: fadeIn 0.4s ease;
}

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

.result-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.tag-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.meta-time {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 0.75rem;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* Audio & Metrics Row */
.audio-metrics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (max-width: 860px) {
  .audio-metrics-grid {
    grid-template-columns: 1fr;
  }
}

.audio-player-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.audio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}

.audio-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.audio-title i {
  font-size: 1.6rem;
  color: var(--accent-primary);
}

.audio-title h4 {
  font-size: 1.05rem;
  font-weight: 700;
}

.audio-title span {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.audio-badge {
  font-size: 0.8rem;
  background: var(--bg-input);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  font-family: var(--font-mono);
}

audio {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-md);
  outline: none;
}

/* Compression Comparison */
.compression-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), var(--bg-surface));
  border-color: rgba(16, 185, 129, 0.25);
}

.comp-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  color: var(--accent-success);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.comp-stats {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-bottom: 1rem;
}

.comp-stat-item {
  text-align: center;
}

.comp-stat-item .label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.comp-stat-item .value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
}

.comp-stat-item.highlight .value {
  color: var(--accent-success);
}

.comp-arrow {
  font-size: 1.2rem;
  color: var(--text-muted);
}

.savings-pill {
  text-align: center;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.45rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Scores Grid */
.scores-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

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

.score-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--card-shadow);
  transition: var(--transition);
}

.score-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

.score-card.highlight-total {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.15));
  border-color: rgba(99, 102, 241, 0.4);
}

.score-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.score-val {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.65rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.score-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.score-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.8s ease;
}

/* Transcript Card */
.transcript-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.transcript-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.transcript-text {
  background: var(--bg-input);
  border-left: 4px solid var(--accent-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.25rem;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  font-style: normal;
}

/* Markdown Report Card */
.markdown-report-card .card-header {
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.85rem;
}

.markdown-report-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #818cf8;
}

.markdown-body {
  color: var(--text-primary);
  line-height: 1.75;
  font-size: 0.98rem;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  font-family: var(--font-display);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.markdown-body h3 {
  color: #a5b4fc;
  font-size: 1.15rem;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 0.4rem;
}

.markdown-body h4 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 1.02rem;
  font-weight: 700;
}

.markdown-body p {
  margin-bottom: 0.85rem;
}

.markdown-body ul, .markdown-body ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.markdown-body li {
  margin-bottom: 0.45rem;
}

.markdown-body strong {
  color: #f43f5e;
}
body.dark-theme .markdown-body strong {
  color: #fb7185;
}

.markdown-body hr {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: 1.5rem 0;
}

/* ==========================================================================
   SINGLE RESULT — PROFESSIONAL REPORT LAYOUT
   ========================================================================== */
#single-result-container {
  gap: 1.75rem;
  margin-top: 1.75rem;
}

#single-result-container .result-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  background: var(--bg-surface);
  box-shadow: 0 12px 30px -20px rgba(15, 23, 42, .35);
}

#single-result-container .result-meta-left {
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  min-width: 0;
  gap: .75rem;
}

.result-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #10b981, #059669);
  box-shadow: 0 8px 18px -8px rgba(5, 150, 105, .65);
}

.result-meta-copy { display: flex; flex-direction: column; min-width: 0; }
.result-status-title { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.result-status-title > strong {
  color: var(--text-primary);
  font-size: .92rem;
  font-weight: 800;
  letter-spacing: -.015em;
}
#single-result-container .tag-success {
  padding: .2rem .55rem;
  border-radius: 999px;
  color: #047857;
  background: rgba(16, 185, 129, .1);
  border-color: rgba(16, 185, 129, .2);
  font-size: .62rem;
  font-weight: 800;
}
#single-result-container .meta-time {
  margin: .15rem 0 0;
  color: var(--text-secondary);
  font-size: .7rem;
}

#single-result-container .result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .45rem;
}
#single-result-container .result-actions .btn {
  min-height: 38px;
  padding: .5rem .78rem;
  border-radius: 10px;
  font-size: .7rem;
  font-weight: 750;
  white-space: nowrap;
}
#single-result-container .result-actions .btn-zalo {
  box-shadow: 0 8px 18px -10px rgba(0, 136, 255, .75);
}

.result-group {
  display: grid;
  gap: .85rem;
}
.result-group-heading {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 0 .15rem;
}
.result-group-heading h3 {
  color: var(--text-primary);
  font-size: .94rem;
  font-weight: 800;
  letter-spacing: -.015em;
}
.result-group-heading p {
  margin-top: 1px;
  color: var(--text-secondary);
  font-size: .69rem;
}
.result-group-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  font-size: .84rem;
}
.result-group-icon.icon-audio { color: #4f46e5; background: rgba(99, 102, 241, .1); }
.result-group-icon.icon-score { color: #7c3aed; background: rgba(124, 58, 237, .09); }
.result-group-icon.icon-transcript { color: #0284c7; background: rgba(14, 165, 233, .1); }

#single-result-container .audio-metrics-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}
#single-result-container .audio-player-card,
#single-result-container .compression-card {
  min-width: 0;
  min-height: 188px;
  padding: 1.25rem;
  border-radius: 18px;
  box-shadow: 0 12px 28px -20px rgba(15, 23, 42, .4);
}
#single-result-container .audio-player-card {
  background: linear-gradient(145deg, rgba(99, 102, 241, .045), var(--bg-surface) 48%);
}
#single-result-container .audio-header { align-items: flex-start; gap: 1rem; margin-bottom: 1.35rem; }
#single-result-container .audio-title { min-width: 0; gap: .75rem; }
#single-result-container .audio-title > div { min-width: 0; }
.audio-title-icon,
.comp-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
}
.audio-title-icon { color: #4f46e5; background: rgba(99, 102, 241, .11); }
.comp-title-icon { color: #059669; background: rgba(16, 185, 129, .11); }
#single-result-container .audio-title i { color: inherit; font-size: .9rem; }
.card-eyebrow {
  display: block;
  margin-bottom: 1px;
  color: var(--text-secondary);
  font-size: .58rem !important;
  font-family: var(--font-main) !important;
  font-weight: 800;
  letter-spacing: .055em;
  line-height: 1.35;
  text-transform: uppercase;
}
#single-result-container .audio-title h4 { color: var(--text-primary); font-size: .92rem; letter-spacing: -.01em; }
#single-result-container #audio-filename-display {
  display: block;
  max-width: min(510px, 48vw);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#single-result-container .audio-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: .35rem .6rem;
  color: var(--text-secondary);
  background: var(--bg-input);
  font-family: var(--font-main);
  font-size: .68rem;
  font-weight: 700;
}
#single-result-container audio { height: 46px; }

#single-result-container .compression-card {
  justify-content: space-between;
  background: linear-gradient(145deg, rgba(16, 185, 129, .09), var(--bg-surface) 68%);
}
#single-result-container .comp-title {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: .9rem;
  color: var(--text-primary);
}
#single-result-container .comp-title > div { display: flex; flex-direction: column; }
#single-result-container .comp-title strong { font-size: .86rem; letter-spacing: -.01em; }
#single-result-container .comp-stats { justify-content: space-between; gap: .75rem; margin: 0 0 .9rem; padding: 0 .25rem; }
#single-result-container .comp-stat-item { text-align: left; }
#single-result-container .comp-stat-item.highlight { text-align: right; }
#single-result-container .comp-stat-item .label { font-size: .66rem; color: var(--text-secondary); }
#single-result-container .comp-stat-item .value { font-size: 1.08rem; letter-spacing: -.025em; }
#single-result-container .comp-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: var(--text-secondary);
  background: rgba(148, 163, 184, .1);
  font-size: .76rem;
}
#single-result-container .savings-pill {
  padding: .55rem .7rem;
  border-radius: 11px;
  color: #047857;
  background: rgba(16, 185, 129, .1);
  border-color: rgba(16, 185, 129, .2);
  font-size: .7rem;
}

#single-result-container .scores-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
#single-result-container .score-card {
  display: flex;
  flex-direction: column;
  min-height: 164px;
  padding: 1rem;
  border-radius: 17px;
  text-align: left;
  box-shadow: 0 12px 26px -20px rgba(15, 23, 42, .42);
}
#single-result-container .score-card:hover { transform: translateY(-2px); box-shadow: 0 15px 30px -20px rgba(79, 70, 229, .45); }
#single-result-container .score-card-head { display: flex; align-items: center; gap: .55rem; }
#single-result-container .score-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  border-radius: 10px;
  color: #4f46e5;
  background: rgba(99, 102, 241, .09);
  font-size: .7rem;
}
#single-result-container .score-label { margin: 0; color: var(--text-secondary); font-size: .72rem; font-weight: 750; }
#single-result-container .score-main { display: flex; align-items: baseline; gap: 3px; margin: auto 0 .65rem; }
#single-result-container .score-main > span { color: var(--text-muted); font-size: .72rem; font-weight: 650; }
#single-result-container .score-val {
  margin: 0;
  color: #4f46e5;
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: currentColor;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -.045em;
}
#single-result-container .score-bar { height: 7px; background: rgba(148, 163, 184, .16); }
#single-result-container .score-fill { background: linear-gradient(90deg, #6366f1, #8b5cf6); }
#single-result-container .score-card.highlight-total {
  border-color: rgba(99, 102, 241, .35);
  background: linear-gradient(145deg, rgba(99, 102, 241, .13), rgba(139, 92, 246, .06));
}
#single-result-container .score-card.highlight-total .score-icon { color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6); }

#single-result-container .transcript-card,
#single-result-container .markdown-report-card {
  padding: 1.35rem;
  border-radius: 18px;
  box-shadow: 0 12px 28px -21px rgba(15, 23, 42, .4);
}
#single-result-container .transcript-card .card-header { margin-bottom: 1rem; }
.transcript-heading { display: flex; align-items: center; gap: .7rem; }
#single-result-container .transcript-heading h3 { margin: 0; color: var(--text-primary); font-size: .94rem; }
.transcript-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: .45rem .7rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-secondary);
  background: var(--bg-input);
  font-size: .68rem;
  font-weight: 750;
}
.transcript-copy-btn:hover { color: #4f46e5; border-color: rgba(99, 102, 241, .3); }
#single-result-container .transcript-text {
  margin: 0;
  padding: 1rem 1.1rem;
  border: 0;
  border-radius: 13px;
  color: var(--text-primary);
  background: linear-gradient(145deg, rgba(99, 102, 241, .055), var(--bg-input));
  box-shadow: inset 3px 0 0 #6366f1;
  font-size: .9rem;
  line-height: 1.8;
}
#single-result-container .markdown-report-card .card-header { margin-bottom: 1rem; }

body.dark-theme #single-result-container .tag-success,
body.dark-theme #single-result-container .savings-pill { color: #34d399; }
body.dark-theme #single-result-container .score-val { color: #a78bfa; }

@media (max-width: 980px) {
  #single-result-container .result-top-bar { align-items: flex-start; }
  #single-result-container .result-actions { width: 100%; justify-content: flex-start; }
  #single-result-container .audio-metrics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  #single-result-container { gap: 1.35rem; margin-top: 1.25rem; }
  #single-result-container .result-top-bar { padding: .9rem; }
  #single-result-container .result-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #single-result-container .result-actions .btn { justify-content: center; }
  #single-result-container .scores-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #single-result-container #audio-filename-display { max-width: 60vw; }
}

@media (max-width: 480px) {
  .result-status-title > strong { font-size: .82rem; }
  #single-result-container .result-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #single-result-container .result-actions #copy-zalo-btn,
  #single-result-container .result-actions .btn:last-child { grid-column: 1 / -1; }
  #single-result-container .audio-player-card,
  #single-result-container .compression-card,
  #single-result-container .transcript-card,
  #single-result-container .markdown-report-card { padding: 1rem; }
  #single-result-container .audio-header { align-items: flex-start; }
  #single-result-container #audio-filename-display { max-width: 54vw; }
  #single-result-container .transcript-card .card-header { align-items: flex-start; gap: .75rem; }
  .transcript-copy-btn { width: 36px; padding: 0; justify-content: center; font-size: 0; }
  .transcript-copy-btn i { font-size: .75rem; }
}

/* Batch Section */
.batch-controls-card {
  margin-bottom: 1.75rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.input-with-action {
  display: flex;
  gap: 0.75rem;
}

.input-with-action input {
  flex: 1;
  padding: 0.75rem 1.1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

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

.batch-summary-strip {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.batch-stat {
  display: flex;
  flex-direction: column;
}

.batch-stat .num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-primary);
}

.batch-stat .lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.batch-progress-box {
  margin-bottom: 1.75rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), var(--bg-surface));
}

.batch-prog-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.progress-bar-container {
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Tables */
.table-card {
  padding: 1.25rem;
}

.table-card .card-header.space-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.45rem 1rem;
  width: 320px;
}

.search-bar input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  width: 100%;
  outline: none;
  font-family: var(--font-main);
  font-size: 0.88rem;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.15);
  color: var(--text-secondary);
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--bg-surface-hover);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pending { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.status-running { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.status-success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.status-error { background: rgba(239, 68, 68, 0.15); color: #f87171; }

/* Settings Form */
.settings-card {
  max-width: 850px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.form-group select, .form-group textarea, .form-group input[type="url"], .form-group input[type="password"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.92rem;
  transition: var(--transition);
}

.form-group textarea {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  resize: vertical;
}

.form-group select:focus, .form-group textarea:focus, .form-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.form-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* History Stats Grid */
.history-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .history-stats-grid {
    grid-template-columns: 1fr;
  }
}

.history-stat-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--card-shadow);
  transition: var(--transition);
}

.history-stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

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

.history-stat-icon.icon-primary {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.history-stat-icon.icon-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.history-stat-icon.icon-cyan {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.history-stat-info {
  display: flex;
  flex-direction: column;
}

.history-stat-info .lbl {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-stat-info .val {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.header-btn-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* History Score Badges */
.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.88rem;
  font-family: var(--font-display);
}

.score-pill.score-high {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.score-pill.score-medium {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.score-pill.score-low {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.score-sub-pills {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.score-sub-pills span {
  background: var(--bg-input);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* Action Button Group */
.table-action-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

/* Bảng tài khoản quản trị: ít cột, thao tác dạng dropdown */
#admin-users-table { table-layout: auto; }
#admin-users-table th,
#admin-users-table td { padding-inline: .8rem; }
#admin-users-table th:first-child { width: 30%; }
#admin-users-table th:nth-child(2) { width: 19%; }
#admin-users-table th:nth-child(3) { width: 18%; }
#admin-users-table th:nth-child(4) { width: 14%; }
#admin-users-table th:last-child { width: 19%; }
.admin-user-cell { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.admin-user-avatar { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 12px; color: #fff; background: linear-gradient(135deg,#6366f1,#8b5cf6); box-shadow: 0 7px 16px rgba(99,102,241,.2); font-size: .78rem; font-weight: 800; }
.admin-user-identity { display: flex; min-width: 0; flex-direction: column; line-height: 1.35; }
.admin-user-identity strong { color: var(--text-primary); font-size: .82rem; }
.admin-user-identity strong em { color: var(--text-muted); font-size: .66rem; font-style: normal; font-weight: 600; }
.admin-user-identity span { max-width: 250px; overflow: hidden; color: var(--text-secondary); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-identity small { color: var(--text-muted); font-size: .62rem; }
.admin-status-stack { display: flex; align-items: flex-start; flex-direction: column; gap: .38rem; }
.admin-credit-cell { display: flex; flex-direction: column; white-space: nowrap; line-height: 1.35; }
.admin-credit-cell strong { color: var(--text-primary); font-size: .82rem; }
.admin-credit-cell small { color: var(--text-muted); font-size: .66rem; font-weight: 700; }
.admin-credit-unlimited { color: #6366f1 !important; font-size: 1.05rem !important; }
.admin-action-select-wrap { position: relative; display: inline-flex; align-items: center; min-width: 148px; }
.admin-action-select-wrap > i { position: absolute; left: 12px; z-index: 1; color: #6366f1; font-size: .74rem; pointer-events: none; }
.admin-action-select { width: 100%; min-height: 40px; padding: 0 31px 0 34px; border: 1px solid var(--border-color); border-radius: 11px; outline: 0; color: var(--text-primary); background: var(--bg-input); font-family: var(--font-main); font-size: .72rem; font-weight: 700; cursor: pointer; transition: var(--transition); }
.admin-action-select:hover { border-color: rgba(99,102,241,.35); background: var(--bg-surface-hover); }
.admin-action-select:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.12); }

@media (max-width: 720px) {
  #admin-users-table,
  #admin-users-table tbody,
  #admin-users-table tr,
  #admin-users-table td { display: block; width: 100%; }
  #admin-users-table thead { display: none; }
  #admin-users-table tbody { display: grid; gap: .85rem; }
  #admin-users-table tbody tr { overflow: hidden; border: 1px solid var(--border-color); border-radius: 15px; background: var(--bg-surface); box-shadow: 0 8px 22px -16px rgba(15,23,42,.35); }
  #admin-users-table tbody tr:hover td { background: transparent; }
  #admin-users-table tbody td { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .72rem .85rem; border-bottom: 1px solid var(--border-color); }
  #admin-users-table tbody td:last-child { border-bottom: 0; }
  #admin-users-table tbody td::before { content: attr(data-label); flex: 0 0 82px; color: var(--text-muted); font-size: .67rem; font-weight: 750; }
  #admin-users-table tbody td:first-child { display: block; padding: .9rem; }
  #admin-users-table tbody td:first-child::before { display: none; }
  #admin-users-table .admin-user-empty td { display: block; }
  #admin-users-table .admin-user-empty td::before { display: none; }
  .admin-status-stack { align-items: flex-end; }
  .admin-credit-cell { text-align: right; }
  .admin-action-select-wrap { width: min(100%, 190px); }
  #admin-sub-users .table-responsive { overflow-x: visible; }
}

/* Nút kích hoạt thủ công tài khoản (bảng Admin) */
.btn-activate {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  border: 0;
  white-space: nowrap;
}
.btn-activate:hover { filter: brightness(1.07); color: #fff; }
.btn-activate:disabled { opacity: .6; cursor: not-allowed; }

.audio-mini-player {
  height: 34px;
  width: 150px;
  border-radius: var(--radius-full);
  outline: none;
}

/* ==========================================================================
   MODAL NỀN TẢNG (overlay + card) - dùng cho modal chi tiết & modal cấp lượt
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background: rgba(4, 7, 15, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow-y: auto;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  animation: modal-pop 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header .modal-title-group h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-body {
  padding: 1.5rem;
}

/* Căn giữa card trong overlay khi content dài */
.modal-overlay > .modal-card {
  margin: auto;
}

/* Modal Enhancements */
.modal-title-group {
  display: flex;
  flex-direction: column;
}

.modal-title-group h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   MODAL CHI TIẾT KẾT QUẢ
   ========================================================================== */
#detail-modal .modal-card {
  max-width: 960px;
  max-height: 92vh;
  padding: 0;
  background: #f7f9fc;
  border-color: #dfe7f1;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}
body.dark-theme #detail-modal .modal-card {
  background: #101625;
}
#detail-modal .modal-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: block;
  padding: 1.1rem 1.4rem 1rem;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 5px 18px rgba(30, 52, 87, 0.05);
}
body.dark-theme #detail-modal .modal-header {
  background: rgba(16, 22, 37, 0.96);
}
#detail-modal .modal-title-group {
  min-width: 0;
  padding-right: 3rem;
}
#detail-modal .modal-title-group h3 {
  font-size: 1.18rem;
  letter-spacing: -0.015em;
}
#detail-modal .modal-title-group h3 i {
  color: var(--accent-primary);
}
#detail-modal .modal-subtitle {
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
#detail-modal .modal-header-actions {
  gap: 0.45rem;
  margin-top: 0.9rem;
  padding-right: 2.8rem;
}
#detail-modal .modal-header-actions .btn {
  min-height: 36px;
  padding: 0.45rem 0.75rem;
  border-radius: 9px;
  font-size: 0.76rem;
  box-shadow: none;
}
#detail-modal #close-modal-btn {
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}
#detail-modal .modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.1rem;
  padding: 1.25rem;
  overflow-x: hidden;
}
#detail-modal .modal-body > * {
  margin: 0 !important;
}

.evaluation-summary-card {
  display: grid;
  grid-template-columns: minmax(250px, 0.8fr) minmax(0, 1.45fr);
  width: 100%;
  min-width: 0;
  overflow: hidden;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(30, 52, 87, 0.07);
}
.overall-score-panel {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.35rem;
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.06));
  border-right: 1px solid var(--border-color);
  min-width: 0;
}
.overall-score-ring {
  position: relative;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--accent-primary) var(--score-angle), #e7eaf3 0deg);
}
.overall-score-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  background: var(--bg-input);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--border-color);
}
.overall-score-value {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  color: var(--text-primary);
}
.overall-score-value strong {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.05em;
}
.overall-score-value small {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}
.overall-score-copy {
  min-width: 0;
}
.result-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.45rem;
  padding: 0.22rem 0.52rem;
  color: #6d28d9;
  background: #ede9fe;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
}
.result-level-badge i {
  color: #f59e0b;
}
.overall-score-copy h4 {
  color: var(--text-primary);
  font-size: 0.98rem;
  font-weight: 800;
}
.overall-score-copy p {
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.5;
}
.score-breakdown-panel {
  display: grid;
  min-width: 0;
  gap: 0.8rem;
  padding: 1.25rem 1.35rem;
}
.score-breakdown-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.1rem;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 800;
}
.score-breakdown-heading small {
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
}
.score-metric-row {
  display: grid;
  gap: 0.4rem;
}
.score-metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.score-metric-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-secondary);
}
.score-metric-label > i {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
  border-radius: 8px;
  font-size: 0.72rem;
}
.score-metric-label span {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.score-metric-label strong {
  color: var(--text-primary);
  font-size: 0.74rem;
}
.score-metric-label small {
  color: var(--text-muted);
  font-size: 0.6rem;
}
.score-metric-value {
  color: var(--accent-primary);
  font-family: var(--font-display);
  font-size: 1rem;
}
.score-metric-value small {
  color: var(--text-muted);
  font-size: 0.6rem;
}
.score-metric-track {
  height: 5px;
  overflow: hidden;
  margin-left: 38px;
  background: #e8ecf4;
  border-radius: 999px;
}
.score-metric-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  border-radius: inherit;
}

.detail-audio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  gap: 1.1rem;
}
#detail-modal .modal-body .card {
  padding: 1.15rem;
  background: var(--bg-input);
  border-radius: 16px;
  box-shadow: 0 7px 22px rgba(30, 52, 87, 0.055);
}
.detail-audio-card .audio-header {
  gap: 1rem;
  margin-bottom: 1rem;
}
.detail-audio-card .audio-title {
  min-width: 0;
}
.detail-card-icon {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
  border-radius: 11px;
}
.detail-card-icon.report {
  color: #059669;
  background: rgba(16, 185, 129, 0.1);
}
.detail-audio-card .audio-title > div {
  min-width: 0;
}
.detail-audio-card .audio-title h4 {
  color: var(--text-primary);
  font-size: 0.9rem;
}
.detail-audio-card .audio-title span {
  display: block;
  max-width: 390px;
  overflow: hidden;
  margin-top: 0.15rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-download-btn {
  min-height: 34px;
  padding: 0.35rem 0.65rem;
}
.detail-compression-card {
  padding: 1.15rem !important;
}
.detail-compression-card .comp-title {
  margin-bottom: 0.75rem;
  font-size: 0.78rem;
}
.detail-compression-card .comp-stats {
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.detail-compression-card .comp-stat-item .label {
  font-size: 0.65rem;
}
.detail-compression-card .comp-stat-item .value {
  font-size: 0.95rem;
}
.detail-compression-card .comp-arrow {
  font-size: 0.8rem;
}
.detail-compression-card .savings-pill {
  padding: 0.35rem;
  color: #047857;
  font-size: 0.7rem;
}

.detail-section-card {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}
.detail-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem !important;
  padding: 0 0 0.9rem !important;
  border-bottom: 1px solid var(--border-color);
}
.detail-heading-copy {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.detail-heading-copy > div {
  line-height: 1.25;
}
.detail-heading-copy small {
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}
#detail-modal .detail-heading-copy h3,
#detail-modal .markdown-report-card .detail-heading-copy h3 {
  margin: 0.1rem 0 0;
  padding: 0;
  color: var(--text-primary);
  border: 0;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 800;
}
#detail-modal .transcript-text {
  margin: 0;
  padding: 1rem 1.1rem;
  background: rgba(99, 102, 241, 0.045);
  border-left-width: 3px;
  border-radius: 0 10px 10px 0;
  font-size: 0.88rem;
  line-height: 1.75;
}
#detail-modal .markdown-body {
  font-size: 0.88rem;
  line-height: 1.72;
}
#detail-modal .markdown-body h1,
#detail-modal .markdown-body h2,
#detail-modal .markdown-body h3 {
  color: var(--text-primary);
}

@media (max-width: 760px) {
  #detail-modal {
    padding: 0.5rem;
  }
  #detail-modal .modal-card {
    max-height: calc(100dvh - 1rem);
    border-radius: 16px;
  }
  #detail-modal .modal-header {
    padding: 0.9rem 1rem 0.85rem;
  }
  #detail-modal .modal-title-group h3 {
    font-size: 1rem;
  }
  #detail-modal .modal-header-actions {
    padding-right: 2.5rem;
  }
  #detail-modal .modal-header-actions .btn:not(#modal-zalo-btn) span {
    display: none;
  }
  #detail-modal .modal-header-actions .btn:not(#modal-zalo-btn) {
    width: 36px;
    padding-inline: 0;
  }
  #detail-modal #close-modal-btn {
    top: 0.85rem;
    right: 0.85rem;
  }
  #detail-modal .modal-body {
    gap: 0.85rem;
    padding: 0.85rem;
  }
  .evaluation-summary-card,
  .detail-audio-grid {
    grid-template-columns: 1fr;
  }
  .overall-score-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }
}

@media (max-width: 480px) {
  #detail-modal {
    padding: 0;
  }
  #detail-modal .modal-card {
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }
  #detail-modal .modal-subtitle {
    max-width: calc(100vw - 5rem);
  }
  #detail-modal .modal-header-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  #detail-modal .modal-header-actions::-webkit-scrollbar {
    display: none;
  }
  #detail-modal #modal-zalo-btn span {
    display: none;
  }
  #detail-modal #modal-zalo-btn {
    width: 36px;
    padding-inline: 0;
  }
  .overall-score-panel {
    align-items: center;
    padding: 1rem;
  }
  .overall-score-ring {
    width: 92px;
    height: 92px;
  }
  .overall-score-value strong {
    font-size: 1.8rem;
  }
  .score-breakdown-panel {
    padding: 1rem;
  }
  .detail-section-heading .btn span {
    display: none;
  }
  .detail-section-heading .btn {
    width: 36px;
    padding-inline: 0;
  }
}

/* Zalo Parent Message Button */
.btn-zalo {
  background: linear-gradient(135deg, #0068ff 0%, #00aaff 100%);
  color: #ffffff;
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 104, 255, 0.35);
  transition: var(--transition);
  cursor: pointer;
}

.btn-zalo:hover {
  background: linear-gradient(135deg, #0057e0 0%, #0090ee 100%);
  box-shadow: 0 6px 20px rgba(0, 104, 255, 0.5);
  transform: translateY(-1px);
}

.btn-zalo:active {
  transform: translateY(0);
}

/* Nút nguy hiểm (xóa) */
.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}
.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #ea580c 100%);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}
.btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  opacity: 0.6;
}

.empty-state h4 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 1.5rem;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

/* Print Stylesheet for Report Export */
@media print {
  body {
    background: #ffffff !important;
    color: #111827 !important;
  }
  .app-header,
  .nav-tabs,
  .bg-glow,
  .toast-container,
  .modal-overlay:not(.print-active),
  .modal-header-actions,
  .result-actions,
  .table-action-group button,
  #theme-toggle {
    display: none !important;
  }
  .modal-overlay {
    position: static !important;
    background: transparent !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    display: block !important;
  }
  .modal-card {
    max-width: 100% !important;
    max-height: none !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
  }
  .card, .glass-card {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: none !important;
    color: #111827 !important;
  }
  .markdown-body {
    color: #111827 !important;
  }
  .markdown-body h1, .markdown-body h2, .markdown-body h3 {
    color: #1f2937 !important;
  }
  .markdown-body strong {
    color: #b91c1c !important;
  }
  .score-val {
    color: #4f46e5 !important;
    -webkit-text-fill-color: #4f46e5 !important;
  }
}

/* Utilities */
.text-center { text-align: center; }
.py-4 { padding-top: 2rem; padding-bottom: 2rem; }

/* ==========================================================================
   TAB CONTENT - hiển thị/ẩn theo tab (QUAN TRỌNG cho chuyển tab)
   ========================================================================== */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: tab-fade-in 0.3s ease;
}
@keyframes tab-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Chữ trạng thái trên header */
.status-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Nhóm meta bên trái của thanh kết quả (Đã chấm xong, thời gian) */
.result-meta-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ==========================================================================
   AUTH SCREEN (Đăng nhập / Đăng ký)
   ========================================================================== */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg-app);
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.auth-screen.visible {
  opacity: 1;
  visibility: visible;
}
.auth-screen .bg-glow {
  opacity: 0.5;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 2.2rem 2rem 1.8rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.auth-screen.visible .auth-card {
  transform: translateY(0) scale(1);
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.6rem;
}
.auth-logo .brand-logo {
  width: 60px;
  height: 60px;
  margin: 0 auto 0.8rem;
  font-size: 1.5rem;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: var(--accent-gradient);
  box-shadow: 0 10px 30px -6px rgba(139, 92, 246, 0.5);
}
.auth-logo h2 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-logo p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Link "Về trang chủ" trên màn hình đăng nhập */
.auth-back-home {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  margin: -0.5rem 0 1rem;
  transition: color 0.15s;
}
.auth-back-home:hover {
  color: var(--text-primary);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  padding: 0.3rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  margin-bottom: 1.4rem;
}
.auth-tab {
  padding: 0.6rem 0.5rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}
.auth-tab.active {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 6px 18px -4px rgba(99, 102, 241, 0.5);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.auth-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}
.auth-error {
  min-height: 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-danger);
  text-align: center;
}
.auth-footnote {
  margin-top: 1.4rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.auth-footnote i {
  color: var(--accent-success);
  margin-right: 0.3rem;
}

/* User chip trên header */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.28rem 0.35rem 0.28rem 0.3rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.user-avatar {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
  background: var(--accent-primary);
  border-radius: 9px;
  font-size: 0.78rem;
}
.user-identity {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.user-identity strong {
  font-size: 0.78rem;
  font-weight: 700;
}
.user-chip .btn-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--text-muted);
  border-left: 1px solid var(--border-color);
  border-radius: 0 8px 8px 0;
}
.user-chip .btn-icon:hover {
  color: var(--accent-danger);
  background: rgba(239, 68, 68, 0.12);
}
.user-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.45rem;
  margin-left: 0;
  font-size: 0.62rem;
  font-weight: 700;
  color: #ffffff;
  background: #fff4e6;
  color: #b45309;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-full);
  white-space: nowrap;
  box-shadow: none;
}
.user-role-badge i {
  font-size: 0.65rem;
}

/* Ví lượt chấm trên header */
.credit-wallet {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 40px;
  padding: 0.3rem 0.65rem 0.3rem 0.35rem;
  color: #065f46;
  background: linear-gradient(135deg, #ecfdf5, #f0fdfa);
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  white-space: nowrap;
  box-shadow: 0 5px 16px rgba(16, 185, 129, 0.09);
}
.credit-wallet-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
  background: linear-gradient(145deg, #10b981, #059669);
  border-radius: 9px;
  font-size: 0.78rem;
}
.credit-wallet-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.15;
}
.credit-wallet-info small {
  color: #4b7b6e;
  font-size: 0.58rem;
  font-weight: 600;
}
.credit-wallet-info strong {
  color: #065f46;
  font-size: 0.78rem;
  font-weight: 800;
}
.credit-wallet.unlimited .credit-wallet-info strong {
  font-size: 0.72rem;
}
.credit-wallet.warning {
  color: #92400e;
  background: linear-gradient(135deg, #fffbeb, #fff7ed);
  border-color: #fcd34d;
  box-shadow: 0 5px 16px rgba(245, 158, 11, 0.1);
}
.credit-wallet.warning .credit-wallet-icon {
  background: linear-gradient(145deg, #f59e0b, #d97706);
}
.credit-wallet.warning .credit-wallet-info small,
.credit-wallet.warning .credit-wallet-info strong {
  color: #92400e;
}
.credit-wallet.low {
  color: #991b1b;
  background: linear-gradient(135deg, #fff1f2, #fef2f2);
  border-color: #fca5a5;
  box-shadow: 0 5px 16px rgba(239, 68, 68, 0.1);
}
.credit-wallet.low .credit-wallet-icon {
  background: linear-gradient(145deg, #ef4444, #dc2626);
}
.credit-wallet.low .credit-wallet-info small,
.credit-wallet.low .credit-wallet-info strong {
  color: #991b1b;
}
/* Role badge trong bảng admin */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.role-badge.super {
  color: #ffffff;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
}
.role-badge.user {
  color: var(--text-secondary);
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid var(--border-color);
}

/* Tiêu đề card */
.card-header-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.card-header-title i {
  color: var(--accent-primary);
  font-size: 1.1rem;
}

.text-danger {
  color: var(--accent-danger);
}

/* Nút mã đăng ký Zalo */
.reg-code-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  border: 1px dashed rgba(6, 182, 212, 0.45);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.reg-code-btn:hover {
  background: rgba(6, 182, 212, 0.2);
  border-style: solid;
  transform: translateY(-1px);
}
.reg-code-btn i {
  font-size: 0.75rem;
}

/* ==========================================================================
   TAB NHÓM ZALO - mã đăng ký + hướng dẫn + danh sách nhóm
   ========================================================================== */
.zalo-page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
}
.zalo-page-intro > div { min-width: 0; }
.zalo-page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .65rem;
  padding: .34rem .68rem;
  border: 1px solid rgba(0, 104, 255, .18);
  border-radius: var(--radius-full);
  color: #0068ff;
  background: rgba(0, 104, 255, .07);
  font-size: .7rem;
  font-weight: 750;
}
.zalo-guide-link { flex: 0 0 auto; text-decoration: none; }

.zalo-onboarding-card {
  display: grid;
  grid-template-columns: minmax(280px, .78fr) minmax(0, 1.22fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
}
.zalo-contact-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem;
  color: #fff;
  background:
    radial-gradient(circle at 92% 8%, rgba(255,255,255,.22), transparent 28%),
    linear-gradient(145deg, #0759db 0%, #087dfa 55%, #05a8e8 100%);
}
.zalo-contact-panel::after {
  content: "";
  position: absolute;
  right: -46px;
  bottom: -54px;
  width: 150px;
  height: 150px;
  border: 24px solid rgba(255,255,255,.08);
  border-radius: 50%;
}
.zalo-contact-panel > * { position: relative; z-index: 1; }
.zalo-contact-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 15px;
  background: rgba(255,255,255,.17);
  box-shadow: 0 14px 30px rgba(0,58,164,.22);
  font-size: 1.18rem;
}
.zalo-contact-kicker { color: rgba(255,255,255,.78); font-size: .72rem; font-weight: 650; }
.zalo-contact-panel > strong {
  margin: .15rem 0 .45rem;
  font-size: clamp(1.55rem, 2.3vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: -.025em;
}
.zalo-contact-panel > p { max-width: 360px; color: rgba(255,255,255,.85); font-size: .82rem; line-height: 1.55; }
.zalo-contact-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
.zalo-contact-actions .btn { min-height: 42px; }
.zalo-contact-actions .btn-zalo { color: #0759db; background: #fff; box-shadow: 0 8px 20px rgba(0,45,130,.18); }
.zalo-contact-actions .btn-zalo:hover { color: #064dbc; background: #f4f9ff; }
.zalo-contact-actions .btn-secondary { color: #fff; border-color: rgba(255,255,255,.32); background: rgba(255,255,255,.12); }
.zalo-contact-actions .btn-secondary:hover { border-color: rgba(255,255,255,.6); background: rgba(255,255,255,.2); }

.zalo-setup-flow { padding: 1.75rem 2rem; background: var(--bg-surface); }
.zalo-flow-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.05rem; }
.zalo-flow-heading > span { color: var(--text-primary); font-size: .94rem; font-weight: 800; }
.zalo-flow-heading > small { color: var(--text-muted); font-size: .68rem; }
.zalo-flow-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.zalo-flow-item {
  display: flex;
  gap: .75rem;
  min-width: 0;
  padding: .9rem;
  border: 1px solid var(--border-color);
  border-radius: 13px;
  background: var(--bg-input);
}
.zalo-flow-num {
  display: grid;
  place-items: center;
  flex: 0 0 29px;
  width: 29px;
  height: 29px;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #086cf0, #4f46e5);
  font-size: .7rem;
  font-weight: 800;
  box-shadow: 0 7px 16px rgba(79,70,229,.2);
}
.zalo-flow-item:last-child .zalo-flow-num { background: linear-gradient(135deg, #10b981, #059669); }
.zalo-flow-item strong { display: block; margin: 1px 0 3px; color: var(--text-primary); font-size: .78rem; }
.zalo-flow-item p { color: var(--text-secondary); font-size: .69rem; line-height: 1.5; }

.reg-code-card { margin-top: 1.2rem; }
.reg-code-main {
  padding: 0.25rem 0.5rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  text-align: center;
}
.reg-code-display {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
  border: 2px dashed rgba(6, 182, 212, 0.4);
  border-radius: var(--radius-md);
  padding: 0.7rem 1.8rem;
  min-width: 260px;
}
.reg-code-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 480px;
}
.reg-code-warning {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  width: min(100%, 680px);
  margin-top: .15rem;
  padding: .9rem 1rem;
  border: 1px solid rgba(245, 158, 11, .32);
  border-radius: 14px;
  color: #78350f;
  background: linear-gradient(135deg, rgba(255, 251, 235, .98), rgba(255, 247, 237, .94));
  text-align: left;
}
.reg-code-warning-icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #b45309;
  background: rgba(245, 158, 11, .15);
}
.reg-code-warning strong {
  display: block;
  margin-bottom: .25rem;
  color: #92400e;
  font-size: .8rem;
}
.reg-code-warning p {
  color: #78350f;
  font-size: .74rem;
  line-height: 1.55;
}

[data-theme="dark"] .reg-code-warning {
  border-color: rgba(245, 158, 11, .28);
  color: #fde68a;
  background: rgba(120, 53, 15, .2);
}
[data-theme="dark"] .reg-code-warning strong,
[data-theme="dark"] .reg-code-warning p { color: #fde68a; }

/* Khối khoá khi chưa kích hoạt tính năng chấm thi (ẩn mã đăng ký) */
.reg-code-locked {
  padding: 1.5rem 1rem;
  text-align: center;
  border: 1px dashed var(--border-hover);
  border-radius: 14px;
  background: var(--bg-input);
}
.reg-code-locked-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto 0.75rem;
  border-radius: 16px;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  font-size: 1.4rem;
}
.reg-code-locked > strong {
  display: block;
  font-size: 1.02rem;
  color: var(--text-primary);
}
.reg-code-locked > p {
  max-width: 520px;
  margin: 0.5rem auto 1rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.55;
}

/* Giới hạn lượt chấm trong tab Nhóm Zalo */
.daily-limit-card-body {
  padding: 1rem 1.25rem 1.25rem;
}
.daily-limit-explainer {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid rgba(16,185,129,.2);
  border-radius: 13px;
  background: rgba(16,185,129,.055);
}
.daily-limit-explainer-icon {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: #059669;
  background: rgba(16,185,129,.13);
}
.daily-limit-explainer strong { display: block; margin-bottom: .22rem; color: var(--text-primary); font-size: .83rem; }
.daily-limit-explainer p { max-width: 850px; color: var(--text-secondary); font-size: .76rem; line-height: 1.55; }
.daily-limit-explainer small { display: block; margin-top: .42rem; color: var(--text-muted); font-size: .68rem; line-height: 1.5; }
.daily-limit-description {
  max-width: 660px;
  margin-bottom: 1rem;
  line-height: 1.65;
}
.daily-limit-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.daily-limit-label {
  width: 100%;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 700;
}
.daily-limit-input-group {
  display: flex;
  align-items: stretch;
  width: 160px;
  min-height: 44px;
  overflow: hidden;
  background: var(--bg-input);
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(30, 52, 87, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.daily-limit-input-group:hover {
  border-color: #a5b4fc;
}
.daily-limit-input-group:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
}
.daily-limit-input {
  width: 100%;
  min-width: 0;
  padding: 0.65rem 0.75rem;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
}
.daily-limit-unit {
  display: inline-flex;
  align-items: center;
  padding: 0 0.7rem;
  color: var(--text-secondary);
  background: rgba(148, 163, 184, 0.09);
  border-left: 1px solid var(--border-color);
  font-size: 0.76rem;
  font-weight: 600;
}
.daily-limit-form .btn {
  min-height: 44px;
  padding-inline: 1rem;
}
.daily-limit-status {
  color: var(--text-muted);
  font-size: 0.78rem;
}
.daily-usage-box {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  line-height: 1.7;
}

.group-management-note {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  margin: .8rem 1rem 0;
  padding: .82rem 1rem;
  border: 1px solid rgba(59,130,246,.16);
  border-radius: 12px;
  color: var(--text-secondary);
  background: rgba(59,130,246,.055);
  font-size: .72rem;
  line-height: 1.55;
}
.group-management-note > i { margin-top: .16rem; color: #3b82f6; }
.group-management-note strong { color: var(--text-primary); }

@media (max-width: 520px) {
  .zalo-page-intro { align-items: stretch; flex-direction: column; }
  .zalo-guide-link { justify-content: center; }
  .zalo-onboarding-card { grid-template-columns: 1fr; }
  .zalo-contact-panel, .zalo-setup-flow { padding: 1.25rem; }
  .zalo-flow-list { grid-template-columns: 1fr; }
  .zalo-flow-heading { align-items: flex-start; flex-direction: column; gap: .2rem; }
  .zalo-contact-actions { width: 100%; }
  .zalo-contact-actions .btn { flex: 1 1 150px; justify-content: center; }
  .daily-limit-input-group {
    flex: 1 1 150px;
  }
  .daily-limit-form .btn {
    flex: 0 0 auto;
  }
  .daily-limit-status {
    width: 100%;
  }
}

@media (min-width: 521px) and (max-width: 900px) {
  .zalo-onboarding-card { grid-template-columns: 1fr; }
  .zalo-contact-panel { min-height: 320px; }
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.5rem 0.25rem;
}
.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
}
.guide-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #ffffff;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  font-size: 0.9rem;
}
.guide-step strong {
  display: block;
  margin-bottom: 0.15rem;
}
.guide-step p {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.group-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.group-status.active {
  color: var(--accent-success);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.group-status.inactive {
  color: var(--accent-danger);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.group-status.running {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.group-status.done {
  color: var(--accent-success);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.empty-tip {
  padding: 0.9rem 1.5rem 1.2rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   HƯỚNG DẪN WEBHOOK (trong Super Admin)
   ========================================================================== */
.admin-subnav {
  margin-bottom: 1.2rem;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.admin-subnav .sub-tab {
  flex: 0 0 auto;
  white-space: nowrap;
}
.admin-sub-content .guide-card .card-header {
  padding-bottom: 0.9rem;
}
.guide-body {
  padding: 0.9rem 1.5rem 1.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.guide-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.45rem 0;
}
.guide-label {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 190px;
}
.guide-code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  word-break: break-all;
}
.guide-pre {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  margin: 0;
  overflow-x: auto;
}
.guide-note {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--accent-warning);
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--accent-warning);
  padding: 0.5rem 0.8rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.guide-ol {
  padding-left: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.guide-env-table th {
  font-size: 0.75rem;
}
.guide-env-table td {
  font-size: 0.82rem;
  padding: 0.55rem 0.8rem;
}
.guide-env-table code {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent-cyan);
}

/* Modal xem log webhook */
.debug-log-content {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  max-height: 58vh;
  overflow-y: auto;
  color: var(--text-secondary);
}

/* ==========================================================================
   TOAST NOTIFICATIONS (thông báo góc phải)
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: min(380px, calc(100vw - 2.4rem));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  box-shadow: var(--card-shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.45;
  pointer-events: auto;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
  animation: toast-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(110%); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast i {
  font-size: 1.05rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.toast.success {
  border-left-color: var(--accent-success);
}
.toast.success i {
  color: var(--accent-success);
}

.toast.error {
  border-left-color: var(--accent-danger);
}
.toast.error i {
  color: var(--accent-danger);
}

.toast.info {
  border-left-color: var(--accent-primary);
}
.toast.info i {
  color: var(--accent-primary);
}

/* Mobile: toast dàn ngang gần hết màn hình */
@media (max-width: 600px) {
  .toast-container {
    top: 0.8rem;
    right: 0.8rem;
    left: 0.8rem;
    max-width: none;
  }
}
@media (max-width: 1120px) {
  .system-status,
  .user-role-badge {
    display: none !important;
  }
}

@media (max-width: 720px) {
  .header-container {
    padding: 0.6rem 1rem 0;
    column-gap: 0.7rem;
  }
  .brand {
    gap: 0.6rem;
  }
  .brand-logo {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  .brand-text h1 {
    font-size: 0.92rem;
  }
  .brand-subtitle {
    display: none;
  }
  .user-chip #user-name {
    display: none;
  }
  .user-chip {
    gap: 0.35rem;
  }
  .credit-wallet {
    min-height: 36px;
    gap: 0.4rem;
    padding: 0.2rem 0.5rem 0.2rem 0.25rem;
  }
  .credit-wallet-icon {
    width: 28px;
    height: 28px;
  }
  .credit-wallet-info small {
    display: none;
  }
  .header-actions {
    gap: 0.4rem;
  }
  .theme-toggle-btn {
    width: 34px;
    height: 34px;
  }
  .nav-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    margin-top: 0.55rem;
  }
  .nav-tabs::-webkit-scrollbar {
    display: none;
  }
  .nav-tab {
    flex: 0 0 auto;
    padding: 0.52rem 0.8rem;
    font-size: 0.78rem;
  }
  .main-container {
    margin-top: 1.4rem;
    padding: 0 1rem;
  }
}

@media (max-width: 600px) {
  .brand-text {
    display: none;
  }
}

@media (max-width: 420px) {
  .credit-wallet-icon {
    display: none;
  }
  .credit-wallet {
    padding-inline: 0.5rem;
  }
}

/* ==================== NẠP LƯỢT QUA VIETQR ==================== */
.credit-topup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-left: 10px;
  min-height: 34px;
  padding: 7px 13px;
  border-radius: 10px;
  border: 0;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .25);
  font-size: .75rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
  white-space: nowrap;
}
.credit-topup-btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 9px 20px rgba(79, 70, 229, .34);
  transform: translateY(-1px);
}
.credit-topup-btn:active { transform: translateY(0); }
.credit-topup-btn i { font-size: .7rem; }

/* Nút Kích hoạt tính năng chấm thi — nổi bật hơn nút Nạp lượt */
.credit-topup-btn.activation-cta {
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  box-shadow: 0 6px 16px rgba(245, 158, 11, .3);
}
.credit-topup-btn.activation-cta:hover {
  box-shadow: 0 9px 20px rgba(249, 115, 22, .4);
}
.credit-topup-btn.activation-cta i { animation: activationPulse 2s ease-in-out infinite; }
@keyframes activationPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

#topup-modal {
  padding: 24px;
  background: rgba(15, 23, 42, .64);
  backdrop-filter: blur(8px);
}

.topup-modal-card {
  display: flex;
  flex-direction: column;
  width: min(920px, 100%);
  max-width: 920px;
  max-height: min(92vh, 820px);
  padding: 0;
  border-radius: 24px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  box-shadow: 0 32px 80px -22px rgba(15, 23, 42, .45);
  overflow: hidden;
}

.activation-modal-card {
  width: min(560px, 100%);
  max-width: 560px;
  border-radius: 20px;
  transition: width .22s ease, max-width .22s ease;
}
.activation-modal-card.is-payment-step {
  width: min(920px, 100%);
  max-width: 920px;
}
.activation-modal-card .topup-modal-header { padding: 18px 20px; }
.activation-modal-card .topup-modal-body { padding: 20px; }
.activation-modal-card .topup-title-icon { width: 40px; height: 40px; flex-basis: 40px; border-radius: 12px; }
.activation-modal-card .topup-title-row h3 { font-size: 1rem; }
.activation-price-card { align-items: center; padding: 13px 14px; border-radius: 14px; }
.activation-description { margin: 14px 1px 13px; color: var(--text-secondary); font-size: .76rem; line-height: 1.65; }
.activation-description strong { color: var(--text-primary); font-weight: 800; }
.activation-bonus-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 1px 13px;
  padding: 11px 13px;
  border: 1px solid rgba(16, 185, 129, .28);
  border-radius: 12px;
  background: rgba(16, 185, 129, .08);
  color: var(--text-secondary);
  font-size: .72rem;
  line-height: 1.55;
  text-align: left;
}
.activation-bonus-note i { margin-top: 2px; color: #059669; font-size: .9rem; }
.activation-bonus-note p { margin: 0; }
.activation-bonus-note strong { color: #059669; }
.activation-bonus-note #activation-bonus-units { color: #059669; font-weight: 800; }
.activation-step-choose .topup-primary-cta {
  justify-content: center;
  width: min(220px, 100%);
  min-height: 46px;
  margin-inline: auto;
}
.activation-step-choose .topup-primary-cta > i:last-child { display: none; }
.activation-step-choose .topup-secure-note { margin-top: 9px; }

.topup-modal-header {
  flex: 0 0 auto;
  padding: 22px 26px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, rgba(99, 102, 241, .055), transparent);
}

.topup-title-row { display: flex; align-items: center; gap: 13px; }
.topup-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow: 0 8px 20px rgba(79, 70, 229, .24);
}
.topup-title-row h3 { margin: 0 0 1px; font-size: 1.18rem; letter-spacing: -.02em; }
.topup-title-row .modal-subtitle { font-size: .78rem; color: var(--text-secondary); }
.topup-modal-body { flex: 1; min-height: 0; padding: 24px 26px 26px; overflow-y: auto; }

.topup-balance-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(16, 185, 129, .24);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, .09), rgba(16, 185, 129, .025));
}
.topup-balance-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #047857;
  background: rgba(16, 185, 129, .14);
}
.topup-balance-copy { display: flex; flex-direction: column; line-height: 1.35; }
.topup-balance-copy span { font-size: .72rem; color: var(--text-secondary); }
.topup-balance-copy strong { color: var(--text-primary); font-size: 1.02rem; }
.topup-balance-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: #059669;
  font-size: .74rem;
  font-weight: 700;
}

.topup-section-heading { display: flex; align-items: end; justify-content: space-between; margin: 22px 0 11px; }
.topup-section-heading h4 { font-size: .97rem; color: var(--text-primary); letter-spacing: -.015em; }
.topup-section-heading p { margin-top: 2px; color: var(--text-secondary); font-size: .76rem; }

.topup-packages {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.topup-pkg {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 112px;
  padding: 15px 14px;
  border-radius: 15px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
}
.topup-pkg:hover {
  border-color: rgba(99, 102, 241, .45);
  box-shadow: 0 10px 22px -14px rgba(79, 70, 229, .45);
  transform: translateY(-2px);
}
.topup-pkg.active {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12), 0 10px 24px -16px rgba(79, 70, 229, .55);
  background: linear-gradient(145deg, rgba(99, 102, 241, .12), rgba(99, 102, 241, .035));
}
.topup-pkg-check {
  position: absolute;
  top: 11px;
  right: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  color: transparent;
  background: var(--bg-input);
  font-size: .61rem;
}
.topup-pkg.active .topup-pkg-check { color: #fff; border-color: #6366f1; background: #6366f1; }
.topup-pkg-label { color: var(--text-secondary); font-size: .68rem; font-weight: 600; }
.topup-pkg strong { margin-top: 2px; font-size: 1.22rem; letter-spacing: -.025em; line-height: 1.15; }
.topup-pkg strong small { font-size: .69rem; color: var(--text-secondary); font-weight: 600; }
.topup-pkg .topup-pkg-price { margin-top: auto; color: #4f46e5; font-size: .8rem; font-weight: 800; }

.topup-custom-card {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: rgba(148, 163, 184, .045);
}
.topup-custom-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.topup-custom-heading label { color: var(--text-primary); font-size: .82rem; font-weight: 750; }
.topup-custom-heading > span { color: var(--text-secondary); font-size: .7rem; }
.topup-custom-layout { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 12px; }
.topup-units-field { position: relative; margin: 0; }
.topup-units-field input {
  height: 50px;
  padding-right: 54px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-input);
  font-size: .9rem;
  font-weight: 650;
}
.topup-units-field:focus-within input { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, .11); }
.topup-units-field.invalid input { border-color: var(--accent-danger); }
.topup-units-field > span {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: .72rem;
  font-weight: 650;
}

.topup-total {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  min-height: 50px;
  padding: 7px 13px;
  border: 1px solid rgba(99, 102, 241, .16);
  border-radius: 12px;
  background: rgba(99, 102, 241, .065);
  color: var(--text-secondary);
}
.topup-total span { font-size: .65rem; }
.topup-total strong { color: #4f46e5; font-size: 1.13rem; line-height: 1.25; letter-spacing: -.02em; }
#topup-error {
  display: flex;
  align-items: center;
  min-height: 18px;
  margin: 7px 2px 0;
  color: var(--accent-danger);
  font-size: .73rem;
  font-weight: 700;
}
#topup-error:not(:empty)::before {
  content: "\f06a";
  margin-right: 6px;
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

.topup-primary-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 58%, #7c3aed 100%);
  box-shadow: 0 12px 25px -10px rgba(79, 70, 229, .6);
  font-size: .83rem;
  font-weight: 800;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.topup-primary-cta span { display: inline-flex; align-items: center; gap: 9px; }
.topup-primary-cta:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 15px 30px -10px rgba(79, 70, 229, .68); }
.topup-primary-cta:disabled { opacity: .48; cursor: not-allowed; box-shadow: none; }
.topup-step-choose > .topup-primary-cta {
  justify-content: center;
  width: min(260px, 100%);
  min-height: 46px;
  margin: 18px auto 0;
  padding-inline: 22px;
}
.topup-step-choose > .topup-primary-cta > i:last-child { display: none; }

/* Banner webhook ngân hàng trên tab Admin */
.webhook-banner { margin-bottom: 1.1rem; }
.webhook-banner-body {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 0.9rem 1.1rem;
}
.webhook-banner-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--accent-success);
  background: rgba(16, 185, 129, 0.1);
  font-size: 1.15rem;
}
.webhook-banner-copy {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.webhook-banner-copy strong { font-size: 0.9rem; color: var(--text-primary); }
.webhook-banner-copy code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent-cyan);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.webhook-banner-copy small { font-size: 0.72rem; color: var(--text-muted); }

/* Trang lịch sử nạp lượt */
.topup-history-page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}
.topup-history-page-intro > div { min-width: 0; }
.topup-history-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: .55rem;
  padding: .35rem .7rem;
  border: 1px solid rgba(99,102,241,.2);
  border-radius: var(--radius-full);
  color: #4f46e5;
  background: rgba(99,102,241,.07);
  font-size: .7rem;
  font-weight: 750;
}
.topup-history-page-intro .btn { flex: 0 0 auto; min-height: 44px; }
.topup-history-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.topup-history-stat {
  display: flex;
  align-items: center;
  gap: .9rem;
  min-width: 0;
  padding: 1.15rem;
  border-radius: 16px;
}
.topup-history-stat-icon {
  display: grid;
  place-items: center;
  flex: 0 0 43px;
  width: 43px;
  height: 43px;
  border-radius: 13px;
  font-size: .98rem;
}
.topup-history-stat-icon.is-units { color: #4f46e5; background: rgba(99,102,241,.12); }
.topup-history-stat-icon.is-money { color: #0891b2; background: rgba(6,182,212,.12); }
.topup-history-stat-icon.is-success { color: #059669; background: rgba(16,185,129,.12); }
.topup-history-stat-icon.is-pending { color: #d97706; background: rgba(245,158,11,.13); }
.topup-history-stat > div { min-width: 0; }
.topup-history-stat small { display: block; margin-bottom: 2px; color: var(--text-muted); font-size: .68rem; font-weight: 650; }
.topup-history-stat strong { color: var(--text-primary); font-size: 1.3rem; line-height: 1.2; letter-spacing: -.025em; }
.topup-history-stat div > span { margin-left: 4px; color: var(--text-secondary); font-size: .65rem; font-weight: 650; }

.topup-history-page-card { padding: 0; overflow: hidden; }
.topup-history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border-color);
}
.topup-history-search { width: min(380px, 100%); }
.topup-history-toolbar-actions { display: flex; align-items: center; gap: .65rem; }
.topup-history-toolbar-actions select {
  min-height: 40px;
  padding: 0 2.2rem 0 .8rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  background: var(--bg-input);
  font-size: .75rem;
  font-weight: 650;
  outline: 0;
}
.topup-history-toolbar-actions select:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.topup-history-table td { vertical-align: middle; }
.topup-user-cell strong { display: block; font-weight: 650; color: var(--text-primary); white-space: nowrap; }
.topup-user-cell small { display: block; margin-top: 3px; color: var(--text-muted); font-size: .72rem; white-space: nowrap; }
.topup-transaction-date { display: block; color: var(--text-primary); font-weight: 650; white-space: nowrap; }
.topup-history-table td small { display: block; margin-top: 3px; color: var(--text-muted); font-size: .65rem; white-space: nowrap; }
.topup-transaction-code {
  display: inline-flex;
  padding: .34rem .55rem;
  border: 1px dashed rgba(6,182,212,.4);
  border-radius: 8px;
  color: #0891b2;
  background: rgba(6,182,212,.065);
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 750;
}
.topup-transaction-units { color: #4f46e5; }
.topup-transaction-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: .32rem .62rem;
  border: 1px solid;
  border-radius: var(--radius-full);
  font-size: .68rem;
  font-weight: 750;
  white-space: nowrap;
}
.topup-transaction-status.paid { color: #059669; border-color: rgba(16,185,129,.3); background: rgba(16,185,129,.09); }
.topup-transaction-status.pending { color: #d97706; border-color: rgba(245,158,11,.32); background: rgba(245,158,11,.1); }
.topup-transaction-status.expired { color: #dc2626; border-color: rgba(239,68,68,.28); background: rgba(239,68,68,.08); }
.topup-history-empty { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: 2rem; color: var(--text-muted); }
.topup-history-empty i { margin-bottom: .35rem; color: #94a3b8; font-size: 1.5rem; }
.topup-history-empty strong { color: var(--text-primary); font-size: .85rem; }
.topup-history-empty span { font-size: .7rem; }
.topup-history-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.2rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: .7rem;
}
.topup-history-pagination > div { display: flex; gap: .5rem; }
.topup-history-pagination .btn:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 920px) {
  .topup-history-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .topup-history-page-intro, .topup-history-toolbar { align-items: stretch; flex-direction: column; }
  .topup-history-page-intro .btn { justify-content: center; }
  .topup-history-stats { grid-template-columns: 1fr; }
  .topup-history-toolbar-actions { align-items: stretch; flex-direction: column; }
  .topup-history-toolbar-actions select, .topup-history-toolbar-actions .btn { width: 100%; }
  .topup-history-pagination { align-items: stretch; flex-direction: column; }
  .topup-history-pagination > div { display: grid; grid-template-columns: repeat(2, 1fr); }
  .topup-history-pagination .btn { justify-content: center; }
}
.topup-secure-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: .68rem;
}
.topup-secure-note i { color: #10b981; }

.topup-payment-layout {
  display: grid;
  grid-template-columns: minmax(260px, .82fr) minmax(0, 1.18fr);
  gap: 20px;
  align-items: stretch;
}
.topup-qr-panel,
.topup-transfer-panel {
  border: 1px solid var(--border-color);
  border-radius: 19px;
}
.topup-qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: linear-gradient(160deg, rgba(99, 102, 241, .085), rgba(6, 182, 212, .035));
  text-align: center;
}
.topup-panel-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 13px;
  color: var(--text-primary);
  font-size: .76rem;
  font-weight: 750;
}
.topup-panel-kicker i { color: #4f46e5; }

.topup-qr-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(238px, 100%);
  aspect-ratio: 1;
  padding: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 35px -20px rgba(15, 23, 42, .42);
}
.topup-qr-box svg,
.topup-qr-image { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.topup-qr-loading { color: var(--text-muted); font-size: .9rem; }
.topup-qr-hint { max-width: 270px; margin: 12px 0 0; color: var(--text-secondary); font-size: .69rem; line-height: 1.55; }

.topup-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  margin-top: auto;
  padding: 10px 11px;
  border: 1px solid rgba(245, 158, 11, .24);
  border-radius: 11px;
  color: #b45309;
  background: rgba(245, 158, 11, .09);
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.4;
}

/* Panel báo thanh toán thành công (check AJAX phát hiện giao dịch đã paid) */
.topup-success-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 100%;
  margin-top: auto;
  padding: 17px 15px;
  border: 1px solid rgba(16, 185, 129, .3);
  border-radius: 15px;
  background: linear-gradient(160deg, rgba(16, 185, 129, .12), rgba(6, 182, 212, .05));
  text-align: center;
}
.topup-success-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #10b981, #0d9488);
  font-size: 1.4rem;
  box-shadow: 0 10px 24px -10px rgba(16, 185, 129, .65);
  animation: topup-success-pop .45s cubic-bezier(.2, .8, .2, 1) both;
}
.topup-success-panel h4 { margin: 0; font-size: .95rem; color: #065f46; }
.topup-success-text { margin: 0; font-size: .78rem; color: var(--text-primary); }
.topup-success-text strong { color: #059669; }
.topup-success-sub { margin: 0; font-size: .68rem; color: var(--text-secondary); }
.topup-success-btn {
  width: 100%;
  margin-top: 7px;
  padding: .62rem 1rem;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, #10b981, #0d9488);
  font-size: .76rem;
  font-weight: 750;
  cursor: pointer;
  transition: filter .15s ease;
}
.topup-success-btn:hover { filter: brightness(1.08); color: #fff; }
@keyframes topup-success-pop {
  from { opacity: 0; transform: scale(.4); }
  to { opacity: 1; transform: scale(1); }
}

.topup-transfer-panel { padding: 20px; background: var(--bg-input); }
.topup-payment-summary {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}
.topup-payment-summary > span { color: var(--text-secondary); font-size: .73rem; }
.topup-amount { grid-row: span 2; color: #4f46e5; font-size: 1.65rem; font-weight: 850; line-height: 1.15; letter-spacing: -.035em; }
.topup-count { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: var(--text-secondary); font-size: .72rem; }
.topup-count i { color: #6366f1; }

.topup-transfer-heading { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 8px; }
.topup-transfer-heading h4 { font-size: .82rem; color: var(--text-primary); }
.topup-transfer-heading span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #059669;
  font-size: .64rem;
  font-weight: 750;
}

.topup-bank {
  display: grid;
  gap: 0;
  padding: 2px 13px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: rgba(148, 163, 184, .04);
}
.topup-bank div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border-color); font-size: .71rem; }
.topup-bank div:last-child { border-bottom: 0; }
.topup-bank span { color: var(--text-secondary); }
.topup-bank strong { max-width: 62%; color: var(--text-primary); text-align: right; overflow-wrap: anywhere; }

.topup-content { margin-top: 13px; }
.topup-content > span { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; color: var(--text-secondary); font-size: .68rem; }
.topup-content > span strong { color: #dc2626; font-size: .61rem; text-transform: uppercase; letter-spacing: .025em; }
.topup-content-row { display: flex; gap: 8px; align-items: center; }
.topup-content-row code {
  flex: 1;
  min-width: 0;
  padding: 10px 11px;
  border: 1px dashed rgba(99, 102, 241, .42);
  border-radius: 10px;
  color: #4338ca;
  background: rgba(99, 102, 241, .075);
  font-size: .8rem;
  font-weight: 850;
  letter-spacing: .045em;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topup-copy-btn {
  min-height: 39px;
  padding: 0 12px;
  border: 1px solid rgba(99, 102, 241, .22);
  border-radius: 10px;
  color: #4f46e5;
  background: rgba(99, 102, 241, .08);
  font-size: .7rem;
  font-weight: 800;
}
.topup-copy-btn:hover { background: rgba(99, 102, 241, .14); }

.topup-important-note {
  display: flex;
  gap: 9px;
  margin-top: 13px;
  padding: 10px 11px;
  border-radius: 11px;
  color: #1d4ed8;
  background: rgba(59, 130, 246, .075);
  font-size: .66rem;
  line-height: 1.48;
}
.topup-important-note i { margin-top: 2px; }

.topup-steps { display: grid; gap: 7px; margin: 13px 0 0; padding: 0; list-style: none; }
.topup-steps li { display: flex; align-items: flex-start; gap: 9px; color: var(--text-secondary); font-size: .66rem; line-height: 1.45; }
.topup-steps li > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 7px;
  color: #4f46e5;
  background: rgba(99, 102, 241, .1);
  font-size: .62rem;
  font-weight: 850;
}
.topup-steps li strong { color: var(--text-primary); }

.topup-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding: 8px 0;
  border: 0;
  color: var(--text-secondary);
  background: transparent;
  font-size: .69rem;
  font-weight: 750;
}
.topup-back-btn:hover { color: #4f46e5; }

body.dark-theme .topup-balance-icon,
body.dark-theme .topup-total strong,
body.dark-theme .topup-pkg .topup-pkg-price,
body.dark-theme .topup-amount,
body.dark-theme .topup-content-row code { color: #a5b4fc; }
body.dark-theme .topup-status { color: #fbbf24; }
body.dark-theme .topup-important-note { color: #93c5fd; }

@media (max-width: 760px) {
  #topup-modal { align-items: flex-end; padding: 0; }
  .topup-modal-card { width: 100%; max-height: 94vh; border-radius: 24px 24px 0 0; }
  .topup-modal-header { padding: 18px 18px; }
  .topup-modal-body { padding: 18px; }
  .topup-packages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topup-payment-layout { grid-template-columns: 1fr; }
  .topup-qr-panel { min-height: 390px; }
  .topup-custom-layout { grid-template-columns: 1fr 150px; }
}

@media (max-width: 480px) {
  .topup-title-icon { width: 38px; height: 38px; flex-basis: 38px; }
  .topup-title-row h3 { font-size: 1rem; }
  .topup-balance-note { display: none; }
  .topup-custom-layout { grid-template-columns: 1fr; }
  .topup-total { align-items: flex-start; }
  .topup-content-row { align-items: stretch; flex-direction: column; }
  .topup-copy-btn { justify-content: center; }
  .credit-topup-btn { margin-left: 6px; padding-inline: 10px; }
}

/* ==========================================================================
   AUTH EXPERIENCE — SPLIT SCREEN
   ========================================================================== */
.auth-screen {
  padding: 20px;
  background:
    radial-gradient(circle at 8% 88%, rgba(236, 72, 153, .13), transparent 27%),
    radial-gradient(circle at 92% 8%, rgba(99, 102, 241, .16), transparent 29%),
    #f5f7fb;
}
.auth-screen .bg-glow { display: none; }
.auth-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(430px, .92fr);
  width: 100%;
  max-width: 1120px;
  min-height: min(680px, calc(100vh - 40px));
  max-height: calc(100vh - 40px);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 35px 90px -34px rgba(15, 23, 42, .42);
  overflow: hidden;
  transform: translateY(16px) scale(.985);
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
}
.auth-screen.visible .auth-shell { transform: translateY(0) scale(1); }

.auth-showcase {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 34px 38px 28px;
  color: #fff;
  background:
    radial-gradient(circle at 85% 16%, rgba(129, 140, 248, .52), transparent 30%),
    radial-gradient(circle at 10% 90%, rgba(14, 165, 233, .22), transparent 28%),
    linear-gradient(145deg, #111b4b 0%, #283593 50%, #4f46e5 100%);
  overflow: hidden;
}
.auth-showcase::before,
.auth-showcase::after {
  content: "";
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
}
.auth-showcase::before { width: 300px; height: 300px; top: -168px; right: -90px; box-shadow: 0 0 0 45px rgba(255,255,255,.025), 0 0 0 90px rgba(255,255,255,.018); }
.auth-showcase::after { width: 220px; height: 220px; bottom: -145px; left: -85px; box-shadow: 0 0 0 38px rgba(255,255,255,.02); }
.auth-showcase-brand,
.auth-mobile-brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.auth-showcase-brand { align-self: flex-start; }
.auth-showcase-brand > span:last-child,
.auth-mobile-brand > span:last-child { display: flex; flex-direction: column; line-height: 1.22; }
.auth-showcase-brand strong,
.auth-mobile-brand strong { font-size: .88rem; font-weight: 800; letter-spacing: -.015em; }
.auth-showcase-brand small { color: rgba(255,255,255,.62); font-size: .6rem; }
.auth-mobile-brand small { color: var(--text-secondary); font-size: .6rem; }
.auth-showcase-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #7c6df2, #5b5eea);
  box-shadow: 0 12px 25px -12px rgba(0,0,0,.55);
  font-size: .95rem;
}
.auth-showcase-content { display: flex; flex: 1; flex-direction: column; justify-content: center; width: 100%; max-width: 510px; margin: 18px auto 12px; }
.auth-trust-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px;
  color: #c7d2fe;
  background: rgba(255,255,255,.075);
  font-size: .62rem;
  font-weight: 750;
}
.auth-trust-badge i { color: #fbbf24; }
.auth-showcase-content h1 { margin: 14px 0 8px; font-family: var(--font-display); font-size: clamp(2rem, 3.3vw, 2.8rem); font-weight: 800; line-height: 1.08; letter-spacing: -.045em; }
.auth-showcase-content > p { max-width: 490px; color: rgba(226,232,240,.82); font-size: .78rem; line-height: 1.7; }

.auth-demo-card { width: 100%; margin-top: 20px; padding: 14px; border: 1px solid rgba(255,255,255,.14); border-radius: 18px; background: rgba(255,255,255,.1); box-shadow: 0 20px 45px -25px rgba(0,0,0,.55); backdrop-filter: blur(14px); }
.auth-demo-head { display: flex; align-items: center; gap: 9px; padding-bottom: 11px; border-bottom: 1px solid rgba(255,255,255,.11); }
.auth-demo-zalo { display: inline-flex; align-items: center; justify-content: center; width: 31px; height: 31px; border-radius: 9px; color: #fff; background: #168aff; font-size: .72rem; font-weight: 900; }
.auth-demo-head > div { display: flex; flex-direction: column; line-height: 1.3; }
.auth-demo-head strong { font-size: .68rem; }
.auth-demo-head small { color: rgba(226,232,240,.62); font-size: .52rem; }
.auth-demo-online { width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52,211,153,.14); }
.auth-demo-message { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; }
.auth-demo-message > span { display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; flex: 0 0 27px; border-radius: 8px; color: #fff; background: rgba(255,255,255,.14); font-size: .52rem; font-weight: 800; }
.auth-demo-message p,
.auth-demo-message > div { padding: 8px 10px; border-radius: 5px 11px 11px; background: rgba(255,255,255,.1); font-size: .61rem; }
.auth-demo-message.bot > span { color: #ddd6fe; background: rgba(139,92,246,.24); }
.auth-demo-message.bot > div { flex: 1; }
.auth-demo-message.bot strong { display: block; margin-bottom: 6px; font-size: .63rem; }
.auth-demo-scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.auth-demo-scores b { display: flex; flex-direction: column; padding: 6px; border-radius: 7px; color: rgba(226,232,240,.68); background: rgba(15,23,42,.2); font-size: .49rem; }
.auth-demo-scores em { color: #86efac; font-size: .65rem; font-style: normal; }
.auth-demo-message.bot small { display: block; margin-top: 6px; color: #a7f3d0; font-size: .51rem; }
.auth-benefits { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 13px; }
.auth-benefits > div { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 12px; background: rgba(255,255,255,.065); }
.auth-benefits > div > i { color: #c4b5fd; font-size: .72rem; }
.auth-benefits span { display: flex; flex-direction: column; line-height: 1.35; }
.auth-benefits strong { font-size: .58rem; }
.auth-benefits small { color: rgba(226,232,240,.58); font-size: .5rem; }
.auth-showcase-footer { display: flex; align-items: center; gap: 5px; color: rgba(226,232,240,.55); font-size: .52rem; }
.auth-showcase-footer a { color: rgba(255,255,255,.84); font-weight: 700; text-decoration: none; }
.auth-showcase-footer a:hover { color: #fff; text-decoration: underline; }

.auth-panel { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 24px 32px 28px; color: var(--text-primary); background: var(--bg-surface); overflow-y: auto; }
.auth-panel-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-secure-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid rgba(16,185,129,.18); border-radius: 999px; color: #047857; background: rgba(16,185,129,.07); font-size: .58rem; font-weight: 750; }
.auth-panel .auth-back-home { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--text-secondary); font-size: .64rem; font-weight: 700; text-decoration: none; }
.auth-panel .auth-back-home:hover { color: #4f46e5; }

.auth-panel .auth-card { width: 100%; max-width: 400px; margin: auto; padding: 28px 0 8px; border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; transform: none; }
.auth-screen.visible .auth-card { transform: none; }
.auth-mobile-brand { display: none; margin-bottom: 24px; }
.auth-mobile-brand .auth-showcase-logo { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.auth-heading { margin-bottom: 20px; }
.auth-heading-kicker { display: block; margin-bottom: 4px; color: #4f46e5; font-size: .65rem; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.auth-heading h2 { font-family: var(--font-display); color: var(--text-primary); font-size: 1.65rem; font-weight: 800; letter-spacing: -.035em; line-height: 1.2; }
.auth-heading p { max-width: 360px; margin-top: 6px; color: var(--text-secondary); font-size: .72rem; line-height: 1.55; }

.auth-panel .auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 20px; padding: 4px; border: 1px solid var(--border-color); border-radius: 13px; background: rgba(148,163,184,.08); }
.auth-panel .auth-tab { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 7px 10px; border: 0; border-radius: 9px; color: var(--text-secondary); background: transparent; font-family: var(--font-main); font-size: .7rem; font-weight: 750; cursor: pointer; }
.auth-panel .auth-tab.active { color: #4338ca; background: var(--bg-input); box-shadow: 0 5px 14px -9px rgba(15,23,42,.4), 0 0 0 1px rgba(99,102,241,.1); }
.auth-panel .auth-tab:focus { outline: none; }
.auth-panel .auth-tab:focus-visible { box-shadow: 0 0 0 3px rgba(99,102,241,.16); }
.auth-panel .auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-panel .auth-field label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; color: var(--text-primary); font-size: .69rem; font-weight: 750; }
.auth-panel .auth-field label > span { color: var(--text-muted); font-size: .55rem; font-weight: 600; }
.auth-panel .auth-field .input-with-icon { position: relative; margin: 0; }
.auth-panel .auth-field .input-with-icon > i:first-child { left: 14px; color: #94a3b8; font-size: .73rem; }
.auth-panel .auth-field .input-with-icon input { height: 46px; padding: 0 42px; border: 1px solid var(--border-color); border-radius: 11px; color: var(--text-primary); background: var(--bg-input); font-size: .72rem; font-weight: 550; }
.auth-panel .auth-field .input-with-icon input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.auth-panel .auth-field .input-with-icon:focus-within > i:first-child { color: #4f46e5; }
.auth-password-field input { padding-right: 44px !important; }
.auth-password-toggle { position: absolute; top: 50%; right: 8px; display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; transform: translateY(-50%); border: 0; border-radius: 8px; color: var(--text-muted); background: transparent; line-height: 1; cursor: pointer; }
.auth-password-toggle > i { position: static; display: block; width: 1.1em; color: currentColor; font-size: .92rem; line-height: 1; text-align: center; }
.auth-password-toggle:hover { color: #4f46e5; background: rgba(99,102,241,.07); }
.auth-password-toggle:focus-visible { outline: none; color: #4338ca; background: rgba(99,102,241,.08); box-shadow: 0 0 0 3px rgba(99,102,241,.14); }
.auth-password-hint { display: flex; align-items: center; gap: 5px; margin-top: 5px; color: var(--text-muted); font-size: .55rem; }
.auth-password-hint[hidden] { display: none; }
.auth-panel .auth-error:empty { display: none; }
.auth-panel .auth-error:not(:empty) { display: flex; align-items: flex-start; gap: 7px; margin: 0; padding: 9px 11px; border: 1px solid rgba(239,68,68,.16); border-radius: 10px; color: #b42318; background: #fff5f5; font-size: .65rem; font-weight: 700; line-height: 1.45; text-align: left; }
.auth-panel .auth-error:not(:empty)::before { content: "\f06a"; margin-top: 1px; font-family: "Font Awesome 6 Free"; font-weight: 900; }
.auth-submit-btn { display: inline-flex; align-items: center; justify-content: center; align-self: center; gap: 9px; width: auto; min-width: 184px; min-height: 46px; margin-top: 3px; padding: 0 26px; border: 0; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #4f46e5, #6366f1 58%, #7c3aed); box-shadow: 0 12px 24px -12px rgba(79,70,229,.65); font-size: .73rem; font-weight: 800; }
.auth-submit-btn > span { display: inline-flex; align-items: center; gap: 8px; }
.auth-submit-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 15px 28px -12px rgba(79,70,229,.72); }
.auth-submit-btn:disabled { opacity: .58; cursor: wait; }
.auth-panel .auth-footnote { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px 14px; margin-top: 18px; color: var(--text-muted); font-size: .54rem; text-align: center; }
.auth-panel .auth-footnote span { display: inline-flex; align-items: center; gap: 5px; }
.auth-panel .auth-footnote i { margin: 0; color: #10b981; }

body.dark-theme .auth-screen { background: #070b14; }
body.dark-theme .auth-shell { border-color: rgba(255,255,255,.08); background: #0b0f19; }
body.dark-theme .auth-secure-chip { color: #34d399; }
body.dark-theme .auth-panel .auth-tab.active { color: #c7d2fe; }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; width: min(560px, 100%); min-height: auto; }
  .auth-showcase { display: none; }
  .auth-panel { min-height: min(680px, calc(100vh - 40px)); padding: 24px 36px 30px; }
  .auth-panel .auth-card { max-width: 420px; }
  .auth-mobile-brand { display: inline-flex; }
}

@media (max-width: 640px) {
  .auth-screen { align-items: stretch; min-height: 100dvh; padding: 0; background: var(--bg-surface); }
  .auth-shell { width: 100%; min-height: 100dvh; max-height: none; border: 0; border-radius: 0; box-shadow: none; }
  .auth-panel { min-height: 100dvh; padding: max(18px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); overflow-y: visible; }
  .auth-panel-top { margin-bottom: 18px; }
  .auth-secure-chip { display: none; }
  .auth-panel .auth-back-home { min-height: 40px; font-size: .76rem; }
  .auth-panel .auth-card { max-width: 100%; margin: 0 auto; padding: 6px 0 12px; }
  .auth-mobile-brand { margin-bottom: 19px; }
  .auth-mobile-brand strong { font-size: .98rem; }
  .auth-mobile-brand small { font-size: .68rem; }
  .auth-showcase-logo { width: 44px; height: 44px; flex-basis: 44px; }
  .auth-heading { margin-bottom: 17px; }
  .auth-heading-kicker { font-size: .7rem; }
  .auth-heading h2 { font-size: 1.65rem; }
  .auth-heading p { margin-top: 7px; font-size: .84rem; line-height: 1.55; }
  .auth-panel .auth-tabs { margin-bottom: 18px; padding: 4px; border-radius: 14px; }
  .auth-panel .auth-tab { min-height: 44px; font-size: .82rem; }
  .auth-panel .auth-form { gap: 14px; }
  .auth-panel .auth-field label { margin-bottom: 7px; font-size: .82rem; }
  .auth-panel .auth-field label > span { font-size: .68rem; }
  .auth-panel .auth-field .input-with-icon > i:first-child { left: 15px; font-size: .86rem; }
  .auth-panel .auth-field .input-with-icon input { height: 52px; padding-left: 44px; border-radius: 13px; font-size: 1rem; }
  .auth-password-toggle { right: 9px; width: 36px; height: 36px; }
  .auth-password-hint { margin-top: 7px; font-size: .68rem; line-height: 1.45; }
  .auth-panel .auth-error:not(:empty) { padding: 10px 12px; font-size: .76rem; }
  .auth-submit-btn { min-width: 190px; min-height: 50px; border-radius: 13px; font-size: .84rem; }
  .auth-panel .auth-footnote { gap: 7px 14px; margin-top: 17px; font-size: .66rem; line-height: 1.45; }
}

@media (max-width: 360px) {
  .auth-panel { padding-inline: 14px; }
  .auth-secure-chip { display: none; }
  .auth-heading h2 { font-size: 1.5rem; }
  .auth-panel .auth-footnote { align-items: flex-start; flex-direction: column; }
}


/* ===== Ghi nhớ thiết bị (màn đăng nhập) ===== */
.auth-remember-field { align-self: center; width: min(100%, 330px); margin-top: 0; }
.auth-panel .auth-field label.auth-remember { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; justify-content: initial; gap: .65rem; width: 100%; margin: 0; padding: 2px 0; text-align: left; cursor: pointer; }
.auth-remember input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; margin-top: .1rem; accent-color: #6366f1; cursor: pointer; }
.auth-remember strong { display: block; color: var(--text-primary); font-size: .78rem; font-weight: 700; text-align: left; }
.auth-remember small { display: block; margin-top: .12rem; color: var(--text-muted); font-size: .66rem; line-height: 1.4; text-align: left; }


/* ===== Quản trị job Zalo ===== */
.job-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.job-stat { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; border: 1px solid var(--border-color); border-radius: 14px; background: var(--bg-card); }
.job-stat-icon { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 11px; font-size: .85rem; }
.job-stat-icon.stuck { color: #b45309; background: rgba(245,158,11,.15); }
.job-stat-icon.pending { color: #6366f1; background: rgba(99,102,241,.13); }
.job-stat-icon.running { color: #0284c7; background: rgba(2,132,199,.13); }
.job-stat-icon.error { color: #dc2626; background: rgba(220,38,38,.13); }
.job-stat-icon.done { color: #15a85f; background: rgba(21,168,95,.13); }
.job-stat small { display: block; color: var(--text-muted); font-size: .7rem; font-weight: 600; }
.job-stat strong { display: block; margin-top: .1rem; color: var(--text-primary); font-size: 1.15rem; font-weight: 800; }
#admin-jobs-table tr.job-row-stuck { background: rgba(245,158,11,.07); }
#admin-jobs-table tr.job-row-stuck td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.job-wait { color: #b45309; font-size: .72rem; font-weight: 700; }
.job-err { display: block; max-width: 260px; overflow: hidden; color: var(--accent-danger); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.job-actions { display: flex; gap: .35rem; flex-wrap: wrap; }


/* ===== Tab Giới thiệu ===== */
.referral-hero { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 2rem; margin-bottom: 1rem; padding: 1.75rem 2rem; border: 1px solid rgba(99,102,241,.13); border-radius: 22px; background: linear-gradient(135deg,rgba(255,255,255,.98),rgba(238,242,255,.9)); box-shadow: 0 18px 50px -38px rgba(49,46,129,.55); overflow: hidden; }
.referral-hero::after { content: ""; position: absolute; z-index: -1; top: -105px; right: 18%; width: 260px; height: 260px; border: 46px solid rgba(99,102,241,.055); border-radius: 50%; }
.referral-eyebrow { display: inline-flex; align-items: center; gap: .45rem; margin-bottom: .75rem; color: #4f46e5; font-size: .7rem; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.referral-hero h2 { color: var(--text-primary); font-size: clamp(1.75rem,3vw,2.45rem); font-weight: 850; line-height: 1.12; letter-spacing: -.045em; }
.referral-hero h2 span { color: #5b55ea; }
.referral-hero-copy > p { max-width: 720px; margin-top: .75rem; color: var(--text-secondary); font-size: .88rem; line-height: 1.65; }
.referral-reward-card { display: flex; align-items: center; gap: .85rem; min-width: 245px; padding: 1rem 1.1rem; border: 1px solid rgba(16,185,129,.18); border-radius: 18px; background: rgba(236,253,245,.88); box-shadow: 0 14px 30px -24px rgba(5,150,105,.5); }
.referral-reward-icon { display: grid; place-items: center; flex: 0 0 50px; width: 50px; height: 50px; border-radius: 15px; color: #fff; background: linear-gradient(145deg,#10b981,#059669); box-shadow: 0 12px 22px -13px rgba(5,150,105,.8); font-size: 1.1rem; }
.referral-reward-card > div { display: flex; flex-direction: column; }
.referral-reward-card small { color: #047857; font-size: .65rem; font-weight: 700; }
.referral-reward-card strong { margin-top: .1rem; color: #064e3b; font-size: 1.25rem; line-height: 1.1; }
.referral-reward-card strong b { font-size: 1.75rem; }
.referral-reward-card > div > span { margin-top: .15rem; color: #059669; font-size: .68rem; font-weight: 650; }

.referral-share-card { padding: 1.4rem 1.5rem; border-radius: 20px; }
.referral-share-head,.referral-share-head > div { display: flex; align-items: center; gap: .8rem; }
.referral-share-head { justify-content: space-between; }
.referral-share-head h3 { color: var(--text-primary); font-size: 1rem; font-weight: 800; }
.referral-share-head p { margin-top: .15rem; color: var(--text-muted); font-size: .72rem; }
.referral-section-icon { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 13px; color: #fff; background: linear-gradient(145deg,#6366f1,#8b5cf6); box-shadow: 0 10px 18px -13px rgba(79,70,229,.7); }
.referral-section-icon.small { flex-basis: 36px; width: 36px; height: 36px; border-radius: 11px; font-size: .8rem; }
.referral-private-note { display: inline-flex; align-items: center; gap: .4rem; padding: .42rem .65rem; border: 1px solid rgba(16,185,129,.16); border-radius: 999px; color: #047857; background: rgba(16,185,129,.07); font-size: .64rem; font-weight: 700; white-space: nowrap; }
.referral-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: .9rem; margin: 1.25rem 0; padding: 1rem 1.1rem; border-radius: 16px; background: rgba(99,102,241,.045); }
.referral-flow > div { display: flex; align-items: center; gap: .65rem; }
.referral-flow > div > span { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; border: 1px solid rgba(99,102,241,.2); border-radius: 50%; color: #4f46e5; background: #fff; font-size: .68rem; font-weight: 850; }
.referral-flow p { display: flex; flex-direction: column; }
.referral-flow strong { color: var(--text-primary); font-size: .72rem; }
.referral-flow small { margin-top: .12rem; color: var(--text-muted); font-size: .61rem; }
.referral-flow > i { color: #c7d2fe; font-size: .65rem; }
.referral-link-panel { padding: 1rem; border: 1px solid var(--border-color); border-radius: 16px; background: rgba(248,250,252,.72); }
.referral-link-panel > label { display: block; margin-bottom: .5rem; color: var(--text-primary); font-size: .7rem; font-weight: 750; }
.ref-link-box { position: relative; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: .55rem; }
.ref-link-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #4f46e5; background: rgba(99,102,241,.1); }
.ref-link-box input { width: 100%; min-width: 0; height: 44px; padding: 0 .9rem; border: 1px solid var(--border-color); border-radius: 11px; color: var(--text-primary); background: var(--bg-input); font-family: var(--font-main); font-size: .76rem; }
.ref-copy-btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-width: 138px; height: 44px; padding-inline: 1rem; border-radius: 11px; white-space: nowrap; }
.ref-copy-btn.copied { background: linear-gradient(135deg,#10b981,#059669); box-shadow: 0 10px 22px -14px rgba(5,150,105,.8); }
.ref-copy-status { min-height: 1rem; margin: .48rem 0 0 47px; color: var(--text-muted); font-size: .62rem; line-height: 1.4; }
.referral-code-note { display: flex; align-items: flex-start; gap: .55rem; margin-top: .85rem; padding: .75rem .85rem; border-radius: 12px; color: #475569; background: rgba(14,165,233,.06); font-size: .67rem; line-height: 1.5; }
.referral-code-note > i { margin-top: .15rem; color: #0284c7; }
.referral-stats { grid-template-columns: repeat(4,minmax(0,1fr)); margin: 1rem 0 0; }
.referral-stats .job-stat { min-height: 78px; background: rgba(255,255,255,.88); box-shadow: 0 12px 28px -25px rgba(15,23,42,.45); }
.referral-history-card { margin-top: 1rem; border-radius: 20px; }
.referral-history-subtitle { margin-top: .1rem; color: var(--text-muted); font-size: .66rem; font-weight: 500; }
.referral-hold-note { display: flex; align-items: flex-start; justify-content: center; gap: .45rem; margin: -.2rem .5rem .7rem; color: var(--text-muted); font-size: .67rem; text-align: center; }
.referral-hold-note i { margin-top: .12rem; color: #6366f1; }
.referral-empty { display: flex; align-items: center; flex-direction: column; gap: .35rem; padding: 1.5rem .8rem; }
.referral-empty > i { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: .15rem; border-radius: 13px; color: #6366f1; background: rgba(99,102,241,.09); font-size: 1rem; }
.referral-empty strong { color: var(--text-primary); font-size: .8rem; }
.referral-empty span { color: var(--text-muted); font-size: .68rem; }
.ref-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.ref-badge.pending { color: #b45309; background: rgba(245,158,11,.15); }
.ref-badge.waiting { color: #0284c7; background: rgba(2,132,199,.14); }
.ref-badge.credited { color: #15a85f; background: rgba(21,168,95,.14); }
.ref-badge.rejected { color: #dc2626; background: rgba(220,38,38,.13); }
.ref-desc { display: block; max-width: 380px; color: var(--text-muted); font-size: .74rem; line-height: 1.45; }

body.dark-theme .referral-hero { background: linear-gradient(135deg,rgba(17,24,39,.98),rgba(30,27,75,.88)); }
body.dark-theme .referral-reward-card { background: rgba(6,78,59,.28); }
body.dark-theme .referral-reward-card strong { color: #a7f3d0; }
body.dark-theme .referral-flow > div > span { background: #171a2b; }
body.dark-theme .referral-link-panel { background: rgba(15,23,42,.45); }
body.dark-theme .referral-code-note { color: #94a3b8; }
body.dark-theme .referral-stats .job-stat { background: rgba(18,24,38,.78); }

@media (max-width: 900px) {
  .referral-hero { grid-template-columns: 1fr; gap: 1.25rem; }
  .referral-reward-card { width: min(100%,320px); }
  .referral-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 640px) {
  .referral-hero { padding: 1.25rem; border-radius: 18px; }
  .referral-hero h2 br { display: none; }
  .referral-share-card { padding: 1.1rem; }
  .referral-private-note { display: none; }
  .referral-flow { grid-template-columns: 1fr; gap: .7rem; }
  .referral-flow > i { display: none; }
  .ref-link-box { grid-template-columns: auto minmax(0,1fr); }
  .ref-copy-btn { grid-column: 1 / -1; width: 100%; }
  .ref-copy-status { margin-left: 0; text-align: center; }
  .referral-stats { grid-template-columns: 1fr 1fr; }
  .referral-history-card .card-header { align-items: flex-start; }
}


/* ===== Bảng lịch sử giới thiệu ===== */
.ref-email { display: inline-flex; align-items: center; gap: .3rem; margin-top: .2rem; color: var(--text-secondary); font-size: .72rem; text-decoration: none; }
.ref-email:hover { color: #6366f1; text-decoration: underline; }
.ref-ok { color: #15a85f; font-size: .75rem; font-weight: 700; }
.ref-no { color: #b45309; font-size: .75rem; font-weight: 700; }
.ref-count { color: #0284c7; font-size: .75rem; font-weight: 700; }


/* Icon trong ô nền gradient phải là màu TRẮNG.
   Quy tắc chung `.card-header-title i` đặt màu tím cho mọi icon trong header,
   nên icon nằm trong ô nền tím thành tím-trên-tím và biến mất. */
.referral-section-icon i,
.card-header-title .referral-section-icon i { color: #fff; }


/* ===== Khối giá đơn giản hoá: MỘT mức giá đã gồm lượt chấm ===== */
.pricing-single { display: flex; flex-direction: column; gap: 1rem; margin: 1.4rem 0; }
.price-hero { padding: 1.6rem 1.4rem; border: 1px solid rgba(37,99,235,.16); border-radius: 18px; background: linear-gradient(160deg, rgba(37,99,235,.06), rgba(37,99,235,.02)); text-align: center; }
.price-hero-tag { display: inline-block; margin-bottom: .5rem; padding: .3rem .8rem; border-radius: 999px; color: #1d4ed8; background: rgba(37,99,235,.1); font-size: .72rem; font-weight: 800; letter-spacing: .02em; }
.price-hero .price-amount { justify-content: center; margin: .3rem 0 .1rem; }
.price-hero .price-amount strong { font-size: clamp(2.4rem, 6vw, 3.2rem); }
.price-hero-include { display: flex; align-items: center; justify-content: center; gap: .45rem; margin-top: .7rem; color: #15803d; font-size: .92rem; }
.price-hero-include strong { color: #15803d; }
.price-later { display: flex; align-items: center; gap: .8rem; padding: .95rem 1.1rem; border: 1px dashed rgba(100,116,139,.3); border-radius: 14px; background: rgba(148,163,184,.06); }
.price-later-icon { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 11px; color: #475569; background: rgba(148,163,184,.18); }
.price-later strong { display: block; color: #0f172a; font-size: .9rem; }
.price-later span { display: block; margin-top: .15rem; color: #64748b; font-size: .78rem; }
@media (max-width: 640px) { .price-later { align-items: flex-start; } }
