:root {
  --bg-app: #121413;
  --bg-sidebar: #181a19;
  --bg-topbar: #181a19;
  --bg-card: #1d201f;
  --bg-input: #141716;
  --bg-subtle: #141716;
  --bg-hover: #252a28;
  --border: #2e3431;
  --border-focus: #16a34a;
  --green: #009a29;
  --green-hover: #00b330;
  --green-soft: rgba(0, 154, 41, 0.16);
  --green-text: #4ade80;
  --gold: #e2c07d;
  --text: #f1f5f3;
  --text-secondary: #cbd5e1;
  --text-muted: #9ca8a2;
  --danger: #ef4444;
  --danger-text: #fca5a5;
  --red: #ef4444;
  --red-text: #fca5a5;
  --warning: #f59e0b;
  --warn-text: #fcd34d;
  --amber: #f59e0b;
  --info: #38bdf8;
  --info-text: #7dd3fc;
  --cyan: #38bdf8;
  --accent: #009a29;
  --bg-soft: #141716;
  --shadow-card: none;
  --radius: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-app);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

body.mobile-nav-open {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
}

.muted-sm {
  color: var(--text-muted);
  font-size: 12px;
}

/* APP SHELL: SIDEBAR + WORKSPACE */
.layout-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 244px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand-header {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-globe {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  background: radial-gradient(circle at 30% 30%, rgba(226, 192, 125, 0.25), transparent 70%);
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 17px;
  flex-shrink: 0;
}

.brand-title {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 700;
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 0.4px;
  line-height: 1.1;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.side-nav {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.side-group-label {
  padding: 10px 18px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: #6c7772;
  font-weight: 700;
}

.nav-item {
  width: 100%;
  border: none;
  background: transparent;
  color: #d5ddd9;
  padding: 11px 18px;
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.14s, color 0.14s;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 11px;
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  opacity: 0.9;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--green);
  color: #ffffff;
  font-weight: 600;
}

.nav-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #2c3330;
  color: #e2e8f0;
  font-weight: 700;
}

.nav-item.active .nav-badge {
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* MAIN AREA */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 58px;
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  padding: 8px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  position: sticky;
  top: 0;
  z-index: 25;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-status-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-right: auto;
  min-width: 0;
}

.mobile-menu-btn,
.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.mobile-drawer-backdrop {
  display: none;
}

.mobile-bottom-nav {
  display: none;
}

.page-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gw-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  background: #232826;
  border: 1px solid var(--border);
  max-width: 100%;
  min-width: 0;
}

.gw-pill > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}
.dot.online {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
}
.dot.offline {
  background: var(--danger);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.content-wrap {
  padding: 22px 26px 40px;
  max-width: 1440px;
  width: 100%;
  min-width: 0;
}

.view-panel {
  display: none;
}
.view-panel.active {
  display: block;
}

/* TRAFFILINK SECTION HEADERS (GREEN VERTICAL ACCENT BAR) */
.tl-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  margin: 18px 0 10px;
}
.tl-section-title:first-child {
  margin-top: 0;
}
.tl-section-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--green);
}

.tl-card,
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
  min-width: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.kpi-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* PILL MODE TABS (Manual entry / Parse file / Select number file) */
.mode-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.mode-pill {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid #3a423e;
  background: transparent;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s;
}

.mode-pill:hover {
  border-color: var(--green);
  color: #fff;
}

.mode-pill.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 600;
}

/* FORMS & INPUTS */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.form-row-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: #d5ddd9;
}

.req-star {
  color: var(--danger);
  margin-right: 3px;
}

.input,
.select,
.textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s;
}

.textarea {
  resize: vertical;
  min-height: 115px;
  font-family: inherit;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--border-focus);
}

.link-green {
  background: none;
  border: none;
  color: var(--green-text);
  font-size: 12.5px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.link-green:hover {
  color: #86efac;
}

.warn-hint {
  color: #f87171;
  font-size: 12.5px;
  margin-top: 8px;
}

/* TOGGLE SWITCH (like Split task in panel2.png) */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #363d3a;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #cbd5e1;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--green);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: #fff;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: 0.15s;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--green);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--green-hover);
}
.btn-secondary {
  background: #272c2a;
  border-color: #3b433f;
  color: #e2e8f0;
}
.btn-secondary:hover:not(:disabled) {
  border-color: #55615b;
  background: #303634;
}
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  color: #fff;
  border-color: #4b5550;
}
.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
}

/* PRESET CHIPS FOR INTERVAL PACING */
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 6px;
}
.preset-chip {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #141716;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}
.preset-chip:hover {
  border-color: var(--green);
  color: var(--green-text);
}

/* KPI GRID */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.kpi-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}
.kpi-value {
  font-size: 26px;
  font-weight: 800;
  margin: 4px 0 2px;
  color: #fff;
}
.kpi-value.green {
  color: var(--green-text);
}
.kpi-foot {
  font-size: 11.5px;
  color: #7d8a84;
}

/* TABLES */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.data-table,
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.table th {
  text-align: left;
  padding: 10px 12px;
  background: #151817;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid #242927;
  vertical-align: middle;
}
.data-table tr:hover td,
.table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* PROGRESS BAR FOR CAMPAIGNS */
.prog-track {
  width: 100%;
  min-width: 130px;
  height: 8px;
  background: #121514;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #2a302d;
}
.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, #009a29, #4ade80);
  transition: width 0.3s ease;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-running,
.badge-ready,
.badge-delivered,
.badge-sent {
  background: var(--green-soft);
  color: var(--green-text);
}
.badge-scheduled,
.badge-queued {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
}
.badge-paused,
.badge-warning {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
}
.badge-failed,
.badge-cancelled,
.badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}
.badge-completed,
.badge-empty {
  background: #2a302e;
  color: #cbd5e1;
}

/* SPLIT GRID & CHAT VIEW */
.split-2 {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
}

.chat-box {
  display: flex;
  flex-direction: column;
  height: 520px;
  background: #141716;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-bubble {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
}
.chat-bubble.inbound {
  align-self: flex-start;
  background: #232826;
  border: 1px solid var(--border);
}
.chat-bubble.outbound {
  align-self: flex-end;
  background: rgba(0, 154, 41, 0.22);
  border: 1px solid rgba(74, 222, 128, 0.35);
}
.chat-compose {
  padding: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

/* 32 PORTS GRID */
.ports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 12px;
}
.port-card {
  background: #161918;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.port-card.ready {
  border-color: rgba(0, 154, 41, 0.55);
}
.slot-strip {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
}
.slot-btn {
  padding: 3px 0;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #1f2422;
  color: var(--text-muted);
  cursor: pointer;
}
.slot-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 700;
}

/* CHART BARS FOR STATISTICAL REPORTS */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 170px;
  padding: 16px 8px 6px;
  border-bottom: 1px solid var(--border);
}
.bar-col {
  flex: 1;
  min-width: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  height: 100%;
  justify-content: flex-end;
}
.bar-fill {
  width: 100%;
  max-width: 34px;
  background: linear-gradient(180deg, #22c55e, #008020);
  border-radius: 4px 4px 0 0;
  min-height: 3px;
}

/* MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 60;
}
.modal-card {
  width: 100%;
  max-width: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px;
  max-height: 90vh;
  overflow-y: auto;
}

/* Modal genérico (usado por el detalle de Jobs) */
.modal {
  width: 100%;
  max-width: 900px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.4);
}
.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.2px;
}
.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.modal-close:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.modal-body {
  padding: 16px 18px;
  color: var(--text);
}

/* UTILITY HELPERS */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.status-block {
  font-size: 12.5px;
  color: var(--green-text);
  min-height: 18px;
}
.status-block.err {
  color: #f87171;
}
.code-box {
  background: #121514;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  color: #cbd5e1;
}
.gw-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gw-item {
  background: #141716;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 90;
}
.toast {
  background: #1e2422;
  border: 1px solid var(--green);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* =======================================================
   MAPA FÍSICO DE RANURAS SK32-256 & HOT-SWAP UI
   ======================================================= */
.nav-badge.warn {
  background: #f59e0b;
  color: #111;
  font-weight: 800;
  animation: slotPulse 1.8s infinite ease-in-out;
}

.slotmap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.smap-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #141716;
  border: 1px solid var(--border);
  font-size: 12px;
  color: #cbd5e1;
}

.led {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.led.green {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.75);
}
.led.cyan {
  background: #38bdf8;
  box-shadow: 0 0 7px rgba(56, 189, 248, 0.65);
}
.led.amber {
  background: #f59e0b;
  box-shadow: 0 0 9px rgba(245, 158, 11, 0.85);
}
.led.dashed {
  background: transparent;
  border: 2px dashed #38bdf8;
}
.led.gray {
  background: #525d58;
}
.led.red {
  background: #ef4444;
  box-shadow: 0 0 9px rgba(239, 68, 68, 0.85);
}
.nav-badge.err {
  background: #ef4444;
  color: #fff;
  font-weight: 800;
}

.slotmap-workspace {
  display: grid;
  grid-template-columns: 1fr 345px;
  gap: 16px;
  align-items: start;
}

.chassis-box {
  background: linear-gradient(180deg, #161918 0%, #111413 100%);
  border: 2px solid #2b3330;
  border-radius: 12px;
  padding: 14px 16px 18px;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.65);
}

.chassis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid #262d2a;
  font-size: 11.5px;
  color: #9ca8a2;
}

.chassis-bank-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #8b9892;
  margin: 10px 0 7px;
  font-weight: 700;
}
.chassis-bank-label:first-child {
  margin-top: 0;
}

.chassis-grid-16 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 9px;
}

@media (min-width: 1750px) {
  .chassis-grid-16 {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

.slot-cell {
  position: relative;
  background: #181c1b;
  border: 1px solid #2a312e;
  border-radius: 8px 14px 8px 8px; /* Esquina biselada estilo tarjeta SIM física */
  padding: 8px 8px 7px;
  min-height: 78px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.slot-cell:hover {
  transform: translateY(-1px);
  border-color: #4b5853;
}

.slot-cell.selected {
  outline: 2px solid #4ade80;
  outline-offset: 1px;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.16);
}

.slot-cell.ready {
  background: linear-gradient(180deg, rgba(0, 154, 41, 0.19), rgba(20, 26, 23, 0.95));
  border-color: rgba(34, 197, 94, 0.65);
}

.slot-cell.present-known {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.15), rgba(20, 25, 27, 0.95));
  border-color: rgba(56, 189, 248, 0.55);
}

.slot-cell.needs-number {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.22), rgba(28, 23, 16, 0.95));
  border-color: #f59e0b;
  animation: slotPulse 1.7s infinite ease-in-out;
}

.slot-cell.preassigned {
  background: rgba(56, 189, 248, 0.06);
  border: 1px dashed rgba(56, 189, 248, 0.6);
}

.slot-cell.empty {
  background: #131615;
  border-color: #232927;
  opacity: 0.86;
}

@keyframes slotPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.45);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.08);
  }
}

.slot-cell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}

.slot-code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 800;
  color: #e2e8f0;
}

.slot-phone {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
  font-weight: 700;
  color: #4ade80;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.slot-cell.present-known .slot-phone {
  color: #7dd3fc;
}
.slot-cell.needs-number .slot-phone {
  color: #fcd34d;
}
.slot-cell.preassigned .slot-phone {
  color: #93c5fd;
}
.slot-cell.empty .slot-phone {
  color: #5b6762;
  font-weight: 500;
}

.slot-sub {
  font-size: 10px;
  color: #8d9b94;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-removed-tag {
  font-size: 9.5px;
  color: #fbbf24;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 256-SLOT COMPACT MATRIX */
.matrix256-wrap {
  overflow-x: auto;
}
.matrix256-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  font-size: 11px;
}
.matrix256-table th {
  color: #8b9892;
  font-weight: 700;
  padding: 4px;
  text-align: center;
}
.m256-btn {
  width: 100%;
  min-width: 72px;
  padding: 5px 4px;
  border-radius: 5px;
  border: 1px solid #28302d;
  background: #141817;
  color: #7d8b85;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10.5px;
  cursor: pointer;
  text-align: center;
}
.m256-btn.ready {
  background: rgba(0, 154, 41, 0.22);
  border-color: #22c55e;
  color: #4ade80;
  font-weight: 700;
}
.m256-btn.present-known {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #7dd3fc;
  font-weight: 700;
}
.m256-btn.needs-number {
  background: rgba(245, 158, 11, 0.22);
  border-color: #f59e0b;
  color: #fde68a;
  font-weight: 700;
}
.m256-btn.preassigned {
  border: 1px dashed #38bdf8;
  color: #93c5fd;
}
.m256-btn.selected {
  outline: 2px solid #4ade80;
}

/* RIGHT INSPECTOR PANEL */
.slot-inspector {
  position: sticky;
  top: 72px;
  margin-bottom: 0;
}

.smap-hw-box {
  background: #131615;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #cbd5e1;
}

.smap-phone-big {
  font-size: 16px;
  font-weight: 700;
  padding: 10px 12px;
  color: #4ade80;
  letter-spacing: 0.5px;
}

.smap-phone-big.input-error,
.input.input-error {
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
  background: rgba(239, 68, 68, 0.1);
}

.smap-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 1-CLICK OTP COPY CHIP & OVERVIEW OTP GRID */
.otp-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid rgba(74, 222, 128, 0.45);
  background: rgba(0, 154, 41, 0.22);
  color: #4ade80;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.6px;
  transition: transform 0.12s ease, background 0.15s ease;
}
.otp-copy-btn:hover {
  background: rgba(0, 154, 41, 0.38);
  color: #fff;
  transform: translateY(-1px);
}

.otp-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.otp-card {
  background: #141716;
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: 8px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* =======================================================
   VERIFICADOR AUTOMÁTICO TELCEL (SIM + SERIE IFT + VIGENCIA WEB)
   ======================================================= */
.telcel-verify-box {
  background: #141817;
  border: 1px solid var(--border);
  border-left: 3px solid #38bdf8;
  border-radius: 9px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.telcel-verify-box.tv-ok {
  border-left-color: #22c55e;
  background: rgba(20, 83, 45, 0.22);
}
.telcel-verify-box.tv-warn {
  border-left-color: #f59e0b;
  background: rgba(120, 53, 15, 0.22);
}
.telcel-verify-box.tv-error {
  border-left-color: #ef4444;
  background: rgba(127, 29, 29, 0.24);
}
.telcel-verify-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #e2e8f0;
}
.tv-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tv-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #334155;
  background: #1b201e;
  color: #cbd5e1;
}
.tv-pill.ok {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.45);
  color: #86efac;
}
.tv-pill.warn {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fcd34d;
}
.tv-pill.err {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}
.tv-summary {
  font-size: 12px;
  line-height: 1.42;
  color: #e2e8f0;
}
.btn-telcel-web {
  width: 100%;
  justify-content: center;
  gap: 7px;
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #fff;
  border: 1px solid rgba(56, 189, 248, 0.45);
  font-weight: 600;
  font-size: 12.5px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: filter 0.15s ease, transform 0.12s ease;
}
.btn-telcel-web:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.btn-telcel-web:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.inv-pnn-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 4px;
}
.inv-pnn-tag.telcel {
  background: rgba(14, 165, 233, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}
.inv-pnn-tag.other {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fcd34d;
}
.inv-pnn-tag.ok-telcel {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.48);
  color: #86efac;
}
.inv-pnn-tag.bad-telcel {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.55);
  color: #fca5a5;
}

/* TELCEL CHECKER INVALID SLOTS & REPLACEMENT PANELS */
.slot-cell.telcel-invalid {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.24), rgba(30, 16, 16, 0.96));
  border-color: rgba(239, 68, 68, 0.8);
}
.slot-cell.telcel-invalid .slot-phone {
  color: #fca5a5;
}
.slot-cell.awaiting-swap {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.2), rgba(24, 21, 15, 0.96));
  border: 1px dashed #f59e0b;
}
.slot-cell.awaiting-swap .slot-phone {
  color: #fde68a;
}
.m256-btn.telcel-invalid {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #fca5a5;
  font-weight: 700;
}
.m256-btn.awaiting-swap {
  background: rgba(245, 158, 11, 0.2);
  border: 1px dashed #f59e0b;
  color: #fde68a;
  font-weight: 700;
}
.port-card.telcel-invalid {
  border-color: rgba(239, 68, 68, 0.72);
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.2), #161918);
}
.tc-replace-panel {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.1), rgba(20, 23, 22, 0.95));
  border: 1px solid rgba(245, 158, 11, 0.42);
  border-radius: 10px;
  padding: 12px 14px;
}
.tc-slot-replace-box {
  margin-top: 4px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(127, 29, 29, 0.28);
  border: 1px solid rgba(239, 68, 68, 0.5);
}

@media (max-width: 1200px) {
  .slotmap-workspace {
    grid-template-columns: 1fr;
  }
  .slot-inspector {
    position: static;
  }
  .chassis-grid-16 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* =======================================================
   MODO BLANCO / LIGHT THEME ([data-theme="light"])
   Sin descomponer ningún componente, tarjeta, mapa o tabla
   ======================================================= */
[data-theme="light"] {
  --bg-app: #f3f6f4;
  --bg-sidebar: #ffffff;
  --bg-topbar: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f8faf9;
  --bg-subtle: #f1f5f3;
  --bg-hover: #edf3ef;
  --border: #d5e0da;
  --border-focus: #009a29;
  --green: #008f26;
  --green-hover: #007720;
  --green-soft: rgba(0, 143, 38, 0.12);
  --green-text: #047829;
  --gold: #9a6b12;
  --text: #0f172a;
  --text-secondary: #334155;
  --text-muted: #5b6963;
  --danger: #dc2626;
  --danger-text: #b91c1c;
  --red: #dc2626;
  --red-text: #b91c1c;
  --warning: #d97706;
  --warn-text: #92400e;
  --amber: #d97706;
  --info: #0284c7;
  --info-text: #0369a1;
  --cyan: #0284c7;
  --accent: #008f26;
  --bg-soft: #f1f5f3;
  --shadow-card: 0 2px 8px rgba(15, 23, 42, 0.05);
}

[data-theme="light"] .tl-card,
[data-theme="light"] .kpi-card {
  box-shadow: var(--shadow-card);
}

[data-theme="light"] .brand-globe {
  background: radial-gradient(circle at 30% 30%, rgba(154, 107, 18, 0.16), transparent 70%);
}
[data-theme="light"] .side-group-label {
  color: #64748b;
}
[data-theme="light"] .nav-item {
  color: #334155;
}
[data-theme="light"] .nav-item:hover {
  background: var(--bg-hover);
  color: #0f172a;
}
[data-theme="light"] .nav-item.active {
  background: var(--green);
  color: #ffffff;
}
[data-theme="light"] .nav-badge {
  background: #e2e8f0;
  color: #1e293b;
}
[data-theme="light"] .nav-item.active .nav-badge {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}
[data-theme="light"] .gw-pill {
  background: #f1f5f3;
  color: #1e293b;
}
[data-theme="light"] .tl-section-title {
  color: #0f172a;
}
[data-theme="light"] .mode-pill {
  border-color: #cbd5e1;
  color: #334155;
  background: #f8faf9;
}
[data-theme="light"] .mode-pill:hover {
  border-color: var(--green);
  color: var(--green-text);
  background: #edf7f0;
}
[data-theme="light"] .mode-pill.active {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}
[data-theme="light"] .field label {
  color: #1e293b;
}
[data-theme="light"] .link-green:hover {
  color: #065f20;
}
[data-theme="light"] .warn-hint {
  color: #b91c1c;
}
[data-theme="light"] .toggle-slider {
  background: #cbd5e1;
}
[data-theme="light"] .toggle-slider::before {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
[data-theme="light"] .btn-secondary {
  background: #f1f5f3;
  border-color: #cbd5e1;
  color: #1e293b;
}
[data-theme="light"] .btn-secondary:hover:not(:disabled) {
  background: #e2ebe6;
  border-color: #94a3b8;
  color: #0f172a;
}
[data-theme="light"] .btn-ghost {
  color: #475569;
  border-color: #cbd5e1;
}
[data-theme="light"] .btn-ghost:hover:not(:disabled) {
  background: #f1f5f3;
  color: #0f172a;
  border-color: #94a3b8;
}
[data-theme="light"] .btn-danger {
  background: rgba(220, 38, 38, 0.09);
  border-color: rgba(220, 38, 38, 0.35);
  color: #b91c1c;
}
[data-theme="light"] .btn-danger:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.16);
}
[data-theme="light"] .preset-chip {
  background: #f8faf9;
  color: #334155;
  border-color: #cbd5e1;
}
[data-theme="light"] .preset-chip:hover {
  background: #edf7f0;
  border-color: var(--green);
  color: var(--green-text);
}
[data-theme="light"] .kpi-value {
  color: #0f172a;
}
[data-theme="light"] .kpi-value.green {
  color: var(--green-text);
}
[data-theme="light"] .kpi-foot {
  color: #64748b;
}
[data-theme="light"] .data-table th {
  background: #f1f5f3;
  color: #334155;
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .data-table td {
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
}
[data-theme="light"] .data-table tr:hover td {
  background: rgba(0, 143, 38, 0.04);
}
[data-theme="light"] .prog-track {
  background: #e2e8f0;
  border-color: #cbd5e1;
}
[data-theme="light"] .badge-scheduled,
[data-theme="light"] .badge-queued {
  background: rgba(2, 132, 199, 0.12);
  color: #0369a1;
}
[data-theme="light"] .badge-paused,
[data-theme="light"] .badge-warning {
  background: rgba(217, 119, 6, 0.14);
  color: #92400e;
}
[data-theme="light"] .badge-failed,
[data-theme="light"] .badge-cancelled,
[data-theme="light"] .badge-error {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}
[data-theme="light"] .badge-completed,
[data-theme="light"] .badge-empty {
  background: #e2e8f0;
  color: #334155;
}
[data-theme="light"] .chat-box {
  background: #f8faf9;
}
[data-theme="light"] .chat-header {
  background: #ffffff;
  border-radius: var(--radius) var(--radius) 0 0;
}
[data-theme="light"] .chat-bubble.inbound {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
[data-theme="light"] .chat-bubble.outbound {
  background: rgba(0, 143, 38, 0.13);
  color: #064e1b;
  border-color: rgba(0, 143, 38, 0.35);
}
[data-theme="light"] .port-card {
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}
[data-theme="light"] .port-card.ready {
  border-color: rgba(0, 143, 38, 0.55);
  background: linear-gradient(180deg, rgba(0, 143, 38, 0.05), #ffffff);
}
[data-theme="light"] .port-card.telcel-invalid {
  border-color: rgba(220, 38, 38, 0.65);
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.08), #ffffff);
}
[data-theme="light"] .slot-btn {
  background: #f1f5f3;
  color: #475569;
  border-color: #cbd5e1;
}
[data-theme="light"] .slot-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}
[data-theme="light"] .modal-backdrop {
  background: rgba(15, 23, 42, 0.45);
}
[data-theme="light"] .modal-card {
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}
[data-theme="light"] .status-block.err {
  color: #b91c1c;
}
[data-theme="light"] .code-box {
  background: #f1f5f3;
  color: #1e293b;
  border-color: #cbd5e1;
}
[data-theme="light"] .gw-item {
  background: #f8faf9;
  border-color: #dbe4df;
}
[data-theme="light"] .toast {
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.25);
}
[data-theme="light"] .smap-pill {
  background: #f8faf9;
  color: #1e293b;
  border-color: #cbd5e1;
}
[data-theme="light"] .chassis-box {
  background: linear-gradient(180deg, #eef3f0 0%, #e4ece7 100%);
  border-color: #c2d1c9;
  box-shadow: inset 0 2px 8px rgba(15, 23, 42, 0.06);
}
[data-theme="light"] .chassis-header {
  border-bottom-color: #cbd5e1;
  color: #334155;
}
[data-theme="light"] .chassis-bank-label {
  color: #475569;
}
[data-theme="light"] .slot-cell {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
[data-theme="light"] .slot-cell:hover {
  border-color: #64748b;
}
[data-theme="light"] .slot-cell.selected {
  outline: 2px solid var(--green);
  box-shadow: 0 0 0 4px rgba(0, 143, 38, 0.16);
}
[data-theme="light"] .slot-cell.ready {
  background: linear-gradient(180deg, #ecfdf3 0%, #ffffff 100%);
  border-color: #16a34a;
}
[data-theme="light"] .slot-cell.present-known {
  background: linear-gradient(180deg, #e0f2fe 0%, #ffffff 100%);
  border-color: #0284c7;
}
[data-theme="light"] .slot-cell.needs-number {
  background: linear-gradient(180deg, #fef3c7 0%, #fffbeb 100%);
  border-color: #d97706;
}
[data-theme="light"] .slot-cell.preassigned {
  background: #f0f9ff;
  border: 1px dashed #0284c7;
}
[data-theme="light"] .slot-cell.empty {
  background: #f4f7f5;
  border-color: #d6e0da;
  opacity: 0.92;
}
[data-theme="light"] .slot-cell.telcel-invalid {
  background: linear-gradient(180deg, #fee2e2 0%, #fff5f5 100%);
  border-color: #dc2626;
}
[data-theme="light"] .slot-cell.awaiting-swap {
  background: linear-gradient(180deg, #fef3c7 0%, #fffbeb 100%);
  border: 1px dashed #d97706;
}
[data-theme="light"] .slot-code {
  color: #0f172a;
}
[data-theme="light"] .slot-phone {
  color: #047829;
}
[data-theme="light"] .slot-cell.present-known .slot-phone {
  color: #0369a1;
}
[data-theme="light"] .slot-cell.needs-number .slot-phone {
  color: #b45309;
}
[data-theme="light"] .slot-cell.preassigned .slot-phone {
  color: #0284c7;
}
[data-theme="light"] .slot-cell.empty .slot-phone {
  color: #64748b;
}
[data-theme="light"] .slot-cell.telcel-invalid .slot-phone {
  color: #b91c1c;
}
[data-theme="light"] .slot-cell.awaiting-swap .slot-phone {
  color: #92400e;
}
[data-theme="light"] .slot-sub {
  color: #475569;
}
[data-theme="light"] .slot-removed-tag {
  color: #b45309;
}
[data-theme="light"] .matrix256-table th {
  color: #475569;
}
[data-theme="light"] .m256-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #64748b;
}
[data-theme="light"] .m256-btn.ready {
  background: #dcfce7;
  border-color: #16a34a;
  color: #065f20;
}
[data-theme="light"] .m256-btn.present-known {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #075985;
}
[data-theme="light"] .m256-btn.needs-number {
  background: #fef3c7;
  border-color: #d97706;
  color: #92400e;
}
[data-theme="light"] .m256-btn.preassigned {
  background: #f0f9ff;
  border-color: #0284c7;
  color: #0369a1;
}
[data-theme="light"] .m256-btn.telcel-invalid {
  background: #fee2e2;
  border-color: #dc2626;
  color: #991b1b;
}
[data-theme="light"] .m256-btn.awaiting-swap {
  background: #fef3c7;
  border-color: #d97706;
  color: #92400e;
}
[data-theme="light"] .m256-btn.selected {
  outline: 2px solid var(--green);
}
[data-theme="light"] .smap-hw-box {
  background: #f1f5f3;
  color: #1e293b;
  border-color: #cbd5e1;
}
[data-theme="light"] .smap-phone-big {
  color: #047829;
}
[data-theme="light"] .smap-phone-big.input-error,
[data-theme="light"] .input.input-error {
  border-color: #dc2626 !important;
  color: #b91c1c !important;
  background: rgba(220, 38, 38, 0.07);
}
[data-theme="light"] .otp-copy-btn {
  background: #dcfce7;
  border-color: #22c55e;
  color: #065f20;
}
[data-theme="light"] .otp-copy-btn:hover {
  background: #bbf7d0;
  color: #052e16;
}
[data-theme="light"] .otp-card {
  background: #f8faf9;
  border-color: #cbd5e1;
  border-left: 3px solid var(--green);
}
[data-theme="light"] .telcel-verify-box {
  background: #f8faf9;
  border-color: #cbd5e1;
}
[data-theme="light"] .telcel-verify-box.tv-ok {
  background: #f0fdf4;
  border-left-color: #16a34a;
}
[data-theme="light"] .telcel-verify-box.tv-warn {
  background: #fffbeb;
  border-left-color: #d97706;
}
[data-theme="light"] .telcel-verify-box.tv-error {
  background: #fef2f2;
  border-left-color: #dc2626;
}
[data-theme="light"] .telcel-verify-header,
[data-theme="light"] .tv-summary {
  color: #1e293b;
}
[data-theme="light"] .tv-pill {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}
[data-theme="light"] .tv-pill.ok {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
[data-theme="light"] .tv-pill.warn {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}
[data-theme="light"] .tv-pill.err {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}
[data-theme="light"] .inv-pnn-tag.telcel {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
}
[data-theme="light"] .inv-pnn-tag.other {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}
[data-theme="light"] .inv-pnn-tag.ok-telcel {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
[data-theme="light"] .inv-pnn-tag.bad-telcel {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}
[data-theme="light"] .tc-replace-panel {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.12), #fffbeb);
  border-color: rgba(217, 119, 6, 0.45);
}
[data-theme="light"] .tc-slot-replace-box {
  background: #fef2f2;
  border-color: rgba(220, 38, 38, 0.45);
}

/* =======================================================
   CHAT MÓVIL POR PUERTO Y UNIFICADO (iPhone iOS & Android)
   ======================================================= */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.phonechat-layout {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.phonechat-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  height: 750px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.phonechat-sidebar-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-subtle);
}

.pc-channel-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.pc-channel-item {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 11px 14px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  transition: background 0.14s ease;
}

.pc-channel-item:hover {
  background: var(--bg-hover);
}

.pc-channel-item.active {
  background: var(--green-soft);
  border-left: 4px solid var(--green);
  padding-left: 10px;
}

.pc-ch-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.pc-ch-avatar.all-ports {
  background: linear-gradient(135deg, #009a29, #10b981);
  font-size: 18px;
}

.pc-ch-avatar.carrier-telcel {
  background: linear-gradient(135deg, #0038a8, #0284c7);
}
.pc-ch-avatar.carrier-att {
  background: linear-gradient(135deg, #00a8e0, #0369a1);
}
.pc-ch-avatar.carrier-movistar {
  background: linear-gradient(135deg, #019df4, #16a34a);
}
.pc-ch-avatar.carrier-bait {
  background: linear-gradient(135deg, #eab308, #ca8a04);
}
.pc-ch-avatar.empty-port {
  background: #475569;
  opacity: 0.72;
}

.pc-ch-body {
  flex: 1;
  min-width: 0;
}

.pc-ch-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.pc-ch-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-ch-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.pc-ch-meta {
  font-size: 11.5px;
  color: var(--green-text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-ch-preview {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-ch-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #007aff;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}

/* RIGHT STAGE: SMARTPHONE SIMULATOR */
.phonechat-stage {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 750px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
  background-image: radial-gradient(rgba(120, 140, 130, 0.12) 1px, transparent 1px);
  background-size: 18px 18px;
}

/* DEVICE FRAME */
.phone-mockup {
  width: 100%;
  max-width: 440px;
  height: 710px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: max-width 0.22s ease, border-radius 0.22s ease, background 0.2s ease;
  user-select: text;
}

.phone-mockup.wide-mode {
  max-width: 100%;
}

/* Phone internal color variables (Light Screen vs Dark Screen) */
.phone-mockup.screen-light {
  --ph-bg: #ffffff;
  --ph-stream-bg: #f5f6f8;
  --ph-header-bg: rgba(248, 249, 251, 0.94);
  --ph-text: #111827;
  --ph-sub: #6b7280;
  --ph-border: #e5e7eb;
  --ph-in-bg: #e9e9eb;
  --ph-in-text: #111827;
  --ph-compose-bg: #ffffff;
  --ph-input-bg: #f3f4f6;
  --ph-pill-bg: rgba(15, 23, 42, 0.06);
}

.phone-mockup.screen-dark {
  --ph-bg: #000000;
  --ph-stream-bg: #0b0d10;
  --ph-header-bg: rgba(22, 24, 28, 0.94);
  --ph-text: #f9fafb;
  --ph-sub: #9ca3af;
  --ph-border: #262930;
  --ph-in-bg: #26262a;
  --ph-in-text: #f9fafb;
  --ph-compose-bg: #141619;
  --ph-input-bg: #1f2228;
  --ph-pill-bg: rgba(255, 255, 255, 0.09);
}

/* SKIN 1: iPhone (iOS 18 iMessage) */
.phone-mockup.skin-ios {
  border-radius: 46px;
  border: 11px solid #1f2328;
  box-shadow:
    0 0 0 2px #525860,
    0 24px 55px rgba(0, 0, 0, 0.38);
  background: var(--ph-bg);
  color: var(--ph-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

.phone-mockup.skin-ios.wide-mode {
  border-radius: 24px;
  border-width: 6px;
}

/* SKIN 2: Android (Google Messages / Material You) */
.phone-mockup.skin-android {
  border-radius: 30px;
  border: 9px solid #15171a;
  box-shadow:
    0 0 0 1.5px #3f464d,
    0 22px 50px rgba(0, 0, 0, 0.36);
  background: var(--ph-bg);
  color: var(--ph-text);
  font-family: "Roboto", "Inter", "Segoe UI", system-ui, sans-serif;
}

.phone-mockup.skin-android.screen-light {
  --ph-stream-bg: #f8fafd;
  --ph-header-bg: #eef3fc;
  --ph-in-bg: #e8eef7;
  --ph-in-text: #1f1f1f;
}

.phone-mockup.skin-android.screen-dark {
  --ph-bg: #111318;
  --ph-stream-bg: #111318;
  --ph-header-bg: #1d2026;
  --ph-in-bg: #282c34;
  --ph-in-text: #e3e3e3;
}

.phone-mockup.skin-android.wide-mode {
  border-radius: 18px;
  border-width: 5px;
}

/* Status Bar + Notch / Punch-hole */
.phone-statusbar {
  height: 36px;
  padding: 6px 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  background: var(--ph-header-bg);
  color: var(--ph-text);
  position: relative;
  flex-shrink: 0;
  z-index: 3;
}

.phone-notch {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 7px;
  background: #000;
  transition: all 0.2s ease;
}

.phone-mockup.skin-ios .phone-notch {
  width: 106px;
  height: 24px;
  border-radius: 999px;
}

.phone-mockup.skin-ios .phone-notch::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, #1e3a8a 25%, #090d16 70%);
}

.phone-mockup.skin-android .phone-notch {
  width: 13px;
  height: 13px;
  top: 10px;
  border-radius: 50%;
  background: #090a0c;
  box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.25);
}

/* Phone App Top Header */
.phone-app-header {
  background: var(--ph-header-bg);
  border-bottom: 1px solid var(--ph-border);
  padding: 8px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.phone-mockup.skin-ios .phone-app-header {
  flex-direction: row;
}

.ph-back-btn {
  border: none;
  background: transparent;
  color: #007aff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  white-space: nowrap;
}
.phone-mockup.skin-android .ph-back-btn {
  color: var(--ph-text);
}
.ph-back-btn:hover {
  background: var(--ph-pill-bg);
}

.ph-contact-center {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.phone-mockup.skin-ios .ph-contact-center {
  flex-direction: column;
  gap: 2px;
  text-align: center;
}

.ph-contact-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ph-contact-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ph-text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ph-contact-sub {
  font-size: 11px;
  color: var(--ph-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Message Stream */
.phone-stream {
  flex: 1;
  overflow-y: auto;
  background: var(--ph-stream-bg);
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ph-system-pill {
  align-self: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ph-sub);
  background: var(--ph-pill-bg);
  padding: 3px 11px;
  border-radius: 999px;
  margin: 2px 0 4px;
  text-align: center;
}

.pmsg-row {
  display: flex;
  flex-direction: column;
  max-width: 84%;
  gap: 3px;
}

.pmsg-row.inbound {
  align-self: flex-start;
  align-items: flex-start;
}

.pmsg-row.outbound {
  align-self: flex-end;
  align-items: flex-end;
}

.pmsg-meta-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--ph-sub);
  padding: 0 4px;
}

.pmsg-port-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 10px;
  background: rgba(2, 132, 199, 0.15);
  color: #0284c7;
  cursor: pointer;
}
.phone-mockup.screen-dark .pmsg-port-tag {
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
}

.pmsg-port-tag.carrier-telcel {
  background: rgba(0, 56, 168, 0.14);
  color: #1d4ed8;
}
.phone-mockup.screen-dark .pmsg-port-tag.carrier-telcel {
  background: rgba(59, 130, 246, 0.24);
  color: #93c5fd;
}

.pmsg-port-tag.carrier-att {
  background: rgba(0, 168, 224, 0.16);
  color: #0369a1;
}
.phone-mockup.screen-dark .pmsg-port-tag.carrier-att {
  background: rgba(14, 165, 233, 0.24);
  color: #7dd3fc;
}

.pmsg-bubble {
  padding: 9px 13px;
  font-size: 13.5px;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* iOS Bubbles */
.phone-mockup.skin-ios .pmsg-row.inbound .pmsg-bubble {
  background: var(--ph-in-bg);
  color: var(--ph-in-text);
  border-radius: 18px 18px 18px 5px;
}

.phone-mockup.skin-ios .pmsg-row.outbound .pmsg-bubble {
  background: linear-gradient(180deg, #0a84ff 0%, #007aff 100%);
  color: #ffffff;
  border-radius: 18px 18px 5px 18px;
}

/* Android Google Messages Bubbles */
.phone-mockup.skin-android .pmsg-row.inbound .pmsg-bubble {
  background: var(--ph-in-bg);
  color: var(--ph-in-text);
  border-radius: 20px 20px 20px 6px;
}

.phone-mockup.skin-android .pmsg-row.outbound .pmsg-bubble {
  background: #0b57d0;
  color: #ffffff;
  border-radius: 20px 20px 6px 20px;
}
.phone-mockup.skin-android.screen-dark .pmsg-row.outbound .pmsg-bubble {
  background: #a8c7fa;
  color: #062e6f;
}

.pmsg-otp-chip {
  margin-top: 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.16);
  color: #059669;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.phone-mockup.screen-dark .pmsg-otp-chip {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.22);
}

.pmsg-time {
  font-size: 10px;
  color: var(--ph-sub);
  padding: 0 5px;
}

/* Compose Bar inside Phone */
.phone-compose-wrap {
  background: var(--ph-compose-bg);
  border-top: 1px solid var(--ph-border);
  padding: 8px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.phone-compose-dest {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
}

.phone-compose-dest input,
.phone-compose-dest select {
  background: var(--ph-input-bg);
  border: 1px solid var(--ph-border);
  color: var(--ph-text);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  outline: none;
}

.phone-compose-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.phone-compose-input {
  flex: 1;
  background: var(--ph-input-bg);
  border: 1px solid var(--ph-border);
  color: var(--ph-text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
}

.phone-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  flex-shrink: 0;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.phone-send-btn:hover:not(:disabled) {
  transform: scale(1.05);
}
.phone-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.phone-mockup.skin-ios .phone-send-btn {
  background: #007aff;
}
.phone-mockup.skin-android .phone-send-btn {
  background: #0b57d0;
}

/* Home Indicator / Gesture Bar */
.phone-homebar {
  height: 18px;
  background: var(--ph-compose-bg);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.phone-homebar::after {
  content: "";
  width: 120px;
  height: 4px;
  border-radius: 999px;
  background: var(--ph-sub);
  opacity: 0.45;
}
.phone-mockup.skin-android .phone-homebar::after {
  width: 92px;
  height: 3.5px;
}

@media (max-width: 1080px) {
  .phonechat-layout {
    grid-template-columns: 1fr;
  }
  .phonechat-sidebar {
    height: 330px;
  }
}

/* ============================================================
   PAYTELCEL — Visor de logs del Job (modal detalle)
   ============================================================ */
.ptc-job-logs {
  background: #0b1220;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 12px 14px;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #cbd5e1;
  white-space: pre;
  word-break: normal;
  tab-size: 2;
}
.ptc-job-logs::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.ptc-job-logs::-webkit-scrollbar-track {
  background: #0f172a;
  border-radius: 6px;
}
.ptc-job-logs::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 6px;
}
.ptc-job-logs::-webkit-scrollbar-thumb:hover {
  background: #475569;
}
.ptc-job-log-line {
  display: flex;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px solid rgba(30, 41, 59, 0.4);
}
.ptc-job-log-line:last-child {
  border-bottom: none;
}
.ptc-job-log-line:hover {
  background: rgba(30, 41, 59, 0.35);
}
.ptc-job-log-ts {
  color: #64748b;
  flex-shrink: 0;
  font-size: 11px;
  min-width: 68px;
}
.ptc-job-log-level {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  min-width: 52px;
  text-align: center;
  letter-spacing: 0.3px;
}
.ptc-job-log-level.info  { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.ptc-job-log-level.ok    { background: rgba(34, 197, 94, 0.18);  color: #86efac; }
.ptc-job-log-level.warn  { background: rgba(234, 179, 8, 0.18);  color: #fde047; }
.ptc-job-log-level.error { background: rgba(239, 68, 68, 0.18);  color: #fca5a5; }
.ptc-job-log-level.debug { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; }
.ptc-job-log-msg {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e2e8f0;
}
.ptc-job-log-line.level-error .ptc-job-log-msg { color: #fca5a5; }
.ptc-job-log-line.level-warn  .ptc-job-log-msg { color: #fde047; }
.ptc-job-log-line.level-ok    .ptc-job-log-msg { color: #86efac; }

.ptc-job-empty {
  text-align: center;
  color: #64748b;
  padding: 24px 12px;
  font-style: italic;
}

/* KPI grid del modal — responsive */
.ptc-job-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
@media (max-width: 640px) {
  .ptc-job-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.ptc-job-kpi {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 10px 12px;
}
.ptc-job-kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  margin-bottom: 4px;
}
.ptc-job-kpi-value {
  font-size: 16px;
  font-weight: 700;
  color: #e2e8f0;
}
.ptc-job-kpi-value.green { color: #4ade80; }
.ptc-job-kpi-value.red   { color: #f87171; }
.ptc-job-kpi-value.cyan  { color: #22d3ee; }

.ptc-job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 8px;
  border: 1px solid #1e293b;
}
.ptc-job-meta strong {
  color: #cbd5e1;
  font-weight: 600;
}
.ptc-job-numbers {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 8px;
  border: 1px solid #1e293b;
  max-height: 100px;
  overflow-y: auto;
}
.ptc-job-numbers .mono {
  color: #e2e8f0;
  font-size: 11.5px;
  line-height: 1.7;
}
.ptc-job-error-box {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  color: #fca5a5;
  font-size: 12px;
  margin-bottom: 10px;
}

/* ============================================================
   TRAFFILINK CLOUD & USDT RECHARGE UX
   ============================================================ */
.route-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 960px) {
  .route-cards-grid {
    grid-template-columns: 1fr;
  }
}

.route-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.12s ease;
  text-align: left;
}

.route-card:hover {
  border-color: var(--green-text);
  transform: translateY(-1px);
}

.route-card.active {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.18);
}

html[data-theme="light"] .route-card.active {
  background: rgba(22, 163, 74, 0.07);
}

.route-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.route-card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
}

.route-card-desc {
  font-size: 12.2px;
  color: var(--text-muted);
  line-height: 1.4;
}

.route-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
}

.usdt-deposit-shell {
  display: flex;
  gap: 18px;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 10px;
}

@media (max-width: 720px) {
  .usdt-deposit-shell {
    flex-direction: column;
    align-items: stretch;
  }
}

.usdt-qr-frame {
  flex-shrink: 0;
  width: 216px;
  height: 216px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  display: grid;
  place-items: center;
  padding: 6px;
  margin: 0 auto;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.usdt-qr-frame svg {
  width: 100%;
  height: 100%;
  display: block;
}

.usdt-addr-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  margin: 8px 0;
}

.usdt-addr-text {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  word-break: break-all;
  color: var(--green-text);
}

.watch-pulse-banner {
  border-radius: 10px;
  padding: 11px 14px;
  margin-top: 12px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(14, 165, 233, 0.1);
  font-size: 13px;
}

.watch-pulse-banner.credited {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.14);
}

/* Light-theme parity for .card, .table & mobile controls */
[data-theme="light"] .card {
  box-shadow: var(--shadow-card);
}
[data-theme="light"] .table th {
  background: #f1f5f3;
  color: #334155;
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .table td {
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
}
[data-theme="light"] .table tr:hover td {
  background: rgba(0, 143, 38, 0.04);
}
[data-theme="light"] .mobile-menu-btn,
[data-theme="light"] .sidebar-close-btn {
  background: #f1f5f3;
  border-color: #cbd5e1;
  color: #0f172a;
}

/* ============================================================
   ADAPTACIÓN COMPLETA PARA TELÉFONOS Y TABLETS (RESPONSIVE)
   ============================================================ */
@media (max-width: 960px) {
  .layout-shell {
    display: block;
    min-height: 100dvh;
  }

  /* Slide-out Drawer Sidebar */
  .mobile-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(2px);
    z-index: 70;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }
  .mobile-drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(290px, 84vw);
    height: 100dvh;
    z-index: 80;
    transform: translateX(-104%);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .mobile-menu-btn,
  .sidebar-close-btn {
    display: inline-flex;
  }

  .side-nav {
    padding: 8px 0 16px;
  }
  .nav-item {
    padding: 12px 18px;
    min-height: 44px;
    font-size: 14px;
  }
  .sidebar-footer {
    display: block;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  /* Sticky 2-Row Topbar: Row 1 = Menu + Title + Actions | Row 2 = Status Pills */
  .topbar {
    padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    gap: 8px;
  }
  .topbar-left {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
    gap: 9px;
  }
  .topbar-right {
    order: 2;
    gap: 6px;
  }
  .topbar-status-pills {
    order: 3;
    flex: 1 0 100%;
    margin-right: 0;
    padding-top: 7px;
    border-top: 1px solid var(--border);
    gap: 6px;
  }
  .topbar-status-pills .gw-pill {
    flex: 1 1 auto;
    justify-content: center;
    padding: 4px 9px;
    font-size: 11.5px;
  }
  .page-heading {
    font-size: 15px;
  }

  .content-wrap {
    padding: 14px 14px 36px;
  }

  .split-2,
  .grid-2,
  .form-row-2,
  .form-row-3,
  .form-row-4 {
    grid-template-columns: 1fr;
  }

  .gw-item {
    flex-wrap: wrap;
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  /* Bottom Navigation Dock for Phones */
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    background: var(--bg-topbar);
    border-top: 1px solid var(--border);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.32);
  }
  [data-theme="light"] .mobile-bottom-nav {
    box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.08);
  }

  .mbn-item {
    position: relative;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 50px;
    padding: 4px 2px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.14s ease, background 0.14s ease;
  }
  .mbn-item .mbn-icon {
    font-size: 18px;
    line-height: 1.1;
  }
  .mbn-item .mbn-label {
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;
  }
  .mbn-item.active {
    color: var(--green-text);
    background: var(--green-soft);
  }
  .mbn-badge {
    position: absolute;
    top: 3px;
    right: calc(50% - 21px);
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  }

  /* Leave room at bottom so content & toasts never sit behind the dock */
  .content-wrap {
    padding: 12px 12px calc(86px + env(safe-area-inset-bottom, 0px));
  }

  .toast-container {
    left: 12px;
    right: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  }
  .toast {
    width: 100%;
    text-align: center;
  }

  /* Compact Cards & Section Titles */
  .tl-card,
  .card {
    padding: 14px 13px;
    margin-bottom: 14px;
    border-radius: 10px;
  }
  .tl-section-title {
    font-size: 14.5px;
    flex-wrap: wrap;
  }

  /* Prevent iOS Safari Auto-Zoom on Inputs */
  .input,
  .select,
  .textarea,
  .phone-compose-input,
  .phone-compose-dest input,
  .phone-compose-dest select {
    font-size: 16px;
  }
  .input,
  .select {
    min-height: 40px;
  }

  /* Comfortable Touch Targets */
  .btn {
    min-height: 40px;
    padding: 9px 14px;
  }
  .btn-sm {
    min-height: 36px;
    padding: 6px 11px;
    font-size: 12.5px;
  }
  .mode-pill {
    padding: 8px 13px;
    font-size: 12.5px;
    min-height: 36px;
  }
  .preset-chip {
    padding: 6px 10px;
    font-size: 12px;
    min-height: 34px;
  }

  /* Compact Topbar Action Buttons */
  .topbar-btn-text {
    display: none;
  }
  .topbar-right .btn {
    min-height: 36px;
    padding: 6px 10px;
  }

  /* Slotmap Grid: 3 columns on medium phones */
  .chassis-box {
    padding: 12px 10px 14px;
  }
  .chassis-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .chassis-grid-16 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  /* Inbox Chat Box */
  .chat-box {
    height: min(62dvh, 480px);
    min-height: 340px;
  }
  .chat-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .chat-bubble {
    max-width: 90%;
  }

  /* Tables: compact & smooth horizontal swipe */
  .data-table,
  .table {
    font-size: 12px;
  }
  .data-table th,
  .data-table td,
  .table th,
  .table td {
    padding: 8px 9px;
  }

  /* Bar chart horizontal scroll if many days */
  .bar-chart {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Ports & OTP cards */
  .ports-grid,
  .otp-cards-grid {
    grid-template-columns: 1fr;
  }
  .slot-btn {
    min-height: 32px;
    font-size: 12px;
  }

  /* Modals fit mobile cleanly */
  .modal-backdrop {
    padding: 10px;
    align-items: center;
  }
  .modal-card,
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90dvh !important;
    padding: 15px 14px;
    border-radius: 12px;
  }
  .modal {
    padding: 0;
  }
  .modal-header {
    padding: 12px 14px;
  }
  .modal-body {
    padding: 12px 14px !important;
  }
  .modal-close {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 640px) {
  /* 2-column compact KPIs on phones so you see 4 cards without excessive scrolling */
  .kpi-grid,
  .kpi-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
    margin-bottom: 14px;
  }
  .kpi-card {
    padding: 12px 12px;
  }
  .kpi-label {
    font-size: 11px;
  }
  .kpi-value {
    font-size: 21px;
  }
  .kpi-foot {
    font-size: 11px;
  }

  /* Theme toggle button shows compact icon on narrow phones */
  .theme-toggle-btn {
    padding: 6px 9px !important;
    font-size: 13px;
  }

  /* Toolbars & inline fixed-width controls adapt to full width */
  .toolbar {
    align-items: stretch;
    gap: 8px;
  }
  .toolbar-group {
    width: 100%;
    gap: 7px;
  }
  .toolbar .input[type="search"],
  .toolbar .input[type="file"],
  #campWitnessNumbersInput,
  #otpSpecificPhoneInput,
  #otpQuickNumberPicker,
  #tlImportAccessTokenInput,
  #tlQuickTplSelect,
  #otpAdminFilterUser,
  #otpAdminFilterPhone,
  #otpAdminFilterService,
  #crtHistorySearch,
  #tlTestPhoneInput,
  #tlTestMsgInput {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .toolbar .select,
  .toolbar .input[type="date"] {
    flex: 1 1 140px;
    max-width: 100%;
  }

  /* Switch rows wrap neatly */
  .switch-row {
    gap: 12px;
    align-items: flex-start;
  }

  /* PhoneChat simulator adapted for real phone screens (no bulky bezel) */
  .phonechat-sidebar {
    height: 240px;
  }
  .phonechat-stage {
    padding: 0;
    min-height: 0;
    border: none;
    background: transparent;
    background-image: none;
  }
  .phone-mockup {
    max-width: 100%;
    height: min(72dvh, 580px);
    min-height: 420px;
  }
  .phone-mockup.skin-ios,
  .phone-mockup.skin-android {
    border-width: 2px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  }
  .phone-statusbar {
    height: 28px;
    padding: 2px 14px 0;
    font-size: 11px;
  }
  .phone-mockup.skin-ios .phone-notch {
    width: 72px;
    height: 16px;
    top: 5px;
  }
  .phone-mockup.skin-ios .phone-notch::after {
    width: 7px;
    height: 7px;
    top: 4px;
    right: 8px;
  }
  .phone-compose-dest {
    flex-wrap: wrap;
    gap: 6px;
  }
  .phone-compose-dest select {
    flex: 1 1 120px;
    max-width: 100% !important;
  }
  .phone-compose-dest input {
    flex: 1 1 140px;
    min-width: 0 !important;
  }
  .pmsg-row {
    max-width: 90%;
  }

  /* USDT QR frame scales nicely */
  .usdt-qr-frame {
    width: min(210px, 72vw);
    height: min(210px, 72vw);
  }
  .usdt-addr-box {
    flex-wrap: wrap;
  }

  /* Slotmap inspector actions full width / 2-up */
  .smap-actions-row > button {
    flex: 1 1 calc(50% - 6px);
  }
}

@media (max-width: 520px) {
  /* Slotmap: 2 spacious columns on phones so 10-digit numbers never get cut off */
  .chassis-grid-16 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .slot-cell {
    min-height: 74px;
    padding: 8px;
  }
  .slot-phone {
    font-size: 13px;
  }

  /* Compact topbar pills stack if needed on very narrow phones */
  .topbar-status-pills .gw-pill {
    font-size: 11px;
    padding: 3px 8px;
  }

  /* PayTelcel job logs readable on small screens */
  .ptc-job-logs {
    font-size: 11px;
    padding: 10px;
    max-height: 50dvh;
  }
}


