/* ==========================================================================
   SISTEMA DE DISENO ENTERPRISE SAAS B2G - MEDISUR CRM
   Estilo visual: Linear / Stripe Dashboard + Hilos Corporativos tipo Mensajeria
   CERO EMOJIS - Iconos 100% SVG inline - Numeros tabulares
   ========================================================================== */

:root {
  /* Paleta Corporativa */
  --bg-body: #F1F5F9;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F8FAFC;
  --bg-sidebar: #0F172A;
  --bg-sidebar-hover: #1E293B;
  --bg-sidebar-active: #1D4ED8;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-inverse: #F8FAFC;

  --border-light: #E2E8F0;
  --border-strong: #CBD5E1;
  --border-focus: #2563EB;

  --brand-primary: #1D4ED8;
  --brand-primary-hover: #1E40AF;
  --brand-primary-soft: #EFF6FF;

  --status-success: #059669;
  --status-success-bg: #ECFDF5;
  --status-warning: #D97706;
  --status-warning-bg: #FFFBEB;
  --status-danger: #DC2626;
  --status-danger-bg: #FEF2F2;
  --status-info: #0284C7;
  --status-info-bg: #F0F9FF;
  --status-neutral: #475569;
  --status-neutral-bg: #F1F5F9;

  --bubble-incoming: #FFFFFF;
  --bubble-outgoing: #EFF6FF;
  --bubble-outgoing-border: #BFDBFE;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* Numeros Tabulares Obligatorios para Precios y RUC */
.text-soles, .kpi-value, .totals-value, .item-total-cell, .column-count, .card-meta {
  font-variant-numeric: tabular-nums;
}

/* Tipografia y Enlaces */
a {
  color: var(--brand-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4, h5 {
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

/* Iconos SVG Inline */
.svg-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Layout General */
.app-container {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 220px;
  background-color: var(--bg-sidebar);
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
}

.sidebar-header {
  padding: 14px 14px 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.sidebar-brand:hover {
  text-decoration: none;
}

.brand-logo-frame {
  width: 34px;
  height: 34px;
  background: #FFFFFF;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.sidebar-square-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-identity {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-company-name {
  font-size: 12.5px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-company-sub {
  font-size: 9.5px;
  font-weight: 600;
  color: #94A3B8;
  letter-spacing: 0.5px;
}

.sidebar-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  font-size: 11px;
  color: #94A3B8;
}

.status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10B981;
}

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

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #64748B;
  padding: 10px 10px 4px 10px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: #CBD5E1;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 3px;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background-color: var(--bg-sidebar-hover);
  color: #FFFFFF;
  text-decoration: none;
}

.nav-item.active {
  background-color: var(--brand-primary);
  color: #FFFFFF;
  font-weight: 600;
}

.nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 12px;
  font-weight: 700;
}

.badge-unread {
  background-color: #DC2626 !important;
  color: #FFFFFF;
}

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

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background-color: #1E293B;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: #94A3B8;
}

.btn-logout {
  color: #94A3B8;
  padding: 6px;
  border-radius: 4px;
}
.btn-logout:hover {
  color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Main Area & Topbar */
.app-main {
  margin-left: 220px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  height: 52px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-content {
  padding: 14px 18px;
  flex: 1;
}

/* Botones y Controles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

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

.btn-primary {
  background-color: var(--brand-primary);
  color: #FFFFFF;
}
.btn-primary:hover {
  background-color: var(--brand-primary-hover);
}

.btn-secondary {
  background-color: #FFFFFF;
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background-color: var(--bg-subtle);
  border-color: #94A3B8;
}

.btn-outline {
  background: transparent;
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}
.btn-outline:hover {
  background: var(--brand-primary-soft);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
}

.btn-lg {
  padding: 10px 18px;
  font-size: 14px;
}

.btn-block {
  width: 100%;
}

.btn-icon-danger {
  background: transparent;
  border: none;
  color: #EF4444;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.btn-icon-danger:hover {
  background-color: #FEF2F2;
}

/* Badges y Etiquetas */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-neutral {
  background-color: var(--status-neutral-bg);
  color: var(--status-neutral);
  border: 1px solid #CBD5E1;
}

.badge-success {
  background-color: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid #A7F3D0;
}

.badge-warning {
  background-color: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px solid #FDE68A;
}

.badge-danger {
  background-color: var(--status-danger-bg);
  color: var(--status-danger);
  border: 1px solid #FECACA;
}

.badge-danger-solid {
  background-color: var(--status-danger);
  color: #FFFFFF;
}

.badge-danger-pulse {
  background-color: #DC2626;
  color: #FFFFFF;
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.badge-info {
  background-color: var(--status-info-bg);
  color: var(--status-info);
  border: 1px solid #BAE6FD;
}

/* Alertas Flash */
.flash-container {
  padding: 16px 24px 0 24px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

.alert-success {
  background-color: var(--status-success-bg);
  border: 1px solid #A7F3D0;
  color: #065F46;
}

.alert-danger {
  background-color: var(--status-danger-bg);
  border: 1px solid #FECACA;
  color: #991B1B;
}

.alert-close {
  margin-left: auto;
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
}

/* Tarjetas y Contenedores */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: var(--shadow-xs);
}

.card-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Formularios */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background-color: #FFFFFF;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-control-sm {
  padding: 5px 8px;
  font-size: 12px;
}

.form-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

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

.form-col-span-2 { grid-column: span 2; }
.form-col-span-3 { grid-column: span 3; }

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 10px;
  color: #94A3B8;
  pointer-events: none;
}

.input-with-icon .form-control {
  padding-left: 34px;
}

/* ==========================================================================
   VISTA: AUTENTICACION (LOGIN)
   ========================================================================== */
.auth-body {
  background-color: #0F172A;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.auth-container {
  width: 100%;
  max-width: 440px;
  padding: 20px;
}

.auth-card {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  height: 48px;
  margin-bottom: 12px;
}

.auth-title {
  font-size: 18px;
  font-weight: 800;
  color: #0F172A;
}

.auth-subtitle {
  font-size: 12px;
  color: #64748B;
  margin-top: 4px;
}

.auth-demo-hint {
  background-color: #F8FAFC;
  border: 1px dashed #CBD5E1;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 11px;
  color: #94A3B8;
  border-top: 1px solid var(--border-light);
  padding-top: 14px;
}

/* ==========================================================================
   VISTA: TABLERO KANBAN (PIPELINE)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
}

.kpi-card-warning {
  border-color: #FCD34D;
  background-color: #FFFDF5;
}

.kpi-card-success {
  border-color: #A7F3D0;
  background-color: #F4FDF8;
}

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

.kpi-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: #64748B;
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.1;
}

.kpi-subtext {
  font-size: 11px;
  color: #64748B;
  margin-top: 4px;
}

.filter-bar {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 20px;
}

.filter-form {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-search {
  flex: 1;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 16px;
}

.kanban-column {
  background-color: #E2E8F0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-width: 260px;
  max-height: calc(100vh - 280px);
}

.kanban-column-header {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #CBD5E1;
}

.column-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.column-por_evaluar { background-color: #64748B; }
.column-en_costeo { background-color: #D97706; }
.column-cotizacion_lista { background-color: #2563EB; }
.column-enviada { background-color: #0284C7; }
.column-ganada { background-color: #059669; }
.column-descartada { background-color: #94A3B8; }

.column-title {
  font-size: 13px;
  font-weight: 700;
  color: #1E293B;
}

.column-count {
  background: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  color: #475569;
}

.kanban-cards-container {
  padding: 10px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
}

.kanban-empty-placeholder {
  padding: 24px 10px;
  text-align: center;
  color: #94A3B8;
  font-size: 11px;
  border: 1px dashed #CBD5E1;
  border-radius: 6px;
}

.kanban-card {
  background-color: #FFFFFF;
  border-radius: 6px;
  padding: 12px;
  border: 1px solid #CBD5E1;
  box-shadow: var(--shadow-xs);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kanban-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: #94A3B8;
}

.kanban-card.card-prio-critica {
  border-left: 4px solid #DC2626;
}
.kanban-card.card-prio-urgente {
  border-left: 4px solid #F59E0B;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 6px;
}

.card-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--brand-primary);
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.card-entity {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 4px;
}

.entity-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-object {
  font-size: 12px;
  color: #334155;
  line-height: 1.35;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-contact {
  font-size: 11px;
  color: #64748B;
  border-top: 1px solid #F1F5F9;
  padding-top: 6px;
  margin-bottom: 8px;
}

.contact-name {
  font-weight: 600;
  color: #334155;
}

.contact-phone {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #475569;
  font-size: 10px;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 8px;
  background: #F8FAFC;
  padding: 4px 6px;
  border-radius: 4px;
}

.meta-amount {
  font-weight: 800;
  color: #0F172A;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 6px;
  background-color: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
}
.btn-card-action:hover {
  background-color: #E2E8F0;
  color: #0F172A;
  text-decoration: none;
}

.btn-card-primary {
  background-color: #EFF6FF;
  border-color: #BFDBFE;
  color: #1D4ED8;
}
.btn-card-primary:hover {
  background-color: #DBEAFE;
}

.card-stage-select {
  grid-column: span 2;
  font-size: 10.5px;
  padding: 3px 6px;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  background-color: #FFFFFF;
  color: #475569;
}

/* ==========================================================================
   VISTA: CHAT DE HILOS (BANDEJA ORIGINAL 3 PANELES)
   ========================================================================== */
.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 16px;
  height: calc(100vh - 110px);
}

.chat-sidebar-leads {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.leads-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.leads-title {
  font-size: 13px;
  font-weight: 700;
}

.leads-count {
  background: var(--bg-body);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.leads-search-box {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
}

.leads-list {
  flex: 1;
  overflow-y: auto;
}

.lead-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: inherit;
  position: relative;
  transition: background-color 0.15s ease;
}

.lead-item:hover {
  background-color: var(--bg-subtle);
  text-decoration: none;
}

.lead-item.active {
  background-color: #EFF6FF;
  border-left: 3px solid var(--brand-primary);
}

.lead-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1E293B;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.lead-info {
  flex: 1;
  min-width: 0;
}

.lead-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.lead-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #0F172A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-time {
  font-size: 10px;
  color: #94A3B8;
  flex-shrink: 0;
}

.lead-entity {
  font-size: 11px;
  color: var(--brand-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.lead-preview {
  font-size: 11px;
  color: #64748B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-unread-badge {
  position: absolute;
  right: 14px;
  bottom: 12px;
  background-color: #DC2626;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

/* Panel Central de Conversacion */
.chat-main-stream {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-placeholder-empty {
  padding: 60px 40px;
  text-align: center;
  margin: auto;
  max-width: 440px;
  color: #64748B;
}

.chat-stream-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #F8FAFC;
}

.active-contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.contact-avatar-large {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: var(--brand-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
}

.contact-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.contact-full-name {
  font-size: 15px;
  font-weight: 800;
}

.contact-subline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #64748B;
  margin-top: 2px;
}

.contact-quick-shortcuts {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background-color: #E2E8F0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message-bubble-wrapper {
  display: flex;
  width: 100%;
}
.message-bubble-wrapper.incoming {
  justify-content: flex-start;
}
.message-bubble-wrapper.outgoing {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 78%;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  line-height: 1.45;
}

.incoming .message-bubble {
  background-color: var(--bubble-incoming);
  border: 1px solid #CBD5E1;
  color: #0F172A;
}

.outgoing .message-bubble {
  background-color: var(--bubble-outgoing);
  border: 1px solid var(--bubble-outgoing-border);
  color: #0F172A;
}

.message-bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 11px;
  gap: 12px;
}

.sender-name {
  font-weight: 700;
  color: #1E293B;
}

.message-timestamp {
  color: #64748B;
  font-size: 10.5px;
}

.message-subject {
  font-size: 12px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
  color: var(--brand-primary);
}

.message-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.message-attachments-container {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.attachments-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
}

.attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: #1E293B;
  font-weight: 600;
  text-decoration: none;
}
.attachment-pill:hover {
  background-color: #F1F5F9;
  border-color: #94A3B8;
  text-decoration: none;
}

.attachment-pill.pill-quote-official {
  background-color: #EFF6FF;
  border-color: #3B82F6;
  color: #1D4ED8;
  font-weight: 700;
}

.att-size {
  color: #64748B;
  font-size: 10px;
}

.message-bubble-footer {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  font-size: 10.5px;
}

.message-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #64748B;
}

/* ==========================================================================
   RESPALDO DE AUDITORIA INMUTABLE (COTIZACION OFICIAL ENVIADA)
   ========================================================================== */
.audit-quote-box {
  margin-top: 10px;
  background-color: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-left: 4px solid #2563EB;
  border-radius: 6px;
  padding: 10px 14px;
}

.audit-box-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: #1E40AF;
  letter-spacing: 0.3px;
  margin-bottom: 8px;
}

.audit-box-file {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 8px 12px;
  gap: 12px;
}

.audit-file-left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.audit-icon-doc {
  color: #DC2626;
  flex-shrink: 0;
}

.audit-file-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.audit-file-title {
  font-size: 12px;
  color: #0F172A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audit-file-sub {
  font-size: 10.5px;
  color: #64748B;
}

/* ==========================================================================
   PANEL INFERIOR DE RESPUESTA AL HILO DE CORREO
   ========================================================================== */
.chat-reply-dock {
  background: #FFFFFF;
  border-top: 1px solid var(--border-light);
  padding: 12px 18px;
}

.reply-options-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.option-col {
  flex: 1;
}

.option-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 3px;
}

.vault-checkboxes-bar {
  background-color: #F8FAFC;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 10px;
}

.vault-bar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-primary);
  margin-bottom: 6px;
}

.vault-checkboxes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vault-checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.vault-checkbox-pill.pill-matched {
  background-color: #EFF6FF;
  border-color: #93C5FD;
  color: #1D4ED8;
}

.pill-badge {
  background-color: #DC2626;
  color: #FFFFFF;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
}

.reply-textarea {
  resize: vertical;
  font-size: 13px;
}

.reply-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

/* ==========================================================================
   PANEL 3: FICHA LATERAL DEL CONTACTO Y REQUERIMIENTO (FIJA A LA DERECHA)
   ========================================================================== */
.chat-sidebar-ficha {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.ficha-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}

.ficha-title {
  font-size: 13px;
  font-weight: 700;
}

.ficha-body {
  padding: 14px 16px;
}

.ficha-section {
  margin-bottom: 18px;
}

.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.7px;
  color: #64748B;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.ficha-item {
  background-color: #F8FAFC;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 10px 12px;
}

.ficha-item-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #0F172A;
}

.ficha-item-sub {
  font-size: 11px;
  color: #64748B;
}

.requirements-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.req-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
}

.expedientes-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.exp-history-pill {
  display: block;
  background-color: #F8FAFC;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
  color: inherit;
  font-size: 11.5px;
}
.exp-history-pill:hover {
  background-color: #F1F5F9;
  text-decoration: none;
}
.exp-history-pill.active {
  background-color: #EFF6FF;
  border-color: #93C5FD;
}

/* ==========================================================================
   TABLAS Y LISTADOS
   ========================================================================== */
.table-card {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

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

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

.data-table th {
  background-color: #F8FAFC;
  border-bottom: 1px solid var(--border-light);
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #475569;
  text-align: left;
}

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

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

.table-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ==========================================================================
   CONSTRUCTOR DE COTIZACIONES
   ========================================================================== */
.quote-builder-summary-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: flex-start;
}

.summary-totals-card {
  background: #F8FAFC;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 16px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid #E2E8F0;
}

.totals-row-grand {
  border-bottom: none;
  padding-top: 10px;
  font-size: 16px;
  font-weight: 800;
  color: var(--brand-primary);
}

.totals-value {
  font-weight: 700;
}

/* ==========================================================================
   BOVEDA CORPORATIVA GRID
   ========================================================================== */
.vault-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.vault-card {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
}

.vault-card-default {
  border-color: #93C5FD;
  background-color: #FBFCFE;
}

.vault-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.vault-doc-code {
  font-weight: 800;
  color: var(--brand-primary);
  font-size: 13px;
}

.vault-doc-title {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}

.vault-doc-meta {
  font-size: 11.5px;
  color: #64748B;
  margin-bottom: 12px;
  line-height: 1.4;
}

.vault-card-toggle {
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
  margin-bottom: 12px;
}

.vault-card-actions {
  display: flex;
  gap: 6px;
}

/* ==========================================================================
   MODALES Y UTILITARIOS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-dialog {
  background: #FFFFFF;
  border-radius: 10px;
  width: 100%;
  max-width: 650px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

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

.modal-title {
  font-size: 16px;
  font-weight: 800;
}

.modal-subtitle {
  font-size: 12px;
  color: #64748B;
  margin-top: 2px;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #94A3B8;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

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

.quick-demo-banner {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  padding: 10px 14px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 12px;
}

/* Helpers */
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12.5px; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--brand-primary); }
.text-success { color: var(--status-success); }
.text-warning { color: var(--status-warning); }
.cursor-pointer { cursor: pointer; }
.w-full { width: 100%; }
.flex-1 { flex: 1; }



/* ==========================================================================
   MONITOR DE SINCRONIZACION GMAIL EN VIVO (TOPBAR)
   ========================================================================== */
.btn-sync-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  border: 1px solid transparent;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-sync-status:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-sync-status:active {
  transform: translateY(0);
}

/* Estado: CONECTADO (Verde Seguro) */
.btn-sync-status.status-connected {
  background-color: #059669;
  border-color: #047857;
  color: #FFFFFF;
}

.btn-sync-status.status-connected .status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #6EE7B7;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
  animation: pulse-sync-green 2s infinite ease-in-out;
}

.btn-sync-status.status-connected .status-indicator-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

/* Estado: DESCONECTADO / ERROR (Rojo Alerta Inmediata) */
.btn-sync-status.status-error,
.btn-sync-status.status-disconnected {
  background-color: #DC2626;
  border-color: #B91C1C;
  color: #FFFFFF;
}

.btn-sync-status.status-error .status-indicator-dot,
.btn-sync-status.status-disconnected .status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #FECACA;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
  animation: pulse-sync-red 1.2s infinite ease-in-out;
}

.btn-sync-status.status-error .status-indicator-badge,
.btn-sync-status.status-disconnected .status-indicator-badge {
  background: rgba(0, 0, 0, 0.28);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

/* Estado: VERIFICANDO... (Gris con animacion) */
.btn-sync-status.status-checking {
  background-color: #F1F5F9;
  border-color: #CBD5E1;
  color: #475569;
}

.btn-sync-status.status-checking .status-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #94A3B8;
  animation: pulse-sync-gray 1s infinite alternate;
}

.btn-sync-status.status-checking .status-indicator-badge {
  background: #E2E8F0;
  color: #64748B;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
}

@keyframes pulse-sync-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(110, 231, 183, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(110, 231, 183, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(110, 231, 183, 0); }
}

@keyframes pulse-sync-red {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(254, 202, 202, 0.85); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(254, 202, 202, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(254, 202, 202, 0); }
}

@keyframes pulse-sync-gray {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* Modal de Detalles de Sincronizacion */
.sync-modal-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.sync-modal-banner.banner-connected {
  background-color: #ECFDF5;
  border: 1px solid #A7F3D0;
  color: #065F46;
}

.sync-modal-banner.banner-connected .banner-status-icon {
  background-color: #059669;
  color: #FFFFFF;
}

.sync-modal-banner.banner-error,
.sync-modal-banner.banner-disconnected {
  background-color: #FEF2F2;
  border: 1px solid #FECACA;
  color: #991B1B;
}

.sync-modal-banner.banner-error .banner-status-icon,
.sync-modal-banner.banner-disconnected .banner-status-icon {
  background-color: #DC2626;
  color: #FFFFFF;
}

.sync-modal-banner.banner-checking {
  background-color: #F8FAFC;
  border: 1px solid #E2E8F0;
  color: #334155;
}

.sync-modal-banner.banner-checking .banner-status-icon {
  background-color: #64748B;
  color: #FFFFFF;
}

.banner-status-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.banner-status-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.banner-status-desc {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 2px;
}

.sync-details-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  background-color: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 12px 16px;
}

.sync-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  padding: 4px 0;
  border-bottom: 1px dashed #E2E8F0;
}

.sync-detail-item:last-child {
  border-bottom: none;
}

.sync-detail-label {
  color: var(--text-muted);
  font-weight: 500;
}

.sync-detail-value {
  color: var(--text-primary);
}

.sync-security-notice {
  background-color: #FFFBEB;
  border: 1px solid #FDE68A;
  border-left: 4px solid #D97706;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
}

.sync-security-notice .notice-title {
  font-weight: 700;
  color: #92400E;
  margin-bottom: 3px;
}

.sync-security-notice .notice-text {
  color: #78350F;
  line-height: 1.45;
}


/* ==========================================================================
   MEJORAS V2.0: LOGO CUADRADO, KANBAN COMPACTO, LECTOR PDF, PRE-ENVIO Y DASHBOARD
   ========================================================================== */

.btn:disabled,
button:disabled {
  opacity: 0.48;
  cursor: not-allowed !important;
  pointer-events: none;
}

.badge-success-solid {
  background-color: #059669;
  color: #FFFFFF;
}

.badge-warning-solid {
  background-color: #D97706;
  color: #FFFFFF;
}

.badge-info-solid {
  background-color: #0284C7;
  color: #FFFFFF;
}

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.flex-wrap { flex-wrap: wrap; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.font-mono { font-family: var(--font-mono); }

/* Login Identidad Logo Cuadrado Negro */
.auth-brand-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 8px 14px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
}

.auth-square-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
}

.auth-brand-text {
  text-align: left;
}

.auth-company-name {
  font-size: 13px;
  font-weight: 800;
  color: #0F172A;
}

.auth-company-ruc {
  font-size: 11px;
  font-family: var(--font-mono);
  color: #64748B;
}

/* KPI Compactos y Dashboard Financiero Admin */
.kpi-grid-compact {
  gap: 10px;
  margin-bottom: 10px;
}

.kpi-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.kpi-grid-compact .kpi-card {
  padding: 8px 12px;
}

.kpi-grid-compact .kpi-header {
  margin-bottom: 3px;
}

.kpi-grid-compact .kpi-value {
  font-size: 17.5px;
}

.kpi-grid-compact .kpi-subtext {
  font-size: 10.5px;
  margin-top: 2px;
}

.kpi-card-profit {
  border-color: #6EE7B7;
  background: linear-gradient(180deg, #FFFFFF 0%, #ECFDF5 100%);
}

.exec-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.exec-kpi-card {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
}

.exec-kpi-highlight {
  border-color: #6EE7B7;
  background: #F0FDF4;
}

.exec-kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: #0F172A;
  font-variant-numeric: tabular-nums;
  margin: 4px 0;
}

.dashboard-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.card-header-bar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  background: #FFFFFF;
}

/* Tablero Kanban Ultra-Compacto de 6 Columnas */
.filter-bar-compact {
  padding: 7px 10px;
  margin-bottom: 10px;
}

.pipeline-drag-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #64748B;
  white-space: nowrap;
  margin-left: auto;
}

.kanban-board-compact {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
  overflow-x: auto;
  padding-bottom: 6px;
}

.kanban-board-compact .kanban-column {
  min-width: 0;
  max-height: calc(100vh - 188px);
  background-color: #E2E8F0;
  border: 1px solid #CBD5E1;
  border-radius: 7px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.kanban-board-compact .kanban-column.drag-over {
  background-color: #DBEAFE;
  border-color: #2563EB;
  box-shadow: inset 0 0 0 1px #2563EB;
}

.kanban-board-compact .kanban-column-header {
  padding: 7px 8px;
}

.kanban-board-compact .column-title-group {
  gap: 6px;
  min-width: 0;
}

.kanban-board-compact .column-title {
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-board-compact .column-count {
  font-size: 10.5px;
  padding: 1px 6px;
  flex-shrink: 0;
}

.kanban-board-compact .kanban-cards-container {
  padding: 6px;
  gap: 6px;
  min-height: 90px;
}

.kanban-board-compact .kanban-card {
  padding: 7px 8px;
  border-radius: 5px;
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.is-dragging {
  opacity: 0.42;
  transform: scale(0.98);
}

.kanban-board-compact .card-header {
  margin-bottom: 4px;
  gap: 4px;
}

.card-code-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}

.card-grip {
  color: #94A3B8;
  display: inline-flex;
  cursor: grab;
  flex-shrink: 0;
}

.kanban-board-compact .card-code {
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-sla {
  font-size: 9.5px;
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.kanban-board-compact .card-entity {
  font-size: 10.5px;
  margin-bottom: 3px;
  gap: 4px;
}

.kanban-board-compact .card-object {
  font-size: 11px;
  line-height: 1.28;
  margin-bottom: 5px;
  -webkit-line-clamp: 2;
}

.card-compact-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #475569;
  background: #F8FAFC;
  border: 1px solid #F1F5F9;
  border-radius: 4px;
  padding: 3px 5px;
  margin-bottom: 5px;
}

.contact-name-compact {
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-docs-compact {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.card-actions-compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.card-actions-compact .btn-card-action {
  padding: 3px 4px;
  font-size: 10px;
}

.card-stage-select-compact {
  grid-column: span 2;
  font-size: 10px;
  padding: 2px 4px;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  background-color: #FFFFFF;
  color: #334155;
  width: 100%;
  cursor: pointer;
}

@media (max-width: 1200px) {
  .kanban-board-compact {
    grid-template-columns: repeat(6, minmax(195px, 1fr));
  }
}

/* Lector PDF y Selector Hoja 1 en Constructor de Cotizaciones */
.pdf-reader-panel {
  border-left: 4px solid var(--brand-primary);
  background: linear-gradient(90deg, #F8FAFC 0%, #FFFFFF 100%);
}

.reader-icon-box {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: #EFF6FF;
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #BFDBFE;
}

.extracted-chips-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed #CBD5E1;
}

.ext-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: #1E293B;
}

.ext-chip-alert {
  background: #FFFBEB;
  border-color: #FCD34D;
  color: #92400E;
}

.ext-chip-ok {
  background: #ECFDF5;
  border-color: #A7F3D0;
  color: #065F46;
}

.hoja1-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.hoja1-mode-card {
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  background: #FFFFFF;
  transition: all 0.15s ease;
  display: block;
}

.hoja1-mode-card:hover {
  border-color: #94A3B8;
  background: #F8FAFC;
}

.hoja1-mode-card.active {
  border-color: var(--brand-primary);
  background: #EFF6FF;
  box-shadow: 0 0 0 1px var(--brand-primary);
}

.hoja1-mode-card input[type="radio"] {
  margin-right: 6px;
}

.mode-card-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: #0F172A;
}

.mode-card-desc {
  font-size: 11px;
  color: #475569;
  margin-top: 4px;
  line-height: 1.35;
}

.client-format-box {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 6px;
  padding: 10px 12px;
}

.ordered-dossier-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dossier-step-pill {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 4px;
  border: 1px solid #CBD5E1;
  background: #F8FAFC;
  color: #334155;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dossier-step-pill.step-dynamic {
  background: #EFF6FF;
  border-color: #93C5FD;
  color: #1E40AF;
}

.dossier-step-pill.step-matched {
  background: #ECFDF5;
  border-color: #6EE7B7;
  color: #065F46;
  font-weight: 600;
}

.pill-req-flag {
  background: #059669;
  color: #FFFFFF;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  text-transform: uppercase;
}

.vault-order-badge {
  background: #0F172A;
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Candado Pre-Envio ("Revisar Antes de Enviar" -> "Documento revisado" -> "Enviar") */
.pre-send-gate-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.review-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px dashed #CBD5E1;
  background: #F8FAFC;
  color: #64748B;
  cursor: pointer;
  user-select: none;
}

.review-status-pill.is-reviewed {
  border-style: solid;
  border-color: #059669;
  background: #ECFDF5;
  color: #065F46;
}

.review-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.review-info-card {
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 10px 12px;
}

.review-card-label {
  font-size: 10px;
  font-weight: 800;
  color: #64748B;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.review-attachments-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 8px;
  background: #FFFFFF;
}

.review-att-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 4px;
  font-size: 11.5px;
}

.review-email-preview {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11.5px;
  color: #334155;
  max-height: 95px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.mandatory-review-check-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 2px solid #93C5FD;
  background: #EFF6FF;
  border-radius: 8px;
  cursor: pointer;
}

.mandatory-review-check-box input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #059669;
  cursor: pointer;
}

/* Notificaciones Toast Corporativas */
.toast-container {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-toast {
  background: #0F172A;
  color: #FFFFFF;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  border-left: 4px solid #10B981;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.app-toast.toast-error {
  border-left-color: #EF4444;
}
