/*
 * Canonical OnayDOC public UI reference.
 * Preserve this neutral monochrome visual language and font stack for future
 * pages. Keep code and Figma screens synchronized under docs/design/.
 */

:root {
    color-scheme: light;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f5f6f8;
    color: #15171a;
}

button,
a,
input,
summary {
    font: inherit;
}

.hidden {
    display: none !important;
}

.page {
    width: min(1500px, 100%);
    min-height: calc(100vh - 76px);
    margin: 0 auto;
    padding: 24px 24px 32px;
}

.secure-badge,
.status-badge {
    border: 1px solid #dfe2e7;
    border-radius: 999px;
    background: #fff;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
}

.workspace {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        380px;
    gap: 20px;
    align-items: start;
}

.document-panel,
.signing-panel,
.state-card {
    border: 1px solid #e1e4e8;
    border-radius: 22px;
    background: #fff;
    box-shadow:
        0 12px 40px
        rgba(18, 25, 38, 0.06);
}

.document-panel {
    overflow: hidden;
}

.panel-header {
    min-height: 92px;
    padding: 20px 24px;
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e8eaed;
}

.panel-header h1 {
    margin: 4px 0 0;
    font-size: 20px;
    line-height: 1.3;
}

.eyebrow {
    color: #686e77;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pdf-shell {
    height: calc(100vh - 205px);
    min-height: 650px;
    background: #dfe2e6;
}

.pdf-shell iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.mobile-pdf-viewer {
    display: none;
}

.mobile-pdf-viewer__toolbar,
.mobile-pdf-viewer__navigation {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.mobile-pdf-viewer__toolbar {
    border-bottom: 1px solid #e1e4e8;
    padding: 14px 16px;
}

.mobile-pdf-viewer__toolbar strong {
    font-size: 14px;
}

.mobile-pdf-viewer__toolbar span {
    color: #686e77;
    font-size: 12px;
    font-weight: 700;
}

.mobile-pdf-viewer__stage {
    min-height: 420px;
    display: grid;
    place-items: center;
    background: #dfe2e6;
    padding: 12px;
}

.mobile-pdf-viewer__stage p {
    margin: 0;
    color: #4f555e;
    font-size: 13px;
    text-align: center;
}

.mobile-pdf-viewer__stage img {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid #d7dbe1;
    background: #fff;
    box-shadow: 0 6px 22px rgba(18, 25, 38, 0.12);
}

.mobile-pdf-viewer__navigation {
    border-top: 1px solid #e1e4e8;
    padding: 12px 16px 8px;
}

.pdf-navigation-button {
    min-height: 44px;
    border: 1px solid #d7dbe1;
    border-radius: 12px;
    background: #fff;
    color: #15171a;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 700;
}

.pdf-navigation-button:disabled {
    cursor: default;
    opacity: 0.45;
}

.open-pdf-button {
    min-height: 44px;
    margin: 0 16px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #15171a;
    color: #fff;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.signing-panel {
    position: sticky;
    top: 20px;
    padding: 28px;
}

.signing-panel h2 {
    margin:
        8px 0
        10px;
    font-size: 26px;
    letter-spacing: -0.03em;
}

.muted,
.security-note {
    color: #686e77;
    line-height: 1.55;
}

.signer-summary {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 22px 0;
}

.signer-summary div {
    min-width: 0;
    border: 1px solid #eceef1;
    border-radius: 12px;
    background: #f8f9fa;
    padding: 12px;
}

.signer-summary dt,
.details dt {
    margin-bottom: 6px;
    color: #686e77;
    font-size: 12px;
}

.signer-summary dd,
.details dd {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.details {
    margin: 12px 0 0;
}

.details div {
    padding: 14px 0;
    border-bottom: 1px solid #eceef1;
}

.hash {
    overflow-wrap: anywhere;
    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        monospace;
    font-size: 11px !important;
    font-weight: 500 !important;
}

.primary-button {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 14px;
    background: #15171a;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.primary-button:disabled {
    cursor: wait;
    opacity: 0.55;
}

.secondary-button {
    min-height: 48px;
    margin-top: 24px;
    border: 1px solid #d7dbe1;
    border-radius: 14px;
    background: #fff;
    color: #15171a;
    padding: 0 18px;
    cursor: pointer;
    font-weight: 700;
}

.secondary-button:hover {
    background: #f0f2f5;
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.egov-open-button:focus-visible,
.token-form input:focus-visible,
.technical-details summary:focus-visible {
    outline: 3px solid #4f555e;
    outline-offset: 3px;
}

.state-card:focus,
.egov-flow:focus,
#signing-panel-title:focus {
    outline: 3px solid #4f555e;
    outline-offset: 4px;
}

.security-note {
    margin: 16px 0 0;
    font-size: 12px;
    text-align: center;
}

.action-message {
    margin-bottom: 16px;
    border-radius: 14px;
    background: #f2f4f6;
    padding: 14px;
    font-size: 13px;
    line-height: 1.5;
}

.technical-details {
    margin-top: 22px;
    border-top: 1px solid #eceef1;
    padding-top: 18px;
}

.technical-details summary {
    border-radius: 8px;
    color: #4f555e;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.technical-details[open] summary {
    color: #15171a;
}

.egov-flow {
    margin-bottom: 16px;
    border: 1px solid #dfe2e7;
    border-radius: 16px;
    background: #f8f9fa;
    padding: 16px;
}

.egov-flow__header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.egov-flow.is-success {
    border-color: #b7dfc5;
    background: #f3fbf6;
}

.egov-flow.is-error {
    border-color: #efc5c5;
    background: #fff7f7;
}

.egov-flow__mark {
    min-width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #15171a;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.egov-flow h3 {
    margin: 2px 0 5px;
    font-size: 16px;
}

.egov-flow__header p {
    margin: 0;
    color: #686e77;
    font-size: 13px;
    line-height: 1.45;
}

.egov-verification-badge {
    width: fit-content;
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #9fd2b1;
    border-radius: 999px;
    background: #e9f7ee;
    color: #185c35;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 800;
}

.egov-flow__steps {
    display: grid;
    gap: 7px;
    margin: 16px 0 0;
    padding-left: 22px;
    color: #4f555e;
    font-size: 12px;
    line-height: 1.45;
}

.egov-flow__actions {
    margin-top: 16px;
    display: grid;
    gap: 10px;
}

.egov-open-button {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: #15171a;
    color: #fff;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.egov-open-button:hover {
    background: #292c31;
}

.egov-open-button--secondary {
    border: 1px solid #d7dbe1;
    background: #fff;
    color: #15171a;
}

.egov-open-button--secondary:hover {
    background: #f0f2f5;
}

.egov-flow__expiry {
    margin: 12px 0 0;
    color: #686e77;
    font-size: 12px;
    text-align: center;
}

.egov-return-button {
    width: 100%;
    margin-top: 12px;
}

.state-card {
    width: min(520px, 100%);
    margin: 14vh auto 0;
    padding: 44px;
    text-align: center;
}

.state-card h1 {
    margin: 20px 0 10px;
}

.state-card p {
    margin: 0;
    color: #686e77;
    line-height: 1.5;
}

.token-card {
    width: min(600px, 100%);
    text-align: left;
}

.token-card h1 {
    margin-top: 10px;
}

.token-form {
    margin-top: 28px;
    display: grid;
    gap: 12px;
}

.token-form label {
    font-size: 13px;
    font-weight: 700;
}

.token-form input {
    width: 100%;
    min-height: 52px;
    border: 1px solid #d7dbe1;
    border-radius: 14px;
    background: #fff;
    color: #15171a;
    padding: 0 16px;
    outline: none;
}

.token-form input:focus {
    border-color: #15171a;
    box-shadow: 0 0 0 3px rgba(21, 23, 26, 0.1);
}

.token-form__error {
    color: #a12828 !important;
    font-size: 13px;
}

.token-card .security-note {
    margin-top: 18px;
    text-align: left;
}

.spinner {
    width: 38px;
    height: 38px;
    margin: 0 auto;
    border: 3px solid #e1e4e8;
    border-top-color: #15171a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.state-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #15171a;
    color: #fff;
    font-weight: 800;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 900px) {
    .page {
        padding:
            0 14px
            24px;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    .signing-panel {
        position: static;
        order: -1;
        padding: 22px;
    }

    .pdf-shell {
        height: auto;
        min-height: 0;
    }

    .pdf-shell iframe {
        display: none;
    }

    .mobile-pdf-viewer {
        display: block;
    }

    .secure-badge {
        font-size: 11px;
    }

    .signer-summary {
        margin: 18px 0;
    }
}

.egov-flow__qr-panel {
    display: none;
}

.egov-flow__qr-panel.hidden {
    display: none;
}

.egov-flow__qr-image {
    width: min(100%, 320px);
    height: auto;
    display: block;
    border-radius: 12px;
    background: #fff;
}

.egov-flow__qr-panel p {
    margin: 0;
    color: #686e77;
    font-size: 12px;
    line-height: 1.45;
    text-align: center;
}

@media (min-width: 768px) {
    .egov-flow__qr-panel {
        margin-top: 16px;
        display: grid;
        place-items: center;
        gap: 10px;
        border: 1px solid #e3e6eb;
        border-radius: 14px;
        background: #fff;
        padding: 16px;
    }

    .egov-flow__qr-panel.hidden {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation: none;
    }
}
.signing-terms-consent {
    align-items: flex-start;
    background: #f8f9fa;
    border: 1px solid #dfe2e7;
    border-radius: 14px;
    color: #34383e;
    display: flex;
    font-size: 0.9rem;
    gap: 0.7rem;
    line-height: 1.5;
    margin: 1rem 0;
    padding: 0.9rem 1rem;
}

.signing-terms-consent input {
    flex: 0 0 auto;
    height: 1.1rem;
    margin-top: 0.15rem;
    width: 1.1rem;
}

.signing-terms-consent a {
    color: #15171a;
    font-weight: 700;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
