/* ============================================================
   AKSTRATO CRM — Módulo Cotizaciones
   ============================================================ */

/* ── Vista principal ─────────────────────────────────────── */
.cot-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #F9FAFB;
}

.cot-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 24px 14px;
  background: #fff;
  border-bottom: 1px solid #E5E7EB;
  flex-shrink: 0;
}

.cot-topbar h1 {
  font-size: 18px;
  font-weight: 700;
  color: #0D1B2A;
  flex: 1;
}

.cot-search {
  position: relative;
  width: 240px;
}

.cot-search input {
  width: 100%;
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  padding: 7px 10px 7px 32px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: #F9FAFB;
  color: #374151;
  transition: border-color .15s;
}

.cot-search input:focus {
  border-color: #2B2BFF;
  background: #fff;
}

.cot-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #9CA3AF;
  pointer-events: none;
}

.cot-btn-new {
  background: #2B2BFF;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .15s;
}

.cot-btn-new:hover {
  background: #1a1aee;
}

/* ── Filtros por estado ──────────────────────────────────── */
.cot-filters {
  display: flex;
  gap: 6px;
  padding: 10px 24px;
  background: #fff;
  border-bottom: 1px solid #E5E7EB;
  flex-shrink: 0;
  overflow-x: auto;
}

.cot-filter-btn {
  border: 1.5px solid #E5E7EB;
  background: #fff;
  color: #374151;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}

.cot-filter-btn:hover {
  border-color: #2B2BFF;
  color: #2B2BFF;
}

.cot-filter-btn.active {
  background: #2B2BFF;
  border-color: #2B2BFF;
  color: #fff;
}

/* ── Tabla de cotizaciones ───────────────────────────────── */
.cot-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.cot-empty {
  text-align: center;
  padding: 60px 20px;
  color: #9CA3AF;
}

.cot-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.cot-empty p {
  font-size: 14px;
  font-weight: 500;
  color: #6B7280;
}

.cot-empty small {
  font-size: 12px;
  color: #9CA3AF;
}

.cot-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.cot-table thead tr {
  background: #F9FAFB;
  border-bottom: 1px solid #E5E7EB;
}

.cot-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #6B7280;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.cot-table td {
  padding: 12px 14px;
  font-size: 13px;
  color: #374151;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: middle;
}

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

.cot-table tbody tr:hover td {
  background: #FAFAFA;
}

.cot-table tbody tr {
  cursor: pointer;
  transition: background .1s;
}

.cot-quote-number {
  font-weight: 700;
  color: #2B2BFF;
  font-size: 12px;
  font-family: 'DM Mono', monospace;
}

.cot-contact {
  font-weight: 600;
  color: #0D1B2A;
  font-size: 13px;
}

.cot-lead-title {
  font-size: 11px;
  color: #9CA3AF;
  margin-top: 2px;
}

.cot-total {
  font-weight: 700;
  color: #10B981;
  font-family: 'DM Mono', monospace;
}

/* ── Status badges ───────────────────────────────────────── */
.cot-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.cot-status.borrador  { background: #F3F4F6; color: #6B7280; }
.cot-status.enviada   { background: #FEF3C7; color: #D97706; }
.cot-status.aceptada  { background: #D1FAE5; color: #059669; }
.cot-status.rechazada { background: #FEE2E2; color: #DC2626; }
.cot-status.expirada  { background: #F3F4F6; color: #9CA3AF; }

/* ── Modal editor ────────────────────────────────────────── */
.cot-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.cot-modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 820px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.cot-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #E5E7EB;
  flex-shrink: 0;
}

.cot-modal-head h2 {
  font-size: 16px;
  font-weight: 700;
  color: #0D1B2A;
  flex: 1;
}

.cot-modal-num {
  font-size: 12px;
  color: #2B2BFF;
  font-family: 'DM Mono', monospace;
  font-weight: 700;
}

.cot-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #9CA3AF;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color .15s;
}

.cot-modal-close:hover {
  color: #374151;
  background: #F3F4F6;
}

.cot-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* ── Metadata bar (estado, validez, etc.) ────────────────── */
.cot-meta-bar {
  display: flex;
  gap: 12px;
  padding: 12px 22px;
  background: #F9FAFB;
  border-bottom: 1px solid #E5E7EB;
  align-items: center;
  flex-wrap: wrap;
}

.cot-meta-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cot-meta-label {
  font-size: 10px;
  font-weight: 700;
  color: #9CA3AF;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.cot-meta-input {
  border: 1.5px solid #E5E7EB;
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  color: #374151;
  background: #fff;
  transition: border-color .15s;
}

.cot-meta-input:focus {
  border-color: #2B2BFF;
}

/* ── Items editor ────────────────────────────────────────── */
.cot-items-section {
  padding: 18px 22px;
}

.cot-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}

.cot-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}

.cot-items-table th {
  padding: 7px 8px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: #9CA3AF;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border-bottom: 1.5px solid #E5E7EB;
}

.cot-items-table th.num { text-align: right; }

.cot-items-table td {
  padding: 6px 4px;
  vertical-align: middle;
}

.cot-item-input {
  border: 1.5px solid transparent;
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  width: 100%;
  background: transparent;
  color: #374151;
  transition: border-color .15s, background .15s;
}

.cot-item-input:focus {
  border-color: #2B2BFF;
  background: #F5F3FF;
}

.cot-item-input.num {
  text-align: right;
}

.cot-item-total {
  font-size: 12px;
  font-weight: 700;
  color: #10B981;
  text-align: right;
  padding: 5px 7px;
  font-family: 'DM Mono', monospace;
  white-space: nowrap;
}

.cot-item-del {
  background: none;
  border: none;
  cursor: pointer;
  color: #D1D5DB;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color .15s;
}

.cot-item-del:hover {
  color: #EF4444;
  background: #FEE2E2;
}

.cot-add-item-btn {
  background: none;
  border: 1.5px dashed #D1D5DB;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  color: #6B7280;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cot-add-item-btn:hover {
  border-color: #2B2BFF;
  color: #2B2BFF;
  background: #EEF2FF;
}

/* ── Totals ──────────────────────────────────────────────── */
.cot-totals {
  margin-left: auto;
  width: 280px;
  padding: 12px 22px 0;
}

.cot-totals-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 12px;
  color: #6B7280;
}

.cot-totals-row.main {
  font-size: 15px;
  font-weight: 800;
  color: #0D1B2A;
  border-top: 2px solid #E5E7EB;
  margin-top: 4px;
  padding-top: 8px;
}

.cot-totals-row span:last-child {
  font-family: 'DM Mono', monospace;
  font-weight: 700;
  color: #10B981;
}

.cot-totals-row.main span:last-child {
  font-size: 18px;
}

/* ── Notes section ───────────────────────────────────────── */
.cot-notes-section {
  padding: 14px 22px;
  border-top: 1px solid #F3F4F6;
}

.cot-notes-textarea {
  width: 100%;
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  resize: none;
  color: #374151;
  transition: border-color .15s;
}

.cot-notes-textarea:focus {
  border-color: #2B2BFF;
}

/* ── Action footer ───────────────────────────────────────── */
.cot-modal-foot {
  padding: 14px 22px;
  border-top: 1px solid #E5E7EB;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.cot-foot-left {
  display: flex;
  gap: 8px;
}

.cot-foot-right {
  display: flex;
  gap: 8px;
}

.cot-foot-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}

.cot-foot-btn.primary   { background: #2B2BFF; color: #fff; }
.cot-foot-btn.primary:hover  { background: #1a1aee; }
.cot-foot-btn.success   { background: #10B981; color: #fff; }
.cot-foot-btn.success:hover  { background: #059669; }
.cot-foot-btn.warning   { background: #F59E0B; color: #fff; }
.cot-foot-btn.warning:hover  { background: #D97706; }
.cot-foot-btn.danger    { background: #FEE2E2; color: #DC2626; }
.cot-foot-btn.danger:hover   { background: #FECACA; }
.cot-foot-btn.ghost     { background: #F3F4F6; color: #374151; }
.cot-foot-btn.ghost:hover    { background: #E5E7EB; }
.cot-foot-btn.wa        { background: #25D366; color: #fff; }
.cot-foot-btn.wa:hover       { background: #1DA851; }
.cot-foot-btn.danger-outline { background: transparent; color: #DC2626; border: 1.5px solid #FECACA; }
.cot-foot-btn.danger-outline:hover { background: #FEE2E2; border-color: #FCA5A5; }

/* ── Contact info en header del modal ───────────────────── */
.cot-contact-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #374151;
}

.cot-contact-info.no-contact {
  color: #9CA3AF;
}

.cot-contact-info em {
  font-style: normal;
  color: #6B7280;
}

.cot-contact-change {
  background: #F3F4F6;
  border: none;
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11px;
  color: #6B7280;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all .15s;
}

.cot-contact-change:hover {
  background: #E5E7EB;
  color: #374151;
}

.cot-assign-contact-btn {
  background: none;
  border: 1.5px dashed #D1D5DB;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  color: #6B7280;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .15s;
}

.cot-assign-contact-btn:hover {
  border-color: #2B2BFF;
  color: #2B2BFF;
  background: #EEF2FF;
}

/* ── Contact picker dropdown ─────────────────────────────── */
.cot-contact-picker {
  background: #fff;
  border: 1.5px solid #E5E7EB;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  margin-top: 4px;
  overflow: hidden;
  max-width: 380px;
}

.cot-contact-picker-input {
  width: 100%;
  border: none;
  border-bottom: 1.5px solid #F3F4F6;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  color: #374151;
  background: #FAFAFA;
}

.cot-contact-picker-results {
  max-height: 200px;
  overflow-y: auto;
}

.cot-contact-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .1s;
  border-bottom: 1px solid #F9FAFB;
}

.cot-contact-result:last-child {
  border-bottom: none;
}

.cot-contact-result:hover {
  background: #EEF2FF;
}

.cot-cr-name {
  font-weight: 600;
  font-size: 12px;
  color: #0D1B2A;
}

.cot-cr-co {
  font-size: 11px;
  color: #6B7280;
}

.cot-cr-phone {
  font-size: 11px;
  color: #9CA3AF;
  margin-left: auto;
  font-family: 'DM Mono', monospace;
}

/* ── Lead panel mini-section ─────────────────────────────── */
.lpanel-cot-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #F3F4F6;
  cursor: pointer;
}

.lpanel-cot-item:last-child {
  border-bottom: none;
}

.lpanel-cot-item:hover {
  background: #F9FAFB;
  margin: 0 -18px;
  padding-left: 18px;
  padding-right: 18px;
}

.lpanel-cot-num {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  font-weight: 700;
  color: #2B2BFF;
  flex-shrink: 0;
}

.lpanel-cot-total {
  font-size: 12px;
  font-weight: 700;
  color: #10B981;
  margin-left: auto;
  font-family: 'DM Mono', monospace;
}

.lpanel-cot-date {
  font-size: 10px;
  color: #9CA3AF;
}
