.notes-section { min-width: 0; }
.notes-list { border-top: 1px solid var(--divider); }

.note-card { padding: 18px 0; border-bottom: 1px solid var(--divider); cursor: pointer; }
.note-card:has(a:focus-visible) { background: color-mix(in srgb, var(--accent-soft) 42%, transparent); }
.note-card-main { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; }
.note-selector { padding-top: 3px; }
.note-selector input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.note-card-marker { display: grid; width: 24px; height: 22px; place-items: center; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-family: ui-monospace, monospace; font-size: 8px; }
.note-copy { min-width: 0; }
.note-heading { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.note-heading h3 { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 15px; font-weight: 500; line-height: 1.4; }
.note-heading a { text-decoration: none; }
.note-heading a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.source-excerpt { margin: 5px 0 10px; overflow: hidden; color: var(--secondary); font-size: 13px; line-height: 1.5; text-wrap: pretty; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.status { flex: 0 0 auto; padding: 3px 5px; border: 1px solid var(--divider); border-radius: 4px; color: var(--secondary); font-family: ui-monospace, monospace; font-size: 9px; white-space: nowrap; }
.status.ready_to_move, .status.ready_for_review, .status.completed, .status.qualified { border-color: color-mix(in srgb, var(--success) 45%, var(--divider)); color: var(--success); }
.status.running { border-color: color-mix(in srgb, var(--focus) 45%, var(--divider)); color: var(--focus); }
.status.queued, .status.cancelled, .status.interrupted, .status.corrupt { color: var(--warning); }
.status.failed { border-color: color-mix(in srgb, var(--danger) 45%, var(--divider)); color: var(--danger); }
.note-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--faint); font-family: ui-monospace, monospace; font-size: 10px; }
.note-meta code { color: inherit; }
.note-action { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.note-runner-actions { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.runner-control { display: inline-flex; min-width: 0; align-items: stretch; }
.runner-control > button:first-child { border-radius: 6px 0 0 6px; }
.runner-control > button:only-child { border-radius: 6px; }
.runner-control > button:last-child:not(:first-child) { margin-left: -1px; border-radius: 0 6px 6px 0; }
.note-runner-button { display: inline-flex; min-width: 0; min-height: 38px; padding: 7px 9px; gap: 6px; align-items: center; justify-content: center; font-size: 11px; }
.note-runner-button svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.note-runner-button.primary-button { min-width: 78px; }
.runner-spinner { animation: runner-spin .8s linear infinite; stroke-dasharray: 33 17; }
.runner-stop-button { min-width: 58px; }
.button-link { display: inline-grid; min-height: 38px; padding: 8px 12px; place-items: center; border: 1px solid var(--divider); border-radius: 6px; background: var(--surface); font-size: 13px; text-decoration: none; }
.button-link:hover { border-color: var(--divider-strong); background: var(--soft); }
.button-link[aria-disabled="true"] { pointer-events: none; cursor: not-allowed; opacity: .52; }
.choose-destination { color: var(--success); }

.note-error { margin: 14px 0 0; padding: 12px; border-left: 2px solid var(--danger); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); color: var(--danger); }
.note-error strong { font-size: 12px; }
.note-error pre { max-height: 240px; }
pre { margin: 8px 0 0; padding: 12px; overflow: auto; border: 1px solid var(--divider); border-radius: 6px; background: var(--canvas); color: var(--ink); font-size: 10px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty-state { display: grid; min-height: 180px; padding: 32px; place-content: center; gap: 6px; color: var(--secondary); text-align: center; }
.empty-state strong { color: var(--ink); font-size: 16px; font-weight: 500; }
.empty-state button { width: fit-content; margin: 8px auto 0; }
.load-more { display: block; width: min(100%, 260px); margin: 20px auto 0; }

.detail-view { min-width: 0; }
.back-button { margin-bottom: 22px; border-color: transparent; background: transparent; color: var(--focus); }
.detail-header { display: flex; gap: 20px; margin-bottom: 26px; align-items: flex-start; justify-content: space-between; }
.detail-actions { display: flex; max-width: 100%; gap: 8px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.note-management-action { flex: 1 1 100%; min-width: min(520px, 100%); padding: 14px; border: 1px solid var(--divider); border-radius: 7px; background: var(--surface); }
.note-management-action form { display: grid; gap: 10px; margin-top: 12px; }
.note-management-action form > p { margin: 0; color: var(--secondary); font-size: 10px; line-height: 1.45; }
.note-management-buttons { display: flex; gap: 8px; justify-content: flex-end; }
.detail-header h1 { margin: 5px 0 8px; overflow-wrap: anywhere; font-size: clamp(26px, 5vw, 36px); font-weight: 500; line-height: 1.2; }
.note-authoritative-state { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--faint); font-size: 11px; }
.note-authoritative-state code { max-width: 100%; overflow-wrap: anywhere; }
.detail-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--divider); }
.detail-section h2 { margin: 4px 0 10px; font-size: 18px; font-weight: 500; }
.detail-section > p { color: var(--secondary); font-size: 13px; line-height: 1.55; }
.detail-section-heading { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.detail-section-heading code { color: var(--faint); font-size: 10px; overflow-wrap: anywhere; }
.note-content-controls { display: flex; max-width: 100%; gap: 8px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.note-content-action { flex: 1 1 100%; width: min(620px, 100%); padding: 14px; border: 1px solid var(--divider); border-radius: 7px; background: var(--surface); }
.note-content-action form { display: grid; gap: 8px; margin-top: 12px; }
.note-content-action label { color: var(--secondary); font-size: 11px; }
.note-content-action textarea { width: min(620px, 100%); min-height: 320px; padding: 12px; resize: vertical; font-family: "IBM Plex Mono", "Geist Mono", ui-monospace, monospace; line-height: 1.55; }
.source-section pre { max-height: 60vh; padding: 18px; background: var(--surface); font-size: 12px; line-height: 1.7; }
.note-source-toggle { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--divider); border-radius: 6px; background: var(--canvas); }
.note-source-toggle a { display: inline-flex; min-height: 30px; padding: 4px 8px; align-items: center; border: 0; border-radius: 4px; background: transparent; color: inherit; font-size: 10px; text-decoration: none; }
.note-source-toggle a[aria-current="page"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-small); }
.detail-facts { display: grid; gap: 0; margin: 14px 0; border: 1px solid var(--divider); border-radius: 7px; }
.detail-facts div { display: grid; grid-template-columns: minmax(110px, 160px) minmax(0, 1fr); gap: 12px; padding: 9px 11px; border-bottom: 1px solid var(--divider); }
.detail-facts div:last-child { border-bottom: 0; }
.detail-facts dt { color: var(--faint); font-size: 10px; }
.detail-facts dd { margin: 0; overflow-wrap: anywhere; font-size: 11px; }
.analysis-heading { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; }
.analysis-heading h3 { margin: 4px 0 0; font-size: 18px; font-weight: 500; }
.analysis-heading > div:first-child > span { color: var(--faint); font-size: 10px; text-transform: uppercase; }
.analysis-heading-actions { display: flex; gap: 8px; align-items: center; }

.placement-options { display: grid; gap: 10px; margin-top: 14px; }
.placement-option { display: grid; padding: 13px; gap: 6px; border: 1px solid var(--divider); border-radius: 7px; background: var(--surface); }
.placement-option.unavailable { opacity: .62; }
.placement-option > small { color: var(--faint); font-size: 9px; text-transform: uppercase; }
.placement-option h3 { margin: 0; font-size: 13px; font-weight: 500; }
.placement-option code { color: var(--accent); font-size: 10px; overflow-wrap: anywhere; }
.placement-option p { margin: 0; color: var(--secondary); font-size: 11px; line-height: 1.45; }
.placement-option button { width: fit-content; margin-top: 4px; }
.custom-placement { display: grid; gap: 10px; margin-top: 14px; padding: 14px; border: 1px solid var(--divider); border-radius: 7px; background: var(--canvas); }
.custom-placement label { display: grid; gap: 5px; color: var(--secondary); font-size: 11px; }
.custom-placement input, .custom-placement select { width: 100%; min-height: 40px; padding: 8px 9px; }
.custom-placement small { color: var(--faint); font-size: 9px; }
.custom-placement button { width: fit-content; }

.run-history { margin-top: 28px; }
.run-tabs { display: flex; gap: 6px; margin: 14px 0 0; overflow-x: auto; border-bottom: 1px solid var(--divider); }
.run-tabs a { display: grid; min-width: 170px; padding: 9px 12px; gap: 2px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: inherit; text-align: left; text-decoration: none; }
.run-tabs a[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent); }
.run-tabs span { font-size: 12px; font-weight: 500; }
.run-tabs small { color: var(--faint); font-size: 8px; text-transform: uppercase; }
.run-detail { padding-bottom: 36px; }
.analysis-inner-tabs { display: flex; margin: 16px 0 0; overflow-x: auto; border-bottom: 1px solid var(--divider); }
.analysis-inner-tabs a { display: inline-flex; min-height: 40px; padding: 7px 11px; align-items: center; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--secondary); font-size: 11px; text-decoration: none; }
.analysis-inner-tabs a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--accent); }
.analysis-tab-panel { min-width: 0; padding-top: 16px; }
.analysis-tab-panel > h4 { margin: 22px 0 7px; font-size: 13px; font-weight: 500; }
.analysis-result-summary { max-width: 720px; margin: 0 0 14px; font-size: 15px; line-height: 1.65; }
.analysis-findings { margin: 12px 0 16px; padding-left: 20px; color: var(--secondary); font-size: 12px; line-height: 1.55; }
.detail-method { margin: 10px 0 0; color: var(--faint) !important; font-size: 10px !important; }
.activity-list { display: grid; gap: 8px; margin-top: 10px; }
.activity-row { padding: 11px; border: 1px solid var(--divider); border-radius: 6px; background: var(--canvas); }
.activity-row > summary { display: flex; gap: 8px; justify-content: space-between; cursor: pointer; }
.activity-row strong { font-size: 10px; }
.activity-row span { color: var(--faint); font-size: 9px; white-space: nowrap; }
.activity-row > code { display: block; margin-top: 5px; overflow-wrap: anywhere; color: var(--accent); font-size: 9px; }
.analysis-event-list { display: grid; gap: 7px; margin-top: 16px; }
.analysis-event-list details { min-width: 0; padding: 10px; border: 1px solid var(--divider); border-radius: 6px; }
.analysis-event-list summary { display: flex; gap: 12px; justify-content: space-between; cursor: pointer; font-size: 11px; }
.analysis-event-list time { color: var(--faint); font-size: 9px; white-space: nowrap; }

.analysis-actions-list { display: grid; gap: 12px; }
.analysis-action-card { min-width: 0; padding: 14px; border: 1px solid var(--divider); border-radius: 7px; background: var(--surface); }
.action-block-header { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.analysis-action-card h3, .analysis-action-card h4 { margin: 0; font-size: 13px; font-weight: 500; }
.analysis-action-card .action-block-header p { margin: 4px 0 0; color: var(--secondary); font-size: 11px; line-height: 1.45; }
.action-availability { padding: 3px 5px; border: 1px solid var(--divider); border-radius: 4px; color: var(--faint); font-size: 8px; text-transform: uppercase; }
.action-availability.available { border-color: color-mix(in srgb, var(--success) 45%, var(--divider)); color: var(--success); }
.action-blocked, .action-error { color: var(--danger) !important; font-size: 10px !important; }
.action-change-list { display: grid; margin: 12px 0; padding: 0; gap: 7px; list-style: none; }
.action-change-list li { display: grid; min-width: 0; padding: 9px; gap: 5px; border: 1px solid var(--divider); border-radius: 5px; }
.action-change-list code { color: var(--accent); font-size: 9px; }
.action-change-list span { font-size: 11px; }
.action-executions { margin-top: 12px; border-top: 1px solid var(--divider); padding-top: 10px; }
.action-executions > summary { color: var(--secondary); cursor: pointer; font-size: 10px; }
.action-executions > div { display: grid; gap: 6px; margin-top: 8px; }
.action-executions article { min-width: 0; padding: 8px; border: 1px solid var(--divider); border-radius: 5px; font-size: 10px; }
.action-executions article > span { margin-left: 8px; color: var(--faint); }
.source-action-details { display: grid; gap: 6px; margin: 12px 0; }
.source-action-details div { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 8px; }
.source-action-details dt { color: var(--faint); font-size: 9px; }
.source-action-details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 10px; }
.empty-copy { margin: 8px 0 0; color: var(--secondary); font-size: 11px; }

@keyframes runner-spin { to { transform: rotate(360deg); } }

@media (min-width: 640px) {
  .note-card-main { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .note-action { grid-column: 3; margin-top: 0; align-self: center; }
  .placement-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .custom-placement { grid-template-columns: minmax(150px, .7fr) minmax(240px, 1.4fr) auto; align-items: end; }
}

@media (max-width: 540px) {
  .detail-header { flex-direction: column; }
  .detail-facts div { grid-template-columns: 100px minmax(0, 1fr); }
  .note-runner-button { min-height: 44px; }
  .detail-section-heading { flex-direction: column; }
  .analysis-action-card > .action-block-header { flex-direction: column; }
}
