/* Client-only styles. The official report is isolated inside an inert iframe. */
:root { --gold: #F5B427; --gray: #58595B; --ink: #333538; --muted: #696b70; --line: #dedfe1; --soft: #F8F9FA; color-scheme: light; }
* { box-sizing: border-box; }
html { direction: rtl; scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--soft); font: 15px/1.85 Tahoma, Arial, sans-serif; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, input:focus-visible, textarea:focus-visible, canvas:focus-visible, a:focus-visible { outline: 3px solid var(--gray); outline-offset: 4px; }
input, textarea { width: 100%; min-width: 0; border: 1px solid #bfc2c5; border-radius: 8px; background: #fff; color: var(--ink); padding: 12px 14px; font-size: 16px; line-height: 1.7; }
input::placeholder, textarea::placeholder { color: #74767a; }
textarea { resize: vertical; min-height: 124px; }
input[aria-invalid="true"], canvas[aria-invalid="true"] { border-color: #974a3e; box-shadow: 0 0 0 2px #974a3e20; }
input:disabled, textarea:disabled { background: #f1f2f3; }
p, h1, h2, h3 { overflow-wrap: anywhere; }
p { margin: 0; }
h1, h2 { color: var(--gray); line-height: 1.6; }
h1 { font-size: clamp(24px, 4vw, 32px); margin: 5px 0 10px; }
h2 { font-size: 22px; margin: 0; }
.skip-link { position: absolute; top: -100px; inset-inline-start: 14px; z-index: 10; background: var(--gold); color: var(--ink); padding: 10px 16px; border-radius: 5px; }
.skip-link:focus { top: 12px; }
.client-header { position: relative; isolation: isolate; border-top: 5px solid var(--gold); border-bottom: 1px solid var(--line); background: #fff; }
.client-header::before { content: ''; position: absolute; inset: 0; z-index: -1; background: url('/assets/brand-pattern.png') center/420px; opacity: .05; }
.header-inner { max-width: 1060px; margin: auto; display: flex; align-items: center; gap: 24px; padding: 22px 28px; }
.company-logo { width: 210px; height: 74px; max-width: 44%; object-fit: contain; object-position: right center; }
.header-copy { display: flex; flex-direction: column; font-size: 16px; color: var(--gray); }
.header-copy > span { font-size: 13px; align-self: flex-start; letter-spacing: .5px; }
.header-copy small { font-size: 11px; color: var(--muted); }
.private-label { margin-inline-start: auto; font-size: 12px; color: var(--gray); border: 1px solid var(--line); border-radius: 30px; padding: 5px 13px; background: #fff; white-space: nowrap; }
.private-label span { color: #9a711b; font-size: 9px; margin-inline-end: 4px; }
.client-main { max-width: 1000px; margin: auto; padding: 30px 24px 38px; }
.page-intro { padding-bottom: 22px; }
.page-intro > p:last-child { max-width: 730px; color: var(--muted); }
.eyebrow { font-size: 12px; color: #80601c; font-weight: bold; letter-spacing: .1px; }
.access-notice { border-inline-start: 4px solid var(--gold); padding: 14px 18px; background: #fff9ea; border-radius: 8px; color: #58503e; margin-bottom: 24px; font-size: 13px; }
.access-notice strong { display: block; color: var(--gray); margin-bottom: 3px; }
.message { padding: 16px 18px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.message--error { border-color: #ddc6c1; background: #fcf3f1; color: #7b352a; }
.message--notice { background: #fff8e7; border-color: #eed7a2; color: #67501d; }
.loading-card { text-align: center; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 42px 20px; }
.loading-card strong { display: block; color: var(--gray); }
.loading-card p { color: var(--muted); font-size: 13px; }
.loading-mark { display: block; margin: 0 auto 18px; width: 28px; height: 28px; border: 3px solid #eee; border-top-color: var(--gold); border-radius: 50%; animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.report-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 8px 0 18px; }
.report-heading > div { min-width: 0; }
.state-badge { display: inline-block; flex-shrink: 0; border: 1px solid #eed7a2; background: #fff4d9; border-radius: 30px; color: #67501d; padding: 7px 13px; font-size: 12px; font-weight: bold; }
.state-badge--final { color: #465c46; border-color: #ccdacc; background: #eef4ee; }
.report-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: #fff; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; }
.readonly-label { color: var(--muted); font-size: 12px; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 46px; padding: 10px 19px; border: 1px solid var(--line); border-radius: 8px; font-weight: bold; font-size: 14px; color: var(--gray); line-height: 1.7; text-align: center; transition: background .15s; }
.button--outline { background: #fff; }
.button--outline:hover:not(:disabled) { background: #f1f2f3; }
.button--primary { background: var(--gold); border-color: var(--gold); color: #333538; }
.button--primary:hover:not(:disabled) { background: #edaa1c; }
.report-shell { overflow: hidden; border: 1px solid var(--line); border-radius: 0 0 10px 10px; background: #fff; }
#official-report { display: block; width: 100%; height: 500px; min-width: 0; border: 0; background: #fff; }
.report-footnote { color: var(--muted); font-size: 12px; margin: 12px 2px 26px; }
.approval-tracking { padding: 16px; background: #fff; border: 1px solid var(--line); border-bottom: 0; }
/* Shared approval module's markup remains informational, not an editor. */
.approval-tracking .approval-stepper { display: block; }
.approval-tracking ol, .approval-tracking .workflow-stepper { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 12px; }
.approval-tracking li, .approval-tracking .approval-step { flex: 1 1 180px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.approval-tracking small, .approval-tracking time { display: block; color: var(--muted); font-size: 12px; }
.approval-card { margin-top: 28px; padding: 28px; border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: 12px; background: #fff; }
.card-heading { display: flex; align-items: center; gap: 15px; }
.section-number { width: 47px; height: 47px; flex-shrink: 0; display: grid; place-items: center; border: 1px solid #eddaa9; border-radius: 8px; background: #fff6df; color: #8a6720; font-size: 18px; font-weight: bold; }
.form-intro { color: var(--muted); margin: 14px 0 24px; font-size: 14px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.field label { font-weight: bold; color: var(--gray); }
.required, .optional { color: var(--muted); font-size: 12px; font-weight: normal; }
.field > small { color: var(--muted); font-size: 12px; }
.field-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field-count { color: var(--muted); font-size: 11px; white-space: nowrap; direction: ltr; }
.clear-button { background: #fff; color: var(--gray); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; min-height: 42px; font-size: 12px; }
.clear-button:hover:not(:disabled) { background: var(--soft); }
.signature-help { color: var(--muted); font-size: 12px; }
.signature-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.signature-actions .button { gap: 8px; font-size: 13px; }
.signature-icon { width: 20px; height: 20px; flex-shrink: 0; }
.signature-pad--image .signature-baseline { display: none; }
.signature-pad--image #signature-canvas { object-fit: contain; }
.signature-pad { position: relative; isolation: isolate; border-radius: 9px; overflow: hidden; background: #fff; }
#signature-canvas { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 280; min-height: 130px; border: 1px solid #bfc2c5; border-radius: 9px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
#signature-canvas[aria-disabled="true"] { cursor: not-allowed; opacity: .7; }
.signature-placeholder { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font-size: 19px; color: #b0b2b5; }
.signature-baseline { position: absolute; bottom: 24%; inset-inline: 7%; border-top: 1px dashed #d5d7d9; pointer-events: none; }
.consent-label { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); font-size: 14px; }
.consent-label input { width: 22px; height: 22px; flex-shrink: 0; margin: 3px 0 0; accent-color: var(--gold); cursor: pointer; }
.irreversible-note { font-size: 12px; color: var(--muted); margin: 15px 0; }
.submit-button { width: 100%; min-height: 52px; font-size: 16px; }
.final-card { margin: 26px 0 0; padding: 26px; border: 1px solid #ccdacc; border-top: 4px solid var(--gold); border-radius: 12px; background: #fff; display: grid; grid-template-columns: auto 1fr; gap: 12px 16px; }
.final-mark { width: 45px; height: 45px; display: grid; place-items: center; background: #edf3ed; color: #465c46; border-radius: 50%; font-size: 25px; }
.final-card > div > p:not(.eyebrow) { color: var(--muted); font-size: 13px; margin-top: 8px; }
.final-details, .final-notes, .saved-signature, .final-card > button { grid-column: 1 / -1; }
.final-details { margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; border-radius: 8px; background: var(--soft); }
.final-details dt { color: var(--muted); font-size: 12px; }
.final-details dd { margin: 3px 0 0; font-size: 14px; font-weight: bold; overflow-wrap: anywhere; }
.final-notes { font-size: 14px; padding: 12px 0; }
.final-notes p { white-space: pre-wrap; margin-top: 5px; }
.saved-signature { margin: 0; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.saved-signature figcaption { color: var(--muted); font-size: 12px; }
.saved-signature img { width: 100%; height: auto; max-height: 160px; object-fit: contain; }
.refresh-bar { margin-top: 25px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.expiry-text { color: var(--muted); font-size: 12px; }
.client-footer { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 4px 22px; padding: 23px 20px max(24px, env(safe-area-inset-bottom)); background: #fff; border-top: 3px solid var(--gold); color: var(--gray); font-size: 12px; text-align: center; }
.client-footer > strong { flex-basis: 100%; }
.client-footer > small { flex-basis: 100%; font-size: 11px; color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 600px) {
  .header-inner { gap: 14px; padding: 17px 16px; flex-wrap: wrap; }
  .company-logo { width: 172px; height: 61px; max-width: 51%; }
  .header-copy { font-size: 13px; }
  .header-copy > span { font-size: 11px; }
  .header-copy small { font-size: 10px; }
  .private-label { font-size: 11px; margin: 0; padding: 3px 11px; }
  .client-main { padding: 24px 14px 30px; }
  .access-notice { padding: 12px 14px; }
  .report-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .report-heading h2 { font-size: 21px; }
  .report-actions { padding: 12px; gap: 8px; }
  .report-actions .button { min-height: 44px; padding: 8px 12px; font-size: 12px; }
  .readonly-label { font-size: 11px; }
  .approval-card { padding: 20px 16px; }
  .approval-card h2 { font-size: 20px; }
  .card-heading { gap: 10px; }
  .section-number { width: 39px; height: 43px; }
  .field label { font-size: 14px; }
  .consent-label { padding: 13px; }
  .final-card { padding: 20px 16px; gap: 10px; }
  .final-card h2 { font-size: 20px; }
  .final-details { grid-template-columns: 1fr; }
  .refresh-bar { flex-direction: column; align-items: stretch; }
  .expiry-text { text-align: center; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .client-header, .page-intro, .access-notice, .message, .report-actions, .approval-card, .refresh-bar, .client-footer, .final-card, .report-footnote, .approval-tracking { display: none !important; } body, .client-main { background: #fff; margin: 0; padding: 0; } .report-shell { border: 0; } }

/* Real-client history only: the public demo does not mount these controls. */
.client-metadata { padding: 13px 18px; margin: 0 0 18px; border: 1px solid #eed7a2; border-inline-start: 4px solid var(--gold); border-radius: 8px; background: #fff8e7; color: var(--gray); font-size: 15px; font-weight: bold; line-height: 1.9; }
.client-history { margin: 26px 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.client-history summary { padding: 18px 20px; color: var(--gray); font-size: 16px; font-weight: bold; cursor: pointer; }
.client-history summary::marker { color: #80601c; }
.client-history details[open] summary { border-bottom: 1px solid var(--line); background: #fff9ea; }
.client-history summary:focus-visible, .history-table-wrap:focus-visible { outline: 3px solid var(--gray); outline-offset: -4px; }
.client-history-content { padding: 18px 20px 20px; }
.history-scope-note { color: var(--muted); font-size: 13px; line-height: 1.9; }
.history-list-actions, .history-dialog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; font-size: 13px; color: var(--gray); }
.history-list-actions > p, .history-dialog-actions > p { flex: 1 1 250px; }
.history-table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; border: 1px solid var(--line); border-radius: 8px; }
.history-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 13px; text-align: right; }
.history-table th, .history-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.history-table thead { background: var(--soft); color: var(--gray); }
.history-table tbody tr:last-child > * { border-bottom: 0; }
.history-table tbody th { font-size: 15px; color: var(--gray); }
.history-status { display: inline-block; border: 1px solid #eed7a2; border-radius: 20px; padding: 4px 10px; background: #fff4d9; color: #67501d; font-size: 11px; white-space: nowrap; }
.history-status--final { border-color: #ccdacc; background: #eef4ee; color: #465c46; }
.history-client-name { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; max-width: 230px; }
.history-open { min-height: 42px; padding: 7px 12px; font-size: 12px; white-space: nowrap; }
.history-report-dialog { width: min(1100px, calc(100% - 36px)); max-height: calc(100dvh - 36px); overflow-y: auto; overscroll-behavior: contain; padding: 24px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: 12px; box-shadow: 0 20px 80px #0003; }
.history-report-dialog::backdrop { background: #252629b8; }
.history-dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 18px; }
.history-dialog-heading h2 { font-size: 23px; }
.history-dialog-heading > button { flex-shrink: 0; }
.history-report-preview { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
#history-official-report { display: block; width: 100%; min-width: 0; height: 500px; border: 0; background: #fff; }
.history-report-preview[aria-busy="true"] { min-height: 250px; }
@media (max-width: 600px) {
  .client-metadata { font-size: 14px; padding: 12px 14px; }
  .client-history summary { padding: 16px 14px; font-size: 15px; }
  .client-history-content { padding: 14px; }
  .history-list-actions { align-items: stretch; }
  .history-list-actions > p { flex-basis: 100%; }
  .history-report-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); padding: 16px 12px; border-radius: 9px; }
  .history-dialog-heading { flex-direction: column; gap: 12px; }
  .history-dialog-heading h2 { font-size: 20px; }
  .history-dialog-heading > button, .history-dialog-actions > button { width: 100%; }
  .history-dialog-actions > p { flex-basis: 100%; }
}
@media print { .client-history, .client-metadata, .history-report-dialog { display: none !important; } }
