/*
 * 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 {
    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: #777d87;
    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;
}

.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;
}

.details {
    margin: 28px 0;
}

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

.details dt {
    margin-bottom: 6px;
    color: #777d87;
    font-size: 12px;
}

.details dd {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.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;
}

.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;
}

.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-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: #777d87;
    font-size: 12px;
    text-align: center;
}

.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;
    }

    .pdf-shell {
        height: 70vh;
        min-height: 500px;
    }

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

.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;
    }
}
