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

:root {
  --bg: #0f172a;
  --sidebar: #1e293b;
  --card: #1e293b;
  --card2: #263047;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

/* ── Login ── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, #1e3a5f 0%, var(--bg) 70%);
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 12px;
}

.login-logo h1 { font-size: 22px; font-weight: 700; }
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ── App Layout ── */
#app { display: none; height: 100vh; }
.layout { display: flex; height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-logo .logo-text { font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar-logo .logo-text span { display: block; font-size: 11px; color: var(--text-muted); font-weight: 400; }

.sidebar-nav { flex: 1; padding: 16px 12px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  user-select: none;
  margin-bottom: 2px;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.nav-item.active { background: rgba(59,130,246,0.2); color: var(--accent); }
.nav-item .nav-icon { font-size: 18px; width: 22px; text-align: center; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-muted); }

.btn-logout {
  margin-top: 8px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.btn-logout:hover { background: rgba(255,255,255,0.06); color: var(--text); }

/* ── Main Content ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.view { display: none; flex: 1; padding: 32px; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.view-title h2 { font-size: 22px; font-weight: 700; }
.view-title p { color: var(--text-muted); font-size: 13px; margin-top: 3px; }

/* ── KPI Cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--kpi-color, var(--accent));
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.kpi-icon {
  position: absolute;
  top: 20px; right: 20px;
  font-size: 28px;
  opacity: 0.2;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-ghost:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Search ── */
.search-bar {
  position: relative;
  margin-bottom: 20px;
}

.search-bar input {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px 9px 38px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.search-bar input:focus { border-color: var(--accent); }
.search-bar input::placeholder { color: var(--text-muted); }

.search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
}

/* ── Table ── */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

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

thead {
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

td {
  padding: 13px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(51,65,85,0.5);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.code-badge {
  background: rgba(59,130,246,0.1);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: monospace;
}

.service-tag {
  display: inline-block;
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  margin-right: 3px;
}

.status-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.status-active { background: rgba(34,197,94,0.15); color: var(--success); }
.status-overdue { background: rgba(239,68,68,0.15); color: var(--danger); }
.status-paid { background: rgba(148,163,184,0.15); color: var(--text-muted); }
.status-cancelled { background: rgba(239,68,68,0.1); color: #f87171; }
.status-pending { background: rgba(245,158,11,0.15); color: var(--warning); }
.status-partial { background: rgba(59,130,246,0.15); color: var(--accent); }

/* Mora semaphore */
.mora-ok { color: var(--success); }
.mora-warn { color: var(--warning); }
.mora-danger { color: var(--danger); }

.mora-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.mora-dot-ok { background: var(--success); }
.mora-dot-warn { background: var(--warning); }
.mora-dot-danger { background: var(--danger); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }

.form-control {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text-muted); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.checkbox-item { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.checkbox-item input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; }
.checkbox-item span { font-size: 13px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  padding: 20px;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-lg { max-width: 720px; }

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

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Steps */
.step-indicator {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.step {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.2s;
}

.step.done { background: var(--accent); }
.step.active { background: var(--accent); }

/* Preview box */
.preview-box {
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
}

.preview-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.preview-row:last-child { border-bottom: none; }
.preview-row .label { color: var(--text-muted); font-size: 13px; }
.preview-row .value { font-weight: 600; font-size: 14px; }
.preview-row.highlight .value { color: var(--accent); font-size: 16px; }

/* Client search results */
.client-results {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.client-result-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(51,65,85,0.5);
  transition: background 0.1s;
}

.client-result-item:last-child { border-bottom: none; }
.client-result-item:hover { background: rgba(255,255,255,0.05); }
.client-result-item .name { font-size: 13px; font-weight: 500; }
.client-result-item .code { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Mode selector */
.mode-option {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: all 0.15s;
}

.mode-option:hover { border-color: var(--accent); }
.mode-option.selected { border-color: var(--accent); background: rgba(59,130,246,0.08); }
.mode-option h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.mode-option p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }
.alert-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.2); color: #93c5fd; }

.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

.loading { text-align: center; padding: 32px; color: var(--text-muted); }

/* Installment table inside modal */
.inst-table { font-size: 12px; }
.inst-table th, .inst-table td { padding: 9px 12px; }

/* Mora warning in pay modal */
.mora-warning {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
}

.mora-amount { font-size: 20px; font-weight: 700; color: var(--warning); }

/* Installment status badges */
.status-inst-paid    { background: rgba(34,197,94,0.15);  color: #22c55e; }
.status-inst-pending { background: rgba(59,130,246,0.15); color: #3b82f6; }
.status-inst-vencido { background: rgba(245,158,11,0.15); color: #f59e0b; }
.status-inst-mora    { background: rgba(239,68,68,0.15);  color: #ef4444; }

/* Category button selected state */
.btn-ghost.selected { background: rgba(59,130,246,0.15); border-color: var(--accent); color: var(--accent); }

.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: monospace; }
.fw-600 { font-weight: 600; }

/* ── Centro Financiero ── */
.centro-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}

.centro-kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.centro-kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.centro-kpi.green::before { background: #22c55e; }
.centro-kpi.blue::before  { background: #3b82f6; }
.centro-kpi.yellow::before{ background: #f59e0b; }
.centro-kpi.orange::before{ background: #f97316; }
.centro-kpi.cyan::before  { background: #06b6d4; }
.centro-kpi.teal::before  { background: #14b8a6; }
.centro-kpi.purple::before{ background: #8b5cf6; }
.centro-kpi.red::before   { background: #ef4444; }

.ck-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.ck-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ck-icon {
  position: absolute;
  top: 16px; right: 16px;
  font-size: 24px;
  opacity: 0.15;
}

.centro-kpi.green .ck-value { color: #22c55e; }
.centro-kpi.teal .ck-value  { color: #14b8a6; }
.centro-kpi.cyan .ck-value  { color: #06b6d4; }

.centro-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.centro-tips {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.centro-tip {
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  line-height: 1.5;
}
.centro-tip:last-child { border-bottom: none; }

/* ── Session timeout modal (no close X) ── */
#session-warning-modal .modal { border: 2px solid var(--warning); }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-success   { background: rgba(34,197,94,0.15);  color: #22c55e; }
.badge-info      { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-warning   { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-danger    { background: rgba(239,68,68,0.15);  color: #ef4444; }
.badge-secondary { background: rgba(148,163,184,0.15);color: #94a3b8; }

/* ── Centro KPI subtitle ── */
.ck-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

/* ── Vehicle estado badges ── */
/* DISPONIBLE → badge-success, ARRENDADO → badge-info,
   EN_VENTA   → badge-warning, VENDIDO   → badge-secondary */

/* ── Portfolio distribution bar ── */
.port-bar-wrap {
  background: rgba(255,255,255,0.05);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  flex: 1;
}
.port-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}

/* ── AI tips bullets ── */
.ai-tip-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
  line-height: 1.5;
}
.ai-tip-item:last-child { border-bottom: none; }
.ai-tip-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* ── Projections table ── */
.proj-table th { color: var(--text-muted); font-weight: 600; font-size: 12px; }
.proj-table td { font-size: 13px; }

/* ── Risk badge on client rows ── */
.risk-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
}
.risk-alto   { background: rgba(239,68,68,0.2);   color: #ef4444; }
.risk-medio  { background: rgba(245,158,11,0.2);  color: #f59e0b; }
.risk-bajo   { background: rgba(34,197,94,0.2);   color: #22c55e; }

/* ── WhatsApp / Print modal ── */
.confirm-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ── Client history tab ── */
.tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Btn sizes ── */
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
}

/* ── Sub-nav items (vehicles) ── */
.nav-sub {
  padding-left: 32px !important;
  font-size: 13px;
}
.nav-sub::before {
  content: '└ ';
  opacity: 0.4;
}

/* ── print area ── */
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area {
    display: block !important;
    padding: 32px;
    color: #000;
    background: #fff;
    font-family: 'Inter', sans-serif;
  }
  #print-area h1 { font-size: 22px; margin-bottom: 4px; }
  #print-area .print-section { margin-top: 16px; }
  #print-area table { width: 100%; border-collapse: collapse; }
  #print-area th, #print-area td { border: 1px solid #ccc; padding: 6px 10px; font-size: 13px; }
  #print-area th { background: #f0f0f0; }
  .no-print { display: none !important; }
}

.loan-history-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.loan-history-summary > div {
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.loan-history-summary span,
.receipt-breakdown span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
}
.loan-history-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
}
.receipt-breakdown {
  display: grid;
  gap: 2px;
}
@media (max-width: 900px) {
  .loan-history-summary { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}

/* ── Investments & Opportunities ── */
.tipo-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.tipo-accion-col  { background: rgba(59,130,246,0.2);  color: #60a5fa; }
.tipo-accion-usa  { background: rgba(34,197,94,0.2);   color: #4ade80; }
.tipo-fondo       { background: rgba(249,115,22,0.2);  color: #fb923c; }
.tipo-cripto      { background: rgba(245,158,11,0.2);  color: #fbbf24; }
.tipo-oro         { background: rgba(234,179,8,0.2);   color: #eab308; }
.tipo-divisa      { background: rgba(148,163,184,0.2); color: #94a3b8; }
.tipo-cdt         { background: rgba(139,92,246,0.2);  color: #a78bfa; }
.tipo-otro        { background: rgba(99,102,241,0.2);  color: #818cf8; }

.pl-positive { color: #4ade80; font-weight: 700; }
.pl-negative { color: #f87171; font-weight: 700; }

.holding-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.holding-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
}
.kanban-col {
  min-width: 220px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  flex-shrink: 0;
}
.kanban-col-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.kanban-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  transition: all 0.1s;
}
.kanban-card:hover { border-color: rgba(59,130,246,0.4); }
.kanban-card-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; line-height: 1.3; }

.progress-bar-wrap { background: var(--border); border-radius: 99px; height: 6px; overflow: hidden; margin-top: 6px; }
.progress-bar-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.4s; }

/* Health Score circle */
.health-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 8px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  position: relative;
  font-size: 28px;
  font-weight: 800;
  transition: border-color 0.4s;
}
.health-circle.red   { border-color: #ef4444; color: #ef4444; }
.health-circle.yellow{ border-color: #f59e0b; color: #f59e0b; }
.health-circle.green { border-color: #22c55e; color: #22c55e; }
.health-circle .hs-label { font-size: 10px; font-weight: 500; color: var(--text-muted); }

/* TRM indicator in header */
.trm-indicator {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* Global search */
.global-search-wrap {
  position: relative;
  flex: 1;
  max-width: 320px;
}
.global-search-input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  padding: 6px 12px 6px 32px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.global-search-input:focus { border-color: var(--accent); }
.global-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--text-muted); pointer-events: none; }
.global-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--sidebar);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 2000;
  max-height: 320px;
  overflow-y: auto;
  display: none;
}
.global-search-dropdown.visible { display: block; }
.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(51,65,85,0.4);
  transition: background 0.1s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: rgba(255,255,255,0.05); }
.search-result-item .sri-title { font-size: 13px; font-weight: 500; }
.search-result-item .sri-sub   { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.search-result-item .sri-type  { display: inline-block; font-size: 10px; background: rgba(59,130,246,0.15); color: var(--accent); padding: 1px 6px; border-radius: 99px; margin-right: 4px; }

/* ── Top bar (shows on mobile, header area) ── */
.app-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ── MOBILE FIRST RESPONSIVE ── */

/* Mobile bottom nav */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sidebar);
  border-top: 1px solid var(--border);
  z-index: 500;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.mobile-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: stretch;
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  min-height: 56px;
  min-width: 44px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  text-align: center;
  gap: 2px;
  transition: color 0.15s;
  flex: 1;
  user-select: none;
}
.mobile-nav-item .mn-icon { font-size: 22px; line-height: 1; }
.mobile-nav-item.active { color: var(--accent); }
.mobile-nav-item:active { opacity: 0.7; }

/* Mobile more menu */
.mobile-more-menu {
  display: none;
  position: fixed;
  bottom: 56px;
  left: 0; right: 0;
  background: var(--sidebar);
  border-top: 1px solid var(--border);
  z-index: 499;
  padding: 8px 0;
}
.mobile-more-menu.open { display: block; }
.mobile-more-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  transition: background 0.1s;
}
.mobile-more-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.mobile-more-item.active { color: var(--accent); }

@media (max-width: 767px) {
  /* Hide desktop sidebar */
  .sidebar { display: none; }

  /* Show mobile elements */
  .mobile-nav { display: block; }
  .app-topbar  { display: flex; }

  /* Main layout */
  #app { display: block; height: auto; }
  .layout { flex-direction: column; height: auto; min-height: 100vh; }
  .main-content { overflow-y: auto; padding-bottom: 70px; }

  /* Views */
  .view { padding: 16px 12px; }

  /* KPI Grid → 2 cols on mobile */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
  .kpi-card  { padding: 14px; }
  .kpi-value { font-size: 18px; }
  .kpi-icon  { font-size: 20px; top: 12px; right: 12px; }

  .centro-kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .centro-kpi .ck-value { font-size: 16px; }

  /* View header */
  .view-header { flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
  .view-title h2 { font-size: 18px; }

  /* Forms */
  .form-control { font-size: 16px !important; }
  .form-grid { grid-template-columns: 1fr; }
  .form-row  { grid-template-columns: 1fr; }

  /* Buttons */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }

  /* Tables → card mode */
  .table-wrap { border-radius: 8px; }

  table.mobile-cards thead { display: none; }
  table.mobile-cards tbody tr {
    display: block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 12px;
  }
  table.mobile-cards td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 12px;
  }
  table.mobile-cards td:last-child { border-bottom: none; }
  table.mobile-cards td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    flex-shrink: 0;
    margin-right: 8px;
  }

  /* Modals → bottom sheet */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    width: 100%;
    max-height: 90vh;
    margin: 0;
    animation: slideUp 0.25s ease;
  }
  .modal-lg { max-width: 100%; }

  /* Kanban → horizontal scroll */
  .kanban-board { gap: 8px; }
  .kanban-col { min-width: 180px; }

  /* Centro */
  .centro-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

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

@media (min-width: 768px) {
  /* Desktop only: show global search in sidebar area or topbar */
  .app-topbar { display: none; }
}

/* Toast notification */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  min-width: 200px;
  max-width: 320px;
  box-shadow: var(--shadow);
  animation: toastIn 0.2s ease;
  pointer-events: auto;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }

@keyframes toastIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

/* showToast helper exists in app.js */

/* ── Light mode ── */
body.light-mode {
  --bg: #f0f4f8;
  --sidebar: #ffffff;
  --card: #ffffff;
  --card2: #e8edf3;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #cbd5e1;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

body.light-mode #login-screen {
  background: radial-gradient(ellipse at 50% 0%, #dbeafe 0%, var(--bg) 70%);
}

body.light-mode thead {
  background: rgba(0,0,0,0.03);
}

body.light-mode tr:hover td {
  background: rgba(0,0,0,0.02);
}

body.light-mode td {
  border-bottom-color: rgba(203,213,225,0.6);
}

body.light-mode .nav-item:hover {
  background: rgba(0,0,0,0.05);
}

/* Oportunidades RC5: motor de crecimiento + responsive */
.opp-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: min(100%, 760px);
}
.opp-tabs-inline { margin-top: 0; }
.opp-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.opp-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.opp-work-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}
.opp-growth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: start;
}
.opp-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.opp-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.opp-action-row-end {
  justify-content: flex-end;
  margin-bottom: 16px;
  margin-top: 0;
}
.opp-action-row-between {
  justify-content: space-between;
  margin-bottom: 16px;
  margin-top: 0;
}
.opp-table-wrap { margin: 8px 0 16px; }
.opp-explain { margin-bottom: 16px; }
.opp-rec-list {
  display: grid;
  gap: 10px;
}
.opp-rec-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.opp-rec-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.opp-rec-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
}
.opp-rec-metrics span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
}
.view-header .opp-tabs {
  margin-left: auto;
}
#opp-content {
  max-width: 100%;
  overflow-x: hidden;
}
#opp-content .kanban-board {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}
#opp-content .kanban-col {
  min-width: 220px;
  max-width: 260px;
  flex: 0 0 220px;
}

@media (max-width: 767px) {
  .view-header .opp-tabs {
    margin-left: 0;
    width: 100%;
  }
  .opp-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    justify-content: flex-start;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }
  .opp-tabs .btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .opp-kpi-grid,
  .opp-section-grid,
  .opp-work-grid,
  .opp-growth-grid,
  .opp-card-grid {
    grid-template-columns: 1fr;
  }
  .opp-action-row,
  .opp-action-row-between,
  .opp-action-row-end {
    align-items: stretch;
  }
  .opp-action-row .btn,
  .opp-action-row-between .btn,
  .opp-action-row-end .btn {
    width: 100%;
    justify-content: center;
  }
  .opp-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .opp-rec-head {
    flex-direction: column;
  }
  .opp-rec-head .btn,
  .opp-rec-actions {
    width: 100%;
  }
  .opp-rec-actions .btn {
    flex: 1 1 120px;
  }
  #opp-content .kanban-col {
    min-width: 210px;
    flex-basis: 210px;
  }
}

body.light-mode .nav-item.active {
  background: rgba(59,130,246,0.1);
}

body.light-mode .btn-ghost:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text);
}

body.light-mode .kanban-col {
  background: rgba(0,0,0,0.03);
}

body.light-mode .kanban-card:hover {
  border-color: rgba(59,130,246,0.4);
}

body.light-mode .preview-row {
  border-bottom-color: rgba(0,0,0,0.06);
}

body.light-mode .centro-tip {
  border-bottom-color: rgba(0,0,0,0.05);
}

body.light-mode .global-search-input {
  background: rgba(0,0,0,0.04);
}

body.light-mode .trm-indicator {
  background: rgba(0,0,0,0.05);
}

body.light-mode .holding-card:hover {
  border-color: var(--accent);
}

body.light-mode .mobile-more-item:hover {
  background: rgba(0,0,0,0.04);
}

body.light-mode .modal-overlay {
  background: rgba(0,0,0,0.4);
}

/* =============================================================
   INVESTMENT RADAR MODULE — Estilos ir_*
   Prefijo .ir- para evitar conflictos con estilos existentes
   ============================================================= */

.ir-tabs-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0;
}
.ir-tab-btn {
  background: none;
  border: none;
  padding: 10px 16px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.ir-tab-btn:hover { color: var(--text-primary); }
.ir-tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: transparent;
}
.ir-section-header { margin-bottom: 20px; }
.ir-section-header h3 { margin: 0 0 4px; font-size: 18px; }
.ir-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}
.ir-card-title { font-size: 14px; font-weight: 600; margin: 0 0 14px; color: var(--text-primary); }
.ir-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 8px;
}
@media (max-width: 768px) { .ir-form-grid { grid-template-columns: 1fr; } }
.ir-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.ir-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.ir-result-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
}
.ir-mini-metric {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}
.ir-mini-metric:last-child { border-bottom: 0; }
.ir-mini-metric span { color: var(--text-muted); }
.ir-mini-metric strong { color: var(--text-primary); text-align: right; }
.ir-mini-note {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  padding: 6px 0;
}
.ir-check-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.7;
}
.ir-check-list li { margin-bottom: 4px; }
.ir-company-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}
@media (max-width: 980px) {
  .ir-grid-3,
  .ir-grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .ir-grid-3,
  .ir-grid-4 { grid-template-columns: 1fr; }
  .ir-company-head { flex-direction: column; }
}
.ir-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 640px) { .ir-kpi-grid { grid-template-columns: 1fr; } }
.ir-risk-btns { display: flex; gap: 8px; }
.ir-risk-btn {
  flex: 1;
  padding: 8px 4px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  transition: all 0.15s;
  text-align: center;
}
.ir-risk-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.ir-risk-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
  font-weight: 600;
}
.ir-table-wrap { overflow-x: auto; }
.ir-examples-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
@media (max-width: 640px) { .ir-examples-grid { grid-template-columns: 1fr; } }
.ir-example-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
}
.ir-example-header { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ir-badge {
  background: var(--primary-color);
  color: #fff;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  margin-left: auto;
}
.ir-disclaimer-box {
  background: #fefce8;
  border: 1px solid #fef08a;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 12px;
  color: #713f12;
  margin-top: 20px;
  line-height: 1.5;
}
.ir-disclaimer-inline {
  background: #fefce8;
  border: 1px solid #fef08a;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  color: #713f12;
  margin-bottom: 12px;
}
.ir-help-icon { cursor: pointer; font-size: 12px; opacity: 0.7; user-select: none; }
.ir-help-icon:hover { opacity: 1; }
body.light-mode .ir-disclaimer-box,
body.light-mode .ir-disclaimer-inline { background: #fefce8; color: #713f12; }
body.light-mode .ir-card { background: #fff; }
body.light-mode .ir-example-card { background: #f8fafc; }

/* =============================================================
   RC9 - Responsive global para Radar y Oportunidades
   ============================================================= */

.opp-playbook {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}
.opp-play-card,
.opp-empty-action {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
}
.opp-play-title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.opp-play-card p,
.opp-empty-action p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 0 0 10px;
}

@media (max-width: 900px) {
  .view-header {
    align-items: stretch;
    gap: 12px;
  }
  .opp-tabs,
  .ir-tabs-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
    scrollbar-width: thin;
    padding-bottom: 6px;
  }
  .opp-tabs .btn,
  .ir-tab-btn {
    flex: 0 0 auto;
  }
  .opp-playbook,
  .opp-section-grid,
  .opp-work-grid,
  .opp-growth-grid {
    grid-template-columns: 1fr;
  }
  .kpi-grid,
  .opp-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .content,
  .main-content,
  .view {
    padding-left: 10px;
    padding-right: 10px;
  }
  .kpi-grid,
  .opp-kpi-grid,
  .ir-kpi-grid {
    grid-template-columns: 1fr;
  }
  .kpi-card {
    min-height: 96px;
  }
  .opp-action-row,
  .opp-action-row-between,
  .opp-action-row-end {
    flex-direction: column;
    align-items: stretch !important;
  }
  .opp-action-row .btn,
  .opp-action-row-between .btn,
  .opp-action-row-end .btn {
    width: 100%;
  }
  .kanban-board {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding-bottom: 8px;
  }
  .kanban-col {
    min-width: 240px;
    flex: 0 0 240px;
  }
  table.mobile-cards thead {
    display: none;
  }
  table.mobile-cards,
  table.mobile-cards tbody,
  table.mobile-cards tr,
  table.mobile-cards td {
    display: block;
    width: 100%;
  }
  table.mobile-cards tr {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    background: var(--card-bg);
  }
  table.mobile-cards td {
    border: 0;
    padding: 5px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    text-align: right;
  }
  table.mobile-cards td::before {
    content: attr(data-label);
    color: var(--text-muted);
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0;
  }
  .modal-content {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }
}

/* RC10 - Alertas inteligentes y analisis avanzado de empresas */
.alerts-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.alerts-kpi {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 8px;
  padding: 16px;
  min-height: 112px;
}

.alerts-kpi span,
.alerts-panel-title {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.alerts-kpi strong {
  display: block;
  margin: 10px 0 4px;
  font-size: 26px;
  color: var(--text-primary);
}

.alerts-kpi small {
  color: var(--text-muted);
  font-size: 12px;
}

.alerts-kpi-critica { border-top-color: var(--danger-color); }
.alerts-kpi-alta { border-top-color: var(--warning-color); }
.alerts-kpi-media { border-top-color: var(--info-color); }
.alerts-kpi-valor { border-top-color: var(--success-color); }

.alerts-warning {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, .45);
  border-radius: 8px;
  background: rgba(245, 158, 11, .12);
  color: var(--warning-color);
}

.alerts-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
  gap: 16px;
}

.alerts-panel {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
}

.alerts-panel-title {
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  border-radius: 8px;
  background: rgba(15, 23, 42, .24);
  margin-bottom: 10px;
}

.alert-item-head span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}

.alert-item p {
  margin: 6px 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.alert-item small {
  color: var(--text-muted);
}

.alert-critica { border-left-color: var(--danger-color); }
.alert-alta { border-left-color: var(--warning-color); }
.alert-media { border-left-color: var(--info-color); }
.alert-baja { border-left-color: var(--success-color); }

.alerts-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border-color);
  border-radius: 8px;
}

.alerts-insight-box {
  padding: 12px;
  border-radius: 8px;
  background: rgba(59, 130, 246, .09);
  color: var(--text-secondary);
}

.alerts-insight-box p {
  margin: 0 0 8px;
}

.alerts-insight-list {
  margin-top: 12px;
}

.alerts-insight-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-color);
}

.ir-score-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.ir-score-bar {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 12px;
}

.ir-score-bar div {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, .28);
  overflow: hidden;
}

.ir-score-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-color), var(--success-color));
}

@media (max-width: 900px) {
  .alerts-kpi-grid,
  .alerts-layout,
  .ir-score-bars {
    grid-template-columns: 1fr;
  }
  .alert-item {
    align-items: stretch;
    flex-direction: column;
  }
  .alert-item .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .ir-score-bar {
    grid-template-columns: 86px minmax(0, 1fr) 48px;
  }
}

/* RC11 - Bandeja comercial accionable */
.opp-action-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.opp-action-summary > div {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
}

.opp-action-summary span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.opp-action-summary strong {
  display: block;
  margin-top: 6px;
  color: var(--text-primary);
  font-size: 18px;
}

.opp-growth-action-form {
  margin: 0 0 16px;
}

/* Contenido CARPIO */
.opp-growth-sections {
  justify-content: flex-start;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.opp-content-toolbar,
.opp-content-generate,
.opp-content-filters,
.opp-content-summary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.opp-content-toolbar {
  justify-content: space-between;
  margin-bottom: 14px;
}

.opp-content-generate .form-control {
  min-width: 180px;
}

.opp-content-filters {
  margin-bottom: 14px;
}

.opp-content-filters .form-control {
  max-width: 220px;
}

.opp-content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.opp-content-summary {
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.opp-content-summary span {
  padding: 6px 9px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
}

.opp-content-summary strong {
  color: var(--text-primary);
}

.opp-content-brief,
.opp-content-strategy-name {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.opp-content-status {
  min-width: 118px;
}

.opp-content-strategy-select {
  min-width: 170px;
  margin-bottom: 6px;
}

.opp-content-row-actions {
  white-space: nowrap;
}

.opp-content-form {
  margin: 0;
}

@media (max-width: 900px) {
  .opp-action-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .opp-content-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .opp-action-summary {
    grid-template-columns: 1fr;
  }
  .opp-content-toolbar,
  .opp-content-generate,
  .opp-content-filters {
    align-items: stretch;
    flex-direction: column;
  }
  .opp-content-generate .form-control,
  .opp-content-filters .form-control,
  .opp-content-generate .btn {
    width: 100%;
    max-width: none;
  }
}

/* RC13 - Resultados automaticos: ingresos y ahorros */
.opp-discovery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.opp-discovery-intro {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}
.opp-discovery-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.opp-discovery-summary > div {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}
.opp-discovery-summary span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
}
.opp-discovery-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}
.opp-discovery-summary-income {
  border-top: 3px solid var(--accent) !important;
}
.opp-discovery-summary-savings {
  border-top: 3px solid var(--success) !important;
}
.opp-discovery-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(150px, 190px));
  gap: 10px;
  margin-bottom: 14px;
}
.opp-discovery-description {
  max-width: 520px;
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.4;
}
.opp-discovery-meta {
  margin-top: 3px;
  font-size: 11px;
}
.opp-discovery-title-line {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}
.opp-discovery-kind {
  flex: 0 0 auto;
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}
.opp-discovery-kind-income {
  color: #60a5fa;
  background: rgba(59, 130, 246, .12);
}
.opp-discovery-kind-savings {
  color: #4ade80;
  background: rgba(34, 197, 94, .12);
}
.opp-discovery-row-income td:first-child {
  border-left: 3px solid rgba(59, 130, 246, .65);
}
.opp-discovery-row-savings td:first-child {
  border-left: 3px solid rgba(34, 197, 94, .65);
}
.opp-discovery-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.opp-score {
  display: inline-block;
  width: 64px;
  height: 6px;
  margin-right: 7px;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(148, 163, 184, .25);
  vertical-align: middle;
}
.opp-score span {
  display: block;
  height: 100%;
  background: var(--success);
}
.opp-discovery-empty {
  padding: 28px !important;
  text-align: center;
}

@media (max-width: 900px) {
  .opp-discovery-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .opp-discovery-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .opp-discovery-filters input {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .opp-discovery-toolbar,
  .opp-discovery-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .opp-discovery-toolbar .btn,
  .opp-discovery-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .opp-discovery-summary,
  .opp-discovery-filters {
    grid-template-columns: 1fr;
  }
  .opp-discovery-filters input {
    grid-column: auto;
  }
  .opp-discovery-table table.mobile-cards td[data-label="Resultado"] {
    align-items: flex-start;
    flex-direction: column;
    text-align: left;
  }
  .opp-discovery-title-line {
    flex-direction: column;
  }
  .opp-discovery-row-income td:first-child,
  .opp-discovery-row-savings td:first-child {
    border-left-width: 4px;
    padding-left: 8px;
  }
}
