/* ─── TOKENS ─────────────────────────────────────────────────────────────── */
:root {
  --c-bg:        #f0f2f5;
  --c-surface:   #ffffff;
  --c-sidebar:   #111827;
  --c-sidebar-h: #1f2937;
  --c-sidebar-a: #374151;
  --c-accent:    #4f46e5;
  --c-accent-h:  #4338ca;
  --c-text:      #111827;
  --c-muted:     #6b7280;
  --c-border:    #e5e7eb;
  --c-danger:    #ef4444;
  --c-danger-h:  #dc2626;
  --c-success:   #10b981;
  --c-warn:      #f59e0b;
  --c-info:      #3b82f6;
  --sidebar-w:   260px;
  --topbar-h:    56px;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 1px 3px rgba(0,0,0,.12);
  --shadow-md:   0 4px 12px rgba(0,0,0,.12);
  --transition:  .18s ease;
}

/* ─── RESET ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

/* ─── LAYOUT ─────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── SIDEBAR ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--c-sidebar);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand .brand-name {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
}

.sidebar-brand .brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,.4);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 10px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.65);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-size: 13.5px;
  font-weight: 500;
  user-select: none;
}
.nav-item:hover {
  background: var(--c-sidebar-h);
  color: #fff;
}
.nav-item.active {
  background: var(--c-sidebar-a);
  color: #fff;
}
.nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.update-badge {
  font-size: 11px;
  color: rgba(255,255,255,.35);
  line-height: 1.4;
}
.update-badge strong { color: rgba(255,255,255,.55); }

/* ─── MAIN ───────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  box-shadow: var(--shadow);
}

.topbar h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--c-text);
  flex: 1;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ─── SECTION HEADER ─────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.section-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
}

.section-header .actions { display: flex; gap: 8px; align-items: center; }

/* ─── FILTER BAR ─────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: center;
}

.filter-input, .filter-select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}
.filter-input:focus, .filter-select:focus {
  border-color: var(--c-accent);
}
.filter-input { min-width: 200px; }
.filter-select { cursor: pointer; }

.filter-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--c-muted);
  cursor: pointer;
  user-select: none;
}
.filter-label input[type=checkbox] { cursor: pointer; }

/* ─── TABS ───────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  background: var(--c-border);
  border-radius: var(--radius-sm);
  padding: 3px;
  width: fit-content;
}

.tab-btn {
  padding: 6px 16px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--c-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.tab-btn.active {
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: var(--shadow);
}

/* ─── TABLE ──────────────────────────────────────────────────────────────── */
.table-wrapper {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead tr {
  background: #f9fafb;
  border-bottom: 2px solid var(--c-border);
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover { background: #f9fafb; }

.data-table tbody tr.expanded { background: #f5f7ff; }

.data-table tbody tr.row-detail td {
  background: #f0f4ff;
  padding: 0;
}

.row-detail-content {
  padding: 12px 16px 16px 44px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.detail-field { display: flex; flex-direction: column; gap: 2px; }
.detail-field .detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.detail-field .detail-value { font-size: 13px; color: var(--c-text); }
.detail-field .detail-value.long { grid-column: 1 / -1; }

/* ─── COMPARE BAR ────────────────────────────────────────────────────────── */
.compare-bar {
  position: sticky;
  bottom: 0;
  background: var(--c-sidebar);
  color: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  box-shadow: 0 -2px 8px rgba(0,0,0,.18);
  margin: 8px -24px -24px;
}
.compare-bar .compare-names {
  flex: 1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.compare-bar .compare-chip {
  background: rgba(255,255,255,.12);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
}

/* ─── COMPARE TABLE ──────────────────────────────────────────────────────── */
.compare-table-wrapper {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  margin-top: 16px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.compare-table th {
  padding: 10px 16px;
  background: #f9fafb;
  border-bottom: 2px solid var(--c-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
}

.compare-table td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--c-border);
  border-right: 1px solid var(--c-border);
}
.compare-table td:last-child { border-right: none; }
.compare-table tbody tr:last-child td { border-bottom: none; }
.compare-table td.row-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  background: #f9fafb;
  white-space: nowrap;
}

/* ─── PRICE MATRIX ───────────────────────────────────────────────────────── */
.price-matrix {
  overflow: auto;
}

.price-matrix table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 100%;
}

.price-matrix th {
  padding: 9px 14px;
  background: #f9fafb;
  border: 1px solid var(--c-border);
  font-size: 11px;
  font-weight: 700;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
  text-align: center;
}
.price-matrix th.plan-col { text-align: left; min-width: 180px; }

.price-matrix td {
  padding: 9px 14px;
  border: 1px solid var(--c-border);
  vertical-align: middle;
}
.price-matrix td.plan-name-cell {
  white-space: nowrap;
}
.price-matrix td.plan-name-cell .plan-type-tag {
  display: block;
  font-size: 10px;
  color: var(--c-muted);
}
.price-matrix td.price-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.price-matrix td.price-cell.empty { color: var(--c-muted); text-align: center; }
.price-matrix td.price-cell .monthly {
  display: block;
  font-size: 11px;
  color: var(--c-muted);
}
.price-matrix tr:hover td { background: #f9fafb; }
.price-matrix tr.tipo-separator td {
  background: #f0f2f5;
  font-size: 11px;
  font-weight: 700;
  color: var(--c-accent);
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 6px 14px;
}

/* ─── EQUIPO CARD ────────────────────────────────────────────────────────── */
.equipo-card {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.equipo-card .equipo-info { flex: 1; }
.equipo-card .equipo-name { font-size: 15px; font-weight: 600; }
.equipo-card .equipo-meta { font-size: 12px; color: var(--c-muted); margin-top: 3px; }
.equipo-card .equipo-actions { display: flex; gap: 8px; }

/* ─── SEARCH BOX ─────────────────────────────────────────────────────────── */
.search-container { position: relative; margin-bottom: 16px; }

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface);
  font-size: 14px;
  color: var(--c-text);
  outline: none;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-muted);
  font-size: 16px;
  pointer-events: none;
}

.search-results {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--c-border);
  max-height: 320px;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--c-border);
  transition: background var(--transition);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f5f7ff; }
.search-result-item .eq-brand {
  font-size: 11px;
  color: var(--c-muted);
  white-space: nowrap;
  width: 80px;
  flex-shrink: 0;
}
.search-result-item .eq-name { font-size: 13px; font-weight: 500; flex: 1; }
.search-result-item .eq-sap {
  font-size: 11px;
  color: var(--c-muted);
  white-space: nowrap;
}

/* ─── KPI CARDS ──────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.kpi-card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.kpi-card .kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1;
}
.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--c-muted);
  margin-top: 4px;
}

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  outline: none;
  transition: background var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--c-accent);
  color: #fff;
}
.btn-primary:hover { background: var(--c-accent-h); }

.btn-secondary {
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border);
}
.btn-secondary:hover { background: var(--c-bg); }

.btn-danger {
  background: var(--c-danger);
  color: #fff;
}
.btn-danger:hover { background: var(--c-danger-h); }

.btn-ghost {
  background: transparent;
  color: var(--c-muted);
  border: none;
}
.btn-ghost:hover { color: var(--c-text); background: var(--c-bg); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 40px; padding: 0 20px; font-size: 14px; }

/* ─── BADGE ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-gray   { background: #f3f4f6; color: #374151; }
.badge-indigo { background: #e0e7ff; color: #3730a3; }

/* ─── MODAL ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 640px;
  flex-shrink: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--c-border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-muted);
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--c-bg); color: var(--c-text); }

.modal-body { padding: 20px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--c-border);
}

/* ─── FORM ───────────────────────────────────────────────────────────────── */
.form-section {
  margin-bottom: 20px;
}
.form-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-accent);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--c-border);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-1 { grid-template-columns: 1fr; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-group.full { grid-column: 1 / -1; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
}

.form-input, .form-select, .form-textarea {
  padding: 8px 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--c-accent);
}
.form-textarea { resize: vertical; min-height: 72px; }

.form-hint {
  font-size: 11px;
  color: var(--c-muted);
}

/* ─── CANAL CHECKBOXES ───────────────────────────────────────────────────── */
.canal-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.canal-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1.5px solid var(--c-border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  transition: border-color var(--transition), background var(--transition);
  user-select: none;
}
.canal-check input { display: none; }
.canal-check.checked {
  border-color: var(--c-accent);
  background: rgba(79,70,229,.06);
  color: var(--c-accent);
  font-weight: 600;
}

/* ─── PLANES MULTISELECT ─────────────────────────────────────────────────── */
.planes-multiselect {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
}
.plan-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  font-size: 13px;
}
.plan-check-item:last-child { border-bottom: none; }
.plan-check-item:hover { background: #f5f7ff; }
.plan-check-item input { cursor: pointer; }

/* ─── STATES ─────────────────────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--c-muted);
  font-size: 13px;
  gap: 10px;
}

.empty-msg {
  padding: 48px;
  text-align: center;
  color: var(--c-muted);
  font-size: 13px;
}
.empty-msg .empty-icon { font-size: 32px; margin-bottom: 10px; }
.empty-msg h4 { font-size: 14px; color: var(--c-text); margin-bottom: 4px; }

.error-msg {
  padding: 16px;
  background: #fee2e2;
  border-radius: var(--radius-sm);
  color: var(--c-danger);
  font-size: 13px;
  margin-bottom: 16px;
}

.data-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #1e40af;
  margin-bottom: 16px;
}
.data-notice .notice-icon { flex-shrink: 0; font-size: 14px; line-height: 1.4; }
.data-notice p { margin: 0; line-height: 1.5; }
.data-notice strong { font-weight: 600; }

/* ─── TOAST ──────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast-in .2s ease;
  max-width: 320px;
}
.toast.success { background: #ecfdf5; color: #065f46; border-left: 3px solid var(--c-success); }
.toast.error   { background: #fef2f2; color: #991b1b; border-left: 3px solid var(--c-danger); }
.toast.info    { background: #eff6ff; color: #1e40af; border-left: 3px solid var(--c-info); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── SPINNER ────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ─── MODE TOGGLE ─────────────────────────────────────────────────────────── */
.mode-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--c-muted);
}
.mode-toggle .toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
}
.mode-toggle .toggle-switch input { display: none; }
.mode-toggle .toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--c-border);
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--transition);
}
.mode-toggle .toggle-slider::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: left var(--transition);
}
.mode-toggle input:checked + .toggle-slider { background: var(--c-accent); }
.mode-toggle input:checked + .toggle-slider::after { left: 19px; }

/* ─── SIMULACIÓN DE SOBREPRECIO (M2 canal LIV) ──────────────────────────── */
.simul-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.simul-label {
  font-size: 13px;
  color: var(--c-muted);
  white-space: nowrap;
}
.simul-input-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.simul-input {
  width: 72px;
  padding: 4px 8px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--c-bg);
  color: var(--c-text);
  text-align: right;
}
.simul-input:focus {
  outline: none;
  border-color: var(--c-accent);
}
.simul-suffix {
  font-size: 13px;
  color: var(--c-muted);
}
.btn-simular {
  padding: 4px 14px;
  font-size: 13px;
}
.simul-active-badge {
  font-size: 12px;
  padding: 3px 10px;
  background: #ede9fe;
  color: #6d28d9;
  border-radius: 20px;
  white-space: nowrap;
}
.simul-active-badge a {
  color: #6d28d9;
  text-decoration: underline;
  cursor: pointer;
  margin-left: 4px;
}

/* ─── CONFIG LIVERPOOL SMART ─────────────────────────────────────────────── */
.config-page {
  padding: 24px;
  max-width: 640px;
}

.config-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.config-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
}

.config-card-desc {
  font-size: 13px;
  color: var(--c-muted);
  line-height: 1.6;
  margin-top: -12px;
}

.config-formula {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--c-bg);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.config-formula-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}

.config-formula-code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--c-accent);
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text);
}

.config-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cfg-number-input {
  width: 120px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--c-text);
  background: var(--c-surface);
  text-align: right;
}
.cfg-number-input:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.cfg-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--c-muted);
}

.config-field-hint {
  font-size: 12px;
  color: var(--c-muted);
}

.config-actions {
  padding-top: 4px;
}

.cfg-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}

.cfg-status-ok {
  background: #d1fae5;
  color: #065f46;
}

.cfg-status-error {
  background: #fee2e2;
  color: #991b1b;
}

.cfg-status-icon {
  font-weight: 700;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .form-row { grid-template-columns: 1fr; }
}

/* ─── NAV DOTS ───────────────────────────────────────────────────────────── */
.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── DARK TOGGLE ────────────────────────────────────────────────────────── */
.dark-toggle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  line-height: 1;
}
.dark-toggle:hover {
  background: var(--c-bg);
  color: var(--c-text);
  border-color: var(--c-accent);
}

/* ─── DARK MODE ──────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --c-bg:        #181A20;
  --c-surface:   #1E2130;
  --c-sidebar:   #0f1117;
  --c-sidebar-h: #1a1e2d;
  --c-sidebar-a: #252a3d;
  --c-text:      #E8EAED;
  --c-muted:     #8B90A0;
  --c-border:    #2E3347;
  --shadow:      0 1px 3px rgba(0,0,0,.4);
  --shadow-md:   0 4px 12px rgba(0,0,0,.4);
}

[data-theme="dark"] .data-table thead tr       { background: #252a3d; }
[data-theme="dark"] .data-table tbody tr:hover  { background: #252a3d; }
[data-theme="dark"] .data-table tbody tr.expanded { background: #1f2640; }
[data-theme="dark"] .data-table tbody tr.row-detail td { background: #1a1f35; }
[data-theme="dark"] .compare-table th           { background: #252a3d; }
[data-theme="dark"] .compare-table td.row-label { background: #252a3d; }
[data-theme="dark"] .price-matrix th            { background: #252a3d; }
[data-theme="dark"] .price-matrix tr:hover td   { background: #252a3d; }
[data-theme="dark"] .price-matrix tr.tipo-separator td { background: #1a1f35; }
[data-theme="dark"] .tab-btn.active             { background: #252a3d; color: var(--c-text); }
[data-theme="dark"] .search-result-item:hover   { background: #252a3d; }
[data-theme="dark"] .plan-check-item:hover      { background: #252a3d; }
[data-theme="dark"] .error-msg                  { background: rgba(239,68,68,.12); }
[data-theme="dark"] .data-notice                { background: rgba(59,130,246,.1); border-color: rgba(59,130,246,.3); color: #93c5fd; }
[data-theme="dark"] .simul-active-badge         { background: rgba(109,40,217,.25); color: #c4b5fd; }
[data-theme="dark"] .simul-active-badge a       { color: #c4b5fd; }
[data-theme="dark"] .cfg-status-ok              { background: rgba(16,185,129,.15); color: #6ee7b7; }
[data-theme="dark"] .cfg-status-error           { background: rgba(239,68,68,.15); color: #fca5a5; }
[data-theme="dark"] .toast.success { background: rgba(16,185,129,.15); color: #6ee7b7; }
[data-theme="dark"] .toast.error   { background: rgba(239,68,68,.15);  color: #fca5a5; }
[data-theme="dark"] .toast.info    { background: rgba(59,130,246,.15);  color: #93c5fd; }

[data-theme="dark"] .badge-green  { background: rgba(16,185,129,.2);  color: #6ee7b7; }
[data-theme="dark"] .badge-blue   { background: rgba(59,130,246,.2);  color: #93c5fd; }
[data-theme="dark"] .badge-purple { background: rgba(139,92,246,.2);  color: #c4b5fd; }
[data-theme="dark"] .badge-yellow { background: rgba(245,158,11,.2);  color: #fcd34d; }
[data-theme="dark"] .badge-gray   { background: rgba(107,114,128,.2); color: #d1d5db; }
[data-theme="dark"] .badge-indigo { background: rgba(99,102,241,.2);  color: #a5b4fc; }
[data-theme="dark"] .badge-red    { background: rgba(239,68,68,.2);   color: #fca5a5; }

/* ─── TIPO DROPDOWN FILTER ───────────────────────────────────────────────── */
.tipo-dropdown-wrapper { position: relative; }

.tipo-dropdown-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 180px;
  text-align: left;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 13px;
  outline: none;
}
.tipo-dropdown-btn:focus { border-color: var(--c-accent); }

.tipo-dropdown-panel {
  display: none;
  position: fixed;
  min-width: 210px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 500;
  padding: 4px 0;
}
.tipo-dropdown-panel.open { display: block; }

.tipo-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--c-text);
  user-select: none;
}
.tipo-check-item:hover { background: var(--c-bg); }
.tipo-check-item input { cursor: pointer; accent-color: var(--c-accent); }

/* ─── PLAN SET DIVIDER ───────────────────────────────────────────────────── */
.plan-set-divider td {
  padding: 7px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--c-accent);
  text-transform: uppercase;
  letter-spacing: .7px;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  user-select: none;
}
.plan-set-divider:hover td { filter: brightness(1.05); }

.set-chevron {
  display: inline-block;
  font-size: 9px;
  margin-right: 8px;
  transition: transform .15s;
  color: var(--c-muted);
}
.plan-group.collapsed .set-chevron { transform: rotate(-90deg); }
.plan-group.collapsed tr:not(.plan-set-divider) { display: none; }

.set-count {
  font-size: 10px;
  font-weight: 400;
  color: var(--c-muted);
  margin-left: 8px;
  text-transform: none;
  letter-spacing: 0;
}

/* ─── SERVICE CHIPS ──────────────────────────────────────────────────────── */
.svc-chips { display: flex; flex-wrap: wrap; gap: 2px; }

.svc-chip {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.svc-base {
  background: var(--c-bg);
  color: var(--c-muted);
  font-weight: 500;
}

/* ─── RENTA CONTROL ──────────────────────────────────────────────────────── */
.renta-ctrl {
  display: block;
  font-size: 11px;
  color: var(--c-muted);
  font-weight: 400;
  margin-top: 1px;
}

/* ─── EXPAND BUTTON ─────────────────────────────────────────────────────── */
.btn-expand {
  border-radius: 20px;
  font-size: 11px;
  letter-spacing: .2px;
  white-space: nowrap;
}

/* ─── GB UPGRADE ─────────────────────────────────────────────────────────── */
.gb-upgrade {
  display: block;
  font-size: 10px;
  color: var(--c-success);
  margin-top: 1px;
}
