/*
 * NIZU Sign — the signing screen (M3), iOS 26 style, for the public page and
 * the page inside NIZU. Surfaces come from the shared --ios26-* tokens (which
 * re-tune under body.color-1E202D); the action colours below are NIZU Sign's
 * own because the token accent puts white text at ~3:1 in light mode.
 */

.nzs-body,
.nzs-in-app {
    --nzs-btn: #2f5fd8;          /* white on it: 5.6:1 */
    --nzs-btn-hover: #2a55c4;
    --nzs-link: #2f5fd8;         /* on white: 5.6:1 */
    --nzs-danger: #c4001a;       /* white on it: 6.3:1, on white: 6.3:1 */
    --nzs-danger-text: #c4001a;
    --nzs-ok: #17703d;          /* 5.5:1 on the light grey rows */
    --nzs-card: #ffffff;
    --nzs-page-bg: #f2f2f7;
    --nzs-ink-on-paper: #0b1f44;
}
body.color-1E202D.nzs-body,
body.color-1E202D .nzs-in-app {
    --nzs-link: #8aa4ff;         /* on the dark card: 5.7:1 */
    --nzs-danger-text: #ff8a80;  /* on the dark card: 6:1 */
    --nzs-ok: #4cd480;
    --nzs-card: #23262f;
    --nzs-page-bg: #16181d;
}

/* ---------------------------------------------------------------- public page */

html, body.nzs-body { margin: 0; min-height: 100%; }
body.nzs-body {
    background: var(--nzs-page-bg);
    color: var(--ios26-text);
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}
.nzs-top {
    display: flex;
    justify-content: center;
    padding: max(18px, env(safe-area-inset-top)) 16px 6px;
}
.nzs-logo img { max-height: 34px; max-width: 180px; width: auto; }
.nzs-logo .nizu-logo-stack { position: relative; display: inline-block; }
.nzs-logo .nizu-logo-dark { display: none; }
body.color-1E202D .nzs-logo .nizu-logo-dark { display: inline; }
body.color-1E202D .nzs-logo .nizu-logo-light { display: none; }
.nzs-main { padding: 8px 16px 140px; }
.nzs-foot {
    padding: 0 16px calc(24px + env(safe-area-inset-bottom));
    color: var(--ios26-muted);
    font-size: 12px;
    text-align: center;
}
.nzs-in-app .nzs-back {
    display: inline-block;
    margin: 0 0 14px;
    color: var(--ios26-text);
    font-size: 15px;
}
.nzs-in-app .nzs-back span { color: var(--nzs-link); font-size: 20px; line-height: 1; }

/* ---------------------------------------------------------------- cards */

.nzs { max-width: 560px; margin: 0 auto; color: var(--ios26-text); }
/* the script shows and hides with the hidden attribute; display rules below must not undo it */
.nzs [hidden] { display: none !important; }
.nzs-step[data-step="sign"] { max-width: 920px; margin: 0 auto; }
.nzs:has(.nzs-step[data-step="sign"]:not([hidden])) { max-width: 920px; }
.nzs-card {
    background: var(--nzs-card);
    border-radius: 24px;
    padding: 28px 24px 22px;
    box-shadow: var(--ios26-shadow-1);
    text-align: center;
}
.nzs h1, .nzs h2, .nzs h3 {
    margin: 0 0 10px;
    color: var(--ios26-text);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    outline: none;
}
.nzs h1 { font-size: 26px; }
.nzs h2 { font-size: 24px; }
.nzs h3 { font-size: 19px; text-align: center; }
.nzs-eyebrow {
    margin: 0 0 6px;
    color: var(--ios26-muted);
    font-size: 15px;
}
.nzs-lead {
    margin: 0 0 18px;
    color: var(--ios26-muted);
    font-size: 16px;
}
.nzs-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 20px;
    background: var(--ios26-accent-soft);
    color: var(--nzs-link);
}
.nzs-badge-ok { background: color-mix(in srgb, var(--nzs-ok) 16%, transparent); color: var(--nzs-ok); }
.nzs-badge-stop { background: color-mix(in srgb, var(--nzs-danger-text) 16%, transparent); color: var(--nzs-danger-text); }
.nzs-icon { width: 32px; height: 32px; }
.nzs-quote {
    margin: 0 0 18px;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--ios26-fill);
    color: var(--ios26-text);
    font-size: 15px;
    text-align: left;
    white-space: normal;
}
.nzs-facts {
    list-style: none;
    margin: 0 0 22px;
    padding: 0;
    border-radius: 16px;
    background: var(--ios26-fill);
    text-align: left;
}
.nzs-facts li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ios26-hairline);
    font-size: 15px;
}
.nzs-facts li:last-child { border-bottom: 0; }
.nzs-facts span { color: var(--ios26-muted); }
.nzs-facts strong { color: var(--ios26-text); font-weight: 600; text-align: right; }
.nzs-fine {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    justify-content: center;
    margin: 16px 0 0;
    color: var(--ios26-muted);
    font-size: 13px;
    text-align: left;
}
.nzs-fine .nzs-icon { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 1px; }
.nzs-message { margin-top: 24px; }

/* ---------------------------------------------------------------- buttons */

.nzs-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    margin: 10px 0 0;
    padding: 12px 20px;
    border: 0;
    border-radius: 14px;
    font: inherit;
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, transform .15s var(--ios26-spring), opacity .15s ease;
    -webkit-tap-highlight-color: transparent;
}
.nzs-btn:active { transform: scale(.98); }
.nzs-btn:focus-visible { outline: 3px solid var(--ios26-accent-ring); outline-offset: 2px; }
.nzs-btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.nzs-btn.is-busy { opacity: .7; cursor: progress; }
.nzs-btn-primary { background: var(--nzs-btn); color: #fff; }
.nzs-btn-primary:hover:not([disabled]) { background: var(--nzs-btn-hover); color: #fff; }
.nzs-btn-plain { background: transparent; color: var(--nzs-link); }
.nzs-btn-plain:hover:not([disabled]) { background: var(--ios26-fill); }
.nzs-btn-danger { background: var(--nzs-danger); color: #fff; }
.nzs-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--nzs-link);
    font: inherit;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
}
.nzs-link:hover { text-decoration: underline; color: var(--nzs-link); }
.nzs-link-danger { color: var(--nzs-danger-text); }
.nzs-link-danger:hover { color: var(--nzs-danger-text); }

.nzs-note {
    margin: 12px 0 0;
    color: var(--ios26-muted);
    font-size: 14px;
}
.nzs-note.is-error { color: var(--nzs-danger-text); }

/* ---------------------------------------------------------------- code */

.nzs-pin {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 4px auto 0;
    cursor: text;
}
.nzs-pin input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    border: 0;
    font-size: 16px; /* no zoom on iOS */
    caret-color: transparent;
}
.nzs-pin-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 56px;
    border-radius: 14px;
    background: var(--ios26-fill);
    box-shadow: inset 0 0 0 1px var(--ios26-hairline-strong);
    color: var(--ios26-text);
    font-size: 26px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: box-shadow .15s ease, transform .2s var(--ios26-spring);
}
.nzs-pin-box.is-filled { transform: translateY(-1px); }
.nzs-pin-box.is-next { box-shadow: inset 0 0 0 2px var(--nzs-link); }
@media (max-width: 380px) {
    .nzs-pin { gap: 6px; }
    .nzs-pin-box { width: 40px; height: 52px; }
}

/* ---------------------------------------------------------------- sign */

.nzs-sign-head { padding: 6px 2px 14px; text-align: center; }
.nzs-sign-head .nzs-lead { margin-bottom: 10px; }
.nzs-head-actions { display: flex; justify-content: center; gap: 22px; }
.nzs-pages { display: flex; flex-direction: column; gap: 18px; }
.nzs-page-wrap { width: 100%; }
.nzs-page {
    position: relative;
    width: 100%;
    container-type: inline-size; /* field text scales with the page, like the paper */
    overflow: hidden;
    border-radius: 6px;
    background: #fff; /* paper stays white in both themes */
    box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 10px 30px rgba(0, 0, 0, .10);
}
.nzs-page img { display: block; width: 100%; height: 100%; }
.nzs-layer { position: absolute; inset: 0; }
.nzs-page-num {
    margin-top: 6px;
    color: var(--ios26-muted);
    font-size: 12px;
    text-align: center;
}

.nzs-field {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0 4px;
    border: 1.5px dashed #2f5fd8;
    border-radius: 6px;
    background: rgba(47, 95, 216, .12);
    color: #0b1f44; /* on white paper: always dark */
    font: 600 clamp(7px, 1.9cqw, 13px)/1.1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    white-space: nowrap;
    cursor: pointer;
    overflow: hidden;
    animation: nzs-pulse 2.4s ease-in-out infinite;
    -webkit-tap-highlight-color: transparent;
}
.nzs-field:focus-visible { outline: 3px solid rgba(47, 95, 216, .45); outline-offset: 1px; }
.nzs-field.is-optional { border-color: #6b7a99; background: rgba(107, 122, 153, .10); animation: none; }
.nzs-field.is-filled {
    border: 1px solid rgba(31, 138, 76, .55);
    background: rgba(31, 138, 76, .06);
    animation: none;
}
.nzs-field img { max-width: 100%; max-height: 100%; object-fit: contain; }
.nzs-field-date { cursor: default; }
.nzs-field-checkbox { font-size: 14px; }
.nzs-field-tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes nzs-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(47, 95, 216, 0); }
    50% { box-shadow: 0 0 0 4px rgba(47, 95, 216, .18); }
}
@media (prefers-reduced-motion: reduce) {
    .nzs-field { animation: none; }
    .nzs-btn, .nzs-pin-box { transition: none; }
}

/* the action bar: frosted glass, pinned to the bottom */
.nzs-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--ios26-surface-strong);
    -webkit-backdrop-filter: var(--ios26-blur);
    backdrop-filter: var(--ios26-blur);
    border-top: 1px solid var(--ios26-hairline);
}
.nzs-bar-inner { max-width: 560px; margin: 0 auto; }
.nzs-bar .nzs-btn { margin-top: 6px; }
.nzs-progress {
    display: block;
    color: var(--ios26-muted);
    font-size: 13px;
    text-align: center;
}
.nzs-consent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 2px 0 0;
    color: var(--ios26-text);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}
.nzs-consent input { flex: 0 0 22px; width: 22px; height: 22px; margin: 0; accent-color: var(--nzs-btn); }
/* inside NIZU the page scrolls in its own container, beside the sidebar: the bar sticks to it */
.nzs-in-app .nzs-bar {
    position: sticky;
    margin: 18px -4px 0;
    border: 1px solid var(--ios26-hairline);
    border-radius: 20px;
    box-shadow: var(--ios26-shadow-1);
}

/* ---------------------------------------------------------------- sheets */

.nzs-scrim {
    position: fixed;
    inset: 0;
    z-index: 1060;
    background: rgba(0, 0, 0, .35);
}
.nzs-sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 1061;
    width: min(560px, 100%);
    max-height: 92vh;
    overflow: auto;
    box-sizing: border-box;
    padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    background: var(--nzs-card);
    box-shadow: var(--ios26-shadow-2);
    color: var(--ios26-text);
    transform: translateX(-50%);
    animation: nzs-up .28s var(--ios26-ease);
}
.nzs-sheet[hidden], .nzs-scrim[hidden] { display: none; }
@keyframes nzs-up { from { transform: translate(-50%, 24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
html.nzs-sheet-open, html.nzs-sheet-open body { overflow: hidden; }
.nzs-grabber {
    width: 38px;
    height: 5px;
    margin: 0 auto 12px;
    border-radius: 999px;
    background: var(--ios26-hairline-strong);
}
.nzs-sheet .nzs-lead { text-align: center; }
.nzs-sheet-actions { display: flex; gap: 10px; margin-top: 8px; }
.nzs-sheet-actions .nzs-btn { flex: 1 1 0; }
.nzs-seg {
    display: flex;
    gap: 4px;
    padding: 3px;
    margin: 0 0 12px;
    border-radius: 12px;
    background: var(--ios26-fill);
}
.nzs-seg button {
    flex: 1 1 0;
    min-height: 34px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ios26-text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.nzs-seg button.is-on { background: var(--nzs-card); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.nzs-input,
.nzs-type-row input {
    width: 100%;
    box-sizing: border-box;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--ios26-hairline-strong);
    border-radius: 12px;
    background: var(--ios26-fill);
    color: var(--ios26-text);
    font: inherit;
    font-size: 16px; /* no zoom on iOS */
}
.nzs-input:focus, .nzs-type-row input:focus { outline: none; border-color: var(--nzs-link); box-shadow: 0 0 0 3px var(--ios26-accent-ring); }
.nzs-type-row { margin: 0 0 12px; }
.nzs-pad-frame {
    position: relative;
    border-radius: 16px;
    background: #fff; /* ink on paper in both themes */
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}
.nzs-pad-canvas {
    display: block;
    width: 100%;
    height: 190px;
    touch-action: none;
    cursor: crosshair;
}
.nzs-pad-canvas.is-initials { height: 150px; }
.nzs-pad-canvas.is-typed { pointer-events: none; cursor: default; }
.nzs-pad-line {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 34px;
    border-bottom: 1px solid rgba(11, 31, 68, .25);
    pointer-events: none;
}

/* ---------------------------------------------------------------- phone */

@media (max-width: 560px) {
    .nzs-main { padding: 4px 12px 150px; }
    .nzs-card { padding: 24px 18px 18px; border-radius: 22px; }
    .nzs h1 { font-size: 23px; }
    .nzs h2 { font-size: 21px; }
}

/* ---------------------------------------------------------------- /verify (M6) */

.nzs-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 0 0 14px;
    padding: 26px 16px;
    border: 1.5px dashed var(--ios26-hairline-strong);
    border-radius: 18px;
    color: var(--ios26-text);
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease;
}
.nzs-drop:hover,
.nzs-drop.is-over { background: var(--ios26-accent-soft); border-color: var(--nzs-link); }
.nzs-drop strong { color: var(--nzs-link); font-size: 17px; }
.nzs-drop span { color: var(--ios26-muted); font-size: 13px; }
.nzs-ref { text-align: left; }
.nzs-ref summary { color: var(--nzs-link); font-size: 15px; cursor: pointer; }
.nzs-ref-row { display: flex; gap: 8px; margin-top: 10px; }
.nzs-ref-row .nzs-input { flex: 1 1 auto; font-family: "SF Mono", Menlo, Consolas, monospace; text-transform: uppercase; }
.nzs-ref-row .nzs-btn { width: auto; margin: 0; }
.nzs-v-result { margin-top: 16px; }
.nzs-v-result h3 { margin: 18px 0 8px; text-align: left; }
.nzs-v-result .nzs-badge { font-size: 30px; font-weight: 700; }
.nzs-badge-warn { background: rgba(255, 159, 10, .16); color: #b25e00; }
body.color-1E202D .nzs-badge-warn { color: #ffb340; }
.nzs-facts strong.is-ok { color: var(--nzs-ok); }
.nzs-facts strong.is-bad { color: var(--nzs-danger-text); }
.nzs-facts strong { overflow-wrap: anywhere; }
