/* BAP uses the RTM palette, spacing, controls, and typography. */
.bap-panel, .bap-form-page, .bap-form { min-width: 0; }
.bap-panel h2, .bap-form-section h2 { margin: 0; font-size: var(--rtm-section, 1.125rem); }
.bap-help { margin: 0; color: var(--rtm-muted, #6b7774); font-size: var(--rtm-text-sm, .875rem); line-height: 1.55; }
.bap-panel-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.bap-panel-header > div { flex: 1 1 250px; min-width: 0; }
.bap-panel-header .bap-help { margin-top: 6px; }
.bap-panel-header > .btn { flex-shrink: 0; }
.bap-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.bap-card { border: 1px solid var(--rtm-line, #dce3df); border-radius: var(--rtm-radius-small, 12px); padding: 20px; min-width: 0; background: var(--rtm-surface, #fff); }
.bap-card > header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.bap-card-symbol { width: 42px; height: 42px; border-radius: 12px; background: var(--rtm-tint, #edf2ed); color: var(--rtm-primary, #0d3b2e); display: grid; place-items: center; flex: 0 0 auto; }
.bap-card-symbol .ti { width: 22px; height: 22px; }
.bap-card-title { flex: 1 1 150px; min-width: 0; }
.bap-card-title h3 { margin: 0 0 4px; font-size: 1rem; overflow-wrap: anywhere; }
.bap-card-title > span { color: var(--rtm-muted, #6b7774); font-size: .8rem; }
.bap-badge { display: inline-flex; border-radius: 8px; padding: 5px 9px; background: var(--rtm-bg, #f5f8f5); color: var(--rtm-muted, #6b7774); font-size: .75rem; line-height: 1.4; }
.bap-badge.is-signed { background: var(--rtm-tint, #edf2ed); color: var(--rtm-primary, #0d3b2e); }
.bap-card-data { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; margin: 18px 0 16px; }
.bap-card-data > div { min-width: 0; }
.bap-card-data dt, .bap-card-uuid > span, .bap-document-info span { display: block; font-size: .78rem; font-weight: 400; color: var(--rtm-muted, #6b7774); margin-bottom: 5px; }
.bap-card-data dd { margin: 0; line-height: 1.5; font-size: .875rem; overflow-wrap: anywhere; }
.bap-card-uuid { padding: 10px 12px; background: var(--rtm-bg, #f5f8f5); border-radius: 8px; }
.bap-card-uuid code, .bap-document-info code { font-size: .8rem; color: var(--rtm-ink, #172b24); overflow-wrap: anywhere; }
.bap-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.bap-card-actions .btn { min-height: 44px; font-size: .875rem; }
.bap-upload, .bap-versions { border-top: 1px solid var(--rtm-line, #dce3df); margin-top: 16px; padding-top: 4px; }
.bap-upload > summary, .bap-versions > summary { cursor: pointer; min-height: 44px; padding: 10px 0; color: var(--rtm-primary, #0d3b2e); font-size: .875rem; }
.bap-upload > summary .ti { vertical-align: middle; margin-right: 6px; width: 18px; height: 18px; }
.bap-upload form { display: grid; gap: 10px; padding-top: 6px; }
.bap-upload form > .btn { justify-self: start; }
.bap-upload .form-control { width: 100%; min-width: 0; font-size: .875rem; }
.bap-check { display: flex; align-items: flex-start; gap: 10px; line-height: 1.55; font-size: .875rem; cursor: pointer; }
.bap-check > input { flex-shrink: 0; margin-top: 4px; }
.bap-error { color: var(--rtm-danger, #bf4441); margin: 0; font-size: .875rem; }
.bap-versions ul { list-style: none; margin: 0; padding: 0; }
.bap-versions li { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: .8rem; padding: 8px 0; }
.bap-versions a { min-height: 32px; display: inline-flex; align-items: center; }
.bap-empty { grid-column: 1 / -1; text-align: center; padding: 28px 16px; max-width: 580px; margin-inline: auto; }
.bap-empty .bap-card-symbol { margin: 0 auto 14px; width: 52px; height: 52px; }
.bap-empty h3 { font-size: 1.05rem; margin: 0 0 8px; }
.bap-empty p { margin-bottom: 8px; line-height: 1.6; }
.bap-form-page { width: 100%; max-width: none; margin: 0; gap: 16px; }
.bap-form-page > .rk-heading, .bap-form-page > .bap-form { width: 100%; min-width: 0; }
.bap-form-page .rk-heading .bap-help { margin-top: 8px; }
.bap-form { display: grid; gap: 16px; }
.bap-form-section { display: grid; gap: 16px; padding: 22px; }
.bap-form-section > header { display: flex; align-items: center; gap: 10px; }
.bap-section-number { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-width: 34px; padding: 4px 8px; min-height: 32px; border-radius: 8px; background: var(--rtm-tint, #edf2ed); color: var(--rtm-primary, #0d3b2e); font-size: .8rem; }
.bap-document-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; border-bottom: 1px solid var(--rtm-line, #dce3df); padding-bottom: 16px; }
.bap-document-info strong { font-size: .875rem; font-weight: 500; }
.bap-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; }
.bap-field { display: grid; gap: 7px; min-width: 0; }
.bap-field > label, .bap-question label, .bap-upload form > label { font-size: .875rem; font-weight: 500; }
.bap-field small, .bap-companions small { color: var(--rtm-muted, #6b7774); font-weight: 400; }
.bap-form :is(input, select, textarea) { max-width: 100%; min-width: 0; }
.bap-form textarea { resize: vertical; }
.bap-form input[type="date"], .bap-form input[type="time"] { width: 100%; }
.bap-span-full { grid-column: 1 / -1; }
.bap-time-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.bap-companions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 20px; padding: 0; margin: 0; border: 0; }
.bap-companions legend { float: none; width: 100%; font-size: .875rem; font-weight: 500; margin-bottom: 0; }
.bap-companions .bap-check:has(input:disabled) { opacity: .55; }
.bap-explanation p { margin: 0; font-size: .875rem; line-height: 1.65; }
.bap-questions { display: grid; gap: 16px; }
.bap-question { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--rtm-line, #dce3df); border-radius: 10px; min-width: 0; }
.bap-question legend { float: none; width: auto; font-size: .875rem; font-weight: 600; padding: 0 6px; margin: 0; }
.bap-question-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bap-question-heading > .btn { font-size: .75rem; padding: 5px 8px; min-height: 36px; }
.bap-question > label:not(:first-child) { margin-top: 5px; }
.bap-evidence-picker { display: grid; gap: 8px; min-width: 0; }
.bap-evidence-rows { display: grid; gap: 8px; }
.bap-evidence-row { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 8px; }
.bap-evidence-row select { width: 100%; }
.bap-icon-button { width: 42px; height: 44px; padding: 0 !important; }
.bap-evidence-picker > .btn, .bap-form-section > .btn { justify-self: start; }
.bap-ink-note { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border-radius: 10px; background: var(--rtm-tint, #edf2ed); }
.bap-ink-note > .ti { flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px; color: var(--rtm-primary, #0d3b2e); }
.bap-ink-note p { margin: 0; font-size: .875rem; line-height: 1.6; }
.bap-form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-block: 4px 12px; }
.bap-form-actions .btn { min-height: 44px; }
@media (max-width: 767px) {
    .bap-form-grid, .bap-document-info { grid-template-columns: minmax(0, 1fr); }
    .bap-form-section { padding: 16px; }
    .bap-question { padding: 12px; }
    .bap-card { padding: 16px; }
    .bap-card-data { gap: 12px; }
    .bap-form input, .bap-form textarea, .bap-form select { font-size: 1rem; }
    .bap-form-actions > .btn { flex: 1 1 auto; }
}
@media (max-width: 380px) {
    .bap-card-data { grid-template-columns: minmax(0, 1fr); }
    .bap-card-actions > .btn { flex: 1 1 auto; }
    .bap-question-heading > .btn span { display: none; }
}
