.pilot { color: var(--ink); }
.pilot-history { padding-top: 52px; }
.pilot-history .sidebar { top: 52px; }
.pilot-history-banner { position: fixed; inset: 0 0 auto; z-index: 30; min-height: 52px; background: #eee8ff; color: #514165; padding: 10px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 12px; }
.pilot-history-banner a { text-decoration: underline; white-space: nowrap; }
.pilot main { padding-bottom: 24px; }
.pilot .sidebar { overflow-y: auto; padding-top: 24px; }
.pilot .workspace { margin: 24px 0 20px; }
.pilot .sidebar nav { display: grid; gap: 14px; }
.pilot-nav-group { min-width: 0; }
.pilot .pilot-nav-group h2 { font-size: 11px; font-weight: 600; color: #655d73; margin: 0 12px 6px; }
.pilot .pilot-nav-items .nav-item { margin: 0; padding: 11px 12px; line-height: 1.45; }
.pilot .nav-item[data-section=studio] { font-weight: 650; }
.pilot .nav-item > .icon { flex-shrink: 0; }
.pilot .sidebar-bottom { padding-top: 16px; }
.pilot :is(button, a, input, select, textarea, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pilot .btn { min-height: 42px; font-size: 13px; }
.pilot .btn:disabled { cursor: not-allowed; }
.pilot .badge { font-size: 12px; }
.pilot .badge.green { background: #e7f5ee; color: #21694d; }
.pilot .badge.red { background: #fff0f0; color: #a03845; }
.pilot-loading { padding: 40px 24px; text-align: center; }
.pilot-login { min-height: 100vh; display: grid; place-items: center; padding: 24px !important; }
.pilot-login-card { width: min(100%, 440px); background: white; border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: 0 16px 60px #38206608; }
.pilot-login .brand { padding: 0; margin-bottom: 30px; }
.pilot-login h1 { font-size: 26px; margin-bottom: 12px; }
.pilot-login p { color: #635c73; line-height: 1.6; }
.pilot-login .pilot-form { margin-top: 24px; }
.pilot-skip { position: fixed; top: -100px; left: 12px; z-index: 50; padding: 12px; background: white; }
.pilot-skip:focus { top: 12px; }
.pilot-company { display: grid; gap: 8px; font-size: 12px; width: 100%; }
.pilot select, .pilot input:not([type=checkbox]), .pilot textarea { border: 1px solid #d9d3e5; border-radius: 8px; background: white; color: var(--ink); padding: 10px 12px; min-height: 42px; width: 100%; max-width: 100%; }
.pilot textarea { resize: vertical; line-height: 1.6; }
.pilot label { color: #51475f; }
.pilot-card { padding: 24px; }
.pilot-card > h2 { margin-bottom: 10px; }
.pilot-note { color: #655d73; font-size: 13px; line-height: 1.7; margin: 10px 0; overflow-wrap: anywhere; }
.pilot-create summary, .pilot-card > summary { cursor: pointer; font-weight: 600; line-height: 1.7; }
.pilot-create { padding: 16px 20px; }
.pilot-create form { margin-top: 20px; }
.pilot-form { display: grid; gap: 20px; }
.pilot-form label, .pilot-inline-form label { display: grid; gap: 8px; font-size: 13px; }
.pilot-form small { line-height: 1.5; color: #655d73; }
.pilot-form > button { justify-self: start; }
.pilot-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.pilot-form-grid .pilot-note { margin: 0; }
.pilot-form-grid > button { justify-self: end; align-self: end; }
.pilot-inline-form { display: flex; gap: 16px; align-items: end; margin: 22px 0 16px; flex-wrap: wrap; }
.pilot-inline-form label { flex: 1; min-width: 200px; }
.pilot-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.pilot-section-heading > .icon { color: var(--accent); width: 30px; height: 30px; }
.pilot-empty { padding: 35px 16px; display: grid; justify-items: center; text-align: center; gap: 16px; color: #655d73; line-height: 1.7; }
.pilot-empty .icon { color: #8871bc; width: 28px; height: 28px; }
.pilot-message { margin: 0 0 18px; padding: 14px 16px; border: 1px solid #d4e6dd; background: #eff8f3; color: #236345 !important; border-radius: 10px; line-height: 1.7; overflow-wrap: anywhere; }
.pilot-message.error { background: #fff1f2; border-color: #edccd0; color: #943948 !important; }
.pilot-coverage { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.pilot-coverage .pilot-note { flex-basis: 100%; margin: 0; }
.pilot-run-list { margin-top: 15px; }
.pilot-run { display: flex; align-items: center; gap: 18px; width: 100%; text-align: left; padding: 18px 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
.pilot-run:hover, .pilot-run.selected { background: var(--soft); border-radius: 8px; }
.pilot-run > span:first-child { flex: 1; min-width: 0; }
.pilot-run strong { font-size: 14px; }
.pilot-run small { display: block; color: #655d73; margin-top: 6px; overflow-wrap: anywhere; }
.pilot-summary { font-size: 16px; line-height: 1.8; white-space: pre-wrap; padding: 16px 0; }
.pilot-finding { border-top: 1px solid var(--line); padding: 24px 0 8px; }
.pilot-finding h3 { line-height: 1.6; overflow-wrap: anywhere; }
.pilot dl { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 12px 20px; line-height: 1.7; }
.pilot dt { color: #655d73; }
.pilot dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.pilot-evidence { margin: 12px 0; padding: 14px; border-radius: 10px; background: #f7f4fc; }
.pilot-evidence summary { cursor: pointer; overflow-wrap: anywhere; }
.pilot-evidence blockquote { margin: 16px 0; border-left: 3px solid var(--accent); padding: 4px 16px; white-space: pre-wrap; line-height: 1.7; }
.pilot-evidence pre, .pilot-json { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.7; background: #f8f7fb; padding: 16px; border-radius: 8px; max-height: 480px; overflow-y: auto; }
.pilot-pager { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; font-size: 12px; padding: 12px 0; }
.pilot-pager > span { margin-right: auto; color: #655d73; }
.pilot-record { border-top: 1px solid var(--line); padding: 18px 0; }
.pilot-record summary { cursor: pointer; line-height: 1.7; overflow-wrap: anywhere; }
.pilot-record summary > span { display: block; margin-top: 6px; color: #655d73; font-size: 12px; }
.pilot-messages { display: grid; gap: 12px; max-height: 600px; overflow-y: auto; padding: 10px 0; }
.pilot-chat-message { padding: 16px; background: #f5f5f9; border-radius: 12px; margin-right: 6%; }
.pilot-chat-message.out { background: #f0ebff; margin-right: 0; margin-left: 6%; }
.pilot-chat-message > div { display: flex; gap: 12px; justify-content: space-between; font-size: 12px; flex-wrap: wrap; }
.pilot-chat-message time, .pilot-chat-message small { color: #655d73; }
.pilot-chat-message p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; margin: 8px 0; }
.pilot-table-wrap { overflow-x: auto; }
.pilot-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pilot-table td, .pilot-table th { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; color: var(--ink); }
.pilot-table th { color: #655d73; background: #f9f8fc; }
.pilot-upload { padding: 24px; border: 1px dashed #bca9e0; border-radius: 12px; background: #faf8ff; }
.pilot-upload .icon { color: var(--accent); }
.pilot .pilot-checkbox { display: flex; align-items: flex-start; gap: 10px; line-height: 1.7; }
.pilot-checkbox input { accent-color: var(--accent); width: 18px; height: 18px; flex: 0 0 18px; margin-top: 3px; }
.pilot fieldset { padding: 20px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.pilot legend { font-weight: 600; padding: 0 8px; }
.pilot-marker { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px 20px; padding: 20px 0; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.pilot-marker button { justify-self: end; }
.pilot-footer { color: #655d73; font-size: 12px; line-height: 1.7; padding: 12px 0; }
.engine { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
.engine [data-engine-history]:empty, .engine [data-engine-report]:empty, .engine [data-engine-message]:empty { display: none; }
.engine [data-engine-config] { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
.engine-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.engine-rule { padding: 16px 0; border-bottom: 1px solid var(--line); }
.engine-rule:last-child { border-bottom: 0; }
.engine .pilot-form { margin-top: 20px; }
.engine h3, .engine h4 { margin: 20px 0 12px; }
.engine-list { margin: 10px 0; padding-left: 22px; line-height: 1.8; overflow-wrap: anywhere; }
.engine-version { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.engine-version small, .engine-reason { display: block; color: #655d73; font-size: 12px; margin-top: 6px; }
.engine .pilot-table td, .engine .pilot-table th { white-space: normal; min-width: 130px; line-height: 1.6; }
.engine .pilot-table th:first-child { min-width: 210px; }
.engine-feedback { margin: 20px 0; padding: 16px; border: 1px solid var(--line); border-radius: 10px; }
.engine-feedback summary { cursor: pointer; }
.engine-metric-evidence { margin-top: 10px; font-weight: 400; font-size: 12px; }
.engine-metric-evidence summary { cursor: pointer; }
.engine-metric-evidence .pilot-evidence { min-width: 240px; }
.engine .pilot-section-heading { flex-wrap: wrap; }
.sources { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
.sources [data-source-message]:empty { display: none; }
.source-tabs, .source-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.sources .source-content, .sources .source-editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 0; border: 0; margin: 0; min-width: 0; }
.sources .pilot-table-wrap { min-width: 0; max-width: 100%; }
.sources .pilot-table td, .sources .pilot-table th { white-space: normal; min-width: 140px; max-width: 360px; line-height: 1.6; overflow-wrap: anywhere; }
.sources .pilot-table input, .sources .pilot-table select { min-width: 160px; width: 100%; }
.sources .pilot-table small, .source-version small { display: block; color: #655d73; font-size: 12px; margin-top: 6px; }
.sources .pilot-note { margin: 0; }
.sources .pilot-section-heading { flex-wrap: wrap; }
.source-version { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.source-samples { min-width: 0; border-top: 1px solid var(--line); padding: 12px 0; }
.source-samples summary { cursor: pointer; padding: 8px 0; }
.source-samples details { margin: 8px 0; }
.sources fieldset:disabled input, .sources fieldset:disabled select, .sources fieldset:disabled textarea { color: #655d73; background: #f5f4f8; }
@media(max-width: 900px) {
  .pilot .sidebar { width: 200px; }
  .pilot .main-shell { margin-left: 200px; }
  .pilot main { padding: 24px 20px; }
  .pilot .topbar { padding: 0 20px; }
  .pilot dl { grid-template-columns: 1fr; gap: 4px; }
  .pilot dd { margin-bottom: 12px; }
}
@media(max-width: 760px) {
  .pilot .sidebar { position: relative !important; }
  .pilot .pilot-menu-toggle { display: block; position: absolute; top: 20px; right: 16px; }
  .pilot .sidebar:not(.is-open) nav, .pilot .sidebar:not(.is-open) .sidebar-bottom { display: none; }
  .pilot .sidebar .sidebar-bottom { flex-wrap: wrap; }
  .pilot-history { padding-top: 78px; }
  .pilot-history .sidebar { top: 78px; }
  .pilot-history-banner { min-height: 78px; align-items: flex-start; flex-direction: column; gap: 7px; }
  .pilot .sidebar { display: flex; flex-direction: column; position: static; width: auto; padding: 18px 16px 12px; overflow: visible; }
  .pilot .brand { padding: 0; }
  .pilot .workspace { display: flex; margin: 18px 0; }
  .pilot .sidebar nav { gap: 12px; }
  .pilot .pilot-nav-group h2 { margin-left: 8px; }
  .pilot-nav-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .pilot .pilot-nav-items .nav-item { font-size: 12px; padding: 10px 8px; justify-content: center; text-align: center; }
  .pilot .pilot-nav-items .nav-item > .icon { display: none; }
  .pilot .nav-item.active::before { display: none; }
  .pilot .sidebar-bottom { display: flex; align-items: center; gap: 16px; margin-top: 10px; }
  .pilot .sidebar-bottom > a { flex: 1; }
  .pilot .profile { border: 0; padding: 8px 0; margin: 0; }
  .pilot .profile .avatar { display: none; }
  .pilot .main-shell { margin-left: 0; }
  .pilot .topbar { height: auto; min-height: 64px; gap: 12px; padding: 10px 16px; }
  .pilot .breadcrumb { gap: 8px; flex-wrap: wrap; }
  .pilot main { padding: 22px 16px; }
  .pilot .page-heading { align-items: flex-start; flex-direction: column; gap: 14px; }
  .pilot h1 { font-size: 27px; }
  .pilot-card { padding: 18px; }
  .pilot-form-grid, .pilot-marker { grid-template-columns: 1fr; }
  .pilot-inline-form { align-items: stretch; flex-direction: column; }
  .pilot-inline-form label { min-width: 0; }
  .pilot-run { gap: 10px; flex-wrap: wrap; }
  .pilot-run > span:first-child { flex-basis: 100%; }
  .pilot-run > .icon { margin-left: auto; }
  .pilot fieldset { padding: 14px; }
  .pilot-login-card { padding: 26px 22px; }
}

.pilot-menu-toggle { display: none; }
.pilot [hidden] { display: none !important; }
.pilot .pilot-logout { width: 100%; margin-top: 10px; }
