@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* =====================================================================
   MODULO PROPOSTAS — listagem de oportunidades + correcoes
   Tudo escopado em .propostas-module (prefixo prp-): reaproveita as classes
   dh-* de negociacoes.css (filtros, tabela, status) sem altera-las.
   ===================================================================== */

.propostas-module {
  --prp-red: #c0272d;
  --prp-red-dark: #a01f24;
  --prp-red-soft: #fdf2f2;
  --prp-amber: #8f3400;
  --prp-amber-soft: #fff3e0;
  --prp-blue: #1565c0;
  --prp-blue-soft: #e3f2fd;
  --prp-green: #2e7d32;
  --prp-ink: #1a1a1a;
  --prp-ink-soft: #575757;
  --prp-ink-faint: #6b6b6b;
  --prp-border: #e0e0e0;
  --prp-surface: #ffffff;
  --prp-surface-2: #f5f5f5;
  font-family: 'DM Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.propostas-module .prp-search-label { display: block; margin-bottom: 5px; font-size: .75rem; font-weight: 700; color: var(--prp-ink-soft); }
.propostas-module .prp-page-heading { padding: 0 0 16px; margin-bottom: 16px; border-bottom: 1px solid var(--prp-border); }
.propostas-module .prp-page-eyebrow { color: var(--prp-red); font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.propostas-module .prp-page-heading h1 { margin: 3px 0 4px; color: var(--prp-ink); font-size: 1.65rem; line-height: 1.2; }
.propostas-module .prp-page-heading p { margin: 0; max-width: 760px; color: var(--prp-ink-soft); font-size: .85rem; line-height: 1.5; }
.propostas-module .prp-btn.prp-mobile-filter-toggle,
.propostas-module .prp-mobile-list { display: none; }

/* ---- Cabecalho: busca + acoes ---- */
.propostas-module .prp-header-left { width: 100%; }

.propostas-module .prp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.propostas-module .prp-search {
  flex: 1 1 360px;
  max-width: 560px;
  margin: 0;
}

.propostas-module .prp-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.propostas-module .prp-filter-bar { flex-wrap: wrap; row-gap: 10px; }
.propostas-module .prp-filter-clear-group { justify-content: flex-end; }
.propostas-module .prp-filter-empty { padding: 8px 12px; color: var(--prp-ink-faint); font-size: .75rem; }

/* ---- Botoes ---- */
.propostas-module .prp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.propostas-module .prp-btn:disabled { opacity: .5; cursor: not-allowed; }
.propostas-module .prp-btn:focus-visible { outline: 2px solid var(--prp-red); outline-offset: 2px; }

.propostas-module .prp-btn-primary { background: var(--prp-red); color: #fff; }
.propostas-module .prp-btn-primary:hover:not(:disabled) { background: var(--prp-red-dark); }

.propostas-module .prp-btn-outline { background: var(--prp-surface); border-color: #d1d5db; color: #374151; }
.propostas-module .prp-btn-outline:hover:not(:disabled) { border-color: var(--prp-red); color: var(--prp-red); }

.propostas-module .prp-btn-danger-outline { background: var(--prp-surface); border-color: #fecaca; color: var(--prp-red); }
.propostas-module .prp-btn-danger-outline:hover:not(:disabled) { background: var(--prp-red-soft); }

.propostas-module .prp-btn-ghost { background: transparent; border-color: #d1d5db; color: #374151; }
.propostas-module .prp-btn-ghost:hover:not(:disabled) { background: #f3f4f6; }

.propostas-module .prp-btn-link {
  height: auto;
  padding: 6px 4px;
  background: none;
  color: var(--prp-red);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.propostas-module .prp-btn-sm { min-height: 36px; height: auto; padding: 7px 10px; font-size: .75rem; border-radius: 8px; }

/* ---- Pilula "Reabertura solicitada" (contador + filtro) ---- */
.propostas-module .prp-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px 0 14px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: var(--prp-surface);
  color: #374151;
  font: inherit;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
}
.propostas-module .prp-pill[hidden] { display: none; }
.propostas-module .prp-pill.is-alert { border-color: #fcd34d; background: var(--prp-amber-soft); color: var(--prp-amber); }
.propostas-module .prp-pill.is-active { border-color: var(--prp-red); background: var(--prp-red); color: #fff; }
.propostas-module .prp-pill-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .08);
  font-size: .7rem;
}
.propostas-module .prp-pill.is-active .prp-pill-count { background: rgba(255, 255, 255, .25); }

/* ---- Resumo do resultado ---- */
.propostas-module .dh-kanban-header { gap: 16px; flex-wrap: wrap; }
.propostas-module .prp-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: .75rem;
  color: var(--prp-ink-soft);
}
.propostas-module .prp-summary strong { color: var(--prp-ink); }
.propostas-module .prp-summary-item { display: inline-flex; align-items: center; gap: 6px; }
.propostas-module .prp-dot-ativa::before,
.propostas-module .prp-dot-ganha::before,
.propostas-module .prp-dot-perdida::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.propostas-module .prp-dot-ativa::before { background: var(--prp-blue); }
.propostas-module .prp-dot-ganha::before { background: var(--prp-green); }
.propostas-module .prp-dot-perdida::before { background: var(--prp-red); }

/* ---- Tabela ---- */
.propostas-module .prp-table { min-width: 1080px; }
.propostas-module .prp-table .prp-th-acoes,
.propostas-module .prp-table .prp-td-acoes { position: sticky; right: 0; background: #fff; box-shadow: -8px 0 12px -12px rgba(0, 0, 0, .35); }
.propostas-module .prp-table .prp-th-acoes { background: #f5f5f5; }
.propostas-module .prp-table .dh-tb-row:focus-visible { outline: 2px solid var(--prp-red); outline-offset: -2px; }
.propostas-module .prp-table thead th.is-sortable { cursor: pointer; user-select: none; }
.propostas-module .prp-table thead th.is-sortable:hover { color: var(--prp-ink); }
.propostas-module .prp-table thead th.is-sortable::after { content: '\2195'; margin-left: 4px; opacity: .35; }
.propostas-module .prp-table thead th.is-sorted-asc,
.propostas-module .prp-table thead th.is-sorted-desc { color: var(--prp-red); }
.propostas-module .prp-table thead th.is-sorted-asc::after { content: '\2191'; opacity: 1; }
.propostas-module .prp-table thead th.is-sorted-desc::after { content: '\2193'; opacity: 1; }

/* negociacoes.css esconde a 3a coluna no mobile (pensado pra tabela do kanban) —
   aqui a 3a coluna e' Canal/Fonte, que o usuario pediu explicitamente. */
@media (max-width: 768px) {
  .propostas-module .prp-table thead th:nth-child(3),
  .propostas-module .prp-table .dh-tb-row td:nth-child(3) { display: table-cell; }
}

.propostas-module .prp-cliente {
  display: block;
  font-size: .75rem;
  color: var(--prp-ink);
  overflow: hidden;
  text-overflow: ellipsis;
}
.propostas-module .prp-cliente-meta { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; }
.propostas-module .prp-canal { font-weight: 600; color: #374151; }
.propostas-module .prp-status-line { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.propostas-module .prp-row-pendente { box-shadow: inset 3px 0 0 #f59e0b; }
.propostas-module .prp-td-acoes { overflow: visible; }
.propostas-module .prp-muted { color: var(--prp-ink-faint); font-size: .68rem; font-style: italic; }
.propostas-module .prp-empty { text-align: center; padding: 32px; color: #9ca3af; font-style: italic; }
.propostas-module .prp-load-error { padding: 24px; color: var(--prp-ink-soft); text-align: center; }

.propostas-module .prp-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: .55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  line-height: 1.4;
  white-space: nowrap;
}
.propostas-module .prp-badge-pdf { background: #f3f4f6; color: #374151; border: 1px solid var(--prp-border); }
.propostas-module .prp-badge-pendente { background: var(--prp-amber-soft); color: var(--prp-amber); }
.propostas-module .prp-badge-recusada { background: #f3f4f6; color: var(--prp-ink-soft); }
.propostas-module .prp-badge-reaberta { background: var(--prp-blue-soft); color: var(--prp-blue); }
.propostas-module .prp-badge-corrigida { background: #e8f5e9; color: #1b5e20; }
.propostas-module .prp-mobile-code,
.propostas-module .dh-tb-cell-cod { font-family: 'JetBrains Mono', monospace; }

.propostas-module .prp-list-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 0 4px;
  font-size: .75rem;
  color: var(--prp-ink-faint);
}
.propostas-module .prp-list-foot:empty { display: none; }

/* ---- Modal de correção ---- */
.propostas-module .prp-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(17, 24, 39, .55);
}
.propostas-module .prp-modal-backdrop[hidden] { display: none; }

.propostas-module .prp-modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--prp-surface);
  border-radius: 16px;
  border-top: 5px solid var(--prp-red);
  box-shadow: 0 24px 60px rgba(17, 24, 39, .25);
  outline: none;
}
.propostas-module .prp-modal-editor { width: min(900px, 100%); }
.propostas-module .prp-modal-editor .prp-modal-body { gap: 16px; }
.propostas-module .prp-edit-section { padding: 16px 0; border-top: 1px solid var(--prp-border); }
.propostas-module .prp-edit-section h4 { margin: 0 0 12px; color: var(--prp-ink); font-size: 1rem; }
.propostas-module .prp-edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.propostas-module .prp-edit-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: .8rem; font-weight: 600; color: var(--prp-ink-soft); text-transform: none; letter-spacing: normal; }
.propostas-module .prp-edit-field input,
.propostas-module .prp-edit-field select,
.propostas-module .prp-edit-field textarea { width: 100%; box-sizing: border-box; padding: 9px 10px; border: 1px solid #c9c9c9; border-radius: 6px; background: #fff; color: var(--prp-ink); font: inherit; font-weight: 400; }
.propostas-module .prp-edit-field :is(input, select, textarea):focus-visible { outline: 2px solid var(--prp-red); outline-offset: 1px; }
.propostas-module .prp-equip-edit { padding: 14px 0; border-bottom: 1px solid var(--prp-border); }
.propostas-module .prp-equip-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: var(--prp-ink); }
.propostas-module .prp-equip-head small { font-family: 'JetBrains Mono', monospace; color: var(--prp-ink-faint); }
.propostas-module .prp-check { display: inline-flex; align-items: center; gap: 8px; padding: 8px 0; color: var(--prp-ink); font-weight: 600; }
.propostas-module [hidden] { display: none !important; }
.propostas-module .prp-field-error:empty { display: none; }

.propostas-module .prp-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--prp-border);
}
.propostas-module .prp-modal-eyebrow {
  margin: 0 0 2px;
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--prp-ink-faint);
}
.propostas-module .prp-modal-title { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--prp-ink); }
.propostas-module .prp-modal-close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--prp-ink-faint);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 8px;
}
.propostas-module .prp-modal-close:hover { background: #f3f4f6; color: var(--prp-ink); }

.propostas-module .prp-modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: .8rem;
  color: #374151;
}

.propostas-module .prp-modal-foot {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--prp-border);
}

.propostas-module .prp-resumo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--prp-surface-2);
  border: 1px solid var(--prp-border);
}
.propostas-module .prp-resumo span {
  display: block;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--prp-ink-faint);
}
.propostas-module .prp-resumo strong {
  display: block;
  color: var(--prp-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.propostas-module .prp-info { margin: 0; color: var(--prp-ink-soft); line-height: 1.5; }

.propostas-module .prp-pedido {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--prp-amber-soft);
  border: 1px solid #fde68a;
}
.propostas-module .prp-pedido-head { margin: 0 0 6px; color: var(--prp-amber); font-size: .75rem; }
.propostas-module .prp-pedido-texto { margin: 0; color: var(--prp-ink); white-space: pre-wrap; line-height: 1.5; }

.propostas-module .prp-section-label {
  display: block;
  margin: 0 0 6px;
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--prp-ink-soft);
}
.propostas-module .prp-section-label em { color: var(--prp-red); font-style: normal; }

.propostas-module .prp-consequencias ul { margin: 0; padding-left: 18px; line-height: 1.55; }
.propostas-module .prp-consequencias li + li { margin-top: 4px; }

/* <label> herda caixa alta/peso do estilo global de label — neutraliza aqui. */
.propostas-module .prp-field { display: block; text-transform: none; letter-spacing: normal; font-weight: 400; }
.propostas-module .prp-field textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 90px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font: inherit;
  font-size: .8rem;
  color: var(--prp-ink);
}
.propostas-module .prp-field textarea:focus { outline: none; border-color: var(--prp-red); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.propostas-module .prp-field-help {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-size: .68rem;
  color: var(--prp-ink-faint);
}
.propostas-module .prp-field-error { color: var(--prp-red); font-weight: 600; }

.propostas-module .prp-field select.prp-select {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font: inherit;
  font-size: .8rem;
  color: var(--prp-ink);
  background: var(--prp-surface);
}
.propostas-module .prp-field select.prp-select:focus { outline: none; border-color: var(--prp-red); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }

/* ---- Botao de editar Funil/Fonte na celula (chamado #63) ---- */
.propostas-module .prp-origem-cell { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.propostas-module .prp-origem-edit-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--prp-ink-faint);
  cursor: pointer;
}
.propostas-module .prp-origem-edit-btn:hover { background: var(--prp-red-soft); border-color: #fecaca; color: var(--prp-red); }

@media (max-width: 560px) {
  .propostas-module .prp-resumo { grid-template-columns: 1fr; }
  .propostas-module .prp-modal-foot .prp-btn { flex: 1 1 auto; }
}

@media (max-width: 768px) {
  .propostas-module .prp-btn.prp-mobile-filter-toggle,
  .propostas-module .prp-mobile-list { display: block; }
  .propostas-module .prp-filter-bar { display: none; }
  .propostas-module .prp-filter-bar.prp-filter-open { display: flex; }
  .propostas-module .prp-table-wrap { display: none; }
  .propostas-module .prp-toolbar-actions { width: 100%; }
  .propostas-module .prp-toolbar-actions > * { flex: 1; }
  .propostas-module .prp-toolbar-actions :is(.prp-btn, .prp-pill) { min-height: 44px; }
  .propostas-module .prp-mobile-list { display: grid; gap: 12px; padding: 8px 0; }
  .propostas-module .prp-mobile-card { padding: 16px; background: #fff; border: 1px solid var(--prp-border); border-radius: 12px; }
  .propostas-module .prp-mobile-card-head,
  .propostas-module .prp-mobile-meta,
  .propostas-module .prp-mobile-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
  .propostas-module .prp-mobile-card h3 { margin: 10px 0 4px; font-size: 1rem; color: var(--prp-ink); }
  .propostas-module .prp-mobile-card p { margin: 0 0 12px; color: var(--prp-ink-soft); font-size: .8rem; }
  .propostas-module .prp-mobile-meta { margin-bottom: 12px; font-size: .78rem; color: var(--prp-ink-soft); }
  .propostas-module .prp-mobile-meta strong { color: var(--prp-ink); }
  .propostas-module .prp-mobile-actions { justify-content: flex-start; margin-top: 14px; }
  .propostas-module .prp-mobile-actions .prp-btn { min-height: 44px; }
  .propostas-module .prp-modal-backdrop { padding: 0; }
  .propostas-module .prp-modal { width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .propostas-module .prp-edit-grid { grid-template-columns: 1fr; gap: 0; }
  .propostas-module .prp-modal-close { min-width: 44px; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .propostas-module .prp-btn { transition: none; }
}
