  /* ── Scoping & tokens ───────────────────────────────────────────────
     All styles live under .workbook so they don't leak into the WP theme.
     The original file had body{...} and *{...} rules that were nuking
     WP-wide page styles. CSS nesting (& and bare descendants) is used
     to keep selectors short. */
  .workbook {
    /* Color tokens — kept hex to preserve the brand teal/yellow palette
       this calculator was built around. Naming convention mirrors the
       horizon design system. */
    --dcw-teal-700:     #17576e;
    --dcw-teal-800:     #0f3f52;
    --dcw-yellow:       #f5c518;
    --dcw-orange-bg:    #fce8d5;
    --dcw-orange-border:#d4a070;
    --dcw-text:         #1a1f24;
    --dcw-muted:        #5a6470;
    --dcw-border:       #d6dbe0;
    --dcw-border-strong:#9aa3ad;
    --dcw-card:         #ffffff;
    --dcw-row-alt:      #f7f8fa;
    --dcw-radius:       6px;
    --dcw-radius-sm:    3px;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.45;
    color: var(--dcw-text);

    /* Card */
    max-width: 980px;
    margin: 24px auto;
    background: var(--dcw-card);
    border: 1px solid var(--dcw-border);
    border-radius: var(--dcw-radius);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 6px 16px rgba(0,0,0,0.05);
    overflow: hidden;
  }

  /* Scoped box-sizing reset — does NOT touch margin/padding so we don't
     wipe out WP's default heading/paragraph rhythm. */
  .workbook,
  .workbook *,
  .workbook *::before,
  .workbook *::after { box-sizing: border-box; }

  /* Reset margin/padding on workbook content only (not the surrounding
     WP page). The workbook owns its own rhythm. */
  .workbook h1, .workbook h2, .workbook h3, .workbook h4,
  .workbook p, .workbook ul, .workbook ol, .workbook table {
    margin: 0;
  }

  /* Header rules removed — header was deleted from the template; site
     chrome supplies the title now. */

  /* ── Body ── */
  .workbook .body {
    padding: 20px 24px 24px;
    display: flex;
    gap: 24px;
    align-items: stretch;
  }
  .left-col { flex: 1; min-width: 0; }
  .right-col {
    flex: 0 0 228px;
    display: flex;
    flex-direction: column;
  }

  /* ── Inputs ──
     Row spacing rewritten to use min-height and gap instead of a hard
     26px height. The hard height was clipping select dropdowns whose
     intrinsic heights vary by OS/browser, causing the rows to visually
     overlap (the "safe-harbor spacing" bug). */
  .workbook .inputs { margin-bottom: 18px; }
  .workbook .input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    margin-bottom: 6px;
  }
  .workbook .input-label {
    width: 220px;
    white-space: nowrap;
    font-size: 13px;
    color: var(--dcw-text);
    flex-shrink: 0;
  }

  /* Editable target DC% input — orange "fillable" indicator */
  .workbook .target-dc-input {
    background: var(--dcw-orange-bg);
    border: 1px solid var(--dcw-orange-border);
    padding: 5px 10px;
    width: 180px;
    height: 30px;
    text-align: center;
    font: inherit;
    font-weight: 600;
    color: var(--dcw-text);
    border-radius: var(--dcw-radius-sm);
    outline: none;
    cursor: text;
    transition: border-color .15s ease, box-shadow .15s ease;
  }
  .workbook .target-dc-input:focus {
    border-color: #b06030;
    box-shadow: 0 0 0 3px rgba(180,100,40,0.18);
  }
  .workbook .target-dc-input.invalid {
    border-color: #c0392b;
    background: #fde8e8;
  }
  .workbook .target-dc-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }

  .workbook .input-select {
    width: 180px;
    height: 30px;
    padding: 0 28px 0 10px;
    font: inherit;
    font-size: 13px;
    color: var(--dcw-text);
    border: 1px solid var(--dcw-border-strong);
    background: #fff
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%235a6470' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E")
      no-repeat right 10px center;
    border-radius: var(--dcw-radius-sm);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color .15s ease, box-shadow .15s ease;
  }
  .workbook .input-select:focus {
    outline: none;
    border-color: var(--dcw-teal-700);
    box-shadow: 0 0 0 3px rgba(23,87,110,0.15);
  }
  .irs-link {
    font-size: 11px;
    color: #1155cc;
    text-decoration: underline;
    margin-left: 220px;
    margin-top: 2px;
    display: block;
  }
  .irs-link:hover { color: #0b3d91; }

  /* ── Table watermark ── */
  .table-watermark-wrap {
    position: relative;
  }
  .table-watermark {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 150px;
    font-weight: 900;
    color: #17576e;
    opacity: 0.045;
    letter-spacing: -5px;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    z-index: 100;
    overflow: hidden;
  }

  /* ── Table ── */
  .components-table {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #555;
    font-size: 11px;
    margin-bottom: 0;
  }
  .components-table thead tr th {
    background: #17576e;
    color: #f5c518;
    padding: 6px 8px;
    font-weight: bold;
    font-size: 11px;
    border: 1px solid #0f3f52;
    white-space: nowrap;
  }
  .components-table tbody tr td {
    padding: 4px 8px;
    border: 1px solid #ccc;
    vertical-align: middle;
    height: 30px;        /* locks row height — prevents twitch when N/A vs select rows mix */
  }
  .all-btn-wrap {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    justify-content: center;
  }
  .all-btn {
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px solid #aaa;
    background: #e8e8e8;
    color: #333;
    cursor: pointer;
    line-height: 1.4;
    white-space: nowrap;
  }
  .all-btn:hover { background: #d0d0d0; border-color: #888; }
  .all-btn.on  { border-color: #2a7a2a; color: #1a5a1a; background: #d8f0d8; }
  .all-btn.on:hover  { background: #c0e8c0; }
  .all-btn.off { border-color: #a03030; color: #7a1010; background: #f8e0e0; }
  .all-btn.off:hover { background: #f0c8c8; }

  .section-label-inv  { background: #FFA500 !important; }
  .section-label-rack { background: #00CFEF !important; }

  .section-label {
    background: #f0f0f0;
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    vertical-align: middle;
    width: 88px;
    line-height: 1.4;
    color: #333;
    border-right: 2px solid #888 !important;
  }
  .comp-name { color: #222; }
  .max-pct-cell { text-align: right; width: 80px; color: #333; }
  .user-input-cell { text-align: center; width: 80px; }

  .user-select {
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 2px 4px;
    font-size: 11px;
    width: 62px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.1s, border-color 0.1s;
  }
  .user-select.yes {
    background: #e0f4e0;
    border-color: #6ec06e;
    color: #1a5a1a;
    font-weight: 600;
  }
  .user-select.no {
    background: #f5f5f5;
    border-color: #ccc;
    color: #888;
    font-weight: 400;
  }

  /* Production row — auto-driven, read-only */
  .prod-row td { background: #f5f5f5; }
  .prod-row .comp-name { font-style: italic; color: #555; }
  .prod-auto-label {
    font-size: 10px;
    color: #888;
    font-style: italic;
  }

  .dc-achieved-cell { text-align: right; width: 90px; color: #333; }
  .dc-zero { color: #bbb; }
  .no-max  { color: #ccc; }

  /* N/A rows — component not applicable for current configuration */
  .na-row td:not(.section-label) { background: #f9f9f9 !important; }
  .na-label {
    font-size: 10px;
    color: #bbb;
    font-style: italic;
  }

  /* No-racking notice row */
  .no-racking-notice td {
    background: #fff8e6 !important;
    border-top: 1px dashed #e0c060 !important;
    border-bottom: 1px dashed #e0c060 !important;
    padding: 7px 12px !important;
    color: #7a5a00;
    font-size: 11px;
    font-style: italic;
    text-align: center;
  }

  /* Section dividers */
  .section-start td { border-top: 2px solid #888 !important; }
  .section-end  td  { border-bottom: 2px solid #888 !important; }

  /* ── Required Module Row ── */
  .required-module-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    border: 2px solid #555;
    border-top: none;
    padding: 8px 14px;
    background: #f9f9f9;
  }
  .required-module-row .rm-label {
    font-size: 12px;
    font-weight: bold;
    color: #333;
  }
  .required-module-row .rm-value {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    background: #fce8d5;
    border: 1px solid #d4a070;
    padding: 4px 18px;
    border-radius: 2px;
    min-width: 80px;
    text-align: center;
  }
  .rm-value.target-met {
    background: #e6f4ea;
    border-color: #7ec995;
    color: #1a7a34;
  }

  /* ── Threshold note ── */
  .threshold-note {
    font-size: 10px;
    color: #888;
    margin-top: 8px;
    text-align: center;
    font-style: italic;
    white-space: nowrap;
  }

  /* ── Chart ── */
  .chart-wrap {
    border: 1px solid #ccc;
    padding: 12px 10px 10px;
    background: #fff;
    flex: 1;                    /* fill full height of right-col */
    display: flex;
    flex-direction: column;
  }
  .chart-title {
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 6px;
    color: #333;
    line-height: 1.35;
    flex-shrink: 0;
  }
  .chart-legend {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-bottom: 8px;
    font-size: 10px;
    color: #333;
    flex-shrink: 0;
  }
  .legend-item { display: flex; align-items: center; gap: 4px; }
  .legend-swatch {
    width: 14px; height: 12px;
    border-radius: 2px;
    display: inline-block;
  }
  .swatch-racking  { background: #00CFEF; }
  .swatch-inverter { background: #FFA500; }
  .swatch-module   { background: rgba(224,48,48,0.45); border: 1px solid #c01818; }
  /* Responsive canvas wrapper — Chart.js needs a positioned parent */
  .chart-canvas-wrap {
    flex: 1;
    position: relative;
    min-height: 180px;
  }
  .chart-canvas-wrap canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100% !important;
    height: 100% !important;
  }

  /* Inline hint text shown next to target/buffer inputs. */
  .workbook .input-hint {
    font-size: 11px;
    color: var(--dcw-muted);
    font-style: italic;
  }

  /* DC buffer % shares the target-DC orange "fillable" treatment so the
     two adjacent rows are visually aligned. Previously this was an
     un-updated copy of the original styles which was rendering shorter
     than the surrounding selects. */
  .workbook .dc-buffer-input {
    background: var(--dcw-orange-bg);
    border: 1px solid var(--dcw-orange-border);
    padding: 5px 10px;
    width: 180px;
    height: 30px;
    text-align: center;
    font: inherit;
    font-weight: 600;
    color: var(--dcw-text);
    border-radius: var(--dcw-radius-sm);
    outline: none;
    cursor: text;
    transition: border-color .15s ease, box-shadow .15s ease;
  }
  .workbook .dc-buffer-input:focus {
    border-color: #b06030;
    box-shadow: 0 0 0 3px rgba(180,100,40,0.18);
  }

  /* .header-btns removed — buttons moved to project band */

  /* ── Print styles ── */
  @media print {
    @page { size: letter landscape; margin: 0.25in 0.3in; }

    /* JS marks every sibling of every ancestor of .workbook with
       data-anza-print-hidden so we can hide them with display:none.
       This keeps the workbook in normal flow (so pagination works
       correctly) while getting the WP theme chrome out of the way. */
    [data-anza-print-hidden] { display: none !important; }

    .workbook {
      width: 100% !important;
      max-width: 100% !important;
      margin: 0 !important;
      box-shadow: none !important;
      border: none !important;
    }

    .all-btn-wrap { display: none !important; }

    /* Fit-to-page: zoom is set by JS in `beforeprint` based on the
       measured workbook size. Default 0.55 errs on the safe side
       when JS isn't running. */
    .workbook { zoom: var(--print-zoom, 0.55); }

    /* Force background colours, images, and borders to actually print
       inside the workbook. */
    .workbook, .workbook *,
    .workbook *::before, .workbook *::after {
      -webkit-print-color-adjust: exact !important;
      print-color-adjust: exact !important;
      color-adjust: exact !important;
    }

    /* Clean, consistent table borders on print */
    .components-table { border: 2px solid #555 !important; }
    .required-module-row { border: 2px solid #555 !important; border-top: none !important; }

    /* Hide interactive-only elements */
    .header-btns, .project-band-btns { display: none !important; }

    /* Keep select dropdowns looking styled (not browser-chrome) */
    .input-select {
      -webkit-appearance: none;
      appearance: none;
      border: 1px solid #bbb !important;
      background: #f4f4f4 !important;
      text-align: center;
      text-align-last: center;
    }
    .user-select {
      -webkit-appearance: none;
      appearance: none;
    }
    .user-select.yes {
      border: 1px solid #6ec06e !important;
      background: #e0f4e0 !important;
    }
    .user-select.no {
      border: 1px solid #ccc !important;
      background: #f5f5f5 !important;
    }
    .target-dc-input, .dc-buffer-input {
      border: 1px solid #d4a070 !important;
      background: #fce8d5 !important;
    }

    /* Project band — keep grey background, clean up inputs for print */
    .project-band {
      background: #f0f4f6 !important;
      border-bottom: 1px solid #dde3e8 !important;
      padding: 8px 16px !important;
    }
    .project-band-input {
      border: none !important;
      background: transparent !important;
      padding: 2px 0 !important;
      font-weight: bold;
    }
    /* Hide band entirely if no project info was entered */
    .project-band--empty { display: none !important; }

    /* Layout — keep compact for one page */
    .body { padding: 12px 16px 14px !important; gap: 16px !important; }
    .chart-canvas-wrap { min-height: 150px !important; }

    /* Prevent bad page breaks */
    .body, .left-col, .right-col { page-break-inside: avoid; }
    .components-table { page-break-inside: avoid; }
    .components-table thead { display: table-header-group; }
    .conclusion-section { page-break-inside: avoid; padding: 12px 16px 14px !important; min-height: 0 !important; }
    #solutions-para { min-height: 0 !important; }
    .disclaimer { page-break-inside: avoid; padding: 8px 16px 12px !important; }
  }

  /* ── Project Band ── */
  .project-band {
    background: #f0f4f6;
    border-bottom: 1px solid #dde3e8;
    padding: 10px 22px;
    display: flex;
    gap: 28px;
    align-items: flex-end;
  }
  .project-band-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .project-band-label {
    font-size: 10px;
    font-weight: bold;
    color: #17576e;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }
  .project-band-input {
    padding: 4px 8px;
    border: 1px solid #c5d0d6;
    background: #fff;
    border-radius: 2px;
    font-size: 12px;
    color: #333;
    outline: none;
  }
  .project-band-input:focus {
    border-color: #17576e;
    box-shadow: 0 0 0 2px rgba(23,87,110,0.1);
  }
  .project-band-input.pb-wide  { width: 220px; }
  .project-band-input.pb-med   { width: 110px; }
  .project-band-input.pb-short { width: 170px; }

  .project-band-btns {
    margin-left: auto;
    display: flex;
    align-items: flex-end;
    gap: 5px;
  }
  .project-band-btn {
    background: #17576e;
    border: 1px solid #0f3f52;
    color: #fff;
    font-size: 11px;
    padding: 0 12px;
    height: 26px;
    line-height: 26px;
    border-radius: 2px;
    cursor: pointer;
    font-family: Arial, sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }
  .project-band-btn:hover { background: #0f3f52; }

  /* ── Conclusion Section ── */
  .conclusion-section {
    border-top: 2px solid #17576e;
    padding: 16px 22px 20px;
    min-height: 210px;
  }
  /* Lock the solutions paragraph height so a short "target met" message
     doesn't collapse the section — matches height of a 2-line paragraph */
  #solutions-para {
    min-height: 64px;
  }
  .conclusion-title {
    font-size: 12px;
    font-weight: bold;
    color: #17576e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 11px;
  }
.conclusion-para {
    font-size: 12px;
    line-height: 1.75;
    color: #222;
    background: #f5f8fa;
    border-left: 3px solid #17576e;
    padding: 11px 15px;
    border-radius: 0 3px 3px 0;
  }
  .conclusion-para .cv { font-weight: bold; color: #17576e; }

  /* ── Disclaimer ── */
  .disclaimer {
    border-top: 1px solid #dde3e8;
    padding: 11px 22px 15px;
    background: #f0f4f6;
  }
  .disclaimer p {
    font-size: 10.5px;
    color: #666;
    line-height: 1.6;
    font-style: italic;
  }
  .disclaimer strong { color: #444; font-style: normal; }

  /* ── HubSpot form gate ──
     When [anza_dc_workbook gated="true"], the workbook is hidden until a
     HubSpot form on the page is submitted. The gate message is shown only
     while gated; the workbook content is hidden only while gated. */
  .dcw-gate-wrapper { width: 100%; }
  .dcw-gate-message {
    display: none;
    margin: 0 0 16px;
    padding: 14px 18px;
    background: #f0f4f6;
    border: 1px solid #dde3e8;
    border-left: 3px solid #17576e;
    border-radius: 4px;
    color: #333;
    font-size: 14px;
    line-height: 1.55;
  }
  .dcw-gate-message strong { color: #17576e; }
  .dcw-gate-wrapper.dcw-gated .dcw-gate-message { display: block; }
  .dcw-gate-wrapper.dcw-gated .dcw-gate-content { display: none; }
