/* === VINCULACIONES SMART CELLULAR === */

:root {
  --brand-50: #eef5ff;
  --brand-100: #d9e8ff;
  --brand-200: #bcd6ff;
  --brand-300: #8ebcff;
  --brand-400: #5996ff;
  --brand-500: #2f70f5;
  --brand-600: #1d54e0;
  --brand-700: #1842b8;
  --brand-800: #163a96;
  --brand-900: #142f74;

  --ink-900: #0b1530;
  --ink-800: #16213f;
  --ink-700: #2a3656;
  --ink-600: #4a5578;
  --ink-500: #6b7595;
  --ink-400: #9099b3;
  --ink-300: #c4cad9;
  --ink-200: #e3e7ef;
  --ink-100: #f1f3f8;
  --ink-50:  #f8f9fc;

  --ok-50: #e9f9ee;
  --ok-500: #16a34a;
  --ok-600: #15803d;
  --ok-700: #14532d;

  --warn-50: #fff8e6;
  --warn-500: #d97706;
  --warn-600: #b45309;

  --err-50: #fdecec;
  --err-500: #dc2626;
  --err-600: #b91c1c;

  --bg: var(--ink-50);
  --surface: #ffffff;
  --surface-2: var(--ink-100);
  --border: var(--ink-200);
  --text: var(--ink-900);
  --text-muted: var(--ink-500);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(11,21,48,0.06);
  --shadow:    0 4px 14px rgba(11,21,48,0.08);
  --shadow-lg: 0 12px 32px rgba(11,21,48,0.12);

  --row-pad-y: 12px;
  --row-pad-x: 14px;

  --font: "Inter", "Helvetica Neue", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #0a1024;
  --surface: #111a36;
  --surface-2: #16224a;
  --border: #233063;
  --text: #e8edfb;
  --text-muted: #8d9ac4;
  --ink-100: #16224a;
  --ink-200: #233063;
}

[data-density="compact"] {
  --row-pad-y: 7px;
  --row-pad-x: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
}

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ============ TOP BAR ============ */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  display: grid;
  place-items: center;
  color: white;
  box-shadow: 0 4px 12px rgba(47,112,245,0.35);
}

.brand-name {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand-name span {
  display: block;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.live-dot::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ok-500);
  box-shadow: 0 0 0 0 rgba(22,163,74,0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(22,163,74,0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand-700);
  font-weight: 600;
  display: grid;
  place-items: center;
  font-size: 13px;
}

/* ============ LAYOUT ============ */
.app {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px;
}

.page-head {
  margin-bottom: 22px;
}
.page-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.page-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 14.5px;
}

.grid {
  display: grid;
  gap: 20px;
}
.grid.two-col {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 1100px) {
  .grid.two-col { grid-template-columns: 1fr; }
}

/* ============ CARDS ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.card-head h2 {
  margin: 0 0 3px;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.card-head .sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.card-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--brand-50);
  color: var(--brand-600);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
[data-theme="dark"] .card-icon { background: rgba(47,112,245,0.15); }

.card-body {
  padding: 22px;
}

/* ============ FORM ============ */
.field-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.search-wrap {
  flex: 1;
  position: relative;
}
.search-wrap svg.lead {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

input.text-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input.text-input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(47,112,245,0.12);
}
input.text-input::placeholder {
  color: var(--ink-400);
  font-family: var(--font);
  letter-spacing: normal;
}

.detect-tag {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 5px;
  background: var(--brand-50);
  color: var(--brand-700);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
[data-theme="dark"] .detect-tag {
  background: rgba(47,112,245,0.18);
  color: var(--brand-300);
}
.detect-tag.invalid {
  background: var(--err-50);
  color: var(--err-600);
}
[data-theme="dark"] .detect-tag.invalid {
  background: rgba(220,38,38,0.18);
  color: #ff8a8a;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s, background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand-600);
  color: white;
}
.btn-primary:hover { background: var(--brand-700); }
.btn-primary:disabled {
  background: var(--ink-300);
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--ink-300);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 7px 10px;
  font-weight: 500;
  font-size: 13px;
}
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.btn-danger-ghost {
  background: transparent;
  color: var(--err-500);
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 500;
}
.btn-danger-ghost:hover {
  background: var(--err-50);
}
[data-theme="dark"] .btn-danger-ghost:hover {
  background: rgba(220,38,38,0.12);
}

/* ============ DROP ZONE ============ */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  background: var(--surface-2);
  transition: background 0.15s, border-color 0.15s;
  cursor: pointer;
  position: relative;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--brand-500);
  background: var(--brand-50);
}
[data-theme="dark"] .dropzone:hover,
[data-theme="dark"] .dropzone.drag-over {
  background: rgba(47,112,245,0.1);
}
.dropzone .dz-icon {
  width: 46px; height: 46px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--brand-600);
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
}
.dropzone .dz-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}
.dropzone .dz-sub {
  font-size: 12.5px;
  color: var(--text-muted);
}
.dropzone .dz-link {
  color: var(--brand-600);
  font-weight: 600;
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-loaded {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.file-loaded .fname {
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
}
.file-loaded .fmeta {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============ PROGRESS ============ */
.progress {
  margin-top: 16px;
}
.progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 7px;
  color: var(--text-muted);
}
.progress-head strong {
  color: var(--text);
  font-weight: 600;
}
.progress-bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-500), var(--brand-700));
  border-radius: 999px;
  transition: width 0.3s ease;
  position: relative;
}
.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.3) 50%,
    transparent 100%
  );
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============ STAT TILES ============ */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 800px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.stat-icon.b { background: var(--brand-50);   color: var(--brand-600); }
.stat-icon.g { background: var(--ok-50);      color: var(--ok-500); }
.stat-icon.y { background: var(--warn-50);    color: var(--warn-500); }
.stat-icon.r { background: var(--err-50);     color: var(--err-500); }
[data-theme="dark"] .stat-icon.b { background: rgba(47,112,245,0.16); }
[data-theme="dark"] .stat-icon.g { background: rgba(22,163,74,0.16); }
[data-theme="dark"] .stat-icon.y { background: rgba(217,119,6,0.18); }
[data-theme="dark"] .stat-icon.r { background: rgba(220,38,38,0.18); }
.stat-num {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

/* ============ TABLE ============ */
.results-card { margin-top: 20px; }
.tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tabs {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.tab {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 7px;
  cursor: pointer;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.tab .count {
  background: var(--surface-2);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.tab.active .count {
  background: var(--brand-50);
  color: var(--brand-700);
}
[data-theme="dark"] .tab.active .count {
  background: rgba(47,112,245,0.2);
  color: var(--brand-300);
}

.search-mini {
  flex: 1;
  min-width: 180px;
  position: relative;
}
.search-mini svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.search-mini input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}
.search-mini input:focus {
  border-color: var(--brand-500);
}

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--border);
}
table.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.results thead th {
  text-align: left;
  padding: 11px var(--row-pad-x);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.results tbody td {
  padding: var(--row-pad-y) var(--row-pad-x);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.results tbody tr:hover {
  background: var(--surface-2);
}
.cell-mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.01em;
}
.cell-muted {
  color: var(--text-muted);
}

/* ============ STATUS BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge.ok       { background: var(--ok-50);    color: var(--ok-600); }
.badge.pending  { background: var(--warn-50);  color: var(--warn-600); }
.badge.fail     { background: var(--err-50);   color: var(--err-600); }
.badge.checking { background: var(--brand-50); color: var(--brand-700); }
.badge.error    { background: #f3f4f6; color: #6b7280; }
[data-theme="dark"] .badge.ok       { background: rgba(22,163,74,0.18);  color: #6ee7a7; }
[data-theme="dark"] .badge.pending  { background: rgba(217,119,6,0.20);  color: #fcd34d; }
[data-theme="dark"] .badge.fail     { background: rgba(220,38,38,0.20);  color: #fca5a5; }
[data-theme="dark"] .badge.checking { background: rgba(47,112,245,0.22); color: #93b5ff; }
[data-theme="dark"] .badge.error    { background: rgba(107,114,128,0.20); color: #9ca3af; }
.badge.checking::before {
  animation: blink 1.4s infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ============ MONITOR PANEL ============ */
.monitor-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 22px;
  background: linear-gradient(90deg, rgba(47,112,245,0.07), rgba(47,112,245,0.02));
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
[data-theme="dark"] .monitor-strip {
  background: linear-gradient(90deg, rgba(47,112,245,0.12), transparent);
}
.monitor-strip .ms-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.monitor-strip .ms-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--brand-100);
  color: var(--brand-700);
  display: grid; place-items: center;
}
[data-theme="dark"] .monitor-strip .ms-icon {
  background: rgba(47,112,245,0.22);
  color: var(--brand-300);
}
.ms-text strong { display: block; font-weight: 600; font-size: 13.5px; color: var(--text); }
.ms-text span { color: var(--text-muted); font-size: 12.5px; }
.countdown {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--brand-700);
  font-size: 14px;
}
[data-theme="dark"] .countdown { color: var(--brand-300); }

/* ============ EMPTY STATE ============ */
.empty {
  padding: 56px 22px;
  text-align: center;
  color: var(--text-muted);
}
.empty .empty-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--surface-2);
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  color: var(--ink-400);
}
.empty p { margin: 4px 0; }
.empty .empty-title {
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
}

/* ============ TOAST ============ */
.toast-host {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}
.toast {
  background: var(--ink-900);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.25s ease;
}
[data-theme="dark"] .toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.toast.ok    { border-left: 3px solid var(--ok-500); }
.toast.err   { border-left: 3px solid var(--err-500); }
.toast.info  { border-left: 3px solid var(--brand-500); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ============ DOWNLOAD MENU ============ */
.dl-wrap { position: relative; }
.dl-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 30;
  overflow: hidden;
}
.dl-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  background: transparent;
  border: none;
  text-align: left;
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
}
.dl-menu button:hover { background: var(--surface-2); }

/* ============ NAV TABS (page-level) ============ */
.nav-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.nav-tab {
  background: transparent;
  border: none;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  transition: color 0.15s, border-color 0.15s;
}
.nav-tab:hover {
  color: var(--text);
}
.nav-tab.active {
  color: var(--brand-700);
  border-bottom-color: var(--brand-600);
}
[data-theme="dark"] .nav-tab.active {
  color: var(--brand-300);
  border-bottom-color: var(--brand-400);
}
.nav-tab .nav-count {
  background: var(--surface-2);
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--text-muted);
}
.nav-tab.active .nav-count {
  background: var(--brand-50);
  color: var(--brand-700);
}
[data-theme="dark"] .nav-tab.active .nav-count {
  background: rgba(47,112,245,0.22);
  color: var(--brand-300);
}

/* ============ SUCCESS SCREEN ============ */
.success-banner {
  margin: 0 22px 16px;
  padding: 12px 14px;
  background: var(--ok-50);
  border: 1px solid rgba(22,163,74,0.25);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ok-700);
}
[data-theme="dark"] .success-banner {
  background: rgba(22,163,74,0.12);
  border-color: rgba(22,163,74,0.35);
  color: #a7f3c4;
}
.sb-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--ok-500);
  color: white;
  display: grid; place-items: center;
  flex-shrink: 0;
}

.row-success {
  background: linear-gradient(90deg, rgba(22,163,74,0.04), transparent 50%);
}
.row-success:hover {
  background: linear-gradient(90deg, rgba(22,163,74,0.08), rgba(22,163,74,0.02) 50%) !important;
}
[data-theme="dark"] .row-success {
  background: linear-gradient(90deg, rgba(22,163,74,0.10), transparent 50%);
}
.row-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ok-500);
  color: white;
  display: grid; place-items: center;
  margin-left: 4px;
}
/* === RECARGAR BUTTON === */
.btn-recargar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  background: var(--brand-500);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn-recargar:hover:not(:disabled) { background: var(--brand-700); }
.btn-recargar:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-recargar--loading { background: var(--ink-400); }

.recargar-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.recargar-check-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.recargar-check-label input[type="checkbox"] { cursor: pointer; accent-color: var(--ok-500); }

.attempt-pill {
  display: inline-block;
  padding: 3px 9px;
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ============ PAGER ============ */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
  gap: 12px;
}
.pager-info {
  font-size: 13px;
  color: var(--text-muted);
}
.pager-info strong { color: var(--text); }
.pager-ctrls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pager-ctrls .btn {
  padding: 7px 12px;
  font-size: 12.5px;
}
.pager-dots {
  display: inline-flex;
  gap: 3px;
  margin: 0 4px;
}
.pager-dot {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12.5px;
  border-radius: 7px;
  cursor: pointer;
}
.pager-dot:hover {
  border-color: var(--brand-400);
  color: var(--text);
}
.pager-dot.active {
  background: var(--brand-600);
  color: white;
  border-color: var(--brand-600);
}

/* ============ HELP TIP ============ */
.helptip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* ============ BTN DANGER ============ */
.btn-danger {
  background: var(--err-500);
  color: white;
  border-color: var(--err-500);
}
.btn-danger:hover { background: var(--err-600); border-color: var(--err-600); }
.btn-danger:disabled { background: var(--ink-300); border-color: var(--ink-300); cursor: not-allowed; }

/* ============ CHECKBOXES ============ */
.cb-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}
input[type="checkbox"].row-cb {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  accent-color: var(--brand-600);
  cursor: pointer;
}
tr.row-selected td {
  background: rgba(47,112,245,0.07);
}
tr.row-selected:hover td {
  background: rgba(47,112,245,0.12) !important;
}
[data-theme="dark"] tr.row-selected td {
  background: rgba(47,112,245,0.13);
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,21,48,0.45);
  backdrop-filter: blur(3px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px 28px 24px;
  max-width: 420px;
  width: 90%;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--err-50);
  color: var(--err-500);
  display: grid; place-items: center;
  margin-bottom: 16px;
}
[data-theme="dark"] .modal-icon {
  background: rgba(220,38,38,0.2);
}
.modal-box h3 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.modal-box p {
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ============ SINGLE QUERY RESULT ============ */
.sq-result {
  margin: 10px 0 4px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sq-result.sq-loading,
.sq-result.sq-result-error {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13.5px;
}
.sq-result.sq-result-error {
  border-color: var(--err-500);
  background: var(--err-50);
  color: var(--err-600);
}
.sq-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.sq-dn {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.sq-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.sq-meta strong {
  color: var(--text);
  font-weight: 600;
}
.sq-monitor-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--brand-600);
  font-weight: 500;
}

/* ============ RECENT LOG ============ */
.recent-stats-mini {
  display: flex;
  gap: 0;
  padding: 10px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.rsm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 22px 5px 0;
  font-size: 13px;
}
.rsm-item:not(:last-child) {
  border-right: 1px solid var(--border);
  margin-right: 22px;
}
.rsm-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rsm-ok .rsm-dot   { background: var(--ok-500); }
.rsm-warn .rsm-dot { background: var(--warn-500); }
.rsm-err .rsm-dot  { background: var(--err-500); }
.rsm-val {
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.rsm-label {
  color: var(--text-muted);
  font-size: 12.5px;
}

.recent-list {
  padding: 22px 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.recent-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.recent-group-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}
.recent-group-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.recent-group-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

ul.recent-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.recent-item {
  display: grid;
  grid-template-columns: 78px 26px 1fr;
  min-height: 42px;
}
.recent-item:hover .ri-body {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.ri-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-right: 12px;
  padding-top: 6px;
}
.ri-time-hh {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.ri-time-ago {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.ri-dot-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
}
.ri-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  flex-shrink: 0;
  z-index: 1;
  position: relative;
}
.ri-connector {
  width: 2px;
  flex: 1;
  min-height: 10px;
  background: var(--border);
  margin-top: 2px;
}
.ri-ok .ri-dot       { background: var(--ok-500);   box-shadow: 0 0 0 1.5px var(--ok-500); }
.ri-fail .ri-dot     { background: var(--warn-500);  box-shadow: 0 0 0 1.5px var(--warn-500); }
.ri-checking .ri-dot { background: var(--brand-500); box-shadow: 0 0 0 1.5px var(--brand-500); }
.ri-error .ri-dot    { background: var(--err-500);   box-shadow: 0 0 0 1.5px var(--err-500); }

ul.recent-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ri-body {
  padding: 4px 8px 12px 12px;
}
.ri-line-1 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}
.ri-dn {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13.5px;
}
.ri-attempts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 7px;
  border-radius: 999px;
}
.ri-line-2 {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}
.ri-meta {
  font-weight: 500;
}

/* ============ IFT ROW (SingleQuery) ============ */
.sq-ift-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
  font-size: 12.5px;
}
.sq-ift-loading {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 12px;
}
.sq-ift-carrier {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
}
.sq-ift-red {
  color: var(--text-muted);
  font-size: 11.5px;
}
.badge-portada {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fff0e0;
  color: #b45309;
  border: 1px solid #f59e0b;
  margin-left: 4px;
}

/* ============ CARRIER BADGES (PortedLines) ============ */
.carrier-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.carrier-telcel  { background: #fff3e0; color: #b45309; border: 1px solid #f59e0b; }
.carrier-movistar{ background: #e8f5e9; color: #15803d; border: 1px solid #22c55e; }
.carrier-att     { background: #e0f0ff; color: #1d54e0; border: 1px solid #60a5fa; }
.carrier-virgin  { background: #fce4ec; color: #b91c1c; border: 1px solid #f87171; }
.carrier-other   { background: #f3edff; color: #6622d4; border: 1px solid #a78bfa; }

/* ============ RESPONSIVE / MOBILE ============ */
@media (max-width: 780px) {
  .app { padding: 14px 12px 40px; }

  .topbar { padding: 10px 14px; }
  .brand { gap: 8px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-name { font-size: 13.5px; }
  .brand-name span { font-size: 9.5px; }
  .topbar-right { gap: 10px; }
  .live-dot { display: none; }
  .avatar { width: 28px; height: 28px; font-size: 12px; }

  .page-head { margin-bottom: 16px; }
  .page-title { font-size: 19px; }
  .page-sub { font-size: 12.5px; }

  .grid { gap: 14px; }

  /* top-level page nav: scroll instead of wrap/overflow */
  .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -12px 16px;
    padding: 0 12px 2px;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tab {
    flex-shrink: 0;
    padding: 10px 12px;
    font-size: 13px;
    gap: 6px;
  }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .stat { padding: 12px 14px; gap: 10px; }
  .stat-icon { width: 36px; height: 36px; }
  .stat-num { font-size: 18px; }
  .stat-label { font-size: 11px; }

  .card-head { padding: 16px 16px 12px; flex-wrap: wrap; row-gap: 10px; }
  .card-body { padding: 16px; }

  /* pill tab-bars used inside cards (Resultados, Desvinculadas, etc.) */
  .tabs {
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0; }

  .search-mini { min-width: 0; flex: 1 1 140px; }

  .table-wrap { -webkit-overflow-scrolling: touch; }
  table.results { font-size: 12.5px; }
  table.results thead th,
  table.results tbody td { padding: 9px 10px; }

  .pager { padding: 12px 14px; flex-direction: column; align-items: stretch; }
  .pager-ctrls { justify-content: center; flex-wrap: wrap; row-gap: 8px; }

  .monitor-strip { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px 16px; }
  .monitor-strip > div:last-child { width: 100%; justify-content: space-between; }

  .recent-stats-mini { padding: 10px 16px; }
  .rsm-item { padding: 5px 14px 5px 0; }
  .rsm-item:not(:last-child) { margin-right: 14px; }
  .recent-list { padding: 16px 16px 10px; }

  .success-banner { margin: 0 16px 14px; }

  .modal-box { padding: 20px 18px 18px; width: 92%; }

  .toast-host { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .toast { font-size: 13px; }
}

@media (max-width: 420px) {
  .page-title { font-size: 17px; }
  .stat-num { font-size: 16px; }
  .card-head h2 { font-size: 14.5px; }
}
