/* Allekirjoitus - Sähköinen allekirjoituspalvelu */

:root {
    --brand-50: #eef2ff;
    --brand-100: #e0e7ff;
    --brand-200: #c7d2fe;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --brand-800: #3730a3;
    --brand-900: #312e81;
    --success-50: #f0fdf4;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --success-700: #15803d;
    --warning-50: #fffbeb;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --danger-50: #fef2f2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --danger-700: #b91c1c;
    --info-50: #eff6ff;
    --info-500: #3b82f6;
    --info-600: #2563eb;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
    --shadow-lg: 0 8px 12px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.06);
}

/* Override Pico defaults — compact sizing */
:root {
    --pico-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --pico-font-size: 87.5%;
    --pico-line-height: 1.5;
    --pico-border-radius: var(--radius-md);
    --pico-spacing: 0.75rem;
    --pico-form-element-spacing-vertical: 0.4rem;
    --pico-form-element-spacing-horizontal: 0.65rem;
    --pico-typography-spacing-vertical: 0.75rem;
    --pico-block-spacing-vertical: 0.75rem;
    --pico-block-spacing-horizontal: 1rem;
    --pico-grid-row-gap: 0.75rem;
    --pico-grid-column-gap: 0.75rem;
}

/* Global */
body {
    background: var(--gray-50);
    color: var(--gray-800);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 0.875rem;
}

h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.25rem; margin-bottom: 0.5rem; }
h3 { font-size: 1rem; margin-bottom: 0.4rem; }
h4 { font-size: 0.875rem; margin-bottom: 0.35rem; }
p { margin-bottom: 0.5rem; }

main.container {
    flex: 1;
    padding-top: 1rem;
    padding-bottom: 1.5rem;
}

/* Navigation */
nav.container-fluid {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    padding: 0.5rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav .brand {
    text-decoration: none;
    color: var(--brand-600) !important;
    font-size: 1rem;
    letter-spacing: -0.025em;
}

nav ul:last-child a {
    font-size: 0.8rem;
    color: var(--gray-600);
    font-weight: 500;
    transition: color 0.15s;
}

nav ul:last-child a:hover {
    color: var(--brand-600);
}

nav ul:last-child a.secondary {
    color: var(--gray-400);
}

nav ul:last-child a.secondary:hover {
    color: var(--danger-600);
}

/* Auth container */
.auth-container {
    max-width: 380px;
    margin: 2.5rem auto;
}

.auth-container article {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.auth-container article header {
    text-align: center;
    border: none;
    padding-bottom: 0.25rem;
}

.auth-container article header h2 {
    color: var(--gray-900);
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 0.15rem;
}

.auth-container article header p {
    color: var(--gray-500);
    font-size: 0.8rem;
}

/* Header row */
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.header-row h2,
.header-row h3 {
    margin: 0;
    color: var(--gray-900);
    font-weight: 700;
}

.header-row h2 {
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

/* Cards / Articles */
article {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

article header {
    border-bottom: 1px solid var(--gray-100);
    padding-bottom: 0.5rem;
}

article header h3 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-700);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Stat cards */
.stat-card {
    text-align: center;
    transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-card header {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    font-weight: 600;
    border: none;
    padding-bottom: 0;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
    color: var(--brand-600);
    letter-spacing: -0.03em;
    line-height: 1.2;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15em 0.55em;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-pending { background: var(--warning-50); color: var(--warning-600); }
.badge-partial { background: var(--info-50); color: var(--info-600); }
.badge-sent { background: var(--info-50); color: var(--info-600); }
.badge-viewed { background: #faf5ff; color: #7c3aed; }
.badge-signed { background: var(--success-50); color: var(--success-700); }
.badge-completed { background: var(--success-50); color: var(--success-700); }
.badge-declined { background: var(--danger-50); color: var(--danger-700); }
.badge-cancelled { background: var(--gray-100); color: var(--gray-500); }
.badge-created { background: var(--info-50); color: var(--info-600); }
.badge-email_sent { background: var(--brand-50); color: var(--brand-700); }
.badge-downloaded { background: #faf5ff; color: #7c3aed; }
.badge-draft { background: var(--gray-100); color: var(--gray-600); }
.badge-signing { background: var(--warning-50); color: var(--warning-600); }

/* Buttons */
[role="button"], button, input[type="submit"] {
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.45rem 1rem;
    transition: all 0.15s;
}

.btn-small {
    font-size: 0.72rem;
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
    background: white;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
}

.btn-small:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-900);
    box-shadow: var(--shadow-sm);
}

.btn-success {
    border-color: var(--success-500);
    color: var(--success-700);
    background: var(--success-50);
}

.btn-success:hover {
    background: var(--success-600);
    color: #fff;
    border-color: var(--success-600);
}

/* Flash messages */
.flash {
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 0.8rem;
}

.flash-success {
    background: var(--success-50);
    color: var(--success-700);
    border: 1px solid #bbf7d0;
}

.flash-error {
    background: var(--danger-50);
    color: var(--danger-700);
    border: 1px solid #fecaca;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2rem 1.5rem;
    color: var(--gray-500);
}

.empty-state p {
    margin-bottom: 1rem;
}

/* Tables */
table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.8rem;
}

table thead th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    font-weight: 600;
    border-bottom: 2px solid var(--gray-200);
    padding: 0.5rem 0.65rem;
}

table tbody td {
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

table tbody tr:hover {
    background: var(--gray-50);
}

table tbody tr:last-child td {
    border-bottom: none;
}

.overflow-auto {
    overflow-x: auto;
}

/* Signer rows in upload form */
.signer-row {
    align-items: end;
}

.signer-actions {
    display: flex;
    align-items: center;
    padding-bottom: 0.25rem;
}

.signer-actions button {
    margin: 0;
    width: auto;
    padding: 0.35rem 0.75rem;
}

/* Audit timeline */
.audit-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.audit-entry {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--gray-100);
    flex-wrap: wrap;
}

.audit-entry:last-child {
    border-bottom: none;
}

.audit-time {
    font-size: 0.72rem;
    color: var(--gray-400);
    min-width: 120px;
    font-variant-numeric: tabular-nums;
}

.audit-who {
    font-weight: 600;
    color: var(--gray-700);
}

.audit-ip {
    font-size: 0.72rem;
    color: var(--gray-400);
}

.ua-cell {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.68rem;
    color: var(--gray-400);
}

/* =========================================
   Signing Page Styles
   ========================================= */

/* Signature panel — normal flow, no sticky */
#signature-panel {
    z-index: 10;
}

.signature-tabs {
    display: flex;
    gap: 0.35rem;
}

.tab-btn {
    background: transparent;
    border: 1px solid var(--gray-300);
    padding: 0.3rem 0.85rem;
    border-radius: 9999px;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--gray-500);
    font-weight: 500;
    width: auto;
    margin: 0;
    transition: all 0.15s;
}

.tab-btn.active {
    background: var(--brand-600);
    color: #fff;
    border-color: var(--brand-600);
}

.tab-btn:hover:not(.active) {
    border-color: var(--gray-400);
    color: var(--gray-700);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Signature pad */
.signature-pad-wrapper {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-md);
    background: #fff;
    margin-bottom: 0.35rem;
    transition: border-color 0.15s;
}

.signature-pad-wrapper:hover {
    border-color: var(--brand-500);
}

#signature-pad {
    width: 100%;
    height: 150px;
    display: block;
}

#clear-signature {
    width: auto;
    margin: 0;
}

/* Typed signature */
.typed-signature-preview {
    font-family: 'Dancing Script', cursive;
    font-size: 2rem;
    color: var(--brand-800);
    padding: 0.75rem;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-md);
    background: #fff;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sign button — success-600 on white only reaches 3.3:1, so the CTA uses the darker step */
.btn-sign {
    background: var(--success-700) !important;
    border-color: var(--success-700) !important;
    color: #fff !important;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: var(--radius-md);
}

.btn-sign:hover {
    background: #126c33 !important;
    border-color: #126c33 !important;
}

/* Destructive confirm */
.btn-danger {
    background: var(--danger-700) !important;
    border-color: var(--danger-700) !important;
    color: #fff !important;
    font-weight: 600;
}

.btn-danger:hover {
    background: #991b1b !important;
    border-color: #991b1b !important;
}

/* Done card */
.done-card {
    text-align: center;
    max-width: 420px;
    margin: 2.5rem auto;
    padding: 2rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.done-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.done-success {
    color: var(--success-500);
}

.done-declined {
    color: var(--danger-500);
}

/* =========================================
   Proxy / Valtakirja Styles
   ========================================= */

.form-hint {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: -0.35rem;
    margin-bottom: 0.65rem;
}

.scope-cell {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.proxy-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
}

.proxy-actions a[role="button"],
.proxy-actions button {
    width: auto;
    margin: 0;
}

.send-signing-details {
    flex-basis: 100%;
}

.send-signing-details summary {
    width: auto;
    display: inline-block;
}

.signing-form {
    margin-top: 0.75rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

/* Proxy document preview */
.proxy-preview {
    padding: 0;
}

.proxy-document {
    max-width: 650px;
    margin: 0 auto;
    padding: 2rem;
    background: #fff;
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.7;
    font-size: 0.9rem;
}

.proxy-doc-header {
    text-align: center;
    margin-bottom: 1.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--brand-600);
}

.proxy-doc-header h2 {
    font-size: 1.5rem;
    letter-spacing: 6px;
    margin-bottom: 0;
    color: var(--brand-800);
}

.proxy-doc-section {
    margin-bottom: 1.25rem;
}

.proxy-doc-section h4 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--brand-700);
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 0.2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.proxy-doc-table {
    width: 100%;
    border-collapse: collapse;
}

.proxy-doc-table td {
    padding: 0.15rem 0.4rem;
    vertical-align: top;
}

.proxy-doc-table td:first-child {
    width: 100px;
    color: var(--gray-500);
}

.proxy-doc-signatures {
    margin-top: 2rem;
    padding-top: 0.75rem;
}

.signature-line {
    text-align: center;
    margin-top: 1.5rem;
}

.sig-line {
    border-bottom: 1px solid var(--gray-800);
    height: 40px;
    margin-bottom: 0.35rem;
}

.signature-line small {
    color: var(--gray-500);
}

/* Footer */
footer.container {
    text-align: center;
    padding: 1rem 0;
    border-top: 1px solid var(--gray-200);
    margin-top: auto;
}

footer.container small {
    color: var(--gray-400);
    font-size: 0.72rem;
}

/* Forms */
label {
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--gray-700);
}

input, select, textarea {
    border-radius: var(--radius-md) !important;
    border-color: var(--gray-300) !important;
    font-size: 0.8rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--brand-500) !important;
    box-shadow: none !important;
}

/* Keyboard focus needs a ring that actually reads against white (>= 3:1). */
:focus-visible {
    outline: 3px solid var(--brand-600);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--brand-600);
    outline-offset: 1px;
    box-shadow: none !important;
}

small {
    color: var(--gray-500);
    font-size: 0.72rem;
}

/* Links */
a {
    color: var(--brand-600);
    font-weight: 500;
}

a:hover {
    color: var(--brand-700);
}

/* Blockquote */
blockquote {
    border-left: 3px solid var(--brand-500);
    background: var(--gray-50);
    padding: 0.65rem 1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 0.35rem 0 0.75rem;
    font-style: normal;
    color: var(--gray-700);
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    #signature-pad {
        height: 120px;
    }

    .typed-signature-preview {
        font-size: 1.5rem;
    }

    nav.container-fluid {
        padding: 0.5rem 0.75rem;
    }

    .auth-container {
        margin: 1.5rem auto;
    }
}

/* =========================================
   Contract / Sopimus Styles
   ========================================= */

.contract-details {
    margin-bottom: 1rem;
}

.contract-details > summary {
    width: auto;
    display: inline-block;
    margin-bottom: 0.75rem;
}

.contract-details > article:first-of-type {
    margin-top: 0;
}

.price-field {
    margin-bottom: 0.5rem;
}

/* =========================================
   Public signing page (/sign/{token})
   -----------------------------------------
   The one screen a customer ever sees, usually once, usually on a phone. It opts out
   of the compact back-office scale: 16px base, 44px targets, one decision per step.
   ========================================= */

.sign-page {
    font-size: 16px;
    background: var(--gray-50);
    color: var(--gray-800);
}

.sign-page .container {
    max-width: 40rem;
}

/* Sender identity — who is asking, answered before anything else */
.sign-header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 1.25em 0;
    margin-bottom: 2em;
}

.sign-sender {
    margin: 0 0 0.15em;
    font-size: 1.0625em;
    line-height: 1.3;
    color: var(--gray-900);
}

.sign-sender-meta {
    display: inline-block;
    margin-left: 0.6em;
    font-size: 0.8125em;
    font-weight: 500;
    color: var(--gray-600);
}

.sign-sender-note {
    margin: 0;
    font-size: 0.9375em;
    color: var(--gray-600);
}

.sign-main {
    padding-bottom: 4em;
}

.sign-title {
    font-size: 1.75em;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 1.5em;
    text-wrap: balance;
}

/* Steps — sequence carries meaning here, so the numbers stay */
.sign-step {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.75em;
    margin-bottom: 1.25em;
    box-shadow: var(--shadow-sm);
}

.sign-step h2 {
    font-size: 1.125em;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--gray-900);
    margin: 0 0 0.5em;
}

.sign-step p {
    font-size: 0.9375em;
    line-height: 1.6;
    color: var(--gray-700);
    max-width: 34em;
    margin: 0 0 1em;
}

.sign-step-quiet {
    background: transparent;
    border-style: dashed;
    box-shadow: none;
}

.sign-step-quiet h2 {
    font-size: 1em;
    color: var(--gray-700);
}

/* Open-the-document link: the most important action in step 1 */
.sign-page .sign-open {
    display: inline-flex;
    align-items: baseline;
    gap: 0.5em;
    min-height: 44px;
    padding: 0.7em 1.4em;
    font-size: 0.9375em;
    width: auto;
    margin: 0;
}

.sign-open-hint {
    font-size: 0.8125em;
    font-weight: 500;
    opacity: 0.75;
}

/* The attestation — a real target, not a 14px box */
.sign-page .sign-confirm {
    display: flex;
    align-items: flex-start;
    gap: 0.75em;
    margin: 1.75em 0 0;
    padding: 0.85em 1em;
    background: var(--brand-50);
    border: 1px solid var(--brand-200);
    border-radius: var(--radius-md);
    font-size: 0.9375em;
    font-weight: 500;
    color: var(--gray-800);
    cursor: pointer;
    min-height: 44px;
}

.sign-page .sign-confirm input[type="checkbox"] {
    flex: 0 0 auto;
    width: 1.5em;
    height: 1.5em;
    margin: 0;
    font-size: 1em;
    cursor: pointer;
}

.sign-gate-hint {
    font-size: 0.9375em;
    color: var(--gray-600);
    margin: 0 0 1em;
}

/* The signature fieldset carries the gate: disabled means disabled for everyone */
.sign-page #signature-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

.sign-page #signature-fieldset:disabled {
    opacity: 0.45;
}

.sign-page .signature-tabs {
    gap: 0.5em;
    margin-bottom: 1em;
}

/* Control borders on this page carry meaning, so they clear the 3:1 non-text floor
   (gray-500 = 4.83:1 on white; gray-300 and gray-400 do not). */
.sign-page .tab-btn {
    min-height: 44px;
    padding: 0.5em 1.25em;
    font-size: 0.9375em;
    color: var(--gray-700);
    border-color: var(--gray-500);
}

.sign-page input,
.sign-page textarea {
    border-color: var(--gray-500) !important;
}

.sign-page .signature-pad-wrapper {
    border: 1px solid var(--gray-500);
    background: #fff;
    margin-bottom: 0.75em;
}

.sign-page .signature-pad-wrapper:hover {
    border-color: var(--gray-500);
}

.sign-page #signature-pad {
    height: 180px;
    touch-action: none;
}

.sign-page #clear-signature,
.sign-page #btn-decline {
    min-height: 44px;
    padding: 0.6em 1.25em;
    font-size: 0.9375em;
    width: auto;
    margin: 0;
}

.sign-page #typed-signature {
    font-size: 1em;
    min-height: 44px;
    margin-bottom: 0.75em;
}

.sign-page label[for="typed-signature"],
.sign-page label[for="decline-reason"] {
    font-size: 0.9375em;
    font-weight: 600;
    color: var(--gray-800);
}

.sign-page .typed-signature-preview {
    border: 1px solid var(--gray-300);
    min-height: 80px;
}

.sign-binding {
    font-size: 0.875em !important;
    color: var(--gray-600) !important;
    margin: 1.5em 0 0.75em !important;
}

.sign-page .btn-sign {
    display: block;
    width: 100%;
    min-height: 52px;
    font-size: 1em;
    padding: 0.85em 1.5em;
    margin: 0;
}

/* Errors speak where the problem is, not in an OS dialog */
.sign-error {
    margin: 1em 0 0;
    padding: 0.75em 1em;
    background: var(--danger-50);
    border: 1px solid var(--danger-500);
    border-radius: var(--radius-md);
    color: var(--danger-700);
    font-size: 0.9375em;
    font-weight: 500;
}

.sign-alert {
    padding: 0.85em 1em;
    background: var(--warning-50);
    border: 1px solid var(--warning-600);
    border-radius: var(--radius-md);
    color: #7a4405;
    font-size: 0.9375em;
    margin-bottom: 1.25em;
}

.sign-footer {
    margin-top: 2em;
    padding-top: 1.5em;
    border-top: 1px solid var(--gray-200);
}

.sign-footer p {
    font-size: 0.8125em;
    line-height: 1.6;
    color: var(--gray-600);
    margin: 0 0 0.5em;
    max-width: 36em;
}

/* Decline dialog */
.sign-page #decline-dialog article {
    max-width: 26em;
}

.sign-page #decline-dialog h2 {
    font-size: 1.125em;
    margin: 0;
}

.sign-page #decline-dialog footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75em;
}

.sign-page #decline-dialog footer button {
    flex: 1 1 12em;
    min-height: 44px;
    margin: 0;
    font-size: 0.9375em;
}

/* Terminal states */
.sign-page .done-card {
    max-width: 30em;
    margin: 3em auto;
    padding: 2.5em 2em;
}

.sign-page .done-card h1 {
    font-size: 1.5em;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin: 0 0 0.75em;
    color: var(--gray-900);
    text-wrap: balance;
}

.sign-page .done-card p {
    font-size: 0.9375em;
    line-height: 1.6;
    color: var(--gray-700);
    margin: 0 0 0.85em;
}

.sign-page .done-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.25em;
    height: 3.25em;
    margin: 0 auto 1.25em;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-600);
}

.sign-page .done-icon svg {
    width: 1.75em;
    height: 1.75em;
}

.sign-page .done-success {
    background: var(--success-50);
    color: var(--success-700);
}

.sign-page .done-declined {
    background: var(--danger-50);
    color: var(--danger-700);
}

.sign-page .done-download {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 0.8em 1.5em;
    margin: 1.5em 0 1em;
    font-size: 0.9375em;
}

.done-meta,
.done-contact {
    font-size: 0.8125em !important;
    color: var(--gray-600) !important;
    margin-bottom: 0 !important;
}

.done-contact {
    margin-top: 1.5em !important;
    padding-top: 1.25em;
    border-top: 1px solid var(--gray-200);
}

.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: 640px) {
    .sign-step {
        padding: 1.25em;
    }

    .sign-title {
        font-size: 1.5em;
    }

    .sign-page #signature-pad {
        height: 160px;
    }

    .sign-page .sign-open,
    .sign-page #clear-signature,
    .sign-page #btn-decline {
        display: block;
        width: 100%;
        text-align: center;
    }
}
