/*
  Scoped styles for ai-capability-pilot-builder.html.
  All selectors are prefixed with .ai-pilot-builder or .apb- to avoid site-wide collisions.
*/

.ai-pilot-builder {
  --apb-navy: #0a1628;
  --apb-navy-mid: #10213d;
  --apb-navy-soft: #172f52;
  --apb-teal: #1f9f9a;
  --apb-teal-dark: #14736f;
  --apb-teal-pale: #dff5f2;
  --apb-white: #ffffff;
  --apb-page: #f6f8fb;
  --apb-text: #162033;
  --apb-muted: #5d697a;
  --apb-border: #d9e1ea;
  --apb-border-strong: #b9c7d7;
  --apb-warning: #9a5b00;
  --apb-danger: #9c2b2e;
  --apb-shadow: 0 18px 48px rgba(10, 22, 40, 0.12);
  background: var(--apb-page);
  color: var(--apb-text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}

.ai-pilot-builder *,
.ai-pilot-builder *::before,
.ai-pilot-builder *::after {
  box-sizing: border-box;
}

.ai-pilot-builder h1,
.ai-pilot-builder h2,
.ai-pilot-builder h3,
.ai-pilot-builder p {
  margin-top: 0;
}

.apb-container {
  margin: 0 auto;
  max-width: 1180px;
  padding: 0 24px;
}

.apb-hero {
  background: var(--apb-navy);
  color: var(--apb-white);
  padding: 64px 0 56px;
}

.apb-hero__inner {
  max-width: 920px;
}

.apb-kicker,
.apb-section-number,
.apb-risk-label {
  color: var(--apb-teal);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.apb-hero h1 {
  font-size: clamp(2.2rem, 6vw, 4.25rem);
  line-height: 1.05;
  margin-bottom: 18px;
}

.apb-intro {
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.08rem;
  max-width: 760px;
}

.apb-workspace {
  display: grid;
  gap: 24px;
  grid-template-columns: 260px minmax(0, 1fr);
  padding-bottom: 44px;
  padding-top: 32px;
}

.apb-steps {
  align-self: start;
  background: var(--apb-white);
  border: 1px solid var(--apb-border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(10, 22, 40, 0.06);
  padding: 16px;
  position: sticky;
  top: 16px;
}

.apb-steps ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.apb-steps li + li {
  margin-top: 6px;
}

.apb-step-link {
  border-radius: 6px;
  color: var(--apb-muted);
  display: block;
  font-size: 0.92rem;
  padding: 9px 10px;
  text-decoration: none;
}

.apb-step-link:hover,
.apb-step-link:focus,
.apb-step-link.is-active {
  background: var(--apb-teal-pale);
  color: var(--apb-navy);
  outline: none;
}

.apb-form {
  display: grid;
  gap: 20px;
}

.apb-card {
  background: var(--apb-white);
  border: 1px solid var(--apb-border);
  border-radius: 8px;
  box-shadow: var(--apb-shadow);
}

.apb-form-section {
  padding: 28px;
  scroll-margin-top: 20px;
}

.apb-section-heading {
  border-bottom: 1px solid var(--apb-border);
  margin-bottom: 22px;
  padding-bottom: 16px;
}

.apb-section-heading h2,
.apb-report__header h2 {
  color: var(--apb-navy);
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  line-height: 1.2;
  margin-bottom: 0;
}

.apb-field-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.apb-field {
  margin-bottom: 18px;
}

.apb-field label,
.apb-question legend,
.apb-checkbox-group legend {
  color: var(--apb-navy);
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.apb-field input,
.apb-field select,
.apb-field textarea {
  background: var(--apb-white);
  border: 1px solid var(--apb-border-strong);
  border-radius: 6px;
  color: var(--apb-text);
  font: inherit;
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

.apb-field textarea {
  resize: vertical;
}

.apb-field input:focus,
.apb-field select:focus,
.apb-field textarea:focus,
.apb-question input:focus,
.apb-checkbox-group input:focus,
.apb-button:focus {
  outline: 3px solid rgba(31, 159, 154, 0.34);
  outline-offset: 2px;
}

.apb-question,
.apb-checkbox-group {
  border: 1px solid var(--apb-border);
  border-radius: 8px;
  margin: 0 0 16px;
  padding: 16px;
}

.apb-question label,
.apb-checkbox-group label {
  align-items: center;
  color: var(--apb-text);
  display: inline-flex;
  gap: 8px;
  margin: 6px 18px 6px 0;
  min-height: 32px;
}

.apb-question input,
.apb-checkbox-group input {
  accent-color: var(--apb-teal-dark);
  height: 18px;
  width: 18px;
}

.apb-muted {
  color: var(--apb-muted);
  margin-bottom: 18px;
}

.apb-risk-preview,
.apb-generated-box {
  background: #f8fbfc;
  border: 1px solid var(--apb-border);
  border-left: 4px solid var(--apb-teal);
  border-radius: 8px;
  padding: 16px;
}

.apb-risk-preview strong {
  color: var(--apb-navy);
  display: block;
  font-size: 1.15rem;
}

.apb-generated-box h3 {
  color: var(--apb-navy);
  font-size: 1rem;
  margin-bottom: 8px;
}

.apb-generated-box ul {
  margin: 0;
  padding-left: 20px;
}

.apb-actions {
  align-items: center;
  background: var(--apb-white);
  border: 1px solid var(--apb-border);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px;
}

.apb-button {
  background: var(--apb-white);
  border: 1px solid var(--apb-border-strong);
  border-radius: 6px;
  color: var(--apb-navy);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 44px;
  padding: 10px 16px;
}

.apb-button:hover {
  border-color: var(--apb-teal-dark);
}

.apb-button--primary {
  background: var(--apb-teal-dark);
  border-color: var(--apb-teal-dark);
  color: var(--apb-white);
}

.apb-button--primary:hover {
  background: var(--apb-teal);
  color: var(--apb-navy);
}

.apb-button--quiet {
  color: var(--apb-muted);
}

.apb-action-status {
  color: var(--apb-muted);
  font-size: 0.92rem;
  min-height: 24px;
}

.apb-report {
  grid-column: 2;
  overflow: hidden;
  scroll-margin-top: 20px;
}

.apb-report__header {
  align-items: start;
  background: var(--apb-navy);
  color: var(--apb-white);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 26px 28px;
}

.apb-report__header h2 {
  color: var(--apb-white);
}

.apb-report__date {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.9rem;
  margin-bottom: 0;
  text-align: right;
  white-space: nowrap;
}

.apb-report__body {
  padding: 28px;
}

.apb-empty-state {
  color: var(--apb-muted);
  margin-bottom: 0;
}

.apb-report-block {
  border-bottom: 1px solid var(--apb-border);
  margin-bottom: 20px;
  padding-bottom: 18px;
}

.apb-report-block:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.apb-report-block h3 {
  color: var(--apb-navy);
  font-size: 1.08rem;
  margin-bottom: 8px;
}

.apb-report-block p,
.apb-report-block li {
  color: var(--apb-text);
}

.apb-report-block ul {
  margin: 0;
  padding-left: 21px;
}

.apb-tier {
  border-radius: 999px;
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 8px;
  padding: 5px 12px;
}

.apb-tier--low {
  background: var(--apb-teal-pale);
  color: var(--apb-teal-dark);
}

.apb-tier--moderate {
  background: #fff0d9;
  color: var(--apb-warning);
}

.apb-tier--high {
  background: #ffe4e5;
  color: var(--apb-danger);
}

.apb-disclaimer {
  padding-bottom: 28px;
}

.apb-disclaimer p {
  background: #eef4f8;
  border: 1px solid var(--apb-border);
  border-radius: 8px;
  color: var(--apb-muted);
  margin-bottom: 0;
  padding: 16px 18px;
}

.apb-footer {
  background: var(--apb-navy);
  color: rgba(255, 255, 255, 0.78);
  padding: 24px;
  text-align: center;
}

.apb-footer p {
  margin-bottom: 0;
}

@media (max-width: 880px) {
  .apb-workspace {
    grid-template-columns: 1fr;
  }

  .apb-steps {
    position: static;
  }

  .apb-steps ol {
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .apb-report {
    grid-column: 1;
  }
}

@media (max-width: 640px) {
  .apb-container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .apb-hero {
    padding: 44px 0 38px;
  }

  .apb-field-grid,
  .apb-steps ol {
    grid-template-columns: 1fr;
  }

  .apb-form-section,
  .apb-report__body,
  .apb-report__header {
    padding: 20px;
  }

  .apb-question label,
  .apb-checkbox-group label {
    display: flex;
    margin-right: 0;
  }

  .apb-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .apb-button {
    width: 100%;
  }

  .apb-report__header {
    display: block;
  }

  .apb-report__date {
    margin-top: 10px;
    text-align: left;
    white-space: normal;
  }
}

@media print {
  body {
    background: #ffffff;
    margin: 0;
  }

  body * {
    visibility: hidden;
  }

  .apb-report,
  .apb-report * {
    visibility: visible;
  }

  .apb-report {
    border: 0;
    box-shadow: none;
    grid-column: auto;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
  }

  .apb-report__header {
    background: #ffffff;
    border-bottom: 2px solid #0a1628;
    color: #0a1628;
    padding: 0 0 18px;
  }

  .apb-report__header h2,
  .apb-report__date,
  .apb-section-number {
    color: #0a1628;
  }

  .apb-report__body {
    padding: 20px 0 0;
  }
}
