/* Cursive fonts for typed signatures (self-hosted, SIL OFL 1.1, see fonts/LICENSE.md). */
@font-face { font-family: "Great Vibes"; src: url("/fonts/great-vibes-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Mrs Saint Delafield"; src: url("/fonts/mrs-saint-delafield-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

/* DMO Business Tools: Signatures (sender screens and the signer page).
   Builds on styles.css tokens. Kept separate so the PDF tools and
   signatures workstreams do not edit the same stylesheet. */

input[type="email"], textarea {
  width: 100%; font: inherit; min-height: 48px; padding: 10px 14px;
  border: 1.5px solid #9d94ad; border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { min-height: 6rem; resize: vertical; }
input[type="email"]:focus-visible, textarea:focus-visible { border-color: var(--brand); }

/* Signer colours: each signer's fields share one colour (always with a text label too). */
.sg-c0 { --sg: #542f9c; --sg-bg: rgba(84, 47, 156, 0.12); }
.sg-c1 { --sg: #1d6b57; --sg-bg: rgba(29, 107, 87, 0.13); }
.sg-c2 { --sg: #a1440f; --sg-bg: rgba(161, 68, 15, 0.12); }
.sg-c3 { --sg: #1d4e78; --sg-bg: rgba(29, 78, 120, 0.12); }
.sg-c4 { --sg: #8a1f5c; --sg-bg: rgba(138, 31, 92, 0.12); }
.sg-dot { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--sg, var(--brand)); flex: none; }

/* Dashboard */
.chip-btn[aria-current="page"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-deep); font-weight: 650; }
.chips a.chip-btn { text-decoration: none; }
.sg-hero h1 { margin-bottom: 0.5rem; }
.sg-section h2 { font-size: 1.5rem; }
.sg-count { font-family: var(--font-text); font-size: 1rem; color: var(--muted); }
.sg-list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.sg-row { display: flex; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.9rem 1.1rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.sg-row:first-child { border-top: 0; }
.sg-row-main { min-width: 0; flex: 1 1 18rem; }
.sg-row-title { font-weight: 650; overflow-wrap: anywhere; display: block; }
.sg-row-sub, .sg-row-date { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.sg-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }

/* Steps */
.sg-steps ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; padding: 0; margin: 0.5rem 0 1rem; }
.sg-step a, .sg-step > span { display: inline-flex; align-items: center; gap: 0.45rem; min-height: 44px; color: var(--muted); text-decoration: none; font-weight: 600; }
.sg-step a { color: var(--brand); }
.sg-step-n { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 1.5px solid currentColor; font-size: 0.85rem; }
.sg-step.is-current > span { color: var(--ink); }
.sg-step.is-current .sg-step-n { background: var(--brand); border-color: var(--brand); color: #fff; }
.sg-step.is-done .sg-step-n { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.sg-step-h { margin-top: 1rem; }
.sg-title { overflow-wrap: anywhere; }
.sg-title-row { display: flex; align-items: center; gap: 0.5rem 1rem; flex-wrap: wrap; }
.sg-title-row h1 { margin-bottom: 0.4rem; }
.sg-docline { margin-top: -0.4rem; overflow-wrap: anywhere; }
.sg-save { color: var(--muted); font-size: 0.92rem; min-height: 1.5em; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.sg-status { font-weight: 600; min-height: 1.5em; }
.sg-nav-actions { margin-top: 2rem; }
.sg-discard { margin: 2.5rem 0 1rem; }
.sg-bad { color: var(--bad); font-weight: 600; }

/* Choose a document */
.sg-drop { text-align: center; }
.sg-drop-title { font-size: 1.5rem; margin: 0 0 0.5rem; }
.sg-details { margin: 1.25rem 0; }
.sg-details summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; }
.sg-doc-list { list-style: none; padding: 0; margin: 0.75rem 0 0; display: grid; gap: 0.4rem; }
.sg-doc-btn { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 0.1rem; padding: 0.7rem 1rem; min-height: 48px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font: inherit; color: var(--ink); cursor: pointer; }
.sg-doc-btn:hover { border-color: var(--brand-line); background: var(--brand-soft); }
.sg-doc-name { font-weight: 650; overflow-wrap: anywhere; }

/* Signers */
.sg-signers { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.sg-signer { box-shadow: inset 6px 0 0 var(--sg); }
.sg-signer-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.sg-signer-head h3 { margin: 0; flex: 1; }
.sg-signer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem 1rem; }
.sg-signer-grid .field + .field { margin-top: 0; }

/* Field editor */
.sg-editor { display: grid; grid-template-columns: 18.5rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.sg-side { position: sticky; top: 0.75rem; display: grid; gap: 0.9rem; max-height: calc(100vh - 1.5rem); overflow: auto; padding-bottom: 0.5rem; }
.sg-toolbar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0.9rem; box-shadow: inset 0 5px 0 var(--sg); }
.sg-add-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; margin-top: 0.75rem; }
.sg-add { min-height: 44px; border-radius: var(--radius); border: 1.5px solid var(--sg); background: var(--sg-bg); color: var(--ink); font: inherit; font-weight: 650; font-size: 0.92rem; cursor: pointer; padding: 0.3rem 0.5rem; }
.sg-add:hover { background: #fff; }
.sg-panel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0.9rem; }
.sg-panel-title { margin-bottom: 0.6rem; }
.sg-panel-actions { margin: 0.8rem 0 0; gap: 0.4rem; }
.sg-counts { margin: 0; font-size: 0.92rem; }
.sg-field-list { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 0.2rem; font-size: 0.92rem; }
.sg-list-btn { background: none; border: 0; padding: 0.35rem 0; min-height: 36px; font: inherit; color: var(--brand); text-align: left; text-decoration: underline; cursor: pointer; }

.sg-pages { display: grid; gap: 1.25rem; min-width: 0; }
.sg-page-label { margin: 0 0 0.3rem; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.sg-page { position: relative; width: 100%; background: #fff; box-shadow: 0 0 0 1px var(--line), var(--shadow-card); border-radius: 4px; overflow: hidden; user-select: none; -webkit-user-select: none; }
.sg-page img { display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.sg-layer { position: absolute; inset: 0; }
.sg-field {
  position: absolute; box-sizing: border-box; margin: 0; padding: 0 3px;
  border: 2px dashed var(--sg); background: var(--sg-bg); color: var(--sg);
  border-radius: 4px; font: 700 clamp(9px, 1.1vw, 13px)/1.1 var(--font-text); text-align: left;
  display: flex; align-items: center; overflow: hidden; cursor: grab; touch-action: none;
}
.sg-field.is-optional { border-style: dotted; }
.sg-field.is-selected { border-style: solid; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--sg); z-index: 2; }
.sg-field:active { cursor: grabbing; }
.sg-field-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.sg-handle { position: absolute; right: -2px; bottom: -2px; width: 16px; height: 16px; background: var(--sg); border-radius: 3px 0 3px 0; cursor: nwse-resize; }
.sg-handle::after { content: ""; position: absolute; inset: -10px; } /* bigger touch target */

/* Review */
.sg-review { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.sg-review-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.sg-review-list li { display: flex; gap: 0.6rem; align-items: baseline; overflow-wrap: anywhere; }

/* Sender's confirmation of authority (required before sending) */
.sg-authority { margin-top: 1rem; border-left: 4px solid var(--brand); }
.sg-authority h3 { margin: 0; }
.sg-authority-list { margin: 0; padding-left: 1.4rem; display: grid; gap: 0.45rem; }
.sg-authority-agree { font-weight: 650; }
.sg-auth-sig { min-height: 2.2rem; margin: 0.4rem 0 0; padding: 0 0.2rem 0.1rem; border-bottom: 1.5px solid var(--line-strong);
  font-family: var(--font-display); font-style: italic; font-size: 1.5rem; color: var(--brand-deep); overflow-wrap: anywhere; }

/* Activity */
.sg-done .actions { margin: 0.8rem 0; }
.sg-recs { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1rem; }
.sg-rec p { margin: 0.25rem 0; }
.sg-rec-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.sg-rec-email { overflow-wrap: anywhere; }
.sg-rec-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.sg-edit-rec { margin-top: 0.6rem; }
.sg-timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.sg-timeline li { display: grid; grid-template-columns: 12rem 1fr; gap: 0.25rem 1rem; padding: 0.45rem 0 0.45rem 1rem; position: relative; }
.sg-timeline li::before { content: ""; position: absolute; left: -6px; top: 0.9rem; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-line); }
.sg-timeline time { color: var(--muted); font-size: 0.9rem; }
.sg-hashes code, .sg-verify code { font-size: 0.8rem; overflow-wrap: anywhere; word-break: break-all; }
.sg-outbox { list-style: none; padding: 0; display: grid; gap: 1rem; }
.sg-mail { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.85rem; background: var(--surface-2); padding: 0.75rem; border-radius: var(--radius-sm); }

@media (max-width: 900px) {
  /* Phones and small tablets: only the "add a field" bar stays at the top;
     the selected field's settings open as a small sheet at the bottom. */
  .sg-editor { display: block; }
  .sg-side { display: contents; }
  .sg-toolbar { position: sticky; top: 0; z-index: 6; padding: 0.6rem; margin-bottom: 0.75rem; }
  .sg-add-row { display: flex; overflow-x: auto; gap: 0.4rem; padding-bottom: 0.25rem; }
  .sg-add { flex: none; padding: 0.3rem 0.8rem; }
  .sg-panel:has(.sg-panel-card) { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom)); background: var(--bg); box-shadow: 0 -8px 24px -12px rgba(31, 22, 64, 0.35); }
  .sg-panel .sg-panel-card .field { display: flex; align-items: center; gap: 0.5rem; }
  .sg-panel .sg-panel-card .field .label { margin: 0; }
  .sg-panel .sg-panel-card .check { min-height: 40px; }
  .sg-panel-actions { margin-top: 0.4rem; }
  .sg-pages { padding-bottom: 15rem; }
  .sg-review { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  /* The "Signatures" link makes five in the main nav: let it wrap to two rows on phones. */
  .main-nav { flex-wrap: wrap; border-radius: var(--radius-lg); }
  .main-nav a { flex: 1 1 28%; }
  .sg-signer-grid { grid-template-columns: 1fr; }
  .sg-row-side { align-items: flex-start; }
  .sg-timeline li { grid-template-columns: 1fr; }
  .sg-who { display: flex; align-items: center; gap: 0.5rem; }
  .sg-who .label { margin: 0; white-space: nowrap; }
  .sg-who select { min-height: 44px; }
  .sg-panel-card { padding: 0.7rem; }
  .sg-field { font-size: 9px; }
}

/* ---------------- Signer page ---------------- */
.sgn-body { background: var(--bg); }
.sgn-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.sgn-header-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 56px; flex-wrap: wrap; }
.sgn-brand { font-family: var(--font-display); font-size: 1.3rem; color: var(--brand-deep); }
.sgn-brand span { font-family: var(--font-text); font-size: 0.85rem; color: var(--muted); }
.sgn-secure { font-size: 0.88rem; color: var(--muted); overflow-wrap: anywhere; }
main.sgn-main { padding-bottom: 9rem; max-width: 60rem; }
.sgn-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.5rem; margin: 1.5rem 0; box-shadow: var(--shadow-card); }
.sgn-card h1 { margin-top: 0.25rem; font-size: clamp(1.7rem, 2.5vw + 1rem, 2.4rem); overflow-wrap: anywhere; }
.sgn-eyebrow { font-weight: 650; color: var(--brand); margin: 0; overflow-wrap: anywhere; }
.sgn-quote { margin: 1rem 0; padding: 0.75rem 1rem; border-left: 4px solid var(--brand-line); background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0; overflow-wrap: anywhere; white-space: pre-line; }
.sgn-quote p { margin: 0; }
.sgn-facts { padding-left: 1.2rem; margin: 1rem 0; }
.sgn-wide { width: 100%; max-width: 26rem; }
.sgn-decline-line { text-align: center; margin: 1.5rem 0; }
.sgn-doc-head { margin: 1.25rem 0 0.75rem; }
.sgn-doc-title { font-size: clamp(1.4rem, 2vw + 1rem, 2rem); margin: 0 0 0.3rem; overflow-wrap: anywhere; }
.sgn-pages { display: grid; gap: 1rem; }
.sgn-page { user-select: auto; }
.sgn-field {
  position: absolute; box-sizing: border-box; margin: 0; padding: 0 3px; cursor: pointer;
  border: 2px solid #c98a00; background: rgba(255, 216, 77, 0.45); color: #3a2a00; border-radius: 3px;
  font: 700 clamp(8px, 1.6vw, 14px)/1.1 var(--font-text); display: flex; align-items: center; justify-content: flex-start; overflow: visible;
  touch-action: manipulation;
}
.sgn-field::before { content: ""; position: absolute; inset: -8px; } /* a finger-sized target around small fields */
.sgn-field.is-required:not(.is-done) { animation: sgn-pulse 2.4s ease-in-out infinite; }
.sgn-field.is-done { background: rgba(227, 242, 231, 0.55); border-color: var(--good); color: var(--ink); }
.sgn-field.sgn-t-date_signed::before { content: none; }
.sgn-field.sgn-t-date_signed { background: rgba(238, 232, 251, 0.6); border: 1.5px dashed var(--brand-line); color: var(--muted); cursor: default; }
.sgn-field img { max-width: 100%; max-height: 100%; object-fit: contain; object-position: left center; }
.sgn-field.sgn-t-checkbox { justify-content: center; padding: 0; }
.sgn-check { font-size: clamp(10px, 2vw, 18px); line-height: 1; color: var(--good); }
.sgn-ftext { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sgn-value { font-weight: 500; color: var(--ink); }
.sgn-auto { font-weight: 500; font-size: 0.85em; }
.sgn-field.is-flash { outline: 4px solid var(--focus); outline-offset: 3px; }
@keyframes sgn-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(201, 138, 0, 0.0); } 50% { box-shadow: 0 0 0 5px rgba(201, 138, 0, 0.28); } }

.sgn-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -16px rgba(31, 22, 64, 0.35); padding: 0.6rem 0 calc(0.6rem + env(safe-area-inset-bottom)); }
.sgn-bar-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; max-width: 60rem; }
.sgn-bar-text { margin: 0; font-weight: 650; }
.sgn-bar-actions { display: flex; gap: 0.5rem; }
.sgn-bar-btn { min-height: 48px; }

.sgn-dialog { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(38rem, calc(100vw - 1.5rem)); max-height: calc(100vh - 1.5rem); box-shadow: var(--shadow-lift); color: var(--ink); }
.sgn-dialog::backdrop { background: rgba(31, 22, 64, 0.45); }
.sgn-dialog-inner { padding: 1.25rem 1.25rem 0.5rem; }
.sgn-dialog-title { margin: 0 0 1rem; font-size: 1.5rem; }
.sgn-tabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 1rem; border: 1px solid var(--line); border-radius: var(--radius-pill); width: fit-content; max-width: 100%; }
.sgn-tab { position: relative; }
.sgn-tab input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sgn-tab span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1.1rem; border-radius: var(--radius-pill); font-weight: 650; }
.sgn-tab input:checked + span { background: var(--brand); color: #fff; }
.sgn-tab input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.sgn-styles { border: 0; padding: 0; margin: 1rem 0 0; display: grid; gap: 0.5rem; }
.sgn-style { display: flex; align-items: center; gap: 0.75rem; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 0.4rem 0.9rem; min-height: 64px; cursor: pointer; overflow: hidden; }
.sgn-style input { width: 1.2rem; height: 1.2rem; accent-color: var(--brand); flex: none; }
.sgn-style:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.sgn-style-sample { font-size: 2rem; color: #10204a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sgn-style-vibes { font-family: "Great Vibes", cursive; font-size: 2.3rem; }
.sgn-style-delafield { font-family: "Mrs Saint Delafield", cursive; font-size: 3rem; line-height: 1.3; }
.sgn-style-flow { font-family: "Fraunces", Georgia, serif; font-style: italic; }
.sgn-style-classic { font-family: Georgia, "Times New Roman", serif; font-style: italic; }
.sgn-style-plain { font-family: var(--font-text); font-weight: 500; }
.sgn-canvas { display: block; width: 100%; border: 1.5px dashed #9d94ad; border-radius: var(--radius); background: #fff; touch-action: none; cursor: crosshair; }
.sgn-up-preview { max-width: 100%; max-height: 120px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 0.5rem; background: #fff; }
.sgn-consent { padding-left: 1.2rem; margin: 1rem 0; }
.sgn-consent li { margin: 0.3rem 0; }
.sgn-agree { margin: 1rem 0 0.25rem; font-weight: 650; }
.sgn-status { font-weight: 600; }
.sgn-message h1 { margin-top: 0; }
.sgn-done h1 { color: var(--good); }

@media (max-width: 640px) {
  .sgn-card { padding: 1.1rem; margin: 1rem 0; }
  .sgn-bar-row { flex-direction: column; align-items: stretch; gap: 0.4rem; }
  .sgn-bar-text { text-align: center; }
  .sgn-bar-actions .btn { flex: 1; }
  .sgn-dialog-inner { padding: 1rem 1rem 0.25rem; }
  .sgn-style-sample { font-size: 1.6rem; }
  main.sgn-main { padding-bottom: 12rem; }
}
@media (prefers-reduced-motion: reduce) {
  .sgn-field.is-required:not(.is-done) { animation: none; }
}
.sgn-styles legend { font-family: var(--font-text); font-size: 1rem; font-weight: 650; padding: 0; }
.sgn-inline-decline { min-height: 44px; padding-left: 0; }
/* Fields scrolled or tabbed into view stay clear of the fixed progress bar. */
html:has(body.sgn-body) { scroll-padding-bottom: 7.5rem; scroll-padding-top: 1rem; }
@media (max-width: 640px) { html:has(body.sgn-body) { scroll-padding-bottom: 10rem; } }

/* Signer page: security code from the email instead of the link */
.sgn-code-form { display: grid; gap: 8px; max-width: 520px; margin-top: 16px; }
.sgn-code-form label { font-weight: 600; }
.sgn-code-input { font: 15px/1.4 ui-monospace, Consolas, Menlo, monospace; padding: 12px; border: 1px solid var(--line, #c9c3d9); border-radius: 8px; width: 100%; box-sizing: border-box; }
.sgn-code-err { color: var(--danger, #a4262c); margin: 0; }
.sgn-code-form .btn { justify-self: start; margin-top: 6px; }

/* Development outbox: rendered email preview */
.sg-mail-preview { margin: 8px 0 12px; }
.sg-mail-preview summary { cursor: pointer; color: var(--brand, #542f9c); font-weight: 600; }
.sg-mail-preview iframe { display: block; width: 100%; height: 720px; border: 1px solid var(--line, #ddd6ea); border-radius: 8px; margin-top: 8px; background: #fff; }

/* Signing order */
.sg-order { border: 1px solid var(--line, #ddd6ea); border-radius: 12px; padding: 12px 16px 14px; margin: 18px 0 0; display: grid; gap: 10px; }
.sg-order legend { padding: 0 6px; }
.sg-order-opt { align-items: flex-start; }
.sg-when { font-weight: 400; font-size: 0.85em; }
.sg-signer-head .btn-quiet + .btn-quiet { margin-left: 0; }
.sg-signer-head { flex-wrap: wrap; }

/* Automatic reminders */
.sg-reminders { display: grid; gap: 6px; }
.sg-rem-box { border-top: 1px solid var(--line, #ddd6ea); margin-top: 12px; padding-top: 12px; }

/* Templates */
.sg-tpl-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.sg-tpl-name { font-size: 1.1rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.sg-tpl p { margin: 4px 0; }
.sg-tpl-roles { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 10px; }
.sg-tpl-role { border-left: 3px solid var(--brand-line, #c9bceb); padding-left: 12px; }
.sg-tpl-save { margin-top: 20px; }

/* Signer header and the "after signing" actions */
a.sgn-brand { text-decoration: none; }
a.sgn-brand:hover, a.sgn-brand:focus-visible { text-decoration: underline; }
.sgn-header-right { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.sgn-after { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.sgn-after:empty, .sgn-message .sgn-after:not(:has(a:not([hidden]))) { display: none; }

/* Saved signature (signer) */
.sgn-saved { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; background: var(--surface); }
.sgn-saved h3 { margin: 0 0 8px; font-size: 1rem; }
.sgn-saved-img { display: block; max-width: 100%; max-height: 110px; background: #fff; border-radius: 6px; margin-bottom: 8px; }
.sgn-or { margin: 10px 0 0; }
.sgn-remember { margin-top: 10px; }
.sgn-remember p { margin: 2px 0 0 1.75rem; }

/* A fillable form arrives as a flat copy: what happened, and its empty boxes as fields. */
.sg-form-notice .notice p { margin: 0 0 0.5rem; }
.sg-boxes-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.sg-boxes-actions .label { margin: 0; }
.sg-boxes-actions select { min-height: 44px; max-width: 100%; }

/* Phones (2026-10-01 audit) */
.sgn-style[hidden], .sgn-styles p[hidden] { display: none; }
.sgn-check-big { font-size: 1.1rem; }
.sgn-check-big input { width: 1.75rem; height: 1.75rem; flex: none; }
/* Type / Draw / Upload share the width on narrow screens instead of running off the edge. */
@media (max-width: 400px) {
  .sgn-tabs { width: 100%; }
  .sgn-tab { flex: 1 1 0; min-width: 0; }
  .sgn-tab span { justify-content: center; width: 100%; padding: 0 0.5rem; }
}
/* Landscape phones: a slimmer progress bar leaves more of the document on screen. */
@media (max-height: 500px) and (orientation: landscape) {
  .sgn-bar { padding: 0.35rem 0 calc(0.35rem + env(safe-area-inset-bottom)); }
  .sgn-bar-row { flex-direction: row; align-items: center; }
  .sgn-bar-btn { min-height: 44px; }
  .sgn-header-row { min-height: 44px; }
  html:has(body.sgn-body) { scroll-padding-bottom: 5rem; }
  main.sgn-main { padding-bottom: 5rem; }
  .sgn-dialog { max-height: calc(100vh - 0.75rem); }
  .sgn-dialog-inner { padding-top: 0.75rem; }
  .sgn-dialog-title { margin-bottom: 0.5rem; font-size: 1.25rem; }
}
