:root {
  --ink: #172033;
  --ink-2: #26334c;
  --muted: #626d84;
  --line: #dce2eb;
  --line-strong: #c7d0dd;
  --canvas: #f4f6f9;
  --surface: #ffffff;
  --accent: #c8912f;
  --accent-dark: #9b6916;
  --accent-soft: #fbf3e4;
  --success: #147a52;
  --success-soft: #eaf7f1;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --warning: #995f00;
  --warning-soft: #fff7df;
  --shadow: 0 16px 44px rgba(23, 32, 51, .08);
  --shadow-sm: 0 8px 24px rgba(23, 32, 51, .07);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 84% -10%, rgba(200,145,47,.10), transparent 28rem),
    var(--canvas);
  font: 15px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(200,145,47,.55);
  outline-offset: 3px;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(225px, 1fr) auto minmax(225px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(220,226,235,.9);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; width: fit-content; }
.brand-mark {
  width: 37px; height: 37px; display: grid; place-items: center;
  border-radius: 10px; color: white; background: var(--ink);
  font-weight: 800; font-size: 18px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.brand-mark.large { width: 52px; height: 52px; font-size: 25px; border-radius: 14px; }
.brand span:last-child { display: flex; flex-direction: column; line-height: 1.12; }
.brand strong { font-size: 13px; letter-spacing: .08em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.topnav { display: flex; gap: 5px; align-items: center; padding: 4px; border-radius: 12px; background: #eef1f5; }
.topnav a { text-decoration: none; color: var(--muted); padding: 8px 13px; border-radius: 8px; font-weight: 650; font-size: 13px; }
.topnav a:hover, .topnav a.active { color: var(--ink); background: white; box-shadow: 0 2px 8px rgba(23,32,51,.07); }
.user-menu { justify-self: end; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }

.shell { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 48px 0 80px; }
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.page-heading { margin: 0 0 28px; max-width: 760px; }
.page-heading h1 { margin: 5px 0 7px; font-size: clamp(30px, 4vw, 43px); line-height: 1.08; letter-spacing: -.035em; }
.page-heading > p:last-child, .page-heading div > p:last-child { margin: 0; color: var(--muted); font-size: 16px; }
.split-heading { max-width: none; display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.eyebrow { margin: 0; color: var(--accent-dark); font-size: 11px; line-height: 1.2; font-weight: 800; letter-spacing: .14em; }
.muted { color: var(--muted); }

.button {
  min-height: 42px; padding: 9px 17px; border: 1px solid transparent; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none; font-weight: 750; font-size: 13px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .56; cursor: not-allowed; }
.button[aria-busy="true"] { cursor: wait; }
.button.primary { background: var(--ink); color: white; box-shadow: 0 7px 18px rgba(23,32,51,.16); }
.button.primary:hover:not(:disabled) { background: var(--ink-2); box-shadow: 0 10px 24px rgba(23,32,51,.22); }
.button.secondary { background: white; color: var(--ink); border-color: var(--line-strong); }
.button.secondary:hover:not(:disabled) { background: #f7f9fb; }
.button.ghost { background: transparent; color: var(--muted); border-color: transparent; }
.button.danger { background: var(--danger-soft); color: var(--danger); border-color: #ffd5d0; }
.button.small { min-height: 34px; padding: 6px 11px; font-size: 12px; }
.button.large { min-height: 50px; font-size: 15px; }
.button.full { width: 100%; }
.text-link, .text-button { border: 0; padding: 0; background: none; color: var(--accent-dark); cursor: pointer; font-weight: 750; text-decoration: none; }
.text-link:hover, .text-button:hover { text-decoration: underline; }
.danger-text { color: var(--danger); }
.icon-button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: #f0f2f6; color: var(--muted); cursor: pointer; font-size: 20px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 22px; }
.metric { padding: 21px; display: flex; flex-direction: column; min-height: 143px; }
.metric span { color: var(--muted); font-weight: 700; font-size: 12px; }
.metric strong { margin: auto 0 0; font-size: 37px; letter-spacing: -.04em; line-height: 1; }
.metric small { color: var(--muted); margin-top: 7px; }
.filter-card { padding: 18px 20px; margin-bottom: 22px; }
.filter-form { display: grid; grid-template-columns: minmax(220px,1.25fr) minmax(170px,.7fr) minmax(190px,.8fr) auto; gap: 13px; align-items: end; }
.filter-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.table-card { overflow: hidden; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.table-card > .section-heading { padding: 22px 24px 15px; }
.section-heading h2, .form-section h2, .info-card h2, .detail-main h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 20px; background: #f7f8fa; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; text-align: left; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
td { padding: 16px 20px; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td strong, td small { display: block; }
td small { color: var(--muted); margin-top: 3px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pagination > div { display: flex; gap: 6px; }

.status { display: inline-flex; align-items: center; width: fit-content; min-height: 25px; padding: 4px 8px; border-radius: 99px; background: #eef1f5; color: #58647a; font-size: 10px; line-height: 1; font-weight: 850; letter-spacing: .04em; }
.status.large { min-height: 34px; padding: 8px 13px; font-size: 11px; }
.status-completed, .status-signed, .status-authenticated { color: var(--success); background: var(--success-soft); }
.status-sent, .status-notified, .status-accessed, .status-document_viewed, .status-in_progress { color: #175ca8; background: #eaf3ff; }
.status-ready, .status-pending, .status-finalizing { color: var(--warning); background: var(--warning-soft); }
.status-failed, .status-declined, .status-revoked, .status-expired { color: var(--danger); background: var(--danger-soft); }

.form-section { display: grid; grid-template-columns: 52px 1fr; gap: 20px; padding: 27px; margin-bottom: 18px; }
.compact-section { grid-template-columns: minmax(0,1fr); margin-bottom: 22px; }
.step-number { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 850; }
.section-content { min-width: 0; }
.form-section .section-content > h2 + p { margin: 5px 0 22px; }
.form-grid { display: grid; gap: 17px; }
.form-grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.form-grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.form-grid.four { grid-template-columns: 1.35fr 1.2fr 1fr .8fr; }
.form-grid.compact { gap: 11px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 7px; color: var(--ink-2); font-weight: 700; font-size: 12px; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 9px;
  color: var(--ink); background: white; outline: none; font-weight: 500; font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200,145,47,.13); }
input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--ink); }
.upload-zone { min-height: 110px; justify-content: center; align-items: center; border: 1px dashed var(--line-strong); border-radius: 12px; background: #fafbfc; cursor: pointer; text-align: center; }
.upload-zone input { width: auto; min-height: 0; border: 0; padding: 0; }
.upload-zone span { display: flex; flex-direction: column; color: var(--ink); }
.upload-zone small { color: var(--muted); margin-top: 2px; }
.check-row { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 600; }
.check-row.strong { font-size: 13px; color: var(--ink); }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 11px; margin-top: 22px; }
.form-error { margin: 12px 0 0; padding: 11px 13px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 13px; font-weight: 650; }
.signer-list { display: grid; gap: 11px; margin-top: 18px; }
.signer-card { position: relative; display: grid; grid-template-columns: 35px 1fr 34px; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; }
.signer-index { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--ink); font-size: 12px; font-weight: 850; }
.advanced-panel { margin: 20px 0; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; }
.advanced-panel summary { cursor: pointer; font-weight: 750; }
.advanced-panel textarea { margin-top: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.notice { padding: 16px 18px; border-radius: 10px; margin-bottom: 22px; }
.notice.warning { background: var(--warning-soft); color: var(--warning); border: 1px solid #f0dda4; }
.setup-notice { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.setup-notice > div { display: grid; gap: 2px; }
.setup-notice .button { flex: 0 0 auto; }

.detail-grid { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 20px; align-items: start; }
.detail-main { padding: 24px; }
.detail-main hr { border: 0; border-top: 1px solid var(--line); margin: 27px 0; }
.detail-side { display: grid; gap: 12px; position: sticky; top: 92px; }
.info-card { padding: 21px; }
dl { margin: 18px 0; }
dl > div { padding: 11px 0; border-bottom: 1px solid #edf0f4; }
dl > div:last-child { border-bottom: 0; }
dt { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
dd { margin: 4px 0 0; font-weight: 650; word-break: break-word; }
.hash { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; line-height: 1.55; }
.button-stack { display: grid; gap: 8px; }
.signer-timeline { margin-top: 18px; }
.timeline-row { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 12px; align-items: center; padding: 14px 0; border-bottom: 1px solid #edf0f4; }
.timeline-row:last-child { border-bottom: 0; }
.timeline-row strong, .timeline-row small { display: block; }
.timeline-row small { color: var(--muted); margin-top: 2px; }
.timeline-dot { width: 29px; height: 29px; display: grid; place-items: center; border: 2px solid var(--line-strong); border-radius: 50%; color: var(--muted); font-size: 11px; font-weight: 850; }
.timeline-dot.done { background: var(--success); border-color: var(--success); color: white; }
.event-list { list-style: none; padding: 0; margin: 17px 0 0; }
.event-list li { display: grid; grid-template-columns: 34px 1fr; gap: 11px; padding: 10px 0; }
.event-list li > span { color: var(--muted); font-family: ui-monospace, monospace; font-size: 11px; }
.event-list strong, .event-list small { display: block; }
.event-list small { color: var(--muted); margin-top: 2px; }

.application-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px; }
.application-card { padding: 21px; }
.application-head { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; }
.app-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; color: var(--accent-dark); background: var(--accent-soft); font-size: 18px; font-weight: 850; }
.application-head h2 { margin: 0; font-size: 17px; }
.application-head p { margin: 1px 0 0; color: var(--muted); }
.application-card details { border-top: 1px solid var(--line); padding-top: 13px; }
.application-card summary { cursor: pointer; font-weight: 750; font-size: 12px; }
.credential-list { margin-top: 10px; }
.credential-list > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; }
.credential-list strong, .credential-list small { display: block; }
.credential-list small { color: var(--muted); margin-top: 2px; }
.secret-panel { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(23,32,51,.62); backdrop-filter: blur(5px); }
.secret-panel > div { width: min(650px,100%); padding: 28px; box-shadow: var(--shadow); }
.secret-panel h2 { margin: 5px 0; }
.secret-value { margin: 16px 0; }
.secret-value > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.secret-value strong { color: var(--ink-2); font-size: 12px; }
.secret-panel code { display: block; padding: 13px; border-radius: 8px; background: #f1f3f6; color: var(--ink); word-break: break-all; user-select: all; }
.secret-copy-status { min-height: 21px; color: var(--muted); font-size: 12px; }
.secret-copy-status.success { color: var(--success); font-weight: 750; }

.dialog-backdrop { position: fixed; z-index: 120; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(23,32,51,.62); backdrop-filter: blur(5px); }
.action-dialog { width: min(520px,100%); padding: 27px; box-shadow: var(--shadow); }
.action-dialog h2 { margin: 6px 0 4px; font-size: 24px; }
.action-dialog > p.muted { margin: 0 0 20px; }
.action-dialog [data-dialog-field] small { color: var(--muted); font-weight: 500; }
.action-dialog .form-actions { margin-top: 18px; }

.empty-state { padding: 55px 24px; text-align: center; grid-column: 1/-1; }
.empty-state h1, .empty-state h3 { margin: 8px 0 5px; }
.empty-state p { color: var(--muted); margin: 0 0 18px; }
.empty-icon, .error-symbol, .success-symbol { width: 52px; height: 52px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; font-size: 24px; font-weight: 850; }
.empty-icon { color: var(--accent-dark); background: var(--accent-soft); }
.error-symbol { color: var(--danger); background: var(--danger-soft); }
.success-symbol { color: var(--success); background: var(--success-soft); }

.standalone { background: var(--ink); }
.standalone-main { min-height: 100vh; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 8vw; width: min(1120px,calc(100% - 48px)); margin: 0 auto; padding: 60px 0; }
.auth-brand { color: white; max-width: 570px; }
.auth-brand .eyebrow { color: #e3bd72; margin: 24px 0 9px; }
.auth-brand h1 { margin: 0; font-size: clamp(39px,5vw,64px); line-height: 1.02; letter-spacing: -.045em; }
.auth-brand > p:not(.eyebrow) { color: #b7c1d4; font-size: 17px; max-width: 540px; }
.feature-list { list-style: none; padding: 20px 0 0; display: grid; gap: 10px; color: #d8dfeb; }
.feature-list li::before { content: "✓"; color: #e3bd72; margin-right: 9px; font-weight: 850; }
.auth-card { padding: 34px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.auth-card h2 { margin: 7px 0 3px; font-size: 27px; }
.form-stack { display: grid; gap: 17px; margin-top: 24px; }

.signing-shell { min-height: 100vh; background: #eef1f5; color: var(--ink); }
.signing-header { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1320px)/2)); border-bottom: 1px solid var(--line); background: white; }
.security-pill { padding: 7px 11px; border-radius: 99px; color: var(--success); background: var(--success-soft); font-size: 11px; font-weight: 750; }
.signing-loading, .signing-error { width: min(520px,calc(100% - 32px)); margin: 12vh auto; padding: 40px; text-align: center; }
.signing-loading h1, .signing-error h1 { margin: 16px 0 4px; }
.signing-loading p, .signing-error p { color: var(--muted); margin: 0; }
.signing-error .recovery-copy { margin: 16px auto; max-width: 400px; }
.spinner { width: 34px; height: 34px; margin: 0 auto; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sign-intro { width: min(1320px,calc(100% - 48px)); margin: 0 auto; padding: 36px 0 20px; }
.sign-intro h1 { margin: 5px 0 4px; font-size: clamp(27px,4vw,39px); letter-spacing: -.03em; }
.sign-intro > p:last-of-type { margin: 0; color: var(--muted); }
.document-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.document-meta span { padding: 5px 8px; border-radius: 6px; background: white; color: var(--muted); border: 1px solid var(--line); font-size: 10px; font-weight: 750; }
.sign-layout { width: min(1320px,calc(100% - 48px)); margin: 0 auto; display: grid; grid-template-columns: minmax(0,1.5fr) minmax(360px,.7fr); gap: 18px; align-items: start; }
.document-viewer { min-height: calc(100vh - 220px); padding: 8px; overflow: hidden; }
.document-viewer iframe { width: 100%; height: calc(100vh - 238px); min-height: 650px; border: 0; border-radius: 10px; background: #dfe3e9; }
.sign-panel { position: sticky; top: 16px; padding: 22px; max-height: calc(100vh - 32px); overflow-y: auto; }
.progress-steps { display: grid; grid-template-columns: 26px 1fr 26px 1fr 26px; align-items: center; margin-bottom: 20px; }
.progress-steps span { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: #edf0f4; color: var(--muted); font-size: 10px; font-weight: 850; }
.progress-steps span.active { color: white; background: var(--success); }
.progress-steps span.done { color: var(--success); background: var(--success-soft); }
.progress-steps i { height: 2px; background: #edf0f4; }
.panel-block { padding: 18px 0; border-top: 1px solid var(--line); }
.panel-block:first-of-type { border-top: 0; }
.panel-block h2 { margin: 0 0 10px; font-size: 16px; }
.panel-block > p { color: var(--muted); font-size: 12px; }
.flow-hint { margin: 0 0 9px; color: var(--muted); font-size: 11px; }
.acceptance-box { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; color: var(--ink) !important; font-size: 12px !important; }
.otp-form { display: grid; gap: 9px; margin-top: 10px; }
#otp-code { text-align: center; font-size: 23px; letter-spacing: .25em; font-weight: 850; }
.inline-success { color: var(--success) !important; font-weight: 750; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; background: #edf0f4; border-radius: 9px; margin-bottom: 11px; }
.segmented button { min-height: 34px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 750; }
.segmented button.active { background: white; color: var(--ink); box-shadow: 0 2px 8px rgba(23,32,51,.08); }
#signature-canvas { display: block; width: 100%; height: 122px; border: 1px dashed var(--line-strong); border-radius: 9px; background: white; touch-action: none; cursor: crosshair; }
#drawn-signature .text-button { margin-top: 7px; font-size: 11px; }
.sign-panel > div > .danger-text { display: block; margin: 15px auto 0; font-size: 12px; }
#already-signed { text-align: center; padding: 30px 6px; }
#already-signed h2 { margin: 13px 0 4px; }
#already-signed p { color: var(--muted); margin: 0 0 18px; }
.signing-footer { width: min(1320px,calc(100% - 48px)); margin: 0 auto; padding: 25px 0 35px; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }

.verify-shell { min-height: 100vh; display: grid; align-content: center; justify-items: center; gap: 20px; padding: 40px 20px; background: #eef1f5; }
.brand.centered { justify-self: center; }
.verify-card { width: min(620px,100%); padding: 35px; text-align: center; }
.verify-card .eyebrow { margin-top: 15px; }
.verify-card h1 { margin: 7px 0 5px; }
.verify-card > p { color: var(--muted); }
.verify-card dl { text-align: left; }
.privacy-note { padding: 11px; border-radius: 8px; background: #f6f8fa; font-size: 11px; }

.toast-region { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast { min-width: 260px; max-width: 440px; padding: 13px 15px; border-radius: 9px; color: white; background: var(--success); box-shadow: var(--shadow); font-size: 13px; font-weight: 650; }
.toast.error { background: var(--danger); }

@media (max-width: 980px) {
  .topbar { grid-template-columns: 1fr auto; padding: 0 20px; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topnav { position: fixed; z-index: 20; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); justify-content: space-around; box-shadow: var(--shadow); }
  .topnav a { flex: 1; text-align: center; }
  .user-menu span { display: none; }
  .shell { padding-bottom: 110px; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .application-grid { grid-template-columns: 1fr; }
  .filter-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filter-search { grid-column: 1 / -1; }
  .form-grid.four { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .auth-shell { grid-template-columns: 1fr; gap: 35px; }
  .auth-brand { max-width: 700px; }
  .sign-layout { grid-template-columns: 1fr; }
  .sign-panel { position: static; max-height: none; }
  .document-viewer { min-height: 600px; }
  .document-viewer iframe { height: 70vh; min-height: 580px; }
}

@media (max-width: 640px) {
  .topbar { min-height: 62px; }
  .topbar .brand small { display: none; }
  .shell { width: min(100% - 24px,1240px); padding-top: 30px; }
  .page-heading h1 { font-size: 31px; }
  .split-heading { align-items: flex-start; flex-direction: column; }
  .metric-grid { gap: 10px; }
  .metric { padding: 15px; min-height: 120px; }
  .metric strong { font-size: 30px; }
  .filter-card { padding: 15px; }
  .filter-form { grid-template-columns: 1fr; }
  .filter-search { grid-column: auto; }
  .filter-actions { justify-content: stretch; }
  .filter-actions .button { flex: 1; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .table-card { border-radius: 12px; }
  th, td { padding: 13px 14px; }
  .form-section { grid-template-columns: 1fr; padding: 18px; }
  .form-grid.two, .form-grid.three, .form-grid.four { grid-template-columns: 1fr; }
  .signer-card { grid-template-columns: 29px 1fr 30px; padding: 12px; align-items: start; }
  .timeline-row { grid-template-columns: 30px 1fr auto; }
  .timeline-row .button { grid-column: 2 / -1; }
  .application-head { grid-template-columns: 42px 1fr; }
  .application-head .status { grid-column: 2; }
  .auth-shell { width: min(100% - 28px,1120px); padding: 35px 0; }
  .auth-brand h1 { font-size: 38px; }
  .auth-brand .feature-list { display: none; }
  .auth-card { padding: 24px; }
  .setup-notice { align-items: stretch; flex-direction: column; }
  .setup-notice .button { width: 100%; }
  .signing-header { padding: 0 14px; }
  .security-pill { display: none; }
  .sign-intro, .sign-layout, .signing-footer { width: calc(100% - 20px); }
  .sign-intro { padding-top: 25px; }
  .document-viewer { min-height: 340px; }
  .document-viewer iframe { min-height: 320px; height: 48vh; }
  .sign-panel { padding: 17px; }
  .primary-sign-action { position: sticky; z-index: 4; bottom: 10px; box-shadow: 0 12px 28px rgba(23,32,51,.28); }
  .signing-footer { flex-direction: column; gap: 3px; }
  .secret-panel, .dialog-backdrop { padding: 12px; }
  .secret-panel > div, .action-dialog { padding: 21px; }
  .secret-value > div { align-items: flex-start; flex-direction: column; }
}

.application-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin: 1rem 0; }
.credential-actions { display: flex; align-items: center; gap: .65rem; }
.break-word { overflow-wrap: anywhere; }
