/* Alias hacia cyc-tokens.css, la hoja compartida por las cuatro apps. */
:root {
  --bg-sidebar:     var(--cyc-surface);
  --bg-main:        var(--cyc-bg);
  --bg-card:        var(--cyc-surface);

  --text-sidebar:   var(--cyc-text-3);
  --text-sidewhite: var(--cyc-text);
  --text-main:      var(--cyc-text);
  --text-muted:     var(--cyc-text-3);

  --c-primary:   var(--cyc-brand);
  --c-primary-ink: var(--cyc-brand-ink);
  --c-secondary: var(--cyc-brand-hover);
  --c-green:     var(--cyc-st-arrendado);
  --c-success:   var(--cyc-st-arrendado);
  --c-orange:    var(--cyc-brand);
  --c-red:       var(--cyc-st-fuera);
  --c-gray:      var(--cyc-surface-3);
  --c-black:     var(--cyc-text);

  --shadow-sm: var(--cyc-shadow-sm);
  --shadow-md: var(--cyc-shadow);
  --radius:    var(--cyc-r-card);
  --border:    var(--cyc-border);
}

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

body {
  font-family: var(--cyc-font);
  background-color: var(--bg-main);
  color: var(--text-main);
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px;
  position: fixed;
  height: 100vh;
  z-index: 10;
}
.sidebar .logo {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-sidewhite);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 40px;
  letter-spacing: -0.3px;
}
.sidebar .logo .logo-mark {
  width: 40px;
  height: auto;
  flex-shrink: 0;
  color: var(--cyc-brand);
}
.sidebar .logo .logo-txt { line-height: 1.15; }
.sidebar .logo b { font-weight: 800; color: var(--cyc-brand-ink); }
.nav-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.nav-item {
  color: var(--text-sidebar);
  text-decoration: none;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
}
.nav-item:hover, .nav-item.active {
  background-color: rgba(232, 101, 26, 0.08);
  color: var(--c-primary);
}
.user-info {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.user-info .role {
  color: var(--text-sidewhite);
  font-weight: 600;
  font-size: 14px;
}
.user-info .updated {
  color: var(--text-sidebar);
  font-size: 12px;
  margin-top: 4px;
}

/* Main Content */
.dashboard {
  flex: 1;
  margin-left: 260px;
  padding: 40px;
  max-width: 100%;
}
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}
.header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--c-orange);
  letter-spacing: -0.5px;
}
.header .subtitle {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 4px;
}
.action-btn {
  background: var(--c-primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(26, 58, 92, 0.2);
}

/* Sections */
.section-block {
  margin-bottom: 48px;
  scroll-margin-top: 40px;
}
.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 800;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
}

/* KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 4px; height: 100%;
}
.card-dark::before { background: var(--c-black); }
.card-green::before { background: var(--c-green); }
.card-orange::before { background: var(--c-orange); }
.card-red::before { background: var(--c-red); }
.card-blue::before { background: var(--c-secondary); }
.card-gray::before { background: var(--c-gray); }

.kpi-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
}
.card-dark .kpi-value { color: var(--text-main); }
.card-green .kpi-value { color: var(--c-green); }
.card-orange .kpi-value { color: var(--c-orange); }
.card-red .kpi-value { color: var(--c-red); }
.card-blue .kpi-value { color: var(--c-primary); }
.card-gray .kpi-value { color: var(--text-main); }
.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Charts */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.chart-container {
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
}
.chart-container.full-width {
  grid-column: 1 / -1;
}
.chart-container h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--c-primary);
}

/* CRM Lists */
.crm-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
}
.crm-column h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-primary);
  margin-bottom: 12px;
}
.mt-4 { margin-top: 24px; }

.list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.crm-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.crm-item-info strong {
  display: block;
  font-size: 14px;
  color: var(--text-main);
  margin-bottom: 4px;
}
.crm-item-info span {
  font-size: 12px;
  color: var(--text-muted);
}
.crm-item-val {
  font-weight: 700;
  font-size: 14px;
}
.val-alta { color: var(--c-red); }
.val-media { color: var(--c-orange); }

.funnel-summary {
  background: var(--c-primary) !important;
  color: white !important;
  padding: 24px;
  border-radius: var(--radius);
  text-align: center;
}
.funnel-summary h4 {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.8;
  margin-bottom: 8px;
}
.pipeline-val {
  font-size: 32px;
  font-weight: 800;
}

/* CRM V2 Styles */
.crm-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.crm-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.crm-tab {
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
}
.crm-tab.active {
  color: var(--c-primary);
  border-bottom: 3px solid var(--c-primary);
}

.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 20px;
  min-height: 500px;
  width: 100%;
}
.kanban-column {
  background: var(--c-gray);
  border-radius: var(--radius);
  flex: 1;
  min-width: 180px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}
.kanban-column h3 {
  font-size: 14px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 15px;
}
.kanban-cards {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kanban-card {
  background: var(--bg-card);
  padding: 15px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  border: 1px solid var(--border);
}
.kanban-card:active {
  cursor: grabbing;
}
.kanban-card .title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 5px;
}
.kanban-card .company {
  font-size: 12px;
  color: var(--text-muted);
}
.kanban-card .amount {
  font-weight: 600;
  color: var(--c-primary);
  margin-top: 10px;
  font-size: 14px;
}

/* Modales CRM */
.modal-backdrop {
  position: fixed; top:0; left:0; width:100%; height:100%;
  background: rgba(0,0,0,0.5);
  display: none;
  z-index: 1000;
}
.modal-content {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-card);
  padding: 30px;
  border-radius: var(--radius);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-md);
}
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 5px; }
.form-group input, .form-group select { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; }

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table th {
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  background: var(--bg-card);
}
.data-table td {
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr {
  transition: background 0.2s;
  cursor: pointer;
}
.data-table tbody tr:hover {
  background: rgba(0,0,0,0.04);
}

/* =============================================
   OPP DRAWER — Panel lateral de oportunidad
   ============================================= */
#opp-drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2000;
  display: none;
  backdrop-filter: blur(2px);
}
#opp-drawer-overlay.open { display: block; }

#opp-drawer {
  position: fixed;
  top: 0; right: -700px;
  width: min(700px, 95vw);
  height: 100vh;
  background: var(--bg-card);
  z-index: 2001;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,0.2);
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
#opp-drawer.open { right: 0; }

.drawer-header {
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--cyc-brand) 0%, var(--cyc-brand-hover) 100%);
  color: white;
  flex-shrink: 0;
  position: relative;
}
.drawer-header .opp-stage-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.15);
  color: white;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.drawer-header h2 { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.drawer-header .opp-meta {
  display: flex; gap: 16px;
  font-size: 13px; color: rgba(255,255,255,0.7);
  flex-wrap: wrap; margin-top: 8px;
}
.drawer-header .opp-meta span { display: flex; align-items: center; gap: 4px; }
.drawer-close-btn {
  position: absolute; top: 20px; right: 20px;
  background: rgba(255,255,255,0.1);
  border: none; color: white;
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.drawer-close-btn:hover { background: rgba(255,255,255,0.25); }
.drawer-amount { font-size: 28px; font-weight: 800; color: #38bdf8; margin-top: 4px; }

.drawer-tabs {
  display: flex; border-bottom: 2px solid var(--border);
  flex-shrink: 0; background: var(--bg-card);
}
.drawer-tab {
  padding: 14px 20px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.2s;
}
.drawer-tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.drawer-tab:hover:not(.active) { color: var(--text-main); background: var(--c-gray); }

.drawer-body { flex: 1; overflow-y: auto; padding: 24px 28px; }
.drawer-pane { display: none; }
.drawer-pane.active { display: block; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.detail-field label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted); display: block; margin-bottom: 4px;
}
.detail-field span { font-size: 14px; color: var(--text-main); font-weight: 500; }
.detail-field.full { grid-column: 1 / -1; }

.comment-box { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.comment-box textarea {
  width: 100%; min-height: 80px; padding: 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 13px; resize: vertical;
  transition: border-color 0.2s; background: var(--c-gray); color: var(--text-main);
}
.comment-box textarea:focus { outline: none; border-color: var(--c-primary); background: white; }
.comment-send-btn {
  align-self: flex-end; padding: 8px 18px;
  background: var(--c-primary); color: white; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.2s; font-family: inherit;
}
.comment-send-btn:hover { background: var(--c-secondary); }
.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment-item {
  background: var(--c-gray); border-radius: 10px;
  padding: 12px 16px; border-left: 3px solid var(--c-primary);
}
.comment-item .comment-text { font-size: 13px; color: var(--text-main); line-height: 1.5; white-space: pre-wrap; }
.comment-item .comment-date { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

.upload-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 32px; text-align: center; cursor: pointer;
  transition: all 0.2s; margin-bottom: 20px; background: var(--c-gray);
}
.upload-zone:hover { border-color: var(--c-primary); background: rgba(232, 101, 26, 0.04); }
.upload-zone .upload-icon { font-size: 32px; margin-bottom: 8px; }
.upload-zone p { font-size: 13px; color: var(--text-muted); }
.upload-zone input[type="file"] { display: none; }
.attachment-list { display: flex; flex-direction: column; gap: 10px; }
.attachment-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--c-gray);
  border-radius: 8px; border: 1px solid var(--border);
}
.attachment-item .att-icon { font-size: 22px; }
.attachment-item .att-info { flex: 1; }
.attachment-item .att-name { font-size: 13px; font-weight: 600; color: var(--text-main); }
.attachment-item .att-date { font-size: 11px; color: var(--text-muted); }
.attachment-item a { color: var(--c-primary); text-decoration: none; font-size: 12px; font-weight: 600; }

.quote-cta {
  background: linear-gradient(135deg, var(--c-secondary), var(--c-primary));
  color: white; border-radius: 12px; padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 16px;
}
.quote-cta h4 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.quote-cta p { font-size: 12px; opacity: 0.8; }
.quote-cta-btn {
  background: white; color: var(--c-primary); border: none;
  padding: 10px 20px; border-radius: 8px; font-size: 13px; font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: all 0.2s; font-family: inherit;
}
.quote-cta-btn:hover { background: #f0f9ff; transform: scale(1.02); }
.quote-list { display: flex; flex-direction: column; gap: 12px; }
.quote-item {
  background: var(--c-gray); border-radius: 10px;
  padding: 16px; border: 1px solid var(--border);
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 12px; align-items: center;
}
.quote-item .quote-num {
  background: var(--c-primary); color: white;
  font-weight: 800; font-size: 14px; padding: 6px 12px; border-radius: 6px;
}
.quote-item .quote-info .quote-amount { font-size: 16px; font-weight: 700; color: var(--c-primary); }
.quote-item .quote-info .quote-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.quote-item a { color: var(--c-primary); text-decoration: none; font-size: 13px; font-weight: 600; }
.quote-item a:hover { text-decoration: underline; }

.drawer-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; color: var(--text-muted); font-size: 14px; gap: 10px;
}
.drawer-loading::before {
  content: ''; width: 18px; height: 18px;
  border: 2px solid var(--border); border-top-color: var(--c-primary);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 32px; color: var(--text-muted); font-size: 13px; }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 8px; display: block; }

/* ═══════════════════════════════════════════════════════════
   MÓDULO: GESTIÓN DE CONTRATOS & EDPs
   ═══════════════════════════════════════════════════════════ */

.contrato-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}
.contrato-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.contrato-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.contrato-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}
.contrato-card-cliente {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2px;
  line-height: 1.15;
}
.contrato-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-activo { background: rgba(22, 163, 74, 0.12); color: var(--c-green); }
.badge-proximo { background: rgba(249, 115, 22, 0.12); color: var(--c-orange); }
.badge-terminado { background: rgba(220, 38, 38, 0.12); color: var(--c-red); }

.contrato-dates {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  font-size: 13px;
}
.contrato-date-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.contrato-date-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
}
.contrato-date-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}
.contrato-date-val.vence-pronto { color: var(--c-orange); }
.contrato-date-val.vencido { color: var(--c-red); }

.contrato-equipos-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.equipo-chip {
  background: var(--c-gray);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.checklist-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
}
.check-ok { background: rgba(22, 163, 74, 0.1); color: var(--c-green); }
.check-missing { background: rgba(220, 38, 38, 0.1); color: var(--c-red); }

.contrato-edps-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 14px;
}
.edp-mini-card {
  min-width: 130px;
  background: var(--c-gray);
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}
.edp-mini-card:hover {
  border-color: var(--c-primary);
  background: rgba(232, 101, 26, 0.05);
}
.edp-mini-periodo {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.edp-mini-etapa {
  font-size: 12px;
  font-weight: 600;
}
.edp-etapa-1 { color: #94A3B8; }
.edp-etapa-2 { color: #64748B; }
.edp-etapa-3 { color: #475569; }
.edp-etapa-4 { color: #15803D; }

.contrato-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.contrato-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.contrato-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.btn-editar { background: var(--c-gray); color: var(--text-main); }
.btn-nuevo-edp { background: var(--cyc-brand-soft); color: var(--c-primary); }
.btn-dar-baja { background: rgba(220, 38, 38, 0.1); color: var(--c-red); }

/* EDP Kanban Global */
.edp-kanban-col {
  min-width: 220px;
  background: var(--c-gray);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}
.edp-kanban-header {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.edp-kanban-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.edp-kanban-card:hover {
  border-color: var(--c-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.edp-kanban-cliente {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.edp-kanban-periodo {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}
.edp-kanban-monto {
  font-size: 12px;
  color: var(--c-primary);
  margin-top: 4px;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   MÓDULO: DAÑOS & MERMAS
   ═══════════════════════════════════════════════════════════ */

.dano-kanban-col {
  min-width: 200px;
  flex-shrink: 0;
  background: var(--c-gray);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dano-kanban-header {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dano-kanban-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.dano-kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.dano-equipo {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 2px;
}
.dano-cliente {
  font-size: 11px;
  color: var(--text-muted);
}
.dano-monto {
  font-size: 12px;
  color: var(--c-red);
  font-weight: 700;
  margin-top: 6px;
}
.dano-fecha {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Stepper visual */
.step-item {
  flex: 1;
  text-align: center;
  padding: 10px 6px;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s;
  border-right: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--c-gray);
}
.step-item:last-child { border-right: none; }
.step-item.active {
  background: var(--c-primary);
  color: white;
}
.step-item.done {
  background: rgba(22, 163, 74, 0.12);
  color: var(--c-green);
}

/* Alerta vencimiento contrato */
.alerta-vencimiento {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  background: rgba(249, 115, 22, 0.1);
  color: var(--c-orange);
  animation: pulse-alert 2s infinite;
}
@keyframes pulse-alert {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Estandarización botón volver al hub */
.btn-volver-hub {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--cyc-brand-soft);
  color: var(--cyc-brand-ink) !important;
  border: 1px solid var(--cyc-brand-line);
  border-radius: 20px;
  font-family: var(--cyc-font);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  line-height: 1;
}
.btn-volver-hub:hover {
  background: var(--cyc-brand);
  color: #ffffff !important;
  box-shadow: 0 4px 12px var(--cyc-brand-glow);
  transform: translateY(-1px);
}
.btn-volver-hub svg {
  stroke: currentColor;
  flex-shrink: 0;
}

/* ═══════════ PIPELINE CRM — ACORDEÓN DE ETAPAS ═══════════ */
.pipeline-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.pipeline-stage {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.pipeline-stage-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.pipeline-stage-header:hover { background: var(--bg-main); }
.pipeline-stage-header.drag-over { background: rgba(232,101,26,0.10); }
.pipeline-stage-header .stage-arrow {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.2s;
  width: 12px;
}
.pipeline-stage.open .pipeline-stage-header .stage-arrow { transform: rotate(90deg); }
.pipeline-stage-header .stage-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0;
}
.pipeline-stage-header .stage-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  flex: 1;
}
.pipeline-stage-header .stage-count {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-main);
  background: var(--c-gray);
  border-radius: 20px;
  padding: 2px 12px;
}
.pipeline-stage-header .stage-total {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-primary);
  min-width: 90px;
  text-align: right;
}
.pipeline-stage-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  padding: 6px 18px 18px;
}
.pipeline-stage-body.drag-over { background: rgba(232,101,26,0.06); }
.pipeline-stage-body .stage-empty {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 13px;
  padding: 8px 2px;
}

/* ═══════════ RESUMEN DEL PIPELINE ═══════════ */
#crm-pipeline-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
}
.summary-group {
  flex: 1;
  min-width: 260px;
}
.summary-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.summary-group-count {
  background: var(--c-red);
  color: #fff;
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 11px;
}
.summary-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.summary-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  padding: 8px 12px;
  min-width: 78px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}
.summary-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--c-primary);
}
.summary-box .summary-dot {
  position: absolute;
  top: 10px; right: 10px;
  width: 8px; height: 8px; border-radius: 50%;
}
.summary-box .summary-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}
.summary-box .summary-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.summary-box.alta { border-left: 3px solid var(--c-red); }
.summary-box.won { border-left: 3px solid var(--c-green); }
.summary-box.won .summary-num { color: var(--c-green); }
.summary-empty {
  color: var(--text-muted);
  font-size: 12px;
  padding: 8px 2px;
}

/* Botón Editar en el drawer */
.drawer-edit-btn {
  position: absolute; top: 20px; right: 60px;
  background: rgba(255,255,255,0.15);
  border: none; color: white;
  height: 32px; padding: 0 12px; border-radius: 16px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: inherit;
  display: flex; align-items: center; gap: 4px;
  transition: background 0.2s;
}
.drawer-edit-btn:hover { background: rgba(255,255,255,0.3); }

/* ═══════════ EDPs POR ETAPA — ACORDEÓN RETRAÍBLE ═══════════ */
.edp-stage {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.edp-stage-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.edp-stage-header:hover { background: var(--bg-main); }
.edp-stage-header .stage-arrow {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.2s;
  width: 12px;
}
.edp-stage.open .edp-stage-header .stage-arrow { transform: rotate(90deg); }
.edp-stage-header .edp-stage-name {
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex: 1;
}
.edp-stage-header .edp-stage-count {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-main);
  background: var(--c-gray);
  border-radius: 20px;
  padding: 2px 12px;
}
.edp-stage-header .edp-stage-total {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-primary);
  min-width: 90px;
  text-align: right;
}
.edp-stage-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  padding: 6px 18px 18px;
}
.edp-stage-body .edp-stage-empty {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 13px;
  padding: 8px 2px;
}

/* ══════════════════════════════════════════════════════════════════════════
   PIPELINE CRM — Tablero en columnas (reemplaza el acordeón vertical)
   Las etapas de trabajo son columnas; Ganado y Perdido viven en la franja
   inferior porque son resultados, no etapas donde se trabaja.
   ══════════════════════════════════════════════════════════════════════════ */
.pipeline-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(258px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: start;
}
.pipeline-col {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}
.pipeline-col-head {
  padding: 12px 14px 11px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.pipeline-col-head .col-bar {
  height: 3px;
  border-radius: 2px;
  margin-bottom: 10px;
}
.pipeline-col-head .col-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pipeline-col-head .col-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-main);
}
.pipeline-col-head .col-count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  background: var(--c-gray);
  border-radius: 20px;
  padding: 1px 9px;
}
.pipeline-col-head .col-money {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--c-primary);
  font-variant-numeric: tabular-nums;
}
.pipeline-col-head .col-pond {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 1px;
}
.pipeline-col-body {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  min-height: 90px;
  max-height: 620px;
  overflow-y: auto;
  transition: background 0.15s;
}
.pipeline-col-body.drag-over {
  background: rgba(232, 101, 26, 0.08);
  box-shadow: inset 0 0 0 2px var(--c-primary);
}
.pipeline-col-body .stage-empty {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 18px 6px;
}

/* ── Tarjeta de negocio ─────────────────────────────────────────────────── */
.pipeline-col-body .kanban-card {
  padding: 11px 12px;
  position: relative;
  transition: box-shadow 0.15s, transform 0.15s;
}
.pipeline-col-body .kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
/* Franja izquierda: cuánto lleva el negocio sin moverse */
.pipeline-col-body .kanban-card::before {
  content: '';
  position: absolute;
  left: 0; top: 9px; bottom: 9px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--border);
}
.kanban-card.age-warn::before { background: #f59e0b; }
.kanban-card.age-bad::before  { background: var(--c-red); }

.kanban-card .card-client {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--c-primary);
  margin-bottom: 3px;
}
.kanban-card .card-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-main);
  margin-bottom: 6px;
}
.kanban-card .card-amount {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}
.kanban-card .card-contact {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}
.kanban-card .card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--text-muted);
}
.kanban-card .card-pill {
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.kanban-card .card-pill.age-ok   { background: #dcfce7; color: #15803d; }
.kanban-card .card-pill.age-warn { background: #fef3c7; color: #b45309; }
.kanban-card .card-pill.age-bad  { background: #fee2e2; color: #b91c1c; }
.kanban-card .card-prob {
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}
.kanban-card .card-prio {
  margin-left: auto;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.kanban-card .card-prio.prio-alta  { background: #fee2e2; color: #b91c1c; }
.kanban-card .card-prio.prio-media { background: #fef3c7; color: #b45309; }
.kanban-card .card-prio.prio-baja  { background: #e0f2fe; color: #0369a1; }

/* ── Franja de negocios cerrados ────────────────────────────────────────── */
.closed-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.closed-strip .closed-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.closed-strip .closed-item:hover {
  border-color: var(--c-primary);
  background: var(--bg-main);
}
.closed-strip .closed-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.closed-strip .closed-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
}
.closed-strip .closed-count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  background: var(--c-gray);
  border-radius: 20px;
  padding: 1px 9px;
}
.closed-strip .closed-amount {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.closed-strip .closed-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .pipeline-board {
    grid-auto-columns: minmax(240px, 82vw);
  }
}

/* ── Íconos monolínea: mismo trazo y terminaciones que el logo ── */
.ico{width:1em;height:1em;flex-shrink:0;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;fill:none;vertical-align:-0.14em}
