/* The dialog owns the viewport; the embedded editor scrolls longer results. */
#roofEditDialog {
  box-sizing: border-box;
  width: min(1480px, calc(100vw - 32px));
  max-width: none;
  height: calc(100vh - 32px);
  height: calc(100dvh - 32px);
  max-height: none;
  padding: 20px;
  overflow: hidden;
}
#roofEditForm { display: flex; flex-direction: column; gap: 8px; height: 100%; min-height: 0; }
#roofEditForm > :not(iframe) { flex-shrink: 0; }
#roofEditForm > p, #roofEditForm > h2 { margin: 0; padding-right: 24px; }
#roofEditForm > h2 { font-size: 20px; line-height: 1.25; }
#roofEditForm > .page-sub { font-size: 12px; line-height: 1.4; }
#roofEditForm .roof-editor-fields { grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: 10px; }
#roofEditForm textarea { height: 44px; min-height: 44px; max-height: 88px; }
#roofEditForm #roofEditorFrame { display: block; flex: 1 1 0; width: 100%; height: auto; min-height: 0; }
#roofEditMessage { font-size: 12px; line-height: 1.35; }

/* Scoped to an actual CRM iframe; the public website keeps its layout. */
body.crm-editor { margin: 0; }
body.crm-editor .experience-workspace { min-height: 0; padding: 12px 0 !important; }
body.crm-editor .experience-shell { width: calc(100% - 24px); }
body.crm-editor .experience-progress { margin-bottom: 10px; font-size: 11px; }
body.crm-editor .experience-progress span { padding-top: 4px; padding-bottom: 7px; }
body.crm-editor .experience-heading { gap: 12px; margin-bottom: 12px; }
body.crm-editor .experience-heading .eyebrow { margin-bottom: 4px; font-size: 10px; }
body.crm-editor .experience-heading h1 { font-size: clamp(24px, 3vw, 32px); margin-bottom: 4px; line-height: 1.1; }
body.crm-editor .experience-heading p:last-child { font-size: 13px; line-height: 1.35; }
body.crm-editor .experience-widget-surface { padding: 12px; border-radius: 12px; box-shadow: none; }
body.crm-editor .experience-widget-surface #solar-widget #solar-confirm-card { padding: 0; margin: 0; box-shadow: none; }
body.crm-editor #solar-confirm-card > p { display: none; }
body.crm-editor .experience-widget-surface #solar-widget #solar-confirm-map-wrap {
  height: clamp(160px, calc(100vh - 220px), 560px) !important;
  height: clamp(160px, calc(100dvh - 220px), 560px) !important;
}
body.crm-editor .experience-widget-surface #solar-widget #solar-map {
  height: clamp(200px, calc(100vh - 230px), 520px) !important;
  height: clamp(200px, calc(100dvh - 230px), 520px) !important;
}
body.crm-editor .experience-widget-surface #solar-widget #solar-confirm-go { min-height: 44px; }
body.crm-editor #solar-confirm-card > div:last-child { position: sticky; bottom: 0; z-index: 20; background: #fff; padding: 6px 0; flex-wrap: wrap; }
.crm-kit-choice, .crm-kit-builder { padding: 16px; border: 1px solid #b7cedb; border-radius: 12px; margin-bottom: 16px; background: #fff; }
.crm-kit-options { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.crm-kit-options button[aria-pressed="false"] { background: #eef4f7 !important; color: #174d6b !important; }
.crm-kit-rows { display: grid; gap: 10px; margin-bottom: 12px; }
.crm-kit-row { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(160px, 2fr) 80px auto; gap: 8px; align-items: end; padding: 10px; border: 1px solid #dce7ed; border-radius: 8px; }
.crm-kit-builder label { display: grid; gap: 5px; font-size: 12px; font-weight: 700; margin: 10px 0; }
.crm-kit-builder select, .crm-kit-builder input { box-sizing: border-box; width: 100%; min-width: 0; padding: 10px; border: 1px solid #b7cedb; border-radius: 6px; background: #fff; color: #172833; font: inherit; }
.crm-kit-builder button:disabled { opacity: .5; cursor: not-allowed; }
.crm-kit-builder .crm-kit-note { font-size: 12px; line-height: 1.4; color: #536c7a; }
.crm-kit-estimate > strong { display: block; font-size: 26px; margin: 14px 0; }
.crm-kit-price-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #dce7ed; font-size: 13px; }
.crm-kit-row label { margin: 0; }
.sw-crm-ready-packages[hidden], .crm-kit-builder[hidden] { display: none !important; }
@media (max-width: 1100px) { .crm-kit-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

@media (max-width: 600px) {
  #roofEditDialog { width: calc(100vw - 12px); height: calc(100vh - 12px); height: calc(100dvh - 12px); padding: 12px; }
  #roofEditForm > h2 { font-size: 17px; }
  #roofEditForm > .page-sub { display: none; }
  #roofEditForm .roof-editor-fields { grid-template-columns: 1fr; gap: 6px; }
  body.crm-editor .experience-heading { gap: 8px; }
  body.crm-editor .experience-actions button { padding: 8px 10px; }
  body.crm-editor .experience-widget-surface { padding: 8px; }
  body.crm-editor .experience-widget-surface #solar-widget #solar-confirm-map-wrap { height: clamp(160px, calc(100dvh - 270px), 420px) !important; }
}

.crm-kit-component-details{grid-column:1/-1;display:grid;gap:6px;padding:10px;background:#f3f8fb;border-radius:8px;font-size:13px;overflow-wrap:anywhere}.crm-kit-mounting{margin:20px 0}.crm-kit-mounting-item{display:grid;gap:8px;padding:14px;margin:10px 0;border:1px solid #cbdde8;border-radius:10px;font-size:13px}.crm-kit-mounting-item input{max-width:120px;display:block}.crm-kit-mounting-item label{font-weight:600}

body.crm-editor #solar-faq{display:none!important}.crm-kit-live-total{position:sticky;top:0;z-index:30;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 18px;background:#e9f4fa;border:1px solid #9abfd3;border-radius:12px;box-shadow:0 4px 16px #1234;margin:12px 0}.crm-kit-live-total strong{font-size:24px;white-space:nowrap}.crm-kit-live-total small{display:block;font-size:12px}.crm-kit-live-total[data-pending=true]{background:#f2f6f8}.crm-kit-live-total[data-pending=true] strong{font-size:clamp(16px,2vw,22px);white-space:normal}.crm-kit-report-link{display:inline-block;margin:12px 0}

.estimate-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 24px}.estimate-settings-grid label{display:grid;grid-template-columns:minmax(220px,1fr) minmax(130px,220px);gap:12px;align-items:center;margin:0}.estimate-settings-grid input{width:100%}.estimate-settings-card{max-width:980px}.estimate-settings-card h2{margin:0 0 14px;font-size:1rem}.estimate-settings-actions{display:flex;align-items:center;justify-content:flex-end;gap:14px;margin-top:20px}.estimate-settings-note{margin:10px 0 18px}.estimate-settings-check{display:flex;align-items:center;gap:10px;margin-top:14px}.estimate-settings-check input{width:auto}@media(max-width:700px){.estimate-settings-grid{grid-template-columns:1fr}.estimate-settings-grid label{grid-template-columns:1fr;gap:5px}}
#screen-estimates .estimate-settings-card{max-width:1100px}#screen-estimates .catalog-item{padding:20px}#screen-estimates .catalog-item>h3,#screen-estimates .catalog-item>p{grid-column:1/-1}

/* Calculation settings: one column of aligned cards and consistent form grids. */
#screen-estimates{max-width:1100px;margin-inline:auto}
#screen-estimates .estimate-settings-card,#screen-estimates .catalog-group{width:100%;max-width:none;box-sizing:border-box;padding:24px;margin:0 0 20px}
#screen-estimates .estimate-settings-grid,#screen-estimates .catalog-item{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 24px}
#screen-estimates .estimate-settings-grid label,#screen-estimates .catalog-item label{display:grid;grid-template-columns:minmax(0,1fr);gap:6px;align-items:start;margin:0;font-size:.8rem;font-weight:600;color:var(--text-muted)}
#screen-estimates .catalog-item{padding:24px 0}
#screen-estimates .catalog-item:last-child{padding-bottom:0}
#screen-estimates .catalog-item>h3{margin:0 0 4px;font-size:1rem}
#screen-estimates input:not([type=checkbox]){width:100%;min-width:0;min-height:42px;box-sizing:border-box}
#screen-estimates .btn{min-height:42px;padding:10px 16px;font-size:.8rem}
#screen-estimates .estimate-settings-actions{padding-top:16px;border-top:1px solid var(--border)}
#screen-estimates #calculationRatesMessage:empty{display:none}
@media(max-width:700px){#screen-estimates .estimate-settings-grid,#screen-estimates .catalog-item{grid-template-columns:minmax(0,1fr)}#screen-estimates .estimate-settings-card,#screen-estimates .catalog-group{padding:18px}}
