:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-input: #0f172a;
  --border-color: #334155;
  --border-focus: #3b82f6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.2);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --podium-gold: #f59e0b;
  --podium-silver: #94a3b8;
  --podium-bronze: #d97706;
  --radius: 10px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
}

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

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

/* Navbar */
.navbar {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.brand-icon {
  font-size: 1.8rem;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-pro {
  font-size: 0.7rem;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Proxy badge */
.proxy-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.proxy-badge:hover {
  border-color: var(--primary);
  background-color: rgba(59, 130, 246, 0.1);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

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

.proxy-badge.checking .status-dot {
  background-color: var(--warning);
  box-shadow: 0 0 8px var(--warning);
}

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

/* Main Container */
.main-container {
  max-width: 1400px;
  margin: 1.5rem auto;
  padding: 0 1.5rem 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Card */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

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

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.preset-buttons {
  display: flex;
  gap: 0.75rem;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s;
}

.btn-text:hover {
  color: #60a5fa;
}

/* Grid Layout */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

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

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chip {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-muted);
}

textarea, input[type="text"], select {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.75rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus, input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Options row */
.options-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  background-color: rgba(15, 23, 42, 0.4);
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.option-field {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.option-field label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.action-field {
  display: flex;
  align-items: flex-end;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0.6rem 1.2rem;
  font-size: 0.88rem;
}

.btn-large {
  padding: 0.75rem 1.6rem;
  font-size: 0.95rem;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

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

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

.btn-secondary:hover {
  border-color: var(--primary);
  background-color: rgba(59, 130, 246, 0.1);
}

/* Progress bar */
.progress-section {
  margin-top: 1.25rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
}

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

.progress-status-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-main);
}

.progress-percent {
  font-weight: 700;
  color: var(--primary);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  transition: width 0.3s ease;
}

/* Live Terminal Console */
.live-console-wrapper {
  margin-top: 1rem;
  background-color: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.live-console-header {
  background-color: #131b2e;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.live-title {
  color: var(--text-main);
  font-size: 0.8rem;
}

.live-pulse {
  color: #10b981;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  animation: pulse-glow 1.5s infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; text-shadow: 0 0 6px rgba(16, 185, 129, 0.6); }
  50% { opacity: 0.5; text-shadow: none; }
}

.live-console-log {
  max-height: 200px;
  overflow-y: auto;
  padding: 0.75rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.live-console-log::-webkit-scrollbar {
  width: 6px;
}

.live-console-log::-webkit-scrollbar-track {
  background: #090d16;
}

.live-console-log::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.log-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.log-line.step_start {
  color: #38bdf8;
}

.log-line.step_done {
  color: #34d399;
}

.log-line.delay {
  color: #64748b;
  font-style: italic;
}

.log-line.all_done {
  color: #fbbf24;
  font-weight: 700;
}

.log-line.error {
  color: #f87171;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

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

.stat-icon {
  font-size: 2rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
}

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

.stat-success { color: var(--success); }
.stat-primary { color: var(--primary); }
.stat-muted { color: var(--text-dim); }

/* Domain breakdown pills */
.domain-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.domain-pill {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.domain-pill strong {
  color: #fff;
}

/* Tabs */
.tabs-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: #fff;
  background-color: var(--primary);
}

.tab-content {
  display: none;
}

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

.export-actions {
  display: flex;
  gap: 0.5rem;
}

/* Table Filters */
.table-filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.table-filters input {
  flex: 2;
  min-width: 200px;
}

.table-filters select {
  flex: 1;
  min-width: 180px;
}

/* Data Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background-color: var(--bg-card);
}

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

.data-table th, .data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: rgba(15, 23, 42, 0.7);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

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

/* Ranking Position Badges */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.rank-1 {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.rank-top3 {
  background-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.rank-top10 {
  background-color: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.rank-top20 {
  background-color: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.rank-notfound {
  background-color: rgba(100, 116, 139, 0.15);
  color: var(--text-dim);
  border: 1px solid rgba(100, 116, 139, 0.3);
  font-size: 0.75rem;
}

.engine-tag {
  font-size: 0.72rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
}

.engine-tag.google {
  background-color: rgba(234, 67, 53, 0.15);
  color: #f87171;
  border: 1px solid rgba(234, 67, 53, 0.3);
}

.engine-tag.bing {
  background-color: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.serp-url-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.82rem;
  word-break: break-all;
  display: block;
}

.serp-url-link:hover {
  text-decoration: underline;
}

.serp-title-snippet {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.modal-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

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

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

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.proxy-test-box {
  margin-top: 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 0.85rem;
}

.proxy-diag-item {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

/* Competitor List in Modal */
.serp-competitor-item {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

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

.competitor-rank {
  font-weight: 800;
  font-size: 1.1rem;
  min-width: 32px;
  color: var(--primary);
}

.competitor-info {
  flex: 1;
}

.competitor-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
}

.competitor-url {
  font-size: 0.78rem;
  color: var(--success);
  word-break: break-all;
}

.competitor-snippet {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Recent History Strip */
.recent-history-strip {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.85rem 1.15rem;
  margin-top: 1.25rem;
}

.recent-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  font-size: 0.85rem;
}

.recent-history-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-main);
}

.recent-history-hint {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-left: 0.25rem;
}

.recent-history-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.recent-chip {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.recent-chip:hover {
  background-color: rgba(99, 102, 241, 0.15);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.recent-chip-engine {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}

.recent-chip-engine.google {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.recent-chip-engine.bing {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.recent-chip-engine.both {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.recent-chip-found {
  color: var(--success);
  font-weight: 600;
}

/* Active Run Banner */
.active-run-banner {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.12), rgba(99, 102, 241, 0.12));
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.active-run-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.active-run-badge {
  background-color: #3b82f6;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.active-run-title {
  font-size: 0.92rem;
  color: var(--text-main);
}

.active-run-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.active-run-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* History Toolbar & Cards */
.history-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.history-search-box {
  flex: 1;
  min-width: 260px;
}

.history-search-box input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.55rem 0.85rem;
  color: var(--text-main);
  font-size: 0.85rem;
}

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

.history-filter-box {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.history-filter-box select {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: var(--text-main);
  font-size: 0.85rem;
}

.btn-danger-text {
  color: var(--danger) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

.btn-danger-text:hover {
  background-color: rgba(239, 68, 68, 0.1) !important;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all 0.2s ease;
}

.history-card:hover {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.history-card.is-active-view {
  border-color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.04);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.12);
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.history-card-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.history-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.history-card-badges {
  display: flex;
  gap: 0.4rem;
}

.badge-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.badge-tag.google {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.badge-tag.bing {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.badge-tag.both {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.badge-tag.active-pill {
  background: #3b82f6;
  color: white;
}

.history-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.65rem;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.85rem;
}

.history-metric-item {
  display: flex;
  flex-direction: column;
}

.history-metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.history-metric-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.history-domains-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

.history-domains-preview strong {
  color: var(--text-main);
}

.history-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-color);
}

.history-actions-left {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.history-actions-right {
  display: flex;
  gap: 0.4rem;
}

.hidden {
  display: none !important;
}


/* ================= TREND & DELTA BADGES ================= */
.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.trend-up {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.trend-down {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.trend-same {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.trend-new {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.trend-out {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.trend-none {
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* Secondary KPI grid for Trends */
.kpi-trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.kpi-trend-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.kpi-trend-icon {
  font-size: 1.3rem;
}

.kpi-trend-val {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.1;
}

.kpi-trend-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ================= AUTH & USER MANAGEMENT ================= */
.auth-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.82rem;
}

.role-tag {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}

.role-tag.admin {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
}

.role-tag.user {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.pending-alert-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ef4444;
  color: #fff;
  border-radius: 9999px;
  min-width: 18px;
  height: 18px;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0 4px;
  margin-left: 4px;
}

/* Auth modal tabs */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.auth-tab-btn {
  flex: 1;
  padding: 0.75rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
}

.auth-notice {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  color: #93c5fd;
  margin-bottom: 1rem;
  line-height: 1.4;
}

/* User status badges in admin table */
.user-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.user-status-badge.approved {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.user-status-badge.pending {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.user-status-badge.blocked {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

/* ================= SCHEDULES & RECURRING TASKS ================= */
.schedule-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
}

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

.schedules-table th {
  background: rgba(15, 23, 42, 0.8);
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.schedules-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--success);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* ================= AUTH GATEWAY (LOCKED SCREEN) ================= */
.auth-gate-wrapper {
  max-width: 480px;
  margin: 3rem auto;
  padding: 0 1rem;
}

.auth-gate-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

.auth-gate-header {
  text-align: center;
}

.auth-gate-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.auth-gate-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.auth-gate-header .subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}
