@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* TD Consultores CRM — Main Stylesheet */
:root {
  --navy: #1a1a2e;
  --td-red: #C8102E;
  --navy-light: #16213e;
  --blue: #F26522;
  --blue-light: #F5874B;
  --blue-pale: #FEF3EB;
  --success: #28a745;
  --success-light: #d4edda;
  --warning: #ffc107;
  --warning-light: #fff3cd;
  --danger: #dc3545;
  --danger-light: #f8d7da;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;
  --sidebar-width: 240px;
  --header-height: 56px;
  --border-radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 2px 8px rgba(0,0,0,0.12);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.16);
}

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

html { font-size: 16px; }

body {
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--gray-100);
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-brand .brand-logo {
  height: 28px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sidebar-brand .brand-logo img {
  height: 100%;
  width: auto;
  filter: brightness(0) invert(1);
}

.sidebar-brand .brand-text {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
}

.sidebar-brand .brand-text small {
  display: block;
  font-size: 0.7rem;
  opacity: 0.65;
  font-weight: 400;
}

.sidebar-nav {
  padding: 0.75rem 0;
  flex: 1;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  padding: 0.75rem 1rem 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.6rem 1rem;
  color: rgba(255,255,255,0.75);
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  text-decoration: none;
}

.nav-item.active {
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}

.nav-item .nav-icon {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-style: normal;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--gray-800);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--gray-700);
  font-size: 1.25rem;
  line-height: 1;
}

.page-content {
  padding: 1.5rem;
  flex: 1;
}

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-800);
}

.card-body {
  padding: 1.25rem;
}

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--blue-pale); }
.stat-icon.green { background: var(--success-light); }
.stat-icon.warning { background: var(--warning-light); }
.stat-icon.navy { background: rgba(26,26,46,0.08); }

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--gray-900);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.2rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn:hover { opacity: 0.88; text-decoration: none; }

.btn-primary { background: var(--blue); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: var(--gray-200); color: var(--gray-800); }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; }
.btn-ghost { background: transparent; color: var(--blue); padding: 0.3rem 0.5rem; }

/* ── Tables ── */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

table th {
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}

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

table tbody tr:hover { background: var(--gray-100); }

.td-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-activo, .badge-success { background: var(--success-light); color: #155724; }
.badge-inactivo, .badge-cancelado, .badge-perdido { background: var(--gray-200); color: var(--gray-600); }
.badge-completado { background: var(--blue-pale); color: #B8471A; }
.badge-propuesta, .badge-warning { background: var(--warning-light); color: #856404; }
.badge-prospecto { background: #e2d9f3; color: #512da8; }
.badge-contacto { background: #d1ecf1; color: #0c5460; }
.badge-negociacion { background: #fff3e0; color: #e65100; }
.badge-cierre { background: var(--success-light); color: #155724; }
.badge-danger { background: var(--danger-light); color: #721c24; }

/* Tipo de interacción */
.tipo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
}

.tipo-reunion { color: #0066cc; }
.tipo-llamada { color: #28a745; }
.tipo-email { color: #6f42c1; }
.tipo-nota { color: #fd7e14; }

/* ── Forms ── */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.3rem;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.87rem;
  font-family: inherit;
  color: var(--gray-900);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(242,101,34,0.12);
}

textarea.form-control { resize: vertical; min-height: 90px; }

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.87rem;
}

.form-check input[type="checkbox"] {
  width: 16px; height: 16px;
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
  margin-top: 1rem;
}

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.page-header-left h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
}

.page-header-left .breadcrumb {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 0.2rem;
}

.page-header-left .breadcrumb a {
  color: var(--gray-500);
}

.page-header-left .breadcrumb a:hover {
  color: var(--blue);
}

.page-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-bar select, .filter-bar input[type="text"] {
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.85rem;
  background: #fff;
  color: var(--gray-800);
  appearance: none;
}

/* ── Detail Page ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 2rem;
  font-size: 0.875rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.detail-item .detail-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-500);
}

.detail-item .detail-value {
  color: var(--gray-900);
}

/* ── Section tabs ── */
.section-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 1.25rem;
  overflow-x: auto;
}

.section-tab {
  padding: 0.6rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-600);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  text-decoration: none;
  display: inline-block;
}

.section-tab:hover {
  color: var(--blue);
  text-decoration: none;
}

.section-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

/* ── Pipeline ── */
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.pipeline-stage {
  background: #fff;
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.pipeline-stage-header {
  padding: 0.65rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid currentColor;
}

.stage-prospecto .pipeline-stage-header { color: #7c3aed; border-bottom-color: #7c3aed; background: #f5f3ff; }
.stage-contacto .pipeline-stage-header { color: #0891b2; border-bottom-color: #0891b2; background: #ecfeff; }
.stage-propuesta .pipeline-stage-header { color: #d97706; border-bottom-color: #d97706; background: #fffbeb; }
.stage-negociacion .pipeline-stage-header { color: #ea580c; border-bottom-color: #ea580c; background: #fff7ed; }
.stage-cierre .pipeline-stage-header { color: #16a34a; border-bottom-color: #16a34a; background: #f0fdf4; }
.stage-perdido .pipeline-stage-header { color: #dc2626; border-bottom-color: #dc2626; background: #fef2f2; }

.pipeline-deals {
  padding: 0.5rem;
  min-height: 60px;
}

.pipeline-deal-card {
  background: var(--gray-100);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.pipeline-deal-card:hover {
  box-shadow: var(--shadow);
}

.pipeline-deal-card:last-child {
  margin-bottom: 0;
}

.deal-name {
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.2rem;
}

.deal-empresa {
  color: var(--gray-500);
  font-size: 0.75rem;
  margin-bottom: 0.3rem;
}

.deal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.deal-valor {
  font-weight: 700;
  color: var(--success);
}

.deal-prob {
  color: var(--gray-500);
  font-size: 0.75rem;
}

.pipeline-stage-total {
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  background: var(--gray-100);
  border-top: 1px solid var(--gray-200);
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--gray-500);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.empty-state p {
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* ── Alert / Flash ── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-success { background: var(--success-light); color: #155724; border: 1px solid #b7dfbc; }
.alert-danger { background: var(--danger-light); color: #721c24; border: 1px solid #f1b0b7; }

/* ── Delete form button ── */
.delete-btn-form { display: inline; margin: 0; padding: 0; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle { display: flex; }

  .form-grid { grid-template-columns: 1fr; }

  .detail-grid { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: 1fr 1fr; }

  .pipeline-grid { grid-template-columns: 1fr; }

  .page-content { padding: 1rem; }

  .page-header { flex-direction: column; }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }

  .sidebar-overlay.show { display: block; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ─── Badges (additional) ─────────────────────────────────────────────────── */
.badge-primary { background: var(--blue-pale); color: #B8471A; }
.badge-secondary { background: var(--gray-200); color: var(--gray-700); }

/* ─── Topbar user info ────────────────────────────────────────────────────── */
.topbar-user {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-right: 0.5rem;
}

/* ─── Table action cell ───────────────────────────────────────────────────── */
.actions-cell { white-space: nowrap; }

/* ─── Checkbox label ──────────────────────────────────────────────────────── */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
}

/* ─── Text muted ──────────────────────────────────────────────────────────── */
.text-muted { color: var(--gray-600); font-size: 0.85rem; }

/* ─── Login Page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: var(--td-red);
}

.login-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Brand panel (left) */
.login-panel-brand {
  flex: 0 0 45%;
  background: linear-gradient(160deg, var(--td-red) 0%, #a00d24 60%, #8b0b1f 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem;
  color: #fff;
}

.login-brand-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  padding-top: 4rem;
}

.login-brand-logo img {
  max-width: 180px;
  height: auto;
  margin-bottom: 2rem;
}

.login-brand-tagline {
  font-size: 1.35rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin: 0 0 2.5rem;
  line-height: 1.4;
}

.brand-features {
  list-style: none;
  margin: 0;
  padding: 0;
}

.brand-feature-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.brand-feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.brand-feature-item span:last-child {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
}

.login-brand-footer {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  padding-top: 2rem;
}

/* Form panel (right) */
.login-panel-form {
  flex: 1;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 4rem;
  animation: fadeInUp 0.4s ease-out;
}

.login-mobile-logo {
  display: none;
  margin-bottom: 1.5rem;
}

.login-mobile-logo img {
  max-width: 160px;
  height: auto;
}

.login-form-inner {
  width: 100%;
  max-width: 400px;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 0.4rem;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--gray-600);
  margin: 0 0 2rem;
  line-height: 1.5;
}

/* Input groups with icons */
.input-group {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.login-input {
  width: 100%;
  padding: 0.75rem 0.75rem 0.75rem 2.75rem;
  border: 1.5px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--gray-900);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.login-input:focus {
  outline: none;
  border-color: #F26522;
  box-shadow: 0 0 0 3px rgba(242, 101, 34, 0.15);
}

.login-input::placeholder { color: var(--gray-400); }

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  display: flex;
  align-items: center;
  line-height: 1;
}

.password-toggle:hover { color: var(--gray-600); }

/* Error alert */
.login-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

/* Submit button */
.login-btn {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  background: #F26522;
  color: #fff;
  border: none;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.2s, transform 0.1s;
  font-family: inherit;
}

.login-btn:hover { background: #d4541a; }
.login-btn:active { transform: scale(0.98); }

.login-form-footer {
  margin-top: 2rem;
  font-size: 0.78rem;
  color: var(--gray-400);
  text-align: center;
}

.login-form .form-group { margin-bottom: 1.25rem; }

/* Animation */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Mobile */
@media (max-width: 768px) {
  .login-container { flex-direction: column; }
  .login-panel-brand { display: none; }
  .login-panel-form { width: 100%; padding: 2rem 1.5rem; }
  .login-mobile-logo { display: block; }
}

/* ─── PWXCT-5: New Module Styles ─────────────────────────────────────────────── */

/* Nav group collapsible sections */
.nav-group { border-bottom: 1px solid rgba(255,255,255,0.06); }

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.65rem 1rem;
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}

.nav-group-header:hover { background: rgba(255,255,255,0.06); }

.nav-group-header span { display: flex; align-items: center; gap: 0.5rem; }

.nav-chevron {
  font-size: 0.6rem;
  transition: transform 0.2s;
  opacity: 0.6;
}

.nav-group-header.expanded .nav-chevron { transform: rotate(180deg); }

.nav-group-items {
  display: none;
  background: rgba(0,0,0,0.15);
}

.nav-group-items.open { display: block; }

.nav-item.nav-sub {
  padding-left: 2rem;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.65);
}

.nav-item.nav-sub:hover { color: #fff; }
.nav-item.nav-sub.active { background: var(--blue); color: #fff; }

/* Module landing page cards */
.module-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.module-card {
  background: #fff;
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
  padding: 1.5rem;
  transition: box-shadow 0.2s, border-color 0.2s;
  text-decoration: none;
  display: block;
}

.module-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--blue);
  text-decoration: none;
}

.module-card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.module-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.4rem;
}

.module-card-desc {
  font-size: 0.82rem;
  color: var(--gray-600);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.module-card-stats {
  display: flex;
  gap: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-200);
}

.module-stat {
  font-size: 0.78rem;
  color: var(--gray-500);
}

.module-stat strong {
  display: block;
  font-size: 1.1rem;
  color: var(--gray-900);
  font-weight: 700;
}

/* Module description banner */
.module-banner {
  background: linear-gradient(135deg, var(--navy) 0%, #2d2d52 100%);
  color: #fff;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.module-banner h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.module-banner p {
  font-size: 0.85rem;
  opacity: 0.85;
  line-height: 1.6;
  margin: 0;
}

/* Health score indicators */
.health-score-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.health-score-alto { background: var(--success); }
.health-score-medio { background: var(--warning); color: var(--gray-800); }
.health-score-bajo { background: var(--danger); }

.health-score-bar-wrap {
  background: var(--gray-200);
  border-radius: 8px;
  height: 8px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.health-score-bar {
  height: 100%;
  border-radius: 8px;
  transition: width 0.5s;
}

/* Onboarding progress */
.onboarding-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray-200);
}

.onboarding-step:last-child { border-bottom: none; }

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.step-number.done { background: var(--success); color: #fff; }
.step-number.in-progress { background: var(--blue); color: #fff; }

/* CPQ calculator */
.cpq-total-box {
  background: var(--navy);
  color: #fff;
  border-radius: var(--border-radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.cpq-total-label {
  font-size: 0.85rem;
  opacity: 0.75;
}

.cpq-total-value {
  font-size: 1.8rem;
  font-weight: 700;
}

/* Renewal alert badges */
.badge-vigente { background: var(--success-light); color: #155724; }
.badge-proximo { background: var(--warning-light); color: #856404; }
.badge-vencido { background: var(--danger-light); color: #721c24; }
.badge-renovado { background: var(--blue-pale); color: #B8471A; }

/* Pipeline type tabs */
.pipeline-type-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.pipeline-tab {
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--gray-300);
  background: #fff;
  color: var(--gray-600);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.pipeline-tab:hover { text-decoration: none; color: var(--blue); border-color: var(--blue); }
.pipeline-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* Score bar */
.score-bar-wrap { display: flex; align-items: center; gap: 0.5rem; }
.score-bar { background: var(--gray-200); border-radius: 8px; height: 6px; flex: 1; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 8px; background: var(--blue); }

/* Fact tags */
.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--blue-pale);
  color: #B8471A;
  margin: 0.15rem;
}

/* Print styles for quotations */
@media print {
  .sidebar, .topbar, .btn, form { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* Responsive adjustments for module cards */
@media (max-width: 768px) {
  .module-cards { grid-template-columns: 1fr; }
  .cpq-total-box { flex-direction: column; text-align: center; }
  .pipeline-type-tabs { gap: 0.25rem; }
}

/* Pipeline partner badge */
.partner-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  background: #e0f2f1;
  color: #00695c;
}

/* Info box */
.info-box {
  background: var(--blue-pale);
  border-left: 3px solid var(--blue);
  border-radius: 0 6px 6px 0;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--gray-800);
  margin-bottom: 1rem;
}

