:root {
  --ink: #10233f;
  --muted: #627087;
  --line: #dde3e8;
  --soft: #f7f8f7;
  --paper: #fffefa;
  --blue: #0f4f8c;
  --blue-deep: #123a68;
  --mint: #dff4ea;
  --mint-ink: #0c6b4f;
  --amber: #fff0cf;
  --amber-ink: #8a5400;
  --danger: #ab3e36;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(24, 42, 65, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--ink); background: #eef2f3; font-family: "DM Sans", Arial, sans-serif; }
button, select, input { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0 42px; }
.site-header { display: flex; justify-content: space-between; align-items: center; padding: 0 2px 32px; }

/* Frontend Logo */
.site-header-logo { height: 48px; width: auto; mix-blend-mode: multiply; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 16px; font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
.header-note { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #2eb37f; box-shadow: 0 0 0 4px rgba(46, 179, 127, 0.14); }
.intro { display: flex; justify-content: space-between; gap: 24px; align-items: end; padding: 18px 0 46px; }
.eyebrow { margin: 0 0 10px; color: var(--blue); font-size: 12px; line-height: 1; letter-spacing: 0.14em; font-weight: 700; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: "Fraunces", Georgia, serif; letter-spacing: -0.04em; }
h1 { max-width: 700px; margin-bottom: 16px; font-size: clamp(39px, 5.2vw, 68px); line-height: 0.98; font-weight: 600; }
.intro-copy { max-width: 650px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.65; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 390px; align-items: start; border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); overflow: hidden; }

/* Frontend Watermark */
.builder { 
  min-width: 0; 
  padding: 34px 38px 42px; 
  position: relative; 
}
.builder::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('./newlogo.webp');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 80% auto; 
  opacity: 0.14; 
  z-index: 0;
  pointer-events: none;
}

/* Ensure form elements sit cleanly above the frontend watermark */
.form-section { padding: 25px 0; border-bottom: 1px solid var(--line); position: relative; z-index: 1; }
.form-section:first-child { padding-top: 0; }
.form-section:last-child { border-bottom: 0; padding-bottom: 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.section-heading.compact { margin-bottom: 15px; }
.section-heading h2 { margin: 0; font-size: 24px; font-weight: 600; }
.help-label, .member-count { color: var(--muted); font-size: 13px; font-weight: 600; }
.member-count { padding: 6px 10px; border-radius: 999px; background: #f2f4f5; }
.product-toggle { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.product-option { position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 92px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 13px; background: #fff; transition: 160ms ease; cursor: pointer; }
.product-option:hover { border-color: #aebdca; }
.product-option.active { border-color: var(--blue); background: #f1f7fd; box-shadow: inset 0 0 0 1px var(--blue); }
.product-option input { position: absolute; opacity: 0; pointer-events: none; }
.product-title { color: var(--ink); font-size: 16px; font-weight: 700; }
.product-desc { color: var(--muted); font-size: 13px; line-height: 1.4; }
.product-notice { display: none; margin-top: 13px; padding: 11px 13px; border-radius: 10px; color: var(--amber-ink); background: var(--amber); font-size: 13px; line-height: 1.55; }
.product-notice.show { display: block; }

.field-grid { display: grid; gap: 13px; }
.policy-grid { grid-template-columns: 1.5fr 1fr 1.3fr; }
.discount-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 7px; color: #5d697b; font-size: 13px; font-weight: 700; }
.field select, .field input { width: 100%; height: 48px; padding: 0 13px; border: 1px solid #dbe1e6; border-radius: 10px; outline: none; color: var(--ink); background: #fff; font-size: 15px; font-weight: 500; transition: 160ms ease; }
.field select:focus, .field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(15, 79, 140, 0.11); }
.field select:disabled { opacity: 0.5; background: #f7f9fa; cursor: not-allowed; }

/* ------------------------------------- */
/* PREMIUM MEMBER CARDS & RIDERS         */
/* ------------------------------------- */
.member-list { display: grid; gap: 18px; }

.member-card { 
  position: relative;
  display: grid; 
  grid-template-columns: minmax(120px, 1.5fr) 90px 110px 42px; 
  gap: 14px; 
  align-items: end; 
  padding: 18px 20px; 
  border: 1px solid #eaedf0; 
  border-radius: 16px; 
  background: #ffffff; 
  box-shadow: 0 4px 14px rgba(18, 58, 104, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.member-card:hover {
  border-color: #d1d8df;
  box-shadow: 0 8px 24px rgba(18, 58, 104, 0.06);
}

.remove-member { width: 42px; height: 48px; border: 0; border-radius: 10px; color: #7b8794; background: transparent; font-size: 24px; line-height: 1; transition: 160ms ease; }
.remove-member:hover:not(:disabled) { color: var(--danger); background: #fbecea; }
.remove-member:disabled { opacity: 0.3; cursor: not-allowed; }

/* Pill-Shaped Member Rider Styling */
.member-riders-grid {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
  padding-top: 18px;
  border-top: 1px dashed #eaedf0;
}

.member-rider-label {
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid #eaedf0;
  border-radius: 9px;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.member-rider-label:hover {
  background: #f1f7fd;
  border-color: #b6c5d1;
  color: var(--blue-deep);
}
.member-rider-label:has(input:checked) {
  background: #eaf3fb;
  border-color: var(--blue);
  color: var(--blue-deep);
  box-shadow: 0 2px 6px rgba(15, 79, 140, 0.08);
}
.member-rider-label input {
  accent-color: var(--blue);
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

/* Deductible elements */
.member-deductible-container { grid-column: 1 / -1; margin-top: 8px; }
.field-label { font-size: 12.5px; color: #5d697b; font-weight: 700; margin-bottom: 6px; display: block; }
.member-deductible-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.deductible-notice { font-size: 12px; color: var(--muted); padding-top: 4px; display: block; }

.member-deductible-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid #dbe1e6; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; background: #fff; transition: all 0.2s ease; color: inherit; }
.member-deductible-pill.active { background: #eaf3fb; border-color: var(--blue); color: var(--blue-deep); }
.member-deductible-pill input { accent-color: var(--blue); width: 14px; height: 14px; margin: 0; cursor: pointer; }

/* ------------------------------------- */

.add-member { margin-top: 12px; }
.secondary-button, .primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 16px; border-radius: 10px; font-size: 14px; font-weight: 700; transition: 160ms ease; }
.secondary-button { border: 1px solid #d6dee4; color: var(--ink); background: #fff; }
.secondary-button:hover { border-color: #a9b8c6; background: #f8fafb; }
.primary-button { border: 1px solid var(--blue-deep); color: #fff; background: var(--blue-deep); box-shadow: 0 5px 12px rgba(18, 58, 104, 0.17); }
.primary-button:hover { background: #0d315b; transform: translateY(-1px); }
.primary-button:disabled { cursor: not-allowed; opacity: 0.5; transform: none; }
.rider-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.rider-option { display: flex; gap: 12px; align-items: flex-start; min-height: 78px; padding: 14px; border: 1px solid #e1e6e9; border-radius: 12px; background: #fff; cursor: pointer; transition: 160ms ease; }
.rider-option:hover { border-color: #b6c5d1; }
.rider-option:has(input:checked) { border-color: #8bb2d5; background: #f1f7fd; }
.rider-option.rider-unavailable { border-color: #efc6a7; background: #fffaf5; }
.rider-option.rider-unavailable:has(input:checked) { border-color: #e7955b; background: #fff4e9; }
.rider-option input { position: absolute; opacity: 0; }
.check { display: inline-grid; place-items: center; flex: 0 0 20px; width: 20px; height: 20px; margin-top: 1px; border: 1px solid #bfcad3; border-radius: 6px; background: #fff; }
.rider-option input:checked + .check { border-color: var(--blue); background: var(--blue); }
.rider-option input:checked + .check::after { content: "✓"; color: white; font-size: 13px; font-weight: 700; }
.rider-option strong, .rider-option small { display: block; }
.rider-option strong { color: var(--ink); font-size: 14px; line-height: 1.3; }
.rider-option small { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.rider-option .rider-price { display: block; margin-bottom: 2px; color: var(--blue); font-size: 13px; font-weight: 800; }
.rider-option .rider-availability { display: block; color: #9b5a2a; font-weight: 700; line-height: 1.35; }
.summary { position: sticky; top: 20px; min-height: 660px; padding: 31px 29px 25px; color: #fff; background: linear-gradient(155deg, #123a68 0%, #0b2d51 100%); }
.summary-topline { display: flex; align-items: center; justify-content: space-between; color: #b8cae0; font-size: 12px; font-weight: 700; letter-spacing: 0.13em; }
.status-pill { padding: 6px 9px; border-radius: 999px; color: #c7f2de; background: rgba(72, 185, 130, 0.18); font-size: 12px; letter-spacing: 0.04em; }
.status-pill.attention { color: #ffe1a9; background: rgba(248, 181, 65, 0.16); }
.summary-product { min-height: 19px; margin: 24px 0 9px; color: #dae7f4; font-size: 14px; }
.premium-value { margin: 0; font-family: "Fraunces", Georgia, serif; font-size: clamp(46px, 4.2vw, 59px); line-height: 0.95; letter-spacing: -0.055em; }
.premium-caption { margin: 10px 0 23px; color: #acc2da; font-size: 13px; }
.summary-rule { height: 1px; background: rgba(205, 223, 239, 0.25); }
.summary-lines { display: grid; padding: 20px 0 10px; }
.summary-line { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; color: #c8d7e7; font-size: 14px; }
.summary-line span:last-child { color: #fff; font-weight: 700; text-align: right; }
.summary-line.total-line { margin-top: 6px; padding-top: 17px; border-top: 1px solid rgba(205, 223, 239, 0.25); color: #fff; font-weight: 700; }
.summary-issues { display: grid; gap: 7px; }
.issue { padding: 10px 11px; border-left: 2px solid #f1b64a; border-radius: 5px; color: #ffe4b2; background: rgba(255,255,255,0.06); font-size: 12px; line-height: 1.5; }
.summary-footer { position: absolute; right: 29px; bottom: 25px; left: 29px; }
.summary-footer p { margin: 0 0 13px; color: #a9c0d8; font-size: 12px; line-height: 1.5; }
.summary-footer .primary-button { width: 100%; background: #fff; color: var(--blue-deep); box-shadow: none; }
.summary-footer .primary-button:hover { background: #eaf3fb; }

.quote-dialog { width: min(820px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 0; border: 0; border-radius: 17px; color: var(--ink); background: #fff; box-shadow: 0 24px 90px rgba(15, 32, 51, 0.36); }
.quote-dialog::backdrop { background: rgba(12, 24, 40, 0.58); backdrop-filter: blur(3px); }
.quote-document { padding: 38px 42px 30px; position: relative; z-index: 1; }
.quote-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 24px; border-bottom: 1px solid #e1e6e9; }
.quote-header-meta { display: grid; gap: 3px; color: var(--muted); font-size: 12px; text-align: right; }
.quote-hero { display: flex; justify-content: space-between; gap: 18px; align-items: end; padding: 30px 0 25px; }
.quote-hero h2 { margin: 0; font-size: 35px; line-height: 1; }
.quote-total { display: grid; justify-items: end; gap: 5px; color: var(--muted); font-size: 13px; text-align: right; }
.quote-total strong { color: var(--blue-deep); font-family: "Fraunces", Georgia, serif; font-size: 34px; letter-spacing: -0.05em; }
.quote-total small { font-size: 12px; }
.quote-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0; margin-bottom: 26px; border: 1px solid #dde4e8; border-radius: 11px; overflow: hidden; }
.quote-meta div { padding: 11px 12px; border-right: 1px solid #dde4e8; border-bottom: 1px solid #dde4e8; }
.quote-meta span, .quote-meta strong { display: block; }
.quote-meta span { margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.quote-meta strong { color: var(--ink); font-size: 13px; }
.quote-block { margin-top: 21px; }
.quote-block-heading { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 9px; border-bottom: 1px solid var(--ink); }
.quote-block-heading h3 { margin: 0; font-size: 15px; }
.quote-block-heading span { color: var(--muted); font-size: 12px; font-weight: 700; }
.quote-row { display: flex; justify-content: space-between; gap: 20px; padding: 10px 0; border-bottom: 1px solid #e8ecee; font-size: 13px; }
.quote-row span:last-child { white-space: nowrap; font-weight: 700; text-align: right; }
.quote-row.subtle { color: var(--muted); }
.quote-row.indent { padding-left: 14px; color: var(--muted); font-size: 12px; }
.quote-row.discount span:last-child { color: var(--mint-ink); }
.quote-row.total { margin-top: 7px; padding: 13px 0 0; border-bottom: 0; color: var(--blue-deep); font-size: 15px; font-weight: 700; }
.quote-row.total span:last-child { font-size: 18px; }
.quote-coverage { padding: 14px 16px; border-radius: 10px; background: #f2f7fa; }
.quote-coverage h3 { margin: 0 0 8px; font-size: 14px; }
.quote-coverage p { margin: 0; color: #55657a; font-size: 12px; line-height: 1.6; }
.quote-footnote { margin-top: 27px; padding-top: 13px; border-top: 1px solid #e1e6e9; }
.quote-footnote p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 42px 23px; border-top: 1px solid #e1e6e9; }

.quote-document::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('./newlogo.webp');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 85% auto;
  opacity: 0.14; 
  z-index: -1;
  pointer-events: none;
}

@media (max-width: 1080px) { .workspace { grid-template-columns: minmax(0, 1fr) 345px; } .builder { padding: 29px; } .summary { padding: 29px 24px; } .summary-footer { right: 24px; left: 24px; } }
@media (max-width: 860px) { .shell { width: min(100% - 28px, 740px); } .intro { align-items: flex-start; flex-direction: column; padding-bottom: 32px; } .workspace { grid-template-columns: 1fr; overflow: visible; } .summary { position: relative; top: auto; min-height: 0; border-radius: 0 0 24px 24px; } .summary-footer { position: static; margin-top: 20px; } .policy-grid { grid-template-columns: 1fr 1fr; } .policy-grid .field:last-child { grid-column: 1 / -1; } }

/* ------------------------------------- */
/* MOBILE RESPONSIVE FIXES               */
/* ------------------------------------- */
@media (max-width: 610px) {
  .shell { width: 100%; padding: 14px 10px 28px; }
  .site-header { align-items: flex-start; flex-direction: column; gap: 12px; padding-bottom: 20px; }
  .intro { padding: 10px 0 26px; }
  h1 { font-size: clamp(34px, 12vw, 44px); line-height: 1; }
  .workspace { border-radius: 18px; }
  .builder { padding: 22px 16px 28px; }
  .product-toggle, .discount-grid, .rider-grid, .policy-grid { grid-template-columns: 1fr; }
  .policy-grid .field:last-child { grid-column: auto; }
  
  /* Mobile Member Card Overrides */
  .member-card { 
    grid-template-columns: 1fr; /* Force 1 column stack */
    gap: 14px; 
    padding: 20px 16px;
  }
  .member-card .field { grid-column: 1 / -1; } /* Full width inputs */
  
  .member-card .field:first-child {
    padding-right: 40px; /* Prevent text clipping under the delete button */
  }

  /* Move delete button to top right */
  .member-card .remove-member {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    margin: 0;
    background: #f2f5f8;
    font-size: 20px;
    border-radius: 8px;
  }

  /* Stack Rider Pills nicely */
  .member-riders-grid {
    flex-direction: column;
    gap: 8px;
  }
  .member-rider-label {
    width: 100%;
    padding: 12px 14px;
  }
  
  /* Stack Deductible Pills nicely */
  .member-deductible-grid {
    flex-direction: column;
    gap: 8px;
  }
  .member-deductible-pill {
    width: 100%;
    justify-content: flex-start;
  }

  .field select, .field input { min-height: 48px; font-size: 16px; }
  .secondary-button, .primary-button { width: 100%; min-height: 46px; font-size: 15px; }
  .summary { padding: 24px 18px; border-radius: 0 0 18px 18px; }
  .premium-value { font-size: 44px; }
  .quote-dialog { width: 100%; max-height: 100%; border-radius: 0; }
  .quote-document { padding: 27px 20px 24px; }
  .dialog-actions { flex-direction: column; justify-content: stretch; padding: 14px 20px 18px; }
}

@media print { 
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  @page { margin: 12mm; size: A4; } 
  body { background: #fff; margin: 0; } 
  body > main, .quote-dialog::backdrop, .no-print { display: none !important; } 
  .quote-dialog { position: static; display: block; width: 100%; max-height: none; overflow: visible; box-shadow: none; border-radius: 0; } 
  .quote-document { padding: 0; position: static; } 
  .quote-document::before { display: none !important; }
  body::before {
    content: "" !important; position: fixed !important; top: 0 !important; left: 0 !important; width: 100vw !important; height: 100vh !important; background-image: url('./newlogo.webp') !important; background-repeat: no-repeat !important; background-position: center center !important; background-size: 85% auto !important; opacity: 0.14 !important; z-index: -1 !important; pointer-events: none !important;
  }
  .quote-row { break-inside: avoid; } 
}