:root {
      --fpd-navy: #071a3d;
      --fpd-navy-2: #0b244f;
      --fpd-red: #ff2a1f;
      --fpd-orange: #ff7a00;
      --fpd-green: #1f7a3a;
      --fpd-green-dark: #063b19;
      --fpd-green-mid: #0f7a32;
      --fpd-green-light: #e9fff0;
      --fpd-text: #20314d;
      --fpd-border: rgba(7, 26, 61, 0.14);
      --fpd-shadow: 0 12px 30px rgba(7, 26, 61, 0.16);
    }

    * {
      box-sizing: border-box;
    }

    html,
    body {
      margin: 0;
      width: 100%;
      height: 100%;
      min-height: 0;
      font-family: Arial, Helvetica, sans-serif;
      background: #edf3fc;
      color: var(--fpd-text);
      overflow: hidden;
    }

    .fpd-viewer-page {
      width: 100%;
      height: 100vh;
      min-height: 0;
      display: flex;
      flex-direction: column;
      background: linear-gradient(180deg, #f7faff 0%, #edf3fc 100%);
      overflow: hidden;
    }

    .fpd-header {
      flex: 0 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      padding: 7px 14px;
      background: linear-gradient(90deg, var(--fpd-navy) 0%, var(--fpd-navy-2) 58%, #12366f 100%);
      border-bottom: 4px solid var(--fpd-red);
      color: #fff;
    }

    .fpd-header-left {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }

    .fpd-dynamic-logo {
      display: flex;
      align-items: center;
      justify-content: left;
      padding: 0;
      width: 42px;
      height: 42px;
      background: #ffffff;
      border-radius: 8px;
      overflow: hidden;
      box-shadow: 0 4px 12px rgba(0,0,0,0.24);
      flex: 0 0 auto;
    }

    .fpd-dynamic-logo svg {
      display: block;
      width: 42px;
      height: 42px;
    }

    .fpd-logo-part,
    .fpd-center-diamond {
      transition: fill 180ms ease-in-out;
    }

    @media (prefers-reduced-motion: reduce) {
      .fpd-logo-part,
      .fpd-center-diamond {
        transition: none;
      }
    }

    .fpd-title {
      font-size: 17px;
      line-height: 1.1;
      font-weight: 800;
      letter-spacing: 0.02em;
      color: #fff;
      white-space: nowrap;
    }

    .fpd-subtitle {
      margin-top: 3px;
      font-size: 11.5px;
      color: rgba(255,255,255,0.82);
      white-space: nowrap;
    }

    .fpd-header-right {
      text-align: right;
      font-size: 11.5px;
      line-height: 1.35;
      color: rgba(255,255,255,0.86);
      white-space: nowrap;
    }

    .fpd-main {
      flex: 1 1 auto;
      min-height: 0;
      display: grid;
      grid-template-columns: 325px minmax(0, 1fr);
      grid-template-rows: minmax(0, 1fr) auto;
      overflow: hidden;
    }

    .fpd-side-top {
      grid-column: 1;
      grid-row: 1;
      min-height: 0;
      overflow: hidden;
      background: rgba(255,255,255,0.97);
      border-right: 1px solid var(--fpd-border);
      padding: 6px;
    }

    .fpd-workarea {
      grid-column: 2;
      grid-row: 1;
      min-width: 0;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow: visible;
    }

    .fpd-bottom-full {
      grid-column: 1 / -1;
      grid-row: 2;
      display: block;
      gap: 8px;
      align-items: stretch;
      padding: 5px 10px;
      background: rgba(255,255,255,0.98);
      border-top: 1px solid var(--fpd-border);
      overflow: visible;
    }

    .fpd-panel-title {
      margin: 0 0 2px;
      font-size: 15px;
      font-weight: 800;
      color: var(--fpd-navy);
    }

    .fpd-panel-note {
      margin: 0 0 5px;
      font-size: 10px;
      line-height: 1.18;
      color: #55657f;
    }

    .fpd-group {
      margin-bottom: 5px;
      padding: 6px;
      border: 1px solid var(--fpd-border);
      border-radius: 10px;
      background: #fff;
      box-shadow: 0 2px 6px rgba(7, 26, 61, 0.035);
    }

    .fpd-group-title {
      margin: 0 0 5px;
      font-size: 12px;
      font-weight: 800;
      color: var(--fpd-navy);
    }

    .fpd-subgroup-title {
      margin: 8px 0 5px;
      padding-top: 6px;
      border-top: 1px solid rgba(7, 26, 61, 0.10);
      font-size: 11px;
      font-weight: 900;
      color: var(--fpd-navy);
      text-transform: uppercase;
      letter-spacing: 0.025em;
    }

    .fpd-subgroup-title:first-child {
      margin-top: 0;
      padding-top: 0;
      border-top: 0;
    }

    .fpd-build-grid,
    .fpd-test-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 5px;
    }

    .fpd-test-grid {
      grid-template-columns: repeat(10, minmax(0, 1fr));
      gap: 4px;
    }

    .fpd-btn,
    .fpd-test-btn,
    .fpd-build-btn {
      appearance: none;
      border: 1px solid rgba(7, 26, 61, 0.14);
      border-radius: 8px;
      padding: 5px 4px;
      font-size: 10px;
      line-height: 1.05;
      font-weight: 800;
      cursor: pointer;
      transition: 0.15s ease;
      min-height: 28px;
      text-align: center;
    }

    .fpd-btn {
      background: var(--fpd-navy);
      color: #fff;
      border-color: var(--fpd-navy);
    }

    .fpd-btn:hover {
      background: #020817;
      border-color: #020817;
    }

    .fpd-btn.orange {
      background: var(--fpd-orange);
      border-color: var(--fpd-orange);
    }

    .fpd-btn.green {
      background: var(--fpd-green);
      border-color: var(--fpd-green);
    }

    .fpd-btn.light,
    .fpd-test-btn,
    .fpd-build-btn {
      background: #f3f7ff;
      color: var(--fpd-navy);
      border-color: rgba(7, 26, 61, 0.14);
    }

    .fpd-btn.light:hover,
    .fpd-test-btn:hover,
    .fpd-build-btn:hover {
      background: #e1ecff;
    }

    .fpd-btn:disabled,
    .fpd-test-btn:disabled,
    .fpd-build-btn:disabled {
      cursor: not-allowed;
      opacity: 0.48;
      box-shadow: none;
    }

    .fpd-btn.active,
    .fpd-test-btn.active,
    .fpd-build-btn.active {
      background: var(--fpd-navy);
      color: #fff;
      border-color: var(--fpd-navy);
      box-shadow: inset 0 0 0 2px var(--fpd-orange);
    }

    .fpd-test-btn.nvis-test {
      background: var(--fpd-green-light);
      color: var(--fpd-green-dark);
      border-color: rgba(31, 122, 58, 0.35);
    }

    .fpd-test-btn.nvis-test:hover {
      background: #d7ffe3;
    }

    .fpd-test-btn.nvis-test.active {
      background: var(--fpd-green-dark);
      color: #eafff0;
      border-color: var(--fpd-green-mid);
      box-shadow: inset 0 0 0 2px #67ff8f;
    }

    .hidden {
      display: none !important;
    }

    .fpd-print-build-btn {
      width: 100%;
      margin-top: 5px;
      min-height: 42px;
      font-size: 12px;
      border-radius: 10px;
      background: var(--fpd-orange);
      color: #fff;
      border: 1px solid var(--fpd-orange);
      box-shadow: 0 6px 16px rgba(255, 122, 0, 0.28);
    }

    .fpd-print-build-btn:hover {
      background: #e86f00;
      border-color: #e86f00;
    }

    .fpd-build-select-row {
      display: grid;
      grid-template-columns: 1fr 132px;
      gap: 6px;
      align-items: center;
      margin-top: 5px;
      font-size: 10.25px;
      color: var(--fpd-navy);
      font-weight: 700;
    }

    .fpd-build-select-row select,
    .fpd-bottom-control select {
      width: 100%;
      height: 28px;
      border: 1px solid rgba(7, 26, 61, 0.18);
      border-radius: 8px;
      background: #f8fbff;
      color: var(--fpd-navy);
      font-size: 10.25px;
      font-weight: 800;
      padding: 3px 5px;
    }

    .fpd-mini-note {
      margin-top: 4px;
      font-size: 9.25px;
      line-height: 1.15;
      color: #6b7280;
    }

    .fpd-sales-card {
      padding: 8px;
      border-radius: 10px;
      background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
      border: 1px solid rgba(7, 26, 61, 0.12);
      overflow: visible;
    }

    .fpd-sales-card h3 {
      margin: 0 0 5px;
      font-size: 12px;
      color: var(--fpd-navy);
      font-weight: 900;
    }

    .fpd-sales-card p {
      margin: 0 0 5px;
      font-size: 10.25px;
      line-height: 1.28;
      color: #42526e;
    }

    .fpd-sales-card strong {
      color: var(--fpd-navy);
    }

    .fpd-bottom-help {
      min-width: 220px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      gap: 6px;
      font-size: 10px;
      line-height: 1.2;
      color: #667790;
    }

    .fpd-bottom-help a {
      color: var(--fpd-orange);
      font-weight: 800;
      text-decoration: none;
    }

    .fpd-bottom-full .fpd-sales-card,
    .fpd-bottom-full .fpd-bottom-help {
      display: none;
    }

    .fpd-stage {
      flex: 1 1 auto;
      width: 100%;
      min-height: 0;
      position: relative;
      overflow: hidden;
      background:
        radial-gradient(circle at center,
          hsl(216, 100%, 88%) 0%,
          hsl(216, 78%, 62%) 46%,
          hsl(222, 82%, 30%) 100%);
      transition: background 0.16s ease-in-out;
    }

    model-viewer {
      display: block;
      width: 100%;
      height: 100%;
      min-height: 0;
      background: transparent;
      --poster-color: transparent;
      touch-action: none;
    }

    .fpd-stage-badge {
      position: absolute;
      right: 12px;
      top: 12px;
      z-index: 3;
      padding: 7px 10px;
      border-radius: 12px;
      background: rgba(255,255,255,0.88);
      border: 1px solid rgba(7, 26, 61, 0.1);
      box-shadow: var(--fpd-shadow);
      text-align: right;
      backdrop-filter: blur(8px);
      max-width: 360px;
    }

    .fpd-stage-badge strong {
      display: block;
      font-size: 11.5px;
      color: var(--fpd-navy);
      margin-bottom: 2px;
    }

    .fpd-stage-badge span {
      display: block;
      font-size: 10.5px;
      color: #5a6982;
      line-height: 1.25;
    }

    .fpd-bottom-controls {
      flex: 0 0 auto;
      display: flex;
      flex-wrap: wrap;
      align-items: end;
      gap: 8px;
      padding: 5px 10px;
      background: rgba(255,255,255,0.98);
      border-top: 1px solid var(--fpd-border);
    }

    .fpd-bottom-control {
      min-width: 122px;
    }

    .fpd-bottom-control label {
      display: block;
      margin: 0 0 2px;
      font-size: 9.5px;
      line-height: 1.1;
      font-weight: 800;
      color: var(--fpd-navy);
    }

    .fpd-bottom-buttons {
      display: flex;
      flex-wrap: wrap;
      gap: 5px;
      margin-left: auto;
    }

    .fpd-bottom-buttons .fpd-btn {
      min-width: 66px;
      min-height: 28px;
      font-size: 10px;
      padding: 5px 7px;
    }

    .fpd-footer {
      flex: 0 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 6px 14px;
      background: #fff;
      border-top: 1px solid var(--fpd-border);
      font-size: 11px;
      color: #60708b;
    }

    .fpd-footer strong {
      color: var(--fpd-navy);
    }

    .fpd-footer a {
      color: var(--fpd-orange);
      font-weight: 800;
      text-decoration: none;
    }

    .fpd-print-summary {
      display: none;
    }

    .fpd-print-summary h2 {
      margin: 0 0 8px;
      font-size: 18px;
      color: var(--fpd-navy);
    }

    .fpd-print-summary pre {
      margin: 0;
      white-space: pre-wrap;
      font-family: Arial, Helvetica, sans-serif;
      font-size: 11px;
      line-height: 1.35;
      color: #1f2937;
    }

    .fpd-print-view-grid {
      display: none;
      margin-top: 14px;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
    }

    .fpd-print-view-card {
      break-inside: avoid;
      border: 1px solid #d1d5db;
      border-radius: 8px;
      overflow: hidden;
      background: #ffffff;
    }

    .fpd-print-view-card h3 {
      margin: 0;
      padding: 6px 8px;
      font-size: 11px;
      color: var(--fpd-navy);
      background: #eef5ff;
      border-bottom: 1px solid #d1d5db;
    }

    .fpd-print-view-card img {
      display: block;
      width: 100%;
      aspect-ratio: 4 / 3;
      object-fit: cover;
      background: #edf3fc;
    }

    .fpd-modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 1000;
      background: rgba(7, 26, 61, 0.55);
      display: none;
      align-items: center;
      justify-content: center;
      padding: 8px;
    }

    .fpd-modal-backdrop.open {
      display: flex;
    }

    .fpd-modal {
      width: min(820px, 100%);
      max-height: calc(100vh - 16px);
      overflow: auto;
      background: #ffffff;
      border-radius: 18px;
      border: 1px solid rgba(7, 26, 61, 0.15);
      box-shadow: 0 24px 70px rgba(0,0,0,0.32);
      padding: 14px;
      color: var(--fpd-navy);
    }

    .fpd-modal h2 {
      margin: 0 0 8px;
      font-size: 20px;
    }

    .fpd-modal p {
      margin: 0 0 12px;
      font-size: 13px;
      line-height: 1.4;
      color: #4b5563;
    }

    .fpd-modal-founder-note {
      margin: 0 0 12px;
      padding: 10px;
      border-radius: 10px;
      background: #f8fbff;
      border: 1px solid rgba(7, 26, 61, 0.12);
      font-size: 12.5px;
      line-height: 1.4;
      color: #35445d;
    }

    .fpd-modal-founder-note strong {
      color: var(--fpd-navy);
    }

    .fpd-modal label {
      display: block;
      margin: 10px 0 4px;
      font-size: 12px;
      font-weight: 800;
      color: var(--fpd-navy);
    }

    .fpd-modal input,
    .fpd-modal textarea {
      width: 100%;
      border: 1px solid #cfd8e3;
      border-radius: 10px;
      padding: 10px;
      font-size: 13px;
      font-family: Arial, Helvetica, sans-serif;
    }

    .fpd-modal textarea {
      height: 96px;
      min-height: 96px;
      resize: none;
    }

    #configSummary {
      height: 220px;
      min-height: 220px;
    }

    .fpd-modal-buttons {
      position: sticky;
      bottom: -14px;
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      justify-content: flex-end;
      margin: 12px -14px -14px;
      padding: 10px 14px 14px;
      background: #ffffff;
      border-top: 1px solid rgba(7, 26, 61, 0.10);
    }

    @media print {
      body {
        overflow: visible;
        background: #ffffff;
      }

      .fpd-modal-backdrop {
        display: none !important;
      }

      .fpd-side-top,
      .fpd-bottom-full,
      .fpd-footer,
      .fpd-bottom-controls {
        display: none !important;
      }

      .fpd-viewer-page {
        height: auto;
        overflow: visible;
      }

      .fpd-print-summary {
        display: block;
        padding: 14px 18px;
        border-bottom: 1px solid #d1d5db;
        background: #ffffff;
      }

      .fpd-print-view-grid {
        display: grid;
      }

      .fpd-main {
        display: block;
      }

      .fpd-workarea {
        display: block;
      }

      .fpd-stage {
        height: 6.6in;
        min-height: 6.6in;
      }

      .fpd-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
      }
    }

    @media (max-width: 980px) {
      html,
      body {
        height: auto;
        min-height: 100%;
        overflow: auto;
      }

      .fpd-viewer-page {
        height: auto;
        min-height: 100dvh;
        overflow: visible;
      }

      .fpd-main {
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: visible;
      }

      .fpd-side-top {
        order: 1;
        width: 100%;
        min-width: 0;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--fpd-border);
        overflow: visible;
      }

      .fpd-workarea {
        order: 2;
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: visible;
      }

      .fpd-bottom-full {
        order: 3;
        display: grid;
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
      }

      .fpd-bottom-full .fpd-sales-card,
      .fpd-bottom-full .fpd-bottom-help {
        display: flex;
      }

      .fpd-bottom-full .fpd-sales-card {
        display: block;
      }

      .fpd-stage {
        flex: 0 0 auto;
        width: 100%;
        height: 68dvh;
        min-height: 420px;
        max-height: 760px;
        overflow: hidden;
      }

      model-viewer {
        display: block;
        width: 100%;
        height: 100%;
        min-height: 420px;
        touch-action: none;
      }

      .fpd-test-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
      }

      .fpd-bottom-controls {
        flex: 0 0 auto;
      }

      .fpd-bottom-buttons {
        margin-left: 0;
      }
    }

    @media (max-width: 700px) {
      .fpd-header {
        flex-direction: column;
        align-items: flex-start;
      }

      .fpd-header-right {
        text-align: left;
      }

      .fpd-title,
      .fpd-subtitle {
        white-space: normal;
      }

      .fpd-title {
        font-size: 16px;
      }

      .fpd-stage {
        height: 62dvh;
        min-height: 360px;
        max-height: 620px;
      }

      model-viewer {
        min-height: 360px;
      }

      .fpd-footer {
        flex-direction: column;
        align-items: flex-start;
      }

      .fpd-stage-badge {
        right: 10px;
        top: 10px;
      }
    }
