.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.product-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.product-card .button-link,
.product-card button {
  margin-top: auto;
}

.button-link {
  display: inline-block;
  border-radius: 10px;
  padding: .7rem 1rem;
  color: #fff;
  text-decoration: none;
  font-weight: 650;
}

.check-row {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: flex-start;
  gap: 10px;
}

.check-row input {
  width: auto;
  margin-top: 4px;
}

.form-grid.two-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 650px) {
  .form-grid.two-fields { grid-template-columns: 1fr; }
}


.lead-card-header { display: grid; gap: 10px; margin-bottom: 16px; }
.lead-reservation { gap: 10px; flex-wrap: wrap; }
.ra-handoff { display: flex; justify-content: flex-end; }
.ra-summary { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 14px 0; }
.ra-summary span { display: grid; gap: 2px; font-weight: 650; }
.ra-summary small { color: var(--muted); font-weight: 600; font-size: 12px; }
.ra-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.ra-actions button { padding: 7px 10px; font-size: 13px; line-height: 1.2; white-space: nowrap; }
.ra-actions button[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(23, 105, 255, .18); }
.ra-actions .ra-rescue-button { border-color: #c2410c; color: #9a3412; }
.ra-form { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 6px; }
.ra-kind { font-weight: 800; font-size: 13px; letter-spacing: .4px; text-transform: uppercase; margin: 10px 0 0; }
.ra-kind.generic { color: #174ea6; }
.ra-kind.rescue { color: #c2410c; }
.ra-consent { border: 1px solid var(--line); border-radius: 12px; padding: 6px 14px; margin: 0; }
.ra-consent legend { font-weight: 700; padding: 0 6px; }
.ra-consent .check-row { font-weight: 500; margin: 10px 0; }
.ra-tag.rescue { background: #fff1e8; color: #9a3412; }
#raResult { margin: 0 0 16px; }

.ra-dialog { width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 40px); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 24px 80px rgba(16,33,59,.3); }
.ra-dialog::backdrop { background: rgba(9,20,37,.58); backdrop-filter: blur(2px); }
.ra-dialog-shell { padding: 24px; overflow: auto; max-height: calc(100vh - 40px); }
.ra-dialog h2 { margin: 0; }
.ra-dialog .ra-form { margin-top: 10px; }

.lead-location { margin: 3px 0 18px; color: var(--muted); font-weight: 650; }
.why-call-card { border-left: 4px solid var(--blue); background: #f3f7ff; border-radius: 0 10px 10px 0; padding: 12px 14px; margin: 18px 0; }
.why-call-card p:last-child { margin: 3px 0 0; line-height: 1.5; }
.vehicle-summary { border-top: 1px solid var(--line); padding-top: 15px; margin-top: 16px; }
.vehicle-summary h3,.vehicle-summary .row { margin-bottom: 9px; }
.vehicle-summary .row strong { color: var(--muted); font-size: 13px; }
.lead-address { border-top: 1px solid var(--line); padding-top: 14px; margin: 18px 0; }
.lead-address p:last-child { margin: 3px 0 0; line-height: 1.45; }
.lead-details { border-top: 1px solid var(--line); padding: 12px 0; }
.lead-details summary { cursor: pointer; font-weight: 750; }
.lead-details > dl { margin: 12px 0 0; padding: 0; border: 0; grid-template-columns: 120px minmax(0,1fr); }
.technical-details > details { margin-top: 12px; }
.technical-details pre { max-height: 260px; overflow: auto; }
.vehicle-card { display: grid; gap: 2px; border: 1px solid var(--line); background: #f8fafc; border-radius: 10px; padding: 11px 13px; margin-bottom: 8px; }
.vehicle-card span,.vehicle-note { color: var(--muted); font-size: 13px; }
.vehicle-note { margin: 8px 0 0; padding: 8px 10px; border-left: 3px solid #94a3b8; background: #f8fafc; }
.vehicle-more { margin-top: 8px; }
.vehicle-more summary { cursor: pointer; color: var(--blue); font-weight: 700; margin-bottom: 8px; }
.clock.lease-warning { color: #9a6700; font-weight: 700; }
.clock.lease-expired { color: var(--danger); font-weight: 700; }

.workspace-grid { grid-template-columns: minmax(340px,.8fr) minmax(600px,1.5fr); align-items: start; }
.workspace-tools { display: grid; grid-template-columns: minmax(300px,1fr) minmax(280px,.9fr); gap: 20px; align-items: start; min-width: 0; }
.workspace-tools .panel { margin-bottom: 0; height: 100%; }
.tool-heading { display: grid; grid-template-columns: minmax(0,1fr) minmax(150px,220px); gap: 12px; align-items: end; margin-bottom: 14px; }
.tool-heading h3,.notepad-card h3 { margin-bottom: 0; }
.tool-heading .eyebrow,.notepad-card .eyebrow { margin-bottom: 2px; }
.script-card .script-body { min-height: 360px; max-height: 64vh; overflow: auto; }
.notepad-card { display: flex; flex-direction: column; gap: 15px; }
.notepad-card .notepad-label { display: grid; gap: 6px; margin: 0; font-weight: 700; }
.call-notepad { min-height: 190px; resize: vertical; line-height: 1.7; }
.outcome-block { display: grid; gap: 8px; }
.field-label { font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.notepad-card .chips { gap: 7px; }
.notepad-card .chips input { width: 1px; height: 1px; }
.notepad-card .chips span { padding: 7px 10px; }
.phone-link { display: inline-block; color: var(--blue); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.phone-link:hover { color: var(--blue2); }
.phone-link.compact { font-weight: 650; }
.phone-link[aria-disabled="true"] { color: var(--muted); text-decoration: none; pointer-events: none; }

@media (max-width: 1350px) {
  .workspace-grid { grid-template-columns: minmax(330px,.9fr) minmax(360px,1.1fr); }
  .workspace-tools { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .workspace-tools { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .workspace-tools { grid-template-columns: 1fr; }
  .tool-heading { grid-template-columns: 1fr; }
  .script-card .script-body { min-height: 260px; max-height: none; }
}

.marketplace-filters { position: relative; z-index: 20; isolation: isolate; overflow: visible; display: grid; grid-template-columns: repeat(2,minmax(180px,280px)); gap: 14px; margin-bottom: 18px; }
.marketplace-filters label { position: relative; z-index: 21; display: grid; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.marketplace-filters select { position: relative; z-index: 22; }
.marketplace-zip-actions { display: flex; gap: 8px; align-items: end; }
#marketplaceZipHelp { grid-column: 1 / -1; margin-top: -8px; }
.marketplace-filters + .table-wrap { position: relative; z-index: 1; }
.marketplace-vehicle-filters { position: relative; z-index: 10; display: grid; grid-template-columns: minmax(240px,1.5fr) repeat(2,minmax(150px,1fr)) repeat(2,minmax(120px,.65fr)); gap: 14px; align-items: end; padding: 14px; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 12px; background: #f7faf8; }
.marketplace-vehicle-filters > div:first-child { align-self: center; }
.marketplace-vehicle-filters p { margin: 0 0 5px; }
.marketplace-vehicle-filters label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.marketplace-vehicle-filters select { min-height: 106px; }
.marketplace-vehicle-actions { display: flex; gap: 8px; align-items: center; grid-column: 1 / -1; }
.marketplace-table .mkt-qty { width: 88px; min-width: 76px; }
.marketplace-table td:last-child { padding-left: 4px; }

@media (max-width: 1100px) {
  .marketplace-vehicle-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .marketplace-vehicle-filters > div:first-child,.marketplace-vehicle-actions { grid-column: 1 / -1; }
}

@media (max-width: 650px) {
  .ra-actions { justify-content: flex-start; }
  .marketplace-filters { grid-template-columns: 1fr; }
  .marketplace-vehicle-filters { grid-template-columns: 1fr; }
  .marketplace-vehicle-filters > div:first-child,.marketplace-vehicle-actions { grid-column: auto; }
  .lead-details > dl { grid-template-columns: 105px minmax(0,1fr); }
}

.campaign-origin { background: #eef7ee; color: #1f6b34; margin-left: 6px; }
.builder-windows { border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px 14px; margin: 0; }
.builder-windows legend { font-weight: 700; padding: 0 6px; }
.builder-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 6px 0 12px; }
.builder-confirm { border: 1px solid #f0c36d; background: #fff8e6; border-radius: 12px; padding: 14px 16px; }
.builder-confirm p { margin: 0 0 10px; font-weight: 600; }
.danger-confirm { border-color: var(--danger); color: var(--danger); }

@media (max-width: 650px) {
  .builder-metrics { grid-template-columns: 1fr; }
}

/* Marketplace WIP / inventory status (0011) */
#marketplaceStatus:empty { display: none; }
.wip-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 12px; margin-top: 8px; }
.wip-grid > div { display: grid; gap: 2px; }
.wip-grid span { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted, #667); }
.wip-grid b { font-size: 18px; }
.account-status { display: inline-block; border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 750; background: #f1f5f9; color: #475569; }
.account-status.active { background: #e9f7ee; color: #176b37; }
.account-status.invited { background: #eef4ff; color: #174ea6; }
.account-status.inactive { background: #fff0f0; color: #a61b1b; }
.wip-block { margin-top: 10px; font-weight: 700; color: #a4472b; }
.wip-note { color: #a4472b; }

/* Let stacked grid columns shrink so wide tables scroll inside .table-wrap instead of pushing panels off-screen. */
.grid > * { min-width: 0; }
@media (max-width: 1000px) {
  .grid.two { grid-template-columns: minmax(0, 1fr); }
}
.form-error { color: #b42318; font-weight: 600; margin: 10px 0 0; }

/* --- Reusable partner-product help (renders any PARTNER_PRODUCT_HELP entry) --- */
.product-card-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: auto; width: 100%; }
.product-card-actions .button-link, .product-card-actions button { margin-top: 0; }

.help-hub { display: grid; gap: 18px; }
.help-hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.help-card { display: flex; flex-direction: column; align-items: flex-start; }
.help-card h2 { margin-bottom: 6px; }
.help-card button { margin-top: auto; }

.product-help { display: grid; gap: 20px; }
.help-back { display: flex; flex-wrap: wrap; gap: 8px; }
.help-back button { padding: 6px 10px; font-size: 13px; }
.help-head { display: grid; gap: 4px; }
.help-head h2 { margin: 0; }
.help-summary { max-width: 72ch; }
.help-badge { display: inline-block; margin-top: 8px; background: var(--mint); color: #17603f; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 750; }

.help-section h3, .help-warning h3 { margin-bottom: 12px; }
.help-glance { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 8px; line-height: 1.55; }
.help-facts { display: grid; grid-template-columns: minmax(130px, auto) minmax(0, 1fr); gap: 6px 18px; margin: 0; border-top: 1px solid var(--line); padding-top: 14px; }
.help-facts dt { font-weight: 700; color: var(--muted); }
.help-facts dd { margin: 0; }

.help-use-cases, .help-talking-points { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.help-use-case, .help-talking-point { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--paper); }
.help-use-case h4, .help-talking-point h4 { margin: 0 0 6px; }
.help-use-case p, .help-talking-point p { margin: 0; line-height: 1.5; }

.help-comparison { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; }
.help-compare { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #f8fafc; }
.help-compare.supplemental { border-color: #cfe0ff; background: #f3f7ff; }
.help-compare p:last-child { margin: 4px 0 0; line-height: 1.5; }
.help-compare-plus { align-self: center; font-size: 26px; font-weight: 800; color: var(--muted); }

.help-steps, .help-points { margin: 12px 0; padding-left: 22px; display: grid; gap: 8px; line-height: 1.5; }
.help-cta-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }
.help-cta-note { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; }
.secondary-link { background: var(--paper); color: var(--blue); border: 1px solid var(--line); }

.help-example { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #f8fafc; }
.help-example h4 { margin: 0 0 10px; }
.help-example-rows { display: grid; grid-template-columns: minmax(150px, auto) minmax(0, 1fr); gap: 4px 18px; margin: 0 0 12px; }
.help-example-rows dt { color: var(--muted); font-weight: 700; }
.help-example-rows dd { margin: 0; font-weight: 650; }
.help-math { font-size: 20px; font-weight: 800; letter-spacing: -.3px; margin: 0 0 10px; }
.help-disclaimer { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.help-source-note { color: var(--muted); font-size: 12px; margin: 0; }

.help-warning { border: 1px solid #f0c36d; background: #fff8e6; }
.help-warning h3 { color: #8a5a00; }
.help-warning ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.5; }

.help-resource-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.help-resource { display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--paper); text-decoration: none; color: var(--ink); }
.help-resource:hover { border-color: #a9b7ca; }
.help-resource strong { color: var(--blue); }
.help-resource span { color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
  .help-comparison { grid-template-columns: 1fr; }
  .help-compare-plus { text-align: center; }
  .help-facts, .help-example-rows { grid-template-columns: 1fr; gap: 2px 0; }
  .help-facts dd, .help-example-rows dd { margin-bottom: 8px; }
}

/* The Exchange shell is light-only. When the operating system requests dark mode the help
   views render as a self-contained dark surface so the guide stays legible without
   restyling the rest of the application. */
@media (prefers-color-scheme: dark) {
  #help, #product-help { background: #0f1a2b; color: #e7edf6; border-radius: 16px; padding: 22px; }
  #help .panel, #product-help .panel { background: #152238; border-color: #2a3d58; color: #e7edf6; }
  #help .muted, #product-help .muted,
  #help .help-disclaimer, #product-help .help-disclaimer,
  #help .help-source-note, #product-help .help-source-note { color: #9fb0c6; }
  #help .help-use-case, #product-help .help-use-case,
  #help .help-talking-point, #product-help .help-talking-point,
  #help .help-resource, #product-help .help-resource { background: #1b2b45; border-color: #2a3d58; }
  #help .help-compare, #product-help .help-compare { background: #1b2b45; border-color: #2a3d58; }
  #help .help-compare.supplemental, #product-help .help-compare.supplemental { background: #172a47; border-color: #35507a; }
  #help .help-example, #product-help .help-example { background: #1b2b45; border-color: #2a3d58; }
  #help .help-warning, #product-help .help-warning { background: #3a2f12; border-color: #6b551d; }
  #help .help-warning h3, #product-help .help-warning h3 { color: #ffd479; }
  #help .help-resource, #product-help .help-resource { color: #e7edf6; }
  #help .help-badge, #product-help .help-badge { background: #17351f; color: #8ee0a8; }
  #help button, #product-help button { background: #1b2b45; border-color: #2a3d58; color: #e7edf6; }
  #help .primary, #product-help .primary { background: var(--blue); border-color: var(--blue); color: #fff; }
  #help .secondary-link, #product-help .secondary-link { background: #1b2b45; color: #9cc4ff; border-color: #2a3d58; }
}
.lead-search-panel { display: grid; gap: 8px; margin-bottom: 16px; }
.lead-search-panel label { font-weight: 700; }
.lead-search-results { display: grid; gap: 6px; max-height: 360px; overflow: auto; }
.lead-result { display: grid; gap: 2px; width: 100%; text-align: left; }
.lead-result span { color: var(--muted); font-size: 13px; font-weight: 500; }
.lead-result[disabled] { opacity: .6; cursor: not-allowed; }
.lead-history { margin: 0 0 16px; padding-left: 18px; color: var(--muted); font-size: 13px; }

/* Marketplace master allocation policy (platform-admin pane) */
.marketplace-policy-products { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.marketplace-policy-product { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #f8fafc; display: grid; gap: 8px; align-content: start; }
.marketplace-policy-product h4 { margin: 0; }
.marketplace-policy-product.policy-no-inventory { opacity: .62; }
.policy-toggle { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 700; }
.policy-toggle input { width: auto; }
.policy-meta { color: var(--muted); font-size: 13px; margin: 0; }
.policy-pct { font-weight: 800; color: var(--ink); }
.policy-access-yes { color: #176b37; font-weight: 800; }
.policy-access-no { color: #94a3b8; }
.marketplace-policy-audit { display: grid; gap: 10px; }
.marketplace-policy-audit .audit-item { border-top: 1px solid var(--line); padding-top: 10px; }
.policy-product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 14px; }
.policy-product-grid label { display: grid; gap: 5px; margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }

/* Request Leads product grouping */
.marketplace-product-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.marketplace-product-tabs button { padding: 6px 12px; font-size: 13px; }
.marketplace-product-tabs button.active { background: var(--ink); color: #fff; }
/* 1.36.0 Storm leads (roofers only) */
.sidebar i.roofer-only{background:#ffe8cc;color:#9a4b00}
.storm-watch{display:flex;flex-wrap:wrap;gap:10px;margin-top:12px}
.storm-watch .pill{border:1px solid var(--line);border-radius:50px;padding:6px 12px;font-size:13px}
.storm-watch .pill.live{background:var(--mint);color:#176348;border-color:#bfe8d6}
.storm-watch .pill.stale{background:#fff4e5;color:#9a4b00;border-color:#ffd9a8}
.storm-warning{border-left:4px solid var(--danger);background:#fff5f4;border-radius:10px;padding:11px 14px;margin:8px 0}
.storm-warning strong{display:block}
.storm-tier1{font-weight:800;color:#9a4b00}
.storm-tiers{border:1px solid var(--line);border-radius:10px;padding:6px 12px;display:flex;gap:14px;align-items:center;flex-wrap:wrap}
.storm-tiers legend{font-size:12px;font-weight:700;padding:0 4px}
.storm-tiers label{display:inline-flex;align-items:center;gap:6px;font-weight:650;margin:0}
.storm-tiers input,#stormZips input[type=checkbox],#stormZipAll{width:auto}
.storm-owners{display:inline-flex;align-items:center;gap:6px;font-weight:650;max-width:420px}
.storm-owners input,#zipProspectOwners{width:auto}

/* 1.40.0 old roofs + hail report */
.roof-check{display:inline-flex;align-items:center;gap:6px;font-weight:650}
.roof-check input{width:auto}
.hail-results{list-style:none;padding:0;margin:10px 0 0;display:grid;gap:8px}
.hail-results li{display:flex;flex-wrap:wrap;gap:10px;align-items:center;border:1px solid var(--line);border-radius:10px;padding:10px 12px}
.button-link{display:inline-block;border:1px solid var(--line);border-radius:10px;padding:.45rem .8rem;font-weight:650;text-decoration:none;color:var(--blue)}
.hail-link{margin-top:10px}

/* 1.43.0 Recall check: a plain link in the sidebar nav (a standalone page, not an app view), styled like the buttons. */
.sidebar nav a.nav-link { display: block; border: 0; background: transparent; color: #b9c6d8; text-align: left; padding: 11px 13px; text-decoration: none; white-space: nowrap; font: inherit; }
.sidebar nav a.nav-link:hover, .sidebar nav a.nav-link:focus-visible { background: #1b3153; color: #fff; }

/* 1.46.0 open recall pilot: "Possible recall" on an auto lead card, and the Recall rewards link (hidden until rewards are on). */
.sidebar nav a.nav-link[hidden], .lead-recall[hidden] { display: none; }
.lead-recall { border: 1px solid #fedf89; border-left: 4px solid #f79009; background: #fffcf5; border-radius: 0 10px 10px 0; padding: 12px 14px; margin: 14px 0 4px; }
.lead-recall p { margin: 4px 0; line-height: 1.45; }
.lead-recall .eyebrow { color: #b54708; margin: 0 0 2px; }
.lead-recall .muted { color: var(--muted); font-size: 13px; }
.lead-recall-parts { font-size: 13px; color: var(--ink); }
.lead-recall-urgent { color: var(--danger); font-weight: 700; }
.lead-recall-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px !important; }
.lead-recall-reward { font-size: 13px; font-weight: 650; color: #027a48; }
.lead-recall-claim { font-size: 13px; font-weight: 650; }
