:root {
    --teal: #086c65;
    --ink: #142b32;
    --muted: #506770;
    --border: #dce7e8;
    --shadow: 0 3px 8px #183b4110, 0 16px 36px #183b4109;
    background: #f3f7f7;
    color: var(--ink);
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
}
body { color: var(--ink); }
body > header { padding-block: 12px; gap: 18px; box-shadow: 0 2px 10px #183b4108; }
.brand { color: var(--teal); }
nav { gap: 4px 8px; }
nav a { padding: 8px 10px; border-radius: 8px; }
nav a:hover, nav a:focus-visible { background: #e9f5f3; text-decoration: none; }
main { max-width: 1280px; }
.section-title { margin: 24px 0; }
.section-title h1 { font-size: clamp(1.55rem, 3vw, 2.35rem); color: var(--ink); line-height: 1.25; }
.section-title p { max-width: 72ch; line-height: 1.65; }
.panel, .document-card, .metrics > div, .portal-document-heading { border-radius: 16px; box-shadow: var(--shadow); }
.metrics > div { border-block-start: 3px solid #80b8ad; }
.metrics strong { color: var(--teal); }
input, select, textarea { border-color: #b8cbcf; }
textarea { width: 100%; min-height: 85px; padding: 10px; border: 1px solid #b8cbcf; border-radius: 8px; background: #fff; color: inherit; font: inherit; resize: vertical; }
.setting-checkbox { display: flex; gap: 9px; align-items: center; }
.setting-checkbox input { width: 18px; height: 18px; accent-color: var(--teal); }
.button, button { border-radius: 10px; }
.secondary { background: #edf5f4; color: #18524e; border-color: #d5e7e4; }
.document-library > .actions { justify-content: space-between; margin-bottom: 14px; }
.document-library h2 { margin: 0; }
.document-card { background: #fff; }
.document-card .preview-link { background: #eef4f4; }
.card-body h3 { line-height: 1.45; }
.card-actions .button { width: 100%; }
.status.awaiting_you, .status.signed, .status.completed { color: #165948; background: #def3eb; }
.status.needs_review, .status.rejected, .status.returned { color: #77352a; background: #fff0e9; }
.status.archived { color: #3b535e; background: #edf1f4; }
.workflow-tabs { margin-block: 12px 18px; }
.review-banner { border-inline-start: 4px solid #c16a43; }
.review-reason { white-space: pre-wrap; overflow-wrap: anywhere; color: #532c25; background: #fff4ee; padding: 14px; border-radius: 10px; }
.signing-pages { display: grid; gap: 16px; margin-block: 14px; }
.signing-pages .signing-page { width: min(100%, 850px); margin: 0 auto; position: relative; scroll-margin-block: 24px 160px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #fff; }
.signing-page figcaption { position: absolute; inset-inline-end: 10px; top: 10px; background: #26353ceb; color: #fff; border-radius: 20px; font-size: 12px; padding: 5px 10px; z-index: 1; pointer-events: none; }
.signing-preview-media { position: relative; }
.signing-preview-media img { display: block; width: 100%; height: auto; }
.signing-preview-media:not(:has(img)) .signature-position { visibility: hidden; }
.signature-position { position: absolute; box-sizing: border-box; z-index: 2; border: 2px dashed #086c65; border-radius: 5px; background: #d8f6ea55; pointer-events: none; }
.signature-position span { position: absolute; bottom: 100%; right: -2px; color: #fff; background: #086c65; border-radius: 5px 5px 0 0; padding: 2px 6px; white-space: nowrap; font-size: clamp(9px, 1.5vw, 12px); font-weight: 650; }
.signature-position:focus { outline: 3px solid #0b726a; outline-offset: 3px; }
.signature-position.label-below span { bottom: auto; top: 100%; border-radius: 0 0 5px 5px; }
.portal { background: #f3f7f7; font-family: inherit; }
.portal-header h1 { color: var(--ink); }
.portal-intro { border-color: #dbe8e7; background: #f8fcfb; color: #315755; }
.portal-filters { padding: 0 14px; margin-block: 12px; }
.portal-filters > summary { padding-block: 10px; color: var(--teal); font-weight: 700; cursor: pointer; }
.portal-filters > .document-filters { margin: 0; padding: 4px 0 14px; box-shadow: none; border: 0; }
.portal-document { margin-block-end: 32px; }
.portal-document-heading { padding: 16px 18px; }
.prepare-state { font-weight: 700; color: #146457; }
.portal-document-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.portal-document-actions :is(button, a) { min-height: 38px; font-size: .87rem; padding: 6px 11px; }
.portal-reject { margin-block: 12px 6px; padding: 0 14px 8px; border: 1px solid #eedbd3; border-radius: 12px; background: #fff; }
.portal-reject summary { color: #8d3f2d; }
.portal-sign-bar { background: #fcffff; }
.portal-sign-bar button { background: var(--teal); }
[hidden] { display: none !important; }
@media (max-width: 650px) {
    body > header { gap: 6px 12px; }
    body > header nav { order: 3; display: flex; flex-basis: 100%; gap: 5px; flex-wrap: wrap; }
    nav a { min-height: 35px; padding: 6px 8px; white-space: nowrap; }
    .section-title { margin: 17px 0; }
    .portal-document-heading { padding: 12px; }
    .portal-main { padding-bottom: max(155px, calc(env(safe-area-inset-bottom) + 140px)); }
    .document-library { padding-inline: 10px; }
    .document-library > .actions { align-items: start; }
}
