/* PIN sign-in ΓÇö premium, responsive, single-purpose screen */
:root {
    --pin-ink: #1d1226;
    --pin-muted: #6f6479;
    --pin-line: #e6e1ea;
    --pin-accent: #714b67;
    --pin-accent-2: #9c6b8f;
    --pin-danger: #b3261e;
    --pin-card: #ffffff;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body.pin-login {
    margin: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    color: var(--pin-ink);
    background:
        radial-gradient(1200px 600px at 15% -10%, rgba(156, 107, 143, .55), transparent 60%),
        radial-gradient(900px 500px at 110% 10%, rgba(113, 75, 103, .45), transparent 55%),
        linear-gradient(160deg, #22112a 0%, #2d1832 45%, #1b1122 100%);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.pin-stage {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2.4vh, 32px) clamp(12px, 3vw, 40px);
}

.pin-card {
    width: min(100%, 386px);
    background: var(--pin-card);
    border-radius: 22px;
    padding: clamp(16px, 3.2vh, 30px) clamp(18px, 4.4vw, 30px) clamp(16px, 3vh, 28px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, .65) inset,
        0 24px 60px rgba(12, 5, 18, .38),
        0 4px 14px rgba(12, 5, 18, .18);
    text-align: center;
}

.pin-brand { display: flex; justify-content: center; margin-bottom: clamp(10px, 1.9vh, 16px); }

/* Sign-in method switcher */
.pin-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin: 0 0 clamp(12px, 2.2vh, 18px);
    background: #f2edf5;
    border: 1px solid #e8e1ee;
    border-radius: 12px;
}

.pin-tab {
    appearance: none;
    border: 0;
    background: transparent;
    border-radius: 9px;
    padding: clamp(7px, 1.2vh, 9px) 8px;
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: .01em;
    color: var(--pin-muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.pin-tab:hover { color: var(--pin-ink); }

.pin-tab.is-active {
    background: #ffffff;
    color: var(--pin-ink);
    box-shadow: 0 1px 2px rgba(29, 18, 38, .12), 0 2px 6px rgba(29, 18, 38, .07);
}

.pin-tab:focus-visible { outline: 3px solid rgba(113, 75, 103, .35); outline-offset: 2px; }

.pin-panel[hidden],
[hidden] { display: none !important; }

/* Backoffice form */
.pin-fields {
    display: flex;
    flex-direction: column;
    gap: clamp(9px, 1.5vh, 13px);
    margin: clamp(12px, 2.2vh, 18px) 0 0;
    text-align: left;
}

.pin-field { display: flex; flex-direction: column; gap: 6px; }

.pin-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--pin-muted);
}

.pin-input {
    width: 100%;
    height: clamp(44px, 6vh, 52px);
    border: 1.5px solid var(--pin-line);
    border-radius: 12px;
    padding: 0 13px;
    font: inherit;
    font-size: 15px;
    color: var(--pin-ink);
    background: #fbfafc;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.pin-input:hover { border-color: #d9d1e0; }

.pin-input:focus {
    outline: none;
    border-color: var(--pin-accent);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(113, 75, 103, .14);
}

.pin-input::placeholder { color: #aaa0b4; }

.pin-password { position: relative; display: block; }
.pin-password .pin-input { padding-right: 50px; }

.pin-reveal {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--pin-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.pin-reveal:hover { background: #f2edf5; color: var(--pin-ink); }
.pin-reveal.is-on { color: var(--pin-accent); }
.pin-reveal:focus-visible { outline: 3px solid rgba(113, 75, 103, .35); outline-offset: 1px; }

.pin-fields + .pin-message { margin-top: clamp(8px, 1.4vh, 12px); }

.pin-logo {
    max-height: clamp(32px, 6.2vh, 52px);
    max-width: 74%;
    height: auto;
    width: auto;
    object-fit: contain;
}

.pin-heading { margin-bottom: clamp(8px, 2vh, 16px); }

.pin-eyebrow {
    margin: 0 0 4px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--pin-accent-2);
}

.pin-heading h1 {
    margin: 0 0 5px;
    font-size: clamp(19px, 4.4vw, 23px);
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -.01em;
}

.pin-sub {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--pin-muted);
}

.pin-dots {
    display: flex;
    justify-content: center;
    gap: clamp(10px, 2vw, 14px);
    margin: 0 0 clamp(6px, 1.2vh, 10px);
}

.pin-dot {
    width: clamp(13px, 2.6vh, 16px);
    height: clamp(13px, 2.6vh, 16px);
    border-radius: 50%;
    border: 1.5px solid #cfc6d6;
    background: #fff;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.pin-dot.is-filled {
    background: var(--pin-accent);
    border-color: var(--pin-accent);
    transform: scale(1.06);
}

.pin-message {
    min-height: 17px;
    margin: 0 0 clamp(6px, 1.2vh, 12px);
    font-size: 12.5px;
    line-height: 1.35;
    font-weight: 600;
    color: var(--pin-muted);
}

.pin-message.is-error { color: var(--pin-danger); }

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(6px, 1.2vh, 10px);
    margin-bottom: clamp(8px, 1.4vh, 14px);
}

.pin-key {
    appearance: none;
    border: 1px solid var(--pin-line);
    background: #fbfafc;
    color: var(--pin-ink);
    border-radius: 13px;
    height: clamp(42px, 6.4vh, 58px);
    font: inherit;
    font-size: clamp(18px, 2.2vh, 20px);
    font-weight: 600;
    cursor: pointer;
    transition: transform .08s ease, background .15s ease, border-color .15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.pin-key:hover { background: #f4f0f6; border-color: #d9d1e0; }
.pin-key:active { transform: scale(.97); background: #ece6f0; }
.pin-key:focus-visible { outline: 3px solid rgba(113, 75, 103, .35); outline-offset: 2px; }

.pin-key-quiet {
    font-size: 12.5px;
    font-weight: 650;
    color: var(--pin-muted);
    background: #f6f3f8;
}

.pin-submit {
    appearance: none;
    width: 100%;
    height: clamp(42px, 6.2vh, 54px);
    border: 0;
    border-radius: 13px;
    background: linear-gradient(135deg, #82598f 0%, #714b67 55%, #5f3d58 100%);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: .01em;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(94, 58, 84, .32);
    transition: transform .08s ease, box-shadow .18s ease, filter .18s ease;
}

.pin-submit:hover { filter: brightness(1.05); }
.pin-submit:active { transform: translateY(1px); box-shadow: 0 6px 14px rgba(94, 58, 84, .28); }
.pin-submit:focus-visible { outline: 3px solid rgba(113, 75, 103, .4); outline-offset: 3px; }
.pin-submit:disabled { cursor: progress; filter: saturate(.8) brightness(.98); }

.pin-hint {
    margin: clamp(8px, 1.6vh, 14px) 0 0;
    font-size: 11.5px;
    line-height: 1.4;
    color: #8b8094;
}

.pin-footer {
    flex: 0 0 auto;
    text-align: center;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    font-size: 11px;
    color: rgba(255, 255, 255, .55);
}

body.is-busy .pin-keypad { opacity: .72; pointer-events: none; }

.pin-card.is-shake { animation: pin-shake .34s cubic-bezier(.36, .07, .19, .97); }

@keyframes pin-shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-6px); }
    40%, 60% { transform: translateX(6px); }
}

@media (max-width: 420px) {
    .pin-card { border-radius: 18px; }
    .pin-hint { display: none; }
    .pin-tab { font-size: 12.5px; }
}

@media (max-height: 620px) {
    .pin-sub { display: none; }
    .pin-hint { display: none; }
    .pin-card { box-shadow: 0 16px 40px rgba(12, 5, 18, .34); }
}

@media (prefers-reduced-motion: reduce) {
    .pin-card.is-shake { animation: none; }
    .pin-dot, .pin-key, .pin-submit { transition: none; }
}
