/* ======================================================
   PROPOSALS MODULE — follows the CRM design system
====================================================== */

/* ── Page wrapper (same as crm-page) ─────────────────── */
.proposals-page {
  padding: 32px 72px 48px;
  background: #f4f6fb;
  min-height: 100vh;
}

/* ── Tab bar — pill style matching crm-status-tabs ───── */
.proposals-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* ── Upload zone ──────────────────────────────────────── */
.prop-upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  padding: 52px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.prop-upload-zone:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

.prop-upload-icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 12px;
  color: #94a3b8;
}

.prop-upload-label {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.prop-upload-hint {
  font-size: 13px;
  color: #94a3b8;
}

/* ── Image preview ────────────────────────────────────── */
.prop-preview-wrap {
  margin-top: 16px;
  text-align: center;
}

.prop-preview-img {
  max-width: 100%;
  max-height: 360px;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.10);
  display: block;
  margin: 0 auto;
}

/* ── Extraction section ───────────────────────────────── */
.prop-extraction-section {
  margin-top: 28px;
}

.prop-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* ── Card (same as crm-card-left/right feel) ──────────── */
.prop-card {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  padding: 22px 24px;
}

.prop-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
}

/* ── Field rows inside card ───────────────────────────── */
.prop-field-row {
  display: flex;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #f8fafc;
  align-items: flex-start;
}

.prop-field-row:last-child {
  border-bottom: none;
}

.prop-field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  min-width: 88px;
  flex-shrink: 0;
  padding-top: 2px;
}

.prop-field-value {
  font-size: 13px;
  color: #111827;
  font-weight: 500;
  word-break: break-word;
}

.prop-field-value-muted {
  color: #94a3b8;
  font-style: italic;
  font-weight: 400;
}

/* ── Budget sub-grid ──────────────────────────────────── */
.prop-budget-section {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.prop-budget-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 8px;
}

.prop-budget-row {
  display: grid;
  grid-template-columns: 90px 1fr 1fr;
  gap: 4px 12px;
  padding: 4px 0;
  font-size: 12px;
  align-items: center;
}

.prop-budget-label {
  font-weight: 600;
  color: #475569;
}

.prop-budget-parc {
  color: #1e293b;
}

.prop-budget-avista {
  color: #16a34a;
  font-weight: 600;
}

/* ── Template match card ──────────────────────────────── */
.prop-template-name {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
  word-break: break-all;
}

.prop-match-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 14px;
}

.prop-match-exact {
  background: #dcfce7;
  color: #166534;
}

.prop-match-approx {
  background: #fef9c3;
  color: #854d0e;
}

.prop-pest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.prop-pest-chip {
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid #e0e7ff;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 600;
}

/* ── Generate bar ─────────────────────────────────────── */
.prop-generate-bar {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.prop-btn-generate {
  padding: 11px 28px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.01em;
}

.prop-btn-generate:hover:not(:disabled) {
  background: #1d4ed8;
}

.prop-btn-generate:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.prop-error-msg {
  font-size: 13px;
  color: #dc2626;
  flex: 1;
}

/* ── PDF section ──────────────────────────────────────── */
.prop-pdf-section {
  margin-top: 32px;
}

.prop-pdf-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #374151;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.prop-pdf-success-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  display: inline-block;
}

.prop-pdf-frame-wrap {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.prop-pdf-iframe {
  width: 100%;
  height: 700px;
  border: none;
  display: block;
}

.prop-pdf-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.prop-btn-download {
  padding: 9px 22px;
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.prop-btn-download:hover {
  background: #15803d;
  color: #fff;
}

/* ── History table ────────────────────────────────────── */
.prop-history-wrap {
  margin-top: 0;
}

/* ── Proposal status badges ───────────────────────────── */
.prop-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.prop-status-done       { background: #dcfce7; color: #166534; }
.prop-status-processing { background: #fef9c3; color: #854d0e; }
.prop-status-error      { background: #fee2e2; color: #991b1b; }
.prop-status-pending    { background: #f1f5f9; color: #475569; }

.prop-download-link {
  color: #2563eb;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.prop-download-link:hover { text-decoration: underline; }

/* ── Action buttons in result area and history table ──── */
.prop-btn-slides {
  padding: 9px 22px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.prop-btn-slides:hover {
  background: #1d4ed8;
  color: #fff;
}

/* Small variants for history table cells */
.prop-action-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.prop-btn-sm {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
  white-space: nowrap;
}

.prop-btn-sm-pdf {
  background: #16a34a;
  color: #fff;
}
.prop-btn-sm-pdf:hover { background: #15803d; color: #fff; }

.prop-btn-sm-slides {
  background: #2563eb;
  color: #fff;
}
.prop-btn-sm-slides:hover { background: #1d4ed8; color: #fff; }

/* ── Empty state ──────────────────────────────────────── */
.prop-empty-row td {
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
}

/* ── Manual match badge ───────────────────────────────── */
.prop-match-manual {
  background: #ede9fe;
  color: #7c3aed;
}

/* ── Template picker ──────────────────────────────────── */
.prop-template-picker {
  margin-top: 14px;
}

.prop-template-toggle-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #64748b;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  transition: background 0.15s, border-color 0.15s;
  letter-spacing: 0.02em;
}

.prop-template-toggle-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.prop-template-picker-body {
  margin-top: 8px;
}

.prop-template-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #1e293b;
  background: #fff;
  box-sizing: border-box;
  outline: none;
  margin-bottom: 6px;
  transition: border-color 0.15s;
}

.prop-template-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.prop-template-results {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.prop-template-option {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  padding: 8px 12px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.1s;
  font-family: inherit;
}

.prop-template-option:last-child {
  border-bottom: none;
}

.prop-template-option:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.prop-template-empty {
  padding: 12px 14px;
  font-size: 12px;
  color: #94a3b8;
  font-style: italic;
}

/* ── History toolbar ──────────────────────────────────── */
.prop-history-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.prop-search-input {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #1e293b;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.prop-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.prop-btn-clear-errors {
  padding: 8px 14px;
  background: none;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  color: #dc2626;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.prop-btn-clear-errors:hover {
  background: #fef2f2;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 900px) {
  .proposals-page { padding: 20px 16px 40px; }
  .prop-cards-grid { grid-template-columns: 1fr; }
}
