@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --purple: #5700C4;
  --navy: #1B3A5C;
  --ink: #000819;
  --muted: #657386;
  --line: #DCE4EC;
  --light: #EDF2F8;
  --stripe: #F9F9F9;
  --white: #FFFFFF;
  --danger: #A33A2E;
  --shadow: 0 10px 30px rgba(20, 33, 54, 0.07);
}

* { box-sizing: border-box; }
html { background: #F7F9FC; }
body { margin: 0; background: #F7F9FC; color: var(--ink); font-family: Poppins, Arial, sans-serif; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

.app-header {
  min-height: 72px; background: var(--white); border-top: 4px solid var(--purple); border-bottom: 1px solid #E4E9F0;
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
}
.header-brand { display: flex; align-items: center; gap: 11px; }
.header-brand > img { width: 42px; height: 42px; object-fit: contain; }
.brand-kicker { color: var(--purple); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.brand-title { color: var(--navy); font-size: 18px; font-weight: 600; margin-top: 1px; }
.user-strip { display: flex; align-items: center; gap: 12px; font-size: 11.5px; color: var(--muted); }
.link-button, .quiet-button { background: transparent; color: var(--purple); border: 0; padding: 6px 0; font-weight: 600; }
.quiet-button { border-bottom: 1px solid rgba(87,0,196,.25); }

.shell { max-width: 1040px; margin: 30px auto 72px; padding: 0 20px; }
.intro { margin-bottom: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.intro h1, .report-page-head h1 { margin: 0; font-size: 27px; line-height: 1.18; font-weight: 600; letter-spacing: -.025em; color: var(--ink); }
.intro p, .report-page-head p { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; }

.steps { display: flex; gap: 7px; margin: 16px 0 22px; overflow-x: auto; padding-bottom: 2px; }
.step {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--muted); padding: 7px 11px;
  border-radius: 999px; white-space: nowrap; font-size: 11px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center;
}
.step span { font-weight: 600; }
.step.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.step.done { color: var(--navy); border-color: #C4CEDA; }
.step.future { opacity: .58; }
.step:disabled { cursor: default; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.primary { border: 0; border-radius: 8px; background: var(--purple); color: #fff; font-weight: 600; padding: 10px 16px; }
.secondary { border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--navy); font-weight: 600; padding: 9px 13px; }

.upload-card { padding: 26px; }
.drop-zone { min-height: 270px; border: 1.5px dashed #B7C5D4; border-radius: 11px; background: #FBFCFE; display: grid; place-items: center; text-align: center; padding: 30px; transition: .15s ease; }
.drop-zone.drag { border-color: var(--purple); background: #F8F4FD; }
.upload-inner { max-width: 440px; }
.upload-mark { width: 38px; height: 38px; object-fit: contain; margin-bottom: 10px; }
.drop-zone h2 { margin: 0 0 7px; font-size: 19px; color: var(--navy); font-weight: 600; }
.drop-zone p { margin: 0 0 18px; color: var(--muted); font-size: 12.5px; }
.privacy-note { margin-top: 12px; font-size: 10.5px; color: var(--muted); text-align: center; }

.status-bar { margin-bottom: 14px; border-radius: 9px; padding: 10px 12px; font-size: 11.8px; font-weight: 600; }
.status-ok { background: #EEF5F1; color: #244D3C; border: 1px solid #BED5CA; }
.status-error { background: #FFF2F0; color: var(--danger); border: 1px solid #E7C3BE; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.form-card { padding: 24px; }
.section-label { color: var(--purple); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid #E8EDF3; padding-bottom: 8px; margin-bottom: 16px; }
.section-label.spaced { margin-top: 23px; }
.form-grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 10.8px; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; color: var(--ink); background: #fff; outline: none; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(87,0,196,.07); }
.field input::placeholder, .field textarea::placeholder { color: #A0AABA; }
.field-help { margin-top: 5px; font-size: 9.8px; line-height: 1.45; color: var(--muted); }
.check-control { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--navy); margin: -2px 0 13px; cursor: pointer; }
.check-control input { accent-color: var(--purple); }
.hidden { display: none !important; }
.claimant-field.hidden { display: none; }
.form-error { min-height: 18px; color: var(--danger); font-size: 11px; font-weight: 500; }
.form-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; border-top: 1px solid #E8EDF3; padding-top: 16px; }

.summary-card { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 20px; box-shadow: var(--shadow); position: sticky; top: 18px; }
.summary-kicker { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }
.summary-total { margin-top: 6px; font-size: 30px; line-height: 1.15; font-weight: 700; color: var(--purple); letter-spacing: -.03em; }
.summary-route { margin-top: 6px; color: var(--navy); font-size: 11.5px; line-height: 1.45; }
.pool-strip { margin-top: 16px; border-top: 1px solid #E8EDF3; border-bottom: 1px solid #E8EDF3; padding: 8px 0; }
.pool-strip > div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 11px; }
.pool-strip span { color: var(--muted); }
.pool-strip strong { color: var(--navy); font-weight: 600; }
.summary-meta { margin-top: 10px; color: var(--muted); font-size: 9.8px; overflow-wrap: anywhere; }

.technical-details { margin-top: 13px; border-top: 1px solid #E8EDF3; padding-top: 11px; }
.technical-details summary { color: var(--muted); font-size: 10.5px; font-weight: 600; cursor: pointer; }
.technical-body { margin-top: 9px; }
.check-row { padding: 6px 0; border-bottom: 1px solid #F0F3F7; font-size: 10px; }
.check-left { display: flex; gap: 7px; }
.check-dot { width: 16px; height: 16px; flex: 0 0 16px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-weight: 700; }
.check-dot.ok { background: #E4F0EA; color: #285B45; }
.check-dot.no { background: #F7E8E5; color: var(--danger); }
.check-label { color: var(--ink); }
.check-detail { color: var(--muted); font-size: 9px; margin-top: 1px; }
.diag { margin-top: 10px; }
.diag-title { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.diag-item { color: var(--muted); font-size: 9px; padding: 2px 0; text-transform: capitalize; }
.diag-item.bad { color: var(--danger); }

.media-workspace { min-width: 0; }
.media-card { padding: 20px; margin-bottom: 14px; }
.media-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.media-heading .section-label.plain { border: 0; padding: 0; margin: 0 0 4px; }
.media-heading p { margin: 0; color: var(--muted); font-size: 10.8px; line-height: 1.5; }
.media-heading-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.photo-drop-zone { border: 1.5px dashed #B7C5D4; border-radius: 9px; background: #FBFCFE; padding: 15px; text-align: center; color: var(--navy); font-size: 11px; transition: .15s ease; }
.photo-drop-zone.drag { border-color: var(--purple); background: #F8F4FD; }
.photo-drop-zone small { display: block; color: var(--muted); font-size: 9.5px; margin-top: 3px; }
.photo-list { margin-top: 14px; display: grid; gap: 10px; }
.photo-edit-card { display: grid; grid-template-columns: 170px minmax(0,1fr); gap: 13px; padding: 10px; border: 1px solid #E3E9F0; border-radius: 10px; background: #fff; }
.photo-preview { border-radius: 8px; overflow: hidden; background: #EEF2F6; min-height: 130px; display: grid; place-items: center; }
.photo-preview img { width: 100%; height: 100%; max-height: 190px; object-fit: cover; display: block; }
.photo-fields { min-width: 0; }
.photo-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.photo-title-row strong { display: block; color: var(--navy); font-size: 11px; }
.photo-title-row span { display: block; color: var(--muted); font-size: 9px; overflow-wrap: anywhere; margin-top: 2px; }
.photo-order { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.mini-button { border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 6px; padding: 5px 7px; font-size: 9.5px; font-weight: 600; }
.mini-button.danger { color: var(--danger); }
.field.compact { margin-bottom: 8px; }
.field.compact label { font-size: 9.8px; margin-bottom: 3px; }
.field.compact input, .field.compact textarea, .field.compact select { padding: 7px 8px; font-size: 10px; border-radius: 7px; }
.photo-include { margin: 2px 0 0; font-size: 10.5px; }

.ai-bulk-action { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ai-bulk-action .secondary { white-space: nowrap; }
.ai-bulk-action small { color: var(--muted); font-size: 8.8px; }
.ai-bulk-progress { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -2px 0 12px; padding: 9px 10px; border: 1px solid #DDD4EC; border-radius: 8px; background: #FCFAFF; }
.ai-bulk-progress-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ai-bulk-progress strong { display: block; color: var(--navy); font-size: 9.8px; }
.ai-bulk-progress small { display: block; margin-top: 2px; color: var(--muted); font-size: 8.8px; }
.ai-bulk-result { margin: -2px 0 12px; padding: 8px 10px; border: 1px solid #DDECE5; border-radius: 8px; background: #F7FBF9; color: #285B45; font-size: 9.4px; font-weight: 600; }
.ai-bulk-result.has-error { border-color: #E9D7D4; background: #FFF9F8; color: var(--danger); }
.ai-photo-queued { background: #FCFAFF; border-color: #E4DDF0; }

.ai-photo-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin: 0 0 9px; padding: 8px 9px; border: 1px solid #E6EAF0; border-radius: 8px; background: #FBFCFE; }
.ai-photo-actions .secondary { padding: 6px 9px; font-size: 9.7px; }
.ai-photo-actions small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.ai-photo-state, .ai-photo-error, .ai-photo-applied { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 9px; padding: 8px 9px; border: 1px solid #E6EAF0; border-radius: 8px; background: #FBFCFE; }
.ai-photo-state { justify-content: flex-start; }
.ai-photo-state strong, .ai-photo-error strong { display: block; color: var(--navy); font-size: 9.8px; }
.ai-photo-state small, .ai-photo-error small { display: block; margin-top: 2px; color: var(--muted); font-size: 8.8px; line-height: 1.4; }
.ai-photo-error { border-color: #E9D7D4; background: #FFF9F8; }
.ai-photo-error small { color: var(--danger); }
.ai-photo-applied { padding: 6px 9px; color: #285B45; background: #F7FBF9; border-color: #DDECE5; font-size: 9.4px; font-weight: 600; }
.ai-photo-applied .quiet-button { padding: 3px 5px; font-size: 8.8px; }
.ai-spinner { width: 14px; height: 14px; flex: 0 0 14px; border: 2px solid #DDD4EC; border-top-color: var(--purple); border-radius: 50%; animation: ai-spin .8s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-photo-panel { margin: 0 0 10px; padding: 10px; border: 1px solid #DDD4EC; border-radius: 9px; background: #FCFAFF; }
.ai-photo-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.ai-photo-panel-head > div { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.ai-photo-panel-head strong { color: var(--navy); font-size: 9.3px; font-weight: 600; }
.ai-kicker { color: var(--purple); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.ai-photo-panel-head .quiet-button { padding: 3px 5px; font-size: 8.7px; }
.ai-suggested-caption { color: var(--ink); font-size: 10.2px; line-height: 1.5; padding: 8px 9px; border-radius: 7px; background: #fff; border: 1px solid #E8E1F1; }
.ai-fact-row { display: grid; grid-template-columns: 82px minmax(0,1fr); gap: 8px; padding-top: 7px; font-size: 9.2px; line-height: 1.45; }
.ai-fact-row > span { color: var(--muted); font-weight: 600; }
.ai-fact-row > div { color: var(--navy); }
.ai-fact-row small { display: block; color: var(--muted); margin-top: 2px; font-size: 8.6px; }
.ai-internal-note { margin-top: 7px; padding: 6px 8px; border-radius: 6px; background: #F5F1FA; color: var(--muted); font-size: 8.8px; line-height: 1.45; }
.ai-boundary { margin-top: 7px; color: var(--muted); font-size: 8.3px; line-height: 1.4; }
.ai-review-actions { display: flex; align-items: center; gap: 6px; margin-top: 9px; }
.ai-review-actions .primary, .ai-review-actions .secondary { padding: 6px 10px; font-size: 9.2px; }
.ai-review-actions .quiet-button { font-size: 9px; }
.media-empty { padding: 18px 14px; border-radius: 8px; background: var(--stripe); color: var(--muted); font-size: 10.5px; text-align: center; }
.media-empty.small { padding: 12px; }
.evidence-section { margin-top: 0; }
.evidence-list { display: grid; gap: 8px; }
.evidence-row { border: 1px solid #E3E9F0; border-radius: 9px; padding: 10px; background: #fff; }
.evidence-main { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 9px; }
.evidence-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.evidence-actions .check-control { margin: 0; }
.media-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 3px; }
.toolbar-actions { display: flex; gap: 7px; align-items: center; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); padding: 28px; }
.login-card h1 { margin: 6px 0 4px; font-size: 23px; font-weight: 600; }
.login-card p { margin: 0 0 20px; color: var(--muted); font-size: 12px; }
.login-card .primary { width: 100%; }
.error-text { color: var(--danger); font-size: 11px; margin-top: 10px; }

/* Report preview and existing browser print route */
.report-workspace { max-width: 1120px; margin: 25px auto 70px; padding: 0 18px; }
.report-page-head { max-width: 860px; margin: 0 auto 4px; display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.report-workspace > .steps { max-width: 860px; margin-left: auto; margin-right: auto; }
.issue-state { border-radius: 999px; padding: 6px 10px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.issue-state.ready { background: #EAF3EE; color: #285B45; }
.issue-state.draft { background: #F2ECFA; color: var(--purple); }
.report-toolbar { max-width: 860px; margin: 0 auto 12px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.report-toolbar > div:last-child { text-align: right; }
.report-settings { position: relative; font-size: 10.5px; color: var(--muted); }
.report-settings summary { cursor: pointer; font-weight: 600; text-align: center; }
.report-settings label { position: absolute; z-index: 5; top: 26px; left: 50%; transform: translateX(-50%); min-width: 260px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 9px; padding: 10px 12px; color: var(--navy); white-space: nowrap; }
.report-settings input { accent-color: var(--purple); }
.report-block { max-width: 860px; margin: 0 auto 12px; padding: 9px 11px; border-radius: 8px; background: #FFF2F0; border: 1px solid #E7C3BE; color: var(--danger); font-size: 11px; font-weight: 600; }

.report-sheet { background: #FFF; border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 2px 12px rgba(0,8,25,.08); max-width: 860px; margin: 0 auto 24px; padding: 44px 56px; color: var(--ink); }
.print-frame { width: 100%; border-collapse: collapse; }
.print-frame > thead > tr > td, .print-frame > tbody > tr > td, .print-frame > tfoot > tr > td { padding: 0; }
.report-running-head { display: flex; justify-content: space-between; align-items: center; font-size: 9.5px; color: #667184; border-bottom: 1px solid #E3E7EE; padding-bottom: 8px; margin-bottom: 30px; }
.report-content { min-width: 0; }
.report-opening { break-inside: avoid; page-break-inside: avoid; }
.report-cover-brand { margin: 0 0 18px; }
.report-cover-brand img { display: block; width: 255px; max-width: 48%; height: auto; object-fit: contain; }
.report-running-head img { width: 30px; height: 30px; object-fit: contain; }
.private { font-style: italic; font-size: 11px; color: #667184; margin: 0 0 14px; }
.report-sheet h1 { font-family: Poppins,Arial,sans-serif; font-weight: 700; font-size: 26px; letter-spacing: .02em; color: var(--purple); margin: 0 0 6px; }
.report-property { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.report-subtitle { font-size: 13px; font-style: italic; color: #667184; margin: 0 0 4px; }
.report-prepared { font-size: 10.5px; font-style: italic; color: #667184; margin: 0 0 22px; }
.report-warning { background: #FFF1EF; border: 1px solid #E3B6B0; color: #963B30; font-size: 10px; font-weight: 650; padding: 7px 9px; margin-bottom: 12px; }
.at-glance { font-size: 11.5px; margin-bottom: 26px; border: 1px solid #E3E7EE; }
.at-glance-title { background: var(--purple); color: #FFF; font-weight: 700; padding: 7px 12px; letter-spacing: .06em; font-size: 11px; }
.at-glance-row { display: grid; grid-template-columns: 58% 42%; border-top: 1px solid #E3E7EE; }
.at-glance-row:first-of-type { border-top: 0; }
.at-glance-row > div { padding: 6px 12px; }
.at-glance-row > div:first-child { background: var(--light); font-weight: 700; border-right: 1px solid #E3E7EE; }
.at-glance-row > div:last-child { text-align: right; }
.report-section { margin: 0 0 23px; break-inside: auto; }
.report-section h2 { display: flex; align-items: baseline; gap: 9px; margin: 0 0 9px; padding-bottom: 5px; border-bottom: 2px solid var(--purple); color: var(--purple); font-size: 15px; line-height: 1.25; font-weight: 650; break-after: avoid; page-break-after: avoid; }
.report-section h2 span { min-width: 20px; }
.report-copy { font-size: 11.5px; line-height: 1.65; margin: 0 0 10px; color: #1C2736; text-align: justify; }
.report-copy.italic { font-style: italic; color: #667184; }
.report-table { border-collapse: collapse; width: 100%; font-size: 11px; margin: 8px 0 14px; break-inside: auto; }
.report-table thead { display: table-header-group; }
.report-table th { background: var(--purple); color: #FFF; text-align: left; padding: 6px 9px; font-weight: 600; font-size: 10.5px; border: 1px solid var(--purple); }
.report-table th.right, .report-table td.right { text-align: right; }
.report-table td { padding: 5px 9px; border: 1px solid #E3E7EE; vertical-align: top; overflow-wrap: anywhere; }
.report-table tbody tr:nth-child(odd) { background: #FAFBFD; }
.report-table tr { break-inside: avoid; page-break-inside: avoid; }
.report-table tr.strong { background: var(--light); font-weight: 700; }
.schedule-table { font-size: 8.8px; table-layout: fixed; }
.schedule-table th:nth-child(1), .schedule-table td:nth-child(1) { width: 6%; }
.schedule-table th:nth-child(2), .schedule-table td:nth-child(2) { width: 22%; text-align: left; }
.schedule-table th:nth-child(3), .schedule-table td:nth-child(3) { width: 14%; text-align: left; }
.schedule-table th:nth-child(4), .schedule-table td:nth-child(4) { width: 13%; }
.schedule-table th:nth-child(5), .schedule-table td:nth-child(5), .schedule-table th:nth-child(6), .schedule-table td:nth-child(6) { width: 9%; }
.schedule-table th:nth-child(7), .schedule-table td:nth-child(7) { width: 12%; }
.schedule-table th:nth-child(8), .schedule-table td:nth-child(8) { width: 15%; }
.schedule-table th:nth-child(n+4), .schedule-table td:nth-child(n+4) { white-space: nowrap; }
.photo-report-table { width: calc(100% + 10px); margin: 10px -5px 0; border-collapse: separate; border-spacing: 5px 8px; table-layout: fixed; }
.photo-report-table tr { break-inside: avoid; page-break-inside: avoid; }
.photo-report-cell { width: 50%; vertical-align: top; padding: 0; }
.photo-report-cell.empty { border: 0; background: transparent; }
.report-photo-card { margin: 0; border: 1px solid #DCE4EC; border-radius: 5px; overflow: hidden; break-inside: avoid; page-break-inside: avoid; background: #fff; }
.report-photo-card img { display: block; width: 100%; height: 185px; object-fit: cover; background: #F2F4F7; }
.report-photo-card figcaption { padding: 6px 7px 7px; font-size: 8.8px; line-height: 1.4; color: #273344; }
.report-photo-link { margin-top: 3px; color: #667184; font-size: 8px; }
.evidence-table { table-layout: fixed; }
.evidence-table th, .evidence-table td { text-align: left !important; }
.evidence-table th:nth-child(1), .evidence-table td:nth-child(1) { width: 31%; }
.evidence-table th:nth-child(2), .evidence-table td:nth-child(2) { width: 29%; }
.evidence-table th:nth-child(3), .evidence-table td:nth-child(3) { width: 40%; }
.evidence-table td { font-size: 8.9px; }
.report-footer { border-top: 2px solid var(--purple); margin-top: 30px; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; font-size: 8.8px; color: #667184; }
.report-footer span { max-width: 94%; }
.report-footer img { width: 24px; height: 24px; object-fit: contain; }

@media screen and (max-width: 820px) {
  .photo-report-table, .photo-report-table tbody, .photo-report-table tr, .photo-report-table td { display: block; width: 100%; }
  .photo-report-cell { margin-bottom: 10px; }
  .app-header { padding: 0 16px; }
  .user-strip span { display: none; }
  .shell { margin-top: 24px; padding: 0 14px; }
  .intro { align-items: flex-start; }
  .workspace-grid { grid-template-columns: 1fr; }
  .summary-card { position: static; }
  .form-grid.two { grid-template-columns: 1fr; gap: 0; }
  .photo-edit-card { grid-template-columns: 1fr; }
  .photo-preview img { max-height: 280px; }
  .evidence-main { grid-template-columns: 1fr; gap: 0; }
  .media-heading { align-items: stretch; flex-direction: column; }
  .media-heading-actions { justify-content: flex-start; }
  .report-workspace { padding: 0 10px; }
  .report-page-head { align-items: flex-start; }
  .report-toolbar { grid-template-columns: 1fr; }
  .report-toolbar > div:last-child { text-align: left; }
  .report-settings summary { text-align: left; }
  .report-settings label { position: static; transform: none; display: block; margin-top: 8px; white-space: normal; }
  .report-sheet { padding: 28px 22px; }
  .report-cover-brand img { width: 230px; max-width: 70%; }
  .at-glance-row { grid-template-columns: 1fr; }
  .at-glance-row > div:first-child { border-right: 0; border-bottom: 1px solid #E3E7EE; }
  .report-table { display: block; overflow-x: auto; }
}

@page { size: A4 portrait; margin: 10mm 0 8mm; }
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  html, body { background: #FFF !important; margin: 0 !important; }
  .no-print, .app-header, .report-toolbar, .report-block, .report-page-head, .steps, .narrative-editor { display: none !important; }
  .report-workspace { max-width: none !important; margin: 0 !important; padding: 0 !important; }
  #report-preview { margin: 0 !important; padding: 0 !important; }
  .report-sheet {
    box-shadow: none !important; border: none !important; border-radius: 0 !important;
    margin: 0 !important; max-width: none !important; width: 210mm !important;
    box-sizing: border-box !important; padding: 2mm 16mm 0 !important;
  }
  .print-frame { width: 100% !important; page-break-inside: auto !important; break-inside: auto !important; }
  .print-frame > thead { display: table-header-group; }
  .print-frame > tfoot { display: table-footer-group; }
  .print-frame > thead td, .print-frame > tbody td, .print-frame > tfoot td { vertical-align: top; }
  .report-running-head { margin-bottom: 8mm !important; }
  .report-footer { margin-top: 5mm !important; }
  .report-opening { break-inside: auto !important; page-break-inside: auto !important; }
  .at-glance { break-inside: avoid-page; page-break-inside: avoid; }

  /* Critical: allow narrative sections to flow naturally across pages. The v1.0.13
     avoid-page rule pushed whole sections to the next sheet and created large blank areas. */
  .report-section { margin-bottom: 6mm; break-inside: auto !important; page-break-inside: auto !important; }
  .report-section h2 { break-after: avoid-page; page-break-after: avoid; }
  .report-copy { orphans: 3; widows: 3; }

  .report-table { width: 100%; overflow: visible !important; break-inside: auto; page-break-inside: auto; }
  .report-table thead { display: table-header-group; }
  .report-table tfoot { display: table-footer-group; }
  .report-table tr, .at-glance-row { break-inside: avoid-page; page-break-inside: avoid; }
  .compact-table { break-inside: avoid-page; page-break-inside: avoid; }
  .report-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .photo-report-table { break-inside: auto; page-break-inside: auto; }
  .photo-report-table tr, .report-photo-card, .report-sheet img { break-inside: avoid-page; page-break-inside: avoid; }
  .report-photo-card img { height: 50mm; max-height: 50mm; }
  .report-photo-card figcaption { min-height: 11mm; }
  .report-section:last-child { margin-bottom: 0; }
  a { color: inherit; text-decoration: none; }
}



/* Phase 9: compact narrative editor inside Report & PDF */
.report-flash { max-width: 860px; margin: 0 auto 12px; }
.narrative-editor { max-width: 860px; margin: 0 auto 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 17px 18px; }
.narrative-editor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid #E8EDF3; }
.narrative-editor-head .section-label.plain { border: 0; padding: 0; margin: 0 0 3px; }
.narrative-editor-head p { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.5; max-width: 660px; }
.narrative-notice { margin: 12px 0 0; }
.narrative-list { margin-top: 10px; border-top: 1px solid #EEF2F6; }
.narrative-item { border-bottom: 1px solid #EEF2F6; }
.narrative-item > summary { list-style: none; cursor: pointer; padding: 10px 2px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--navy); font-size: 11px; font-weight: 600; }
.narrative-item > summary::-webkit-details-marker { display: none; }
.narrative-item > summary::before { content: "+"; color: var(--purple); font-weight: 700; margin-right: 6px; }
.narrative-item[open] > summary::before { content: "−"; }
.narrative-item > summary > span:first-child { flex: 1; }
.custom-chip, .standard-chip { border-radius: 999px; padding: 3px 7px; font-size: 8.5px; font-weight: 700; }
.custom-chip { background: #F2ECFA; color: var(--purple); }
.standard-chip { background: var(--light); color: var(--muted); }
.narrative-item-body { padding: 0 2px 12px 23px; }
.narrative-item-body > p { margin: 0 0 7px; color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.narrative-input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; resize: vertical; color: var(--ink); background: #fff; font-size: 10.5px; line-height: 1.55; outline: none; }
.narrative-input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(87,0,196,.07); }
.narrative-row-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.narrative-editor-actions { display: flex; justify-content: space-between; gap: 10px; padding-top: 13px; }
@media screen and (max-width: 820px) {
  .photo-report-table, .photo-report-table tbody, .photo-report-table tr, .photo-report-table td { display: block; width: 100%; }
  .photo-report-cell { margin-bottom: 10px; }
  .narrative-editor-head { flex-direction: column; }
  .narrative-item-body { padding-left: 0; }
  .narrative-editor-actions { flex-direction: column-reverse; align-items: stretch; }
}

/* Phase 9: factual report issue checks */
.report-checks { max-width: 860px; margin: 0 auto 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.report-checks > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 13px; }
.report-checks > summary::-webkit-details-marker { display: none; }
.report-checks > summary > span:first-child { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.report-checks > summary strong { color: var(--navy); font-size: 11px; font-weight: 650; }
.report-checks > summary small { color: var(--muted); font-size: 9.5px; }
.check-summary-mark { width: 21px; height: 21px; flex: 0 0 21px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 800; }
.check-summary-mark.ready { background: #E4F0EA; color: #285B45; }
.check-summary-mark.needs { background: #F7E8E5; color: var(--danger); }
.report-checks-body { border-top: 1px solid #E8EDF3; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; padding: 8px 13px 11px; }
.report-check-group { min-width: 0; }
.report-check-group-title { color: var(--purple); font-size: 8.7px; line-height: 1.3; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; padding: 6px 0 4px; }
.report-check-row { display: flex; gap: 7px; align-items: flex-start; padding: 5px 0; border-top: 1px solid #F0F3F7; min-width: 0; }
.report-check-label { color: var(--ink); font-size: 9.5px; line-height: 1.35; }
.report-check-detail { color: var(--muted); font-size: 8.3px; line-height: 1.35; margin-top: 1px; overflow-wrap: anywhere; }
.issue-actions { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.issue-actions small { color: var(--muted); font-size: 8.3px; white-space: nowrap; }

@media screen and (max-width: 820px) {
  .report-checks-body { grid-template-columns: 1fr; }
  .report-checks > summary > span:first-child { display: block; }
  .report-checks > summary small { display: block; margin-top: 2px; }
  .issue-actions { align-items: stretch; }
  .issue-actions small { white-space: normal; text-align: left; }
}

/* v1.0.2 landing actions */
.landing-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.action-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.drop-hint { margin-top: 14px; color: var(--muted); font-size: 10.5px; }
@media (max-width: 560px) {
  .landing-actions { flex-direction: column; align-items: stretch; }
  .landing-actions .primary, .landing-actions .secondary { width: 100%; }
}

/* v1.0.3 local-first recovery */
.local-save-status { color: #526476; font-size: 10.2px; font-weight: 600; white-space: nowrap; }
.local-save-status.save-error { color: var(--danger); }
.recovery-card { margin: 0 0 14px; padding: 13px 15px; background: #fff; border: 1px solid #D8E1EA; border-radius: 11px; box-shadow: 0 5px 18px rgba(20, 33, 54, 0.05); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.recovery-copy { min-width: 0; }
.recovery-kicker { color: var(--purple); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 2px; }
.recovery-copy strong { display: block; color: var(--navy); font-size: 12.5px; font-weight: 650; overflow-wrap: anywhere; }
.recovery-copy small { display: block; color: var(--muted); font-size: 9.3px; margin-top: 2px; overflow-wrap: anywhere; }
.recovery-actions { display: flex; gap: 7px; flex: 0 0 auto; }
@media screen and (max-width: 820px) {
  .recovery-card { align-items: stretch; flex-direction: column; }
  .recovery-actions { justify-content: flex-start; }
}

/* v1.0.9: advisory AI report review and wording enhancement */
.ai-review-report-button { border-color: #D5C7EA; background: #FCFAFF; color: var(--purple); }
.ai-report-review { max-width: 860px; margin: 0 auto 12px; background: #fff; border: 1px solid #DDD4EC; border-radius: 10px; box-shadow: var(--shadow); }
.ai-report-review > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 13px; }
.ai-report-review > summary::-webkit-details-marker { display: none; }
.ai-report-review > summary > span:first-child { min-width: 0; }
.ai-report-review > summary .ai-kicker { display: block; margin-bottom: 2px; }
.ai-report-review > summary strong { display: inline; color: var(--navy); font-size: 11px; font-weight: 650; }
.ai-report-review > summary small { display: inline; color: var(--muted); font-size: 9.5px; margin-left: 7px; }
.ai-report-status { flex: 0 0 auto; border-radius: 999px; padding: 4px 8px; font-size: 8.8px; font-weight: 700; }
.ai-report-status.ready { background: #EAF3EE; color: #285B45; }
.ai-report-status.needs { background: #FFF2F0; color: var(--danger); }
.ai-report-review-body { border-top: 1px solid #E8EDF3; padding: 11px 13px 12px; }
.ai-report-review-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 13px; }
.ai-report-review-head > div { min-width: 0; }
.ai-report-review-head .ai-kicker { display: block; margin-bottom: 2px; }
.ai-report-review-head strong { display: block; color: var(--navy); font-size: 10.8px; }
.ai-report-review-head small { display: block; margin-top: 2px; color: var(--muted); font-size: 9.3px; line-height: 1.45; }
.ai-report-review.has-error { border-color: #E9D7D4; background: #FFF9F8; }
.ai-report-review.has-error .ai-report-review-head small { color: var(--danger); }
.ai-report-review.stale { background: #FCFAFF; }
.ai-report-positive { padding: 9px 10px; border-radius: 8px; background: #F7FBF9; border: 1px solid #DDECE5; margin-bottom: 9px; }
.ai-report-positive strong { display: block; color: #285B45; font-size: 9.5px; margin-bottom: 4px; }
.ai-report-positive span { display: block; color: #466B5C; font-size: 9px; line-height: 1.45; padding: 1px 0; }
.ai-report-findings { display: grid; gap: 7px; }
.ai-report-finding { border: 1px solid #E4E8EE; border-left: 3px solid #B8A2D9; border-radius: 7px; padding: 9px 10px; background: #fff; }
.ai-report-finding.needs { border-left-color: #C16C5F; background: #FFFDFC; }
.ai-report-finding-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.ai-report-finding-meta span { color: var(--purple); font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.ai-report-finding-meta small { color: var(--muted); font-size: 8.4px; }
.ai-report-finding > strong { display: block; color: var(--navy); font-size: 9.6px; line-height: 1.45; }
.ai-report-finding > p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.ai-report-clean { padding: 9px 10px; border-radius: 8px; background: #F7FBF9; border: 1px solid #DDECE5; color: #285B45; font-size: 9.5px; font-weight: 600; }
.ai-report-review-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 9px; margin-top: 9px; border-top: 1px solid #EEF2F6; }
.ai-report-review-foot small { color: var(--muted); font-size: 8.6px; line-height: 1.4; }
.ai-report-review-foot .quiet-button { flex: 0 0 auto; font-size: 9px; }

.narrative-row-actions { justify-content: space-between; gap: 8px; }
.narrative-ai-error { margin-top: 7px; padding: 7px 8px; border-radius: 7px; background: #FFF9F8; border: 1px solid #E9D7D4; color: var(--danger); font-size: 8.9px; line-height: 1.45; }
.narrative-ai-suggestion { margin-top: 8px; padding: 9px 10px; border: 1px solid #DDD4EC; border-radius: 8px; background: #FCFAFF; }
.narrative-ai-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.narrative-ai-head > span:last-child { color: var(--muted); font-size: 8.3px; font-weight: 600; }
.narrative-ai-copy { padding: 8px 9px; border: 1px solid #E8E1F1; border-radius: 7px; background: #fff; color: var(--ink); font-size: 9.8px; line-height: 1.55; white-space: pre-wrap; }
.narrative-ai-suggestion > small { display: block; color: var(--muted); font-size: 8.6px; line-height: 1.45; margin-top: 6px; }
.narrative-ai-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.narrative-ai-actions .primary { padding: 6px 9px; font-size: 9px; }
.narrative-ai-actions .quiet-button { font-size: 8.8px; }

@media (max-width: 720px) {
  .ai-report-review > summary { align-items: flex-start; }
  .ai-report-review > summary small { display: block; margin: 2px 0 0; }
  .ai-report-review-foot { align-items: flex-start; flex-direction: column; }
  .narrative-row-actions { flex-wrap: wrap; }
}

/* v1.0.10 safe workbook refresh */
.status-warning { background: #FFF8E7; color: #6B4E00; border: 1px solid #E6CF8D; }
.report-head-actions { display: flex; align-items: center; gap: 10px; }
.photo-link-review { margin: 8px 0 10px; padding: 9px 10px; border: 1px solid #E6CF8D; background: #FFF8E7; border-radius: 8px; color: #5F4906; }
.photo-link-review strong { display: block; font-size: 11.5px; margin-bottom: 2px; }
.photo-link-review span { display: block; font-size: 10.8px; line-height: 1.45; }
@media (max-width: 760px) { .report-head-actions { align-items: flex-end; flex-direction: column-reverse; } }

/* v1.0.18 - compact claim-type selector */
.claim-type-section { margin: 0 0 16px; }
.claim-type-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 0 9px; }
.claim-type-section-label { color: var(--navy); font-size: 11px; font-weight: 700; }
.claim-type-section-head p { margin: 2px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.4; }
.claim-type-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.claim-type-card {
  appearance: none; width: 100%; min-height: 94px; display: grid; grid-template-columns: 22px minmax(0,1fr); gap: 12px;
  align-items: start; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 15px 16px;
  cursor: pointer; box-shadow: 0 3px 12px rgba(20,33,54,.035); transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.claim-type-card:hover { border-color: #B79ADA; background: #FCFAFF; box-shadow: 0 5px 16px rgba(20,33,54,.05); }
.claim-type-card:focus-visible { outline: 0; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(87,0,196,.09); }
.claim-type-card.selected { border: 1.5px solid var(--purple); background: #FBF9FE; box-shadow: 0 0 0 3px rgba(87,0,196,.045); }
.claim-type-selector {
  width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 1.5px solid #B8C4D1; background: #fff;
  display: grid; place-items: center; transition: .15s ease;
}
.claim-type-selector::after { content: ""; width: 5px; height: 9px; border-right: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(45deg) translate(-1px,-1px); opacity: 0; }
.claim-type-card.selected .claim-type-selector { border-color: var(--purple); background: var(--purple); }
.claim-type-card.selected .claim-type-selector::after { opacity: 1; }
.claim-type-copy { min-width: 0; display: block; }
.claim-type-card strong { display: block; margin: 0 0 3px; color: var(--navy); font-size: 16.5px; line-height: 1.3; font-weight: 650; letter-spacing: -.01em; }
.claim-type-card small { display: block; color: var(--ink); font-size: 11.1px; line-height: 1.4; font-weight: 500; }
.claim-type-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 9.8px; line-height: 1.4; }
.claim-type-pending { opacity: .72; }
.disabled-link { pointer-events: none; opacity: .5; }
.summary-secondary { display: flex; justify-content: space-between; gap: 15px; border-top: 1px solid #e7ebf0; padding-top: 9px; margin-top: 9px; font-size: 12px; }
.summary-secondary span { color: #6a7788; }
.summary-secondary strong { color: #1b3a5c; }
/* v1.0.25: development schedules stay inside the printable A4 width. Evidence is
   a narrative field, so it must wrap rather than inheriting the numeric nowrap rule. */
.development-schedule { width: 100%; max-width: 100%; table-layout: fixed; }
.development-schedule th, .development-schedule td { box-sizing: border-box; }
.development-schedule th:last-child, .development-schedule td:last-child {
  text-align: left !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}
.development-schedule.has-cost-role th:nth-child(1), .development-schedule.has-cost-role td:nth-child(1) { width: 5%; }
.development-schedule.has-cost-role th:nth-child(2), .development-schedule.has-cost-role td:nth-child(2) { width: 18%; text-align: left; }
.development-schedule.has-cost-role th:nth-child(3), .development-schedule.has-cost-role td:nth-child(3) { width: 10%; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.development-schedule.has-cost-role th:nth-child(4), .development-schedule.has-cost-role td:nth-child(4) { width: 11%; }
.development-schedule.has-cost-role th:nth-child(5), .development-schedule.has-cost-role td:nth-child(5) { width: 8%; }
.development-schedule.has-cost-role th:nth-child(6), .development-schedule.has-cost-role td:nth-child(6) { width: 11%; white-space: normal; }
.development-schedule.has-cost-role th:nth-child(7), .development-schedule.has-cost-role td:nth-child(7) { width: 12%; }
.development-schedule.has-cost-role th:nth-child(8), .development-schedule.has-cost-role td:nth-child(8) { width: 25%; }
.development-schedule.no-cost-role th:nth-child(1), .development-schedule.no-cost-role td:nth-child(1) { width: 5%; }
.development-schedule.no-cost-role th:nth-child(2), .development-schedule.no-cost-role td:nth-child(2) { width: 23%; text-align: left; }
.development-schedule.no-cost-role th:nth-child(3), .development-schedule.no-cost-role td:nth-child(3) { width: 12%; }
.development-schedule.no-cost-role th:nth-child(4), .development-schedule.no-cost-role td:nth-child(4) { width: 9%; }
.development-schedule.no-cost-role th:nth-child(5), .development-schedule.no-cost-role td:nth-child(5) { width: 12%; white-space: normal; }
.development-schedule.no-cost-role th:nth-child(6), .development-schedule.no-cost-role td:nth-child(6) { width: 13%; }
.development-schedule.no-cost-role th:nth-child(7), .development-schedule.no-cost-role td:nth-child(7) { width: 26%; }
.report-appendix .development-schedule { overflow: hidden; }
@media (max-width:760px) {
  .claim-type-picker { grid-template-columns: 1fr; gap: 9px; }
  .claim-type-card { min-height: 84px; padding: 14px; }
}
@media print {
  .development-schedule { font-size: 7.6pt; width: 100% !important; max-width: 100% !important; }
  .development-schedule th, .development-schedule td { padding: 3.5px 4px; }
  .development-schedule th:last-child, .development-schedule td:last-child { white-space: normal !important; overflow-wrap: anywhere !important; word-break: break-word !important; }
}

/* v1.0.21: editable SBA statement panel */
.sba-editor-note { display:flex; flex-direction:column; gap:4px; margin:0 0 14px; padding:10px 12px; border:1px solid #DDE4EC; border-radius:8px; background:#F7F9FC; font-size:11px; line-height:1.45; }
.sba-editor-note strong { color:var(--navy); }
.sba-editor-note span { color:var(--muted); }

/* v1.0.29: make the development report distinguish the full relief base from
   the deduction available in the tax period shown. */
.at-glance-row.summary-headline > div { padding-top: 9px; padding-bottom: 9px; }
.at-glance-row.summary-headline > div:first-child { background: #F3EEF9; color: var(--navy); font-size: 11.5px; }
.at-glance-row.summary-headline > div:last-child { color: var(--purple); font-size: 14px; font-weight: 750; }
.at-glance-row.summary-period > div:first-child { background: #EEF3F7; }
.at-glance-row.summary-period > div:last-child { color: var(--navy); }

/* v1.0.32 — AI-assisted claim entitlement drafting */
.entitlement-ai-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.entitlement-ai-toolbar small { color: var(--muted); font-size: 8.9px; line-height: 1.4; flex: 1 1 320px; }
.ai-entitlement-button { padding: 6px 10px; font-size: 9.4px; border-color: #D5C7EA; background: #FCFAFF; color: var(--purple); }
.entitlement-ai-loading, .entitlement-ai-error { display: flex; align-items: center; gap: 10px; margin-top: 9px; padding: 9px 10px; border: 1px solid #DDD4EC; border-radius: 8px; background: #FCFAFF; }
.entitlement-ai-loading > div, .entitlement-ai-error > span { min-width: 0; }
.entitlement-ai-loading strong, .entitlement-ai-error strong { display: block; color: var(--navy); font-size: 9.6px; }
.entitlement-ai-loading span:not(.ai-spinner), .entitlement-ai-error span { display: block; margin-top: 2px; color: var(--muted); font-size: 8.8px; line-height: 1.4; }
.entitlement-ai-error { align-items: flex-start; border-color: #E9D7D4; background: #FFF9F8; }
.entitlement-ai-error > span { flex: 1 1 auto; color: var(--danger); }
.entitlement-ai-error .quiet-button { flex: 0 0 auto; font-size: 8.8px; }
.entitlement-ai-suggestion { margin-top: 9px; padding: 10px; border: 1px solid #DDD4EC; border-radius: 8px; background: #FCFAFF; }
.entitlement-ai-suggestion.needs-review { border-color: #E8D8B7; background: #FFFDF8; }
.entitlement-ai-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.entitlement-ai-head > span:last-child { color: var(--muted); font-size: 8.4px; font-weight: 600; }
.entitlement-ai-copy, .entitlement-ai-empty { padding: 9px 10px; border: 1px solid #E8E1F1; border-radius: 7px; background: #fff; color: var(--ink); font-size: 9.9px; line-height: 1.55; white-space: pre-wrap; }
.entitlement-ai-empty { color: var(--muted); font-style: italic; }
.entitlement-ai-suggestion > small { display: block; color: var(--muted); font-size: 8.7px; line-height: 1.45; margin-top: 6px; }
.entitlement-ai-review-note { margin-top: 7px; padding: 7px 8px; border-radius: 7px; border: 1px solid #E8D8B7; background: #FFFDF8; }
.entitlement-ai-review-note strong { display: block; color: var(--navy); font-size: 8.9px; margin-bottom: 2px; }
.entitlement-ai-review-note span { display: block; color: var(--muted); font-size: 8.7px; line-height: 1.45; }
.entitlement-ai-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.entitlement-ai-actions .primary, .entitlement-ai-actions .secondary { padding: 6px 9px; font-size: 9px; }
.entitlement-ai-actions .quiet-button { font-size: 8.8px; }

/* v1.0.34 — AI Workbook Assistant */
.ai-workbook-card{margin-top:22px;padding:26px;display:grid;gap:20px;border:1px solid #d9e1ea;background:linear-gradient(180deg,#fff 0%,#fbfcfe 100%)}
.ai-workbook-card.claim-type-pending{opacity:.72}
.ai-workbook-heading{display:flex;justify-content:space-between;gap:24px;align-items:flex-start}
.ai-workbook-heading h2{margin:5px 0 7px;font-size:24px;color:#000819}
.ai-workbook-heading p{margin:0;max-width:790px;color:#566273;line-height:1.55}
.ai-beta{display:inline-flex;align-items:center;margin-left:6px;padding:2px 7px;border-radius:999px;background:#f2e8ff;color:#5700c4;font-size:10px;font-weight:800;letter-spacing:.06em;text-transform:uppercase}
.ai-model-pill{white-space:nowrap;border:1px solid #dac8f3;background:#f8f3ff;color:#4a0a93;border-radius:999px;padding:8px 12px;font-size:12px;font-weight:700}
.ai-workbook-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.ai-upload-panel{display:grid;gap:10px;align-content:start}
.ai-upload-label{font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.06em;color:#1b3a5c}
.ai-upload-box{min-height:82px;border:1px dashed #b9c7d5;border-radius:12px;padding:14px 15px;display:flex;align-items:center;justify-content:space-between;gap:16px;background:#fff}
.ai-upload-box.has-file{border-style:solid;border-color:#bfa3e6;background:#fcfaff}
.ai-upload-box>div{min-width:0;display:grid;gap:4px}
.ai-upload-box strong{overflow-wrap:anywhere;color:#14263a}
.ai-upload-box small{color:#6f7b89}
.ai-file-list{border:1px solid #e4e9ef;border-radius:10px;background:#fff;overflow:hidden}
.ai-file-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:10px;padding:9px 10px;border-top:1px solid #eef1f4;font-size:12px}
.ai-file-row:first-child{border-top:0}
.ai-file-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ai-file-row small{color:#7b8793}
.ai-file-more,.ai-workbook-empty{padding:10px;color:#7b8793;font-size:12px}
.ai-workbook-actions{display:flex;align-items:center;justify-content:space-between;gap:22px;padding-top:4px}
.ai-workbook-privacy{font-size:12px;color:#657180;line-height:1.5;max-width:820px}
.ai-complete-button{min-width:220px}
.ai-run-status{border:1px solid #e0e6ec;border-radius:12px;background:#fff;padding:14px 16px;display:flex;align-items:center;justify-content:space-between;gap:18px}
.ai-run-status.processing,.ai-run-status.queued,.ai-run-status.uploading{border-color:#cdb8ec;background:#fcfaff}
.ai-run-status.completed{border-color:#b7dec8;background:#fbfffc}
.ai-run-status.failed{border-color:#efc2c2;background:#fffafa}
.ai-run-status-main{display:flex;align-items:center;gap:11px}
.ai-run-status-main>div{display:grid;gap:3px}
.ai-run-status-main small{color:#6a7685}
.ai-run-dot{width:10px;height:10px;border-radius:50%;background:#8895a2;flex:0 0 auto}
.ai-run-status.processing .ai-run-dot,.ai-run-status.queued .ai-run-dot,.ai-run-status.uploading .ai-run-dot{background:#5700c4}
.ai-run-status.completed .ai-run-dot{background:#1b8756}
.ai-run-status.failed .ai-run-dot{background:#b42318}
.ai-run-dot.pulse{box-shadow:0 0 0 0 rgba(87,0,196,.35);animation:aiPulse 1.6s infinite}
@keyframes aiPulse{0%{box-shadow:0 0 0 0 rgba(87,0,196,.35)}70%{box-shadow:0 0 0 8px rgba(87,0,196,0)}100%{box-shadow:0 0 0 0 rgba(87,0,196,0)}}
.ai-run-result{display:grid;gap:16px}
.ai-result-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px}
.ai-result-head h3{margin:5px 0 0;font-size:18px;color:#13283e}
.ai-result-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.ai-result-metrics>div{background:#f7f9fb;border:1px solid #e5eaf0;border-radius:10px;padding:13px;display:grid;gap:2px}
.ai-result-metrics strong{font-size:22px;color:#1b3a5c}
.ai-result-metrics span{font-size:11px;color:#6b7785;text-transform:uppercase;letter-spacing:.04em}
.ai-change-scroll{overflow-x:auto}
.ai-change-table{width:100%;border-collapse:collapse;font-size:12px;background:#fff}
.ai-change-table th,.ai-change-table td{text-align:left;vertical-align:top;padding:8px 9px;border-bottom:1px solid #e8edf2;max-width:360px;overflow-wrap:anywhere}
.ai-change-table th{font-size:10px;text-transform:uppercase;letter-spacing:.05em;color:#6c7784;background:#f7f9fb}
.ai-confidence{display:inline-flex;border-radius:999px;padding:3px 7px;font-size:10px;font-weight:800;background:#edf2f7;color:#455467}
.ai-confidence.high{background:#e8f7ef;color:#166b43}
.ai-confidence.medium{background:#fff7dc;color:#805b00}
.ai-confidence.low,.ai-confidence.review{background:#fff0f0;color:#9d1c1c}
.ai-boundary{border-left:3px solid #5700c4;background:#f8f4ff;padding:11px 13px;color:#4a5565;font-size:12px;line-height:1.5}
@media(max-width:800px){.ai-workbook-heading,.ai-workbook-actions,.ai-result-head{flex-direction:column;align-items:stretch}.ai-model-pill{align-self:flex-start}.ai-workbook-grid{grid-template-columns:1fr}.ai-result-metrics{grid-template-columns:1fr}.ai-complete-button{width:100%;min-width:0}.ai-file-row{grid-template-columns:minmax(0,1fr) auto}.ai-file-row .mini-button{grid-column:1/-1;justify-self:start}}

/* v1.0.34 deployment marker and prominent assistant placement */
.build-badge{display:inline-flex;align-items:center;margin:0 0 7px;padding:4px 9px;border-radius:999px;background:#f2e8ff;color:#5700c4;font-size:10px;font-weight:800;letter-spacing:.05em;text-transform:uppercase}
#workbook-assistant-host{margin-top:14px;margin-bottom:22px}
#workbook-assistant-host .ai-workbook-card{border:2px solid #5700c4;box-shadow:0 12px 30px rgba(87,0,196,.08)}

/* ==========================================================================
   v1.0.38 — multi-claim workspace (tab bar, save markers, toasts, debug)
   ========================================================================== */

.claim-tabbar-host { position: sticky; top: 0; z-index: 40; background: var(--white); border-bottom: 1px solid #E4E9F0; }
.claim-tabbar-host:empty { display: none; border: 0; }

.claim-tabs {
  display: flex; align-items: stretch; gap: 4px; padding: 6px 20px 0;
  overflow-x: auto; scrollbar-width: thin; max-width: 100%;
}
.claim-tab {
  display: flex; align-items: stretch; flex: 0 0 auto; max-width: 260px;
  border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0;
  background: var(--stripe); transition: background .12s ease, border-color .12s ease;
}
.claim-tab:hover { background: #F2F5FA; }
.claim-tab.active { background: var(--white); border-color: #CBD6E4; box-shadow: 0 -2px 0 var(--purple) inset; }
.claim-tab.has-error { border-color: rgba(163, 58, 46, .45); }

.claim-tab-main {
  display: flex; align-items: center; gap: 7px; min-width: 0;
  background: transparent; border: 0; padding: 9px 4px 9px 12px;
  font-size: 12.5px; font-weight: 500; color: var(--muted);
}
.claim-tab.active .claim-tab-main { color: var(--ink); font-weight: 600; }
.claim-tab-title { max-width: 178px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.claim-tab-dot { flex: 0 0 auto; font-size: 9px; line-height: 1; }
.claim-tab-dot.unsaved { color: var(--purple); }
.claim-tab-dot.saving { color: var(--purple); animation: claim-tab-pulse 1.1s ease-in-out infinite; }
.claim-tab-dot.saved { color: #2F855A; font-size: 10px; }
.claim-tab-dot.error { color: var(--danger); font-weight: 700; font-size: 11px; }
@keyframes claim-tab-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

.claim-tab-ai {
  flex: 0 0 auto; font-size: 8.5px; font-weight: 700; letter-spacing: .06em;
  color: var(--purple); background: rgba(87, 0, 196, .1); border-radius: 4px; padding: 2px 4px;
}

.claim-tab-close {
  background: transparent; border: 0; color: var(--muted); font-size: 15px; line-height: 1;
  padding: 0 10px 0 4px; border-radius: 0 8px 0 0;
}
.claim-tab-close:hover { color: var(--danger); }

.claim-tab-add {
  flex: 0 0 auto; align-self: center; background: transparent; border: 1px dashed var(--line);
  color: var(--purple); border-radius: 8px; font-size: 16px; line-height: 1;
  padding: 6px 11px; margin: 0 0 4px 4px;
}
.claim-tab-add:hover { border-color: var(--purple); background: rgba(87, 0, 196, .05); }

.local-save-status.save-pending { color: var(--purple); }
.local-save-status.save-error { color: var(--danger); font-weight: 600; }

/* Saved-claim list on the import screen */
.recovery-list { display: grid; gap: 8px; margin-top: 10px; }
.recovery-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
.recovery-row-copy { display: flex; flex-direction: column; min-width: 0; }
.recovery-row-copy strong { font-size: 13px; }
.recovery-row-copy small { color: var(--muted); font-size: 11px; }
.recovery-row .recovery-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

/* Background-job notifications for claims that are not on screen */
.claim-toast-host {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px));
}
.claim-toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--white); border: 1px solid var(--line); border-left: 3px solid var(--purple);
  border-radius: 8px; box-shadow: var(--shadow); padding: 11px 12px; font-size: 12px; color: var(--ink);
}
.claim-toast.failed { border-left-color: var(--danger); }
.claim-toast-action { background: transparent; border: 0; color: var(--purple); font-weight: 600; font-size: 12px; white-space: nowrap; }
.claim-toast-dismiss { background: transparent; border: 0; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 2px; }

/* Development instrumentation — only rendered with ?debug=1 */
.claim-debug {
  display: flex; flex-wrap: wrap; gap: 12px; padding: 4px 20px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px;
  color: var(--muted); background: #F4F6FA; border-top: 1px solid var(--line);
}
.claim-debug strong { color: var(--ink); }

@media print {
  .claim-tabbar-host, .claim-toast-host { display: none !important; }
}

/* v1.0.39 server-backed claim type lock */
.claim-type-lock { display: block; margin-top: 8px; color: #5b6675; font-size: 0.8rem; }

/* ========================================================================== 
   v1.0.40 — conflict safety, server search and hardened AI states
   ========================================================================== */
.save-conflict-banner {
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  margin:0; padding:11px 20px; border-bottom:1px solid #e7c56e;
  background:#fff8df; color:#58430a; font-size:12px; line-height:1.45;
}
.save-conflict-banner > div:first-child { display:flex; flex-direction:column; gap:2px; min-width:0; }
.save-conflict-banner strong { color:#513900; font-size:12.5px; }
.save-conflict-actions { display:flex; align-items:center; gap:8px; flex:0 0 auto; }
.danger-button { border:1px solid #b23a2f; background:#fff; color:#9a2f27; border-radius:7px; padding:8px 11px; font-weight:700; }
.danger-button:hover { background:#fff1ef; }

.claim-search-form { display:flex; align-items:center; gap:8px; margin:10px 0 12px; }
.claim-search-form input[type="search"] { min-width:260px; flex:1 1 340px; max-width:520px; }
.recovery-load-more { margin-top:10px; }

.ai-run-status.review_required { border-left-color:#b7791f; }
.ai-run-status.insufficient_evidence { border-left-color:#6b7280; }
.ai-run-status.review_required .ai-run-dot { background:#d69e2e; }
.ai-run-status.insufficient_evidence .ai-run-dot { background:#718096; }

@media(max-width:720px) {
  .save-conflict-banner { align-items:stretch; flex-direction:column; padding:10px 14px; }
  .save-conflict-actions { width:100%; flex-wrap:wrap; }
  .claim-search-form { align-items:stretch; flex-wrap:wrap; }
  .claim-search-form input[type="search"] { min-width:100%; max-width:none; }
}
