/* WPRealWise Developer — Front-end styles */
:root {
  --pwd-primary: #7c3aed;
  --pwd-primary-dark: #6d28d9;
  --pwd-green: #16a34a;
  --pwd-red: #dc2626;
  --pwd-yellow: #ca8a04;
  --pwd-border: #e5e7eb;
  --pwd-bg: #f9fafb;
  --pwd-radius: 8px;
}

.pwd-proforma, .pwd-flip, .pwd-reno, .pwd-deal-score, .pwd-my-proformas {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Section */
.pwd-section-title { font-size: 22px; font-weight: 700; margin-bottom: 20px; border-bottom: 2px solid var(--pwd-border); padding-bottom: 10px; }
.pwd-sub-title { font-size: 16px; font-weight: 600; margin: 20px 0 10px; }

/* Layout */
.pwd-proforma-layout, .pwd-flip-layout, .pwd-reno-layout { display: grid; gap: 24px; }
@media (min-width: 900px) {
  .pwd-proforma-layout { grid-template-columns: 460px 1fr; }
  .pwd-flip-layout     { grid-template-columns: 400px 1fr; }
  .pwd-reno-layout     { grid-template-columns: 380px 1fr; }
}

/* Fieldsets */
.pwd-fieldset { border: 1px solid var(--pwd-border); border-radius: var(--pwd-radius); padding: 16px; margin-bottom: 16px; }
.pwd-fieldset legend { font-weight: 700; color: var(--pwd-primary); padding: 0 6px; }
.pwd-field-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.pwd-field label { display: block; font-size: 12px; font-weight: 600; color: #6b7280; margin-bottom: 4px; }

/* Inputs */
.pwd-input, .pwd-select {
  width: 100%; box-sizing: border-box;
  padding: 8px 10px; border: 1px solid var(--pwd-border); border-radius: 6px; font-size: 14px;
}
.pwd-input:focus, .pwd-select:focus { outline: none; border-color: var(--pwd-primary); box-shadow: 0 0 0 3px rgba(124,58,237,.15); }

/* Buttons */
.pwd-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border-radius: 6px; border: none; cursor: pointer; font-size: 14px; font-weight: 600; transition: background .15s; }
.pwd-btn--primary { background: var(--pwd-primary); color: #fff; }
.pwd-btn--primary:hover { background: var(--pwd-primary-dark); }
.pwd-btn--outline { background: transparent; color: var(--pwd-primary); border: 1px solid var(--pwd-primary); }
.pwd-btn--sm { padding: 4px 10px; font-size: 12px; }
.pwd-btn--danger { background: var(--pwd-red); color: #fff; }

/* Actions row */
.pwd-proforma-actions { display: flex; gap: 10px; margin-top: 8px; }

/* Metrics grid */
.pwd-metrics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.pwd-metric-card { background: #fff; border: 1px solid var(--pwd-border); border-radius: var(--pwd-radius); padding: 16px; text-align: center; }
.pwd-metric-card__value { font-size: 28px; font-weight: 800; }
.pwd-metric-card__label { font-size: 11px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; }
.pwd-metric--positive .pwd-metric-card__value { color: var(--pwd-green); }
.pwd-metric--negative .pwd-metric-card__value { color: var(--pwd-red); }
.pwd-metric--neutral  .pwd-metric-card__value { color: var(--pwd-primary); }

/* Annual table */
.pwd-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.pwd-table th { background: var(--pwd-bg); padding: 8px 10px; text-align: right; font-size: 11px; text-transform: uppercase; }
.pwd-table th:first-child, .pwd-table td:first-child { text-align: left; }
.pwd-table td { padding: 8px 10px; border-bottom: 1px solid var(--pwd-border); text-align: right; }
.pwd-table tr.negative td { color: var(--pwd-red); }

/* Deal Score */
.pwd-deal-score { display: grid; gap: 20px; }
@media (min-width: 600px) { .pwd-deal-score { grid-template-columns: 200px 1fr; align-items: center; } }
.pwd-deal-score__dial { position: relative; width: 160px; margin: 0 auto; }
.pwd-score-arc { width: 160px; }
.pwd-deal-score__num { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; font-size: 36px; font-weight: 800; }
.pwd-deal-score__grade { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 14px; font-weight: 700; color: #6b7280; }
.pwd-deal-score__reco { font-size: 14px; line-height: 1.6; background: var(--pwd-bg); padding: 12px 16px; border-radius: var(--pwd-radius); }
.pwd-score-comp { display: grid; grid-template-columns: 130px 1fr 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.pwd-score-comp__label { font-size: 12px; font-weight: 600; color: #6b7280; }
.pwd-score-comp__bar { height: 8px; background: var(--pwd-border); border-radius: 99px; overflow: hidden; }
.pwd-score-comp__fill { height: 100%; background: var(--pwd-primary); border-radius: 99px; transition: width .4s; }
.pwd-score-comp__val { font-size: 12px; font-weight: 700; text-align: right; }

/* Chart */
.pwd-chart { max-width: 100%; height: 260px !important; }

/* Renovation */
.pwd-reno-scope { margin-bottom: 16px; }
.pwd-reno-scope__header { font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; color: #6b7280; padding: 6px 0; border-bottom: 1px solid var(--pwd-border); margin-bottom: 8px; }
.pwd-reno-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; cursor: pointer; flex-wrap: wrap; }
.pwd-reno-item:hover { background: var(--pwd-bg); }
.pwd-reno-item__name { flex: 1; }
.pwd-reno-item__range { font-size: 11px; color: #6b7280; }
.pwd-reno-item__qty-wrap { display: flex; gap: 6px; margin-left: auto; }
.pwd-reno-qty, .pwd-reno-tier { width: 80px; }
.pwd-reno-totals { margin-top: 16px; background: var(--pwd-bg); padding: 16px; border-radius: var(--pwd-radius); font-size: 14px; }

/* Comps */
.pwd-comps { margin-top: 28px; }
.pwd-comps-source { font-size: 13px; font-weight: 400; color: #6b7280; }
.pwd-comps-stats { display: flex; gap: 20px; flex-wrap: wrap; background: var(--pwd-bg); padding: 12px 16px; border-radius: var(--pwd-radius); margin-bottom: 12px; font-size: 14px; }
.pwd-comps-arv { color: var(--pwd-primary); }
.pwd-comps-link { background: none; border: none; color: var(--pwd-primary); cursor: pointer; font-size: 12px; font-weight: 600; padding: 4px 0 0; }
.pwd-comps-link:hover { text-decoration: underline; }

/* Notices */
.pwd-notice, .pwd-error { padding: 12px 16px; border-radius: var(--pwd-radius); background: var(--pwd-bg); color: #6b7280; font-size: 14px; }

/* Print / PDF */
@media print {
  body * { visibility: hidden; }
  #pwd-proforma-app, #pwd-proforma-app * { visibility: visible; }
  #pwd-proforma-app { position: absolute; left: 0; top: 0; width: 100%; }
  .pwd-proforma-actions, #pwd-print-btn, #pwd-save-btn, #pwd-run-btn { display: none !important; }
  .pwd-inputs-panel { break-inside: avoid; }
  .pwd-results-panel { display: block !important; }
  .pwd-metrics-grid { grid-template-columns: repeat(4, 1fr); }
  .pwd-chart { max-height: 220px !important; }
  .pwd-table { font-size: 11px; }
  .pwd-fieldset { border: 1px solid #ccc; margin-bottom: 12px; }
  a[href]:after { content: none !important; }
  @page { margin: 1.5cm; size: A4 portrait; }
}
